define(["@jupyter-widgets/base"], (__WEBPACK_EXTERNAL_MODULE__jupyter_widgets_base__) => { return /******/ (() => { // webpackBootstrap
/******/ 	var __webpack_modules__ = ({

/***/ "./node_modules/.pnpm/css-loader@3.6.0_webpack@5.74.0/node_modules/css-loader/dist/cjs.js!./css/widget.css":
/*!*****************************************************************************************************************!*\
  !*** ./node_modules/.pnpm/css-loader@3.6.0_webpack@5.74.0/node_modules/css-loader/dist/cjs.js!./css/widget.css ***!
  \*****************************************************************************************************************/
/***/ ((module, exports, __webpack_require__) => {

// Imports
var ___CSS_LOADER_API_IMPORT___ = __webpack_require__(/*! ../node_modules/.pnpm/css-loader@3.6.0_webpack@5.74.0/node_modules/css-loader/dist/runtime/api.js */ "./node_modules/.pnpm/css-loader@3.6.0_webpack@5.74.0/node_modules/css-loader/dist/runtime/api.js");
exports = ___CSS_LOADER_API_IMPORT___(false);
// Module
exports.push([module.id, ".custom-widget {\n  background-color: lightseagreen;\n  padding: 0px 2px;\n}\n.cell-output-ipywidget-background {\n  background: none !important;\n}", ""]);
// Exports
module.exports = exports;


/***/ }),

/***/ "./node_modules/.pnpm/css-loader@3.6.0_webpack@5.74.0/node_modules/css-loader/dist/runtime/api.js":
/*!********************************************************************************************************!*\
  !*** ./node_modules/.pnpm/css-loader@3.6.0_webpack@5.74.0/node_modules/css-loader/dist/runtime/api.js ***!
  \********************************************************************************************************/
/***/ ((module) => {

"use strict";


/*
  MIT License http://www.opensource.org/licenses/mit-license.php
  Author Tobias Koppers @sokra
*/
// css base code, injected by the css-loader
// eslint-disable-next-line func-names
module.exports = function (useSourceMap) {
  var list = []; // return the list of modules as css string

  list.toString = function toString() {
    return this.map(function (item) {
      var content = cssWithMappingToString(item, useSourceMap);

      if (item[2]) {
        return "@media ".concat(item[2], " {").concat(content, "}");
      }

      return content;
    }).join('');
  }; // import a list of modules into the list
  // eslint-disable-next-line func-names


  list.i = function (modules, mediaQuery, dedupe) {
    if (typeof modules === 'string') {
      // eslint-disable-next-line no-param-reassign
      modules = [[null, modules, '']];
    }

    var alreadyImportedModules = {};

    if (dedupe) {
      for (var i = 0; i < this.length; i++) {
        // eslint-disable-next-line prefer-destructuring
        var id = this[i][0];

        if (id != null) {
          alreadyImportedModules[id] = true;
        }
      }
    }

    for (var _i = 0; _i < modules.length; _i++) {
      var item = [].concat(modules[_i]);

      if (dedupe && alreadyImportedModules[item[0]]) {
        // eslint-disable-next-line no-continue
        continue;
      }

      if (mediaQuery) {
        if (!item[2]) {
          item[2] = mediaQuery;
        } else {
          item[2] = "".concat(mediaQuery, " and ").concat(item[2]);
        }
      }

      list.push(item);
    }
  };

  return list;
};

function cssWithMappingToString(item, useSourceMap) {
  var content = item[1] || ''; // eslint-disable-next-line prefer-destructuring

  var cssMapping = item[3];

  if (!cssMapping) {
    return content;
  }

  if (useSourceMap && typeof btoa === 'function') {
    var sourceMapping = toComment(cssMapping);
    var sourceURLs = cssMapping.sources.map(function (source) {
      return "/*# sourceURL=".concat(cssMapping.sourceRoot || '').concat(source, " */");
    });
    return [content].concat(sourceURLs).concat([sourceMapping]).join('\n');
  }

  return [content].join('\n');
} // Adapted from convert-source-map (MIT)


function toComment(sourceMap) {
  // eslint-disable-next-line no-undef
  var base64 = btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap))));
  var data = "sourceMappingURL=data:application/json;charset=utf-8;base64,".concat(base64);
  return "/*# ".concat(data, " */");
}

/***/ }),

/***/ "./css/widget.css":
/*!************************!*\
  !*** ./css/widget.css ***!
  \************************/
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

var api = __webpack_require__(/*! !../node_modules/.pnpm/style-loader@1.3.0_webpack@5.74.0/node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js */ "./node_modules/.pnpm/style-loader@1.3.0_webpack@5.74.0/node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js");
            var content = __webpack_require__(/*! !!../node_modules/.pnpm/css-loader@3.6.0_webpack@5.74.0/node_modules/css-loader/dist/cjs.js!./widget.css */ "./node_modules/.pnpm/css-loader@3.6.0_webpack@5.74.0/node_modules/css-loader/dist/cjs.js!./css/widget.css");

            content = content.__esModule ? content.default : content;

            if (typeof content === 'string') {
              content = [[module.id, content, '']];
            }

var options = {};

options.insert = "head";
options.singleton = false;

var update = api(content, options);



module.exports = content.locals || {};

/***/ }),

/***/ "./node_modules/.pnpm/style-loader@1.3.0_webpack@5.74.0/node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js":
/*!*********************************************************************************************************************************!*\
  !*** ./node_modules/.pnpm/style-loader@1.3.0_webpack@5.74.0/node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js ***!
  \*********************************************************************************************************************************/
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

"use strict";


var isOldIE = function isOldIE() {
  var memo;
  return function memorize() {
    if (typeof memo === 'undefined') {
      // Test for IE <= 9 as proposed by Browserhacks
      // @see http://browserhacks.com/#hack-e71d8692f65334173fee715c222cb805
      // Tests for existence of standard globals is to allow style-loader
      // to operate correctly into non-standard environments
      // @see https://github.com/webpack-contrib/style-loader/issues/177
      memo = Boolean(window && document && document.all && !window.atob);
    }

    return memo;
  };
}();

var getTarget = function getTarget() {
  var memo = {};
  return function memorize(target) {
    if (typeof memo[target] === 'undefined') {
      var styleTarget = document.querySelector(target); // Special case to return head of iframe instead of iframe itself

      if (window.HTMLIFrameElement && styleTarget instanceof window.HTMLIFrameElement) {
        try {
          // This will throw an exception if access to iframe is blocked
          // due to cross-origin restrictions
          styleTarget = styleTarget.contentDocument.head;
        } catch (e) {
          // istanbul ignore next
          styleTarget = null;
        }
      }

      memo[target] = styleTarget;
    }

    return memo[target];
  };
}();

var stylesInDom = [];

function getIndexByIdentifier(identifier) {
  var result = -1;

  for (var i = 0; i < stylesInDom.length; i++) {
    if (stylesInDom[i].identifier === identifier) {
      result = i;
      break;
    }
  }

  return result;
}

function modulesToDom(list, options) {
  var idCountMap = {};
  var identifiers = [];

  for (var i = 0; i < list.length; i++) {
    var item = list[i];
    var id = options.base ? item[0] + options.base : item[0];
    var count = idCountMap[id] || 0;
    var identifier = "".concat(id, " ").concat(count);
    idCountMap[id] = count + 1;
    var index = getIndexByIdentifier(identifier);
    var obj = {
      css: item[1],
      media: item[2],
      sourceMap: item[3]
    };

    if (index !== -1) {
      stylesInDom[index].references++;
      stylesInDom[index].updater(obj);
    } else {
      stylesInDom.push({
        identifier: identifier,
        updater: addStyle(obj, options),
        references: 1
      });
    }

    identifiers.push(identifier);
  }

  return identifiers;
}

function insertStyleElement(options) {
  var style = document.createElement('style');
  var attributes = options.attributes || {};

  if (typeof attributes.nonce === 'undefined') {
    var nonce =  true ? __webpack_require__.nc : 0;

    if (nonce) {
      attributes.nonce = nonce;
    }
  }

  Object.keys(attributes).forEach(function (key) {
    style.setAttribute(key, attributes[key]);
  });

  if (typeof options.insert === 'function') {
    options.insert(style);
  } else {
    var target = getTarget(options.insert || 'head');

    if (!target) {
      throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");
    }

    target.appendChild(style);
  }

  return style;
}

function removeStyleElement(style) {
  // istanbul ignore if
  if (style.parentNode === null) {
    return false;
  }

  style.parentNode.removeChild(style);
}
/* istanbul ignore next  */


var replaceText = function replaceText() {
  var textStore = [];
  return function replace(index, replacement) {
    textStore[index] = replacement;
    return textStore.filter(Boolean).join('\n');
  };
}();

function applyToSingletonTag(style, index, remove, obj) {
  var css = remove ? '' : obj.media ? "@media ".concat(obj.media, " {").concat(obj.css, "}") : obj.css; // For old IE

  /* istanbul ignore if  */

  if (style.styleSheet) {
    style.styleSheet.cssText = replaceText(index, css);
  } else {
    var cssNode = document.createTextNode(css);
    var childNodes = style.childNodes;

    if (childNodes[index]) {
      style.removeChild(childNodes[index]);
    }

    if (childNodes.length) {
      style.insertBefore(cssNode, childNodes[index]);
    } else {
      style.appendChild(cssNode);
    }
  }
}

function applyToTag(style, options, obj) {
  var css = obj.css;
  var media = obj.media;
  var sourceMap = obj.sourceMap;

  if (media) {
    style.setAttribute('media', media);
  } else {
    style.removeAttribute('media');
  }

  if (sourceMap && typeof btoa !== 'undefined') {
    css += "\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap)))), " */");
  } // For old IE

  /* istanbul ignore if  */


  if (style.styleSheet) {
    style.styleSheet.cssText = css;
  } else {
    while (style.firstChild) {
      style.removeChild(style.firstChild);
    }

    style.appendChild(document.createTextNode(css));
  }
}

var singleton = null;
var singletonCounter = 0;

function addStyle(obj, options) {
  var style;
  var update;
  var remove;

  if (options.singleton) {
    var styleIndex = singletonCounter++;
    style = singleton || (singleton = insertStyleElement(options));
    update = applyToSingletonTag.bind(null, style, styleIndex, false);
    remove = applyToSingletonTag.bind(null, style, styleIndex, true);
  } else {
    style = insertStyleElement(options);
    update = applyToTag.bind(null, style, options);

    remove = function remove() {
      removeStyleElement(style);
    };
  }

  update(obj);
  return function updateStyle(newObj) {
    if (newObj) {
      if (newObj.css === obj.css && newObj.media === obj.media && newObj.sourceMap === obj.sourceMap) {
        return;
      }

      update(obj = newObj);
    } else {
      remove();
    }
  };
}

module.exports = function (list, options) {
  options = options || {}; // Force single-tag solution on IE6-9, which has a hard limit on the # of <style>
  // tags it will allow on a page

  if (!options.singleton && typeof options.singleton !== 'boolean') {
    options.singleton = isOldIE();
  }

  list = list || [];
  var lastIdentifiers = modulesToDom(list, options);
  return function update(newList) {
    newList = newList || [];

    if (Object.prototype.toString.call(newList) !== '[object Array]') {
      return;
    }

    for (var i = 0; i < lastIdentifiers.length; i++) {
      var identifier = lastIdentifiers[i];
      var index = getIndexByIdentifier(identifier);
      stylesInDom[index].references--;
    }

    var newLastIdentifiers = modulesToDom(newList, options);

    for (var _i = 0; _i < lastIdentifiers.length; _i++) {
      var _identifier = lastIdentifiers[_i];

      var _index = getIndexByIdentifier(_identifier);

      if (stylesInDom[_index].references === 0) {
        stylesInDom[_index].updater();

        stylesInDom.splice(_index, 1);
      }
    }

    lastIdentifiers = newLastIdentifiers;
  };
};

/***/ }),

/***/ "./src/extension.ts":
/*!**************************!*\
  !*** ./src/extension.ts ***!
  \**************************/
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {

"use strict";

// Copyright (c) Jupyter Development Team.
// Distributed under the terms of the Modified BSD License.
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    o[k2] = m[k];
}));
var __exportStar = (this && this.__exportStar) || function(m, exports) {
    for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
// Entry point for the notebook bundle containing custom model definitions.
//
// Setup notebook base URL
//
// Some static assets may be required by the custom widget javascript. The base
// url for the notebook is not known at build time and is therefore computed
// dynamically.
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
window.__webpack_public_path__ =
    document.querySelector('body').getAttribute('data-base-url') +
        'nbextensions/jmv';
__exportStar(__webpack_require__(/*! ./index */ "./src/index.ts"), exports);


/***/ }),

/***/ "./src/index.ts":
/*!**********************!*\
  !*** ./src/index.ts ***!
  \**********************/
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {

"use strict";

// Copyright (c) KaivnD
// Distributed under the terms of the Modified BSD License.
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    o[k2] = m[k];
}));
var __exportStar = (this && this.__exportStar) || function(m, exports) {
    for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
// (() => {
//   const head = document.querySelector('head');
//   const overrideStyles = document.createElement('style');
//   overrideStyles.innerText = `
//     .cell-output-ipywidget-background {
//       background: none !important;
//     }
//     `;
//   head?.appendChild(overrideStyles);
// })();
__exportStar(__webpack_require__(/*! ./version */ "./src/version.ts"), exports);
__exportStar(__webpack_require__(/*! ./widget */ "./src/widget.ts"), exports);


/***/ }),

/***/ "./src/version.ts":
/*!************************!*\
  !*** ./src/version.ts ***!
  \************************/
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {

"use strict";

// Copyright (c) KaivnD
// Distributed under the terms of the Modified BSD License.
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.MODULE_NAME = exports.MODULE_VERSION = void 0;
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
// eslint-disable-next-line @typescript-eslint/no-var-requires
const data = __webpack_require__(/*! ../package.json */ "./package.json");
/**
 * The _model_module_version/_view_module_version this package implements.
 *
 * The html widget manager assumes that this is the same as the npm package
 * version number.
 */
exports.MODULE_VERSION = data.version;
/*
 * The current package name.
 */
exports.MODULE_NAME = data.name;


/***/ }),

/***/ "./src/widget.ts":
/*!***********************!*\
  !*** ./src/widget.ts ***!
  \***********************/
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {

"use strict";

var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.DisplayPortalView = exports.DisplayPortalModel = void 0;
// Copyright (c) KaivnD
// Distributed under the terms of the Modified BSD License.
const base_1 = __webpack_require__(/*! @jupyter-widgets/base */ "@jupyter-widgets/base");
const version_1 = __webpack_require__(/*! ./version */ "./src/version.ts");
// Import the CSS
__webpack_require__(/*! ../css/widget.css */ "./css/widget.css");
// import { DisplayPortal } from './components/DisplayPortal';
const _3dp_1 = __importDefault(__webpack_require__(/*! 3dp */ "./node_modules/.pnpm/3dp@0.0.1/node_modules/3dp/dist/3dp.umd.cjs"));
class DisplayPortalModel extends base_1.DOMWidgetModel {
    defaults() {
        return Object.assign(Object.assign({}, super.defaults()), { _model_name: DisplayPortalModel.model_name, _model_module: DisplayPortalModel.model_module, _model_module_version: DisplayPortalModel.model_module_version, _view_name: DisplayPortalModel.view_name, _view_module: DisplayPortalModel.view_module, _view_module_version: DisplayPortalModel.view_module_version, meshbuffers: [], wirebuffers: [], options: {} });
    }
}
exports.DisplayPortalModel = DisplayPortalModel;
DisplayPortalModel.serializers = Object.assign({}, base_1.DOMWidgetModel.serializers);
DisplayPortalModel.model_name = 'DisplayPortalModel';
DisplayPortalModel.model_module = version_1.MODULE_NAME;
DisplayPortalModel.model_module_version = version_1.MODULE_VERSION;
DisplayPortalModel.view_name = 'DisplayPortalView'; // Set to null if no view
DisplayPortalModel.view_module = version_1.MODULE_NAME; // Set to null if no view
DisplayPortalModel.view_module_version = version_1.MODULE_VERSION;
class DisplayPortalView extends base_1.DOMWidgetView {
    initialize(parameters) {
        const backbone = this;
        const model = this.model;
        const container = document.createElement('div');
        container.style.height = `${model.attributes._height}px`;
        container.style.width = '100%';
        container.oncontextmenu = (e) => e.stopPropagation();
        const meshbuffers = this.model.get('meshbuffers');
        const wiresbuffer = this.model.get('wirebuffers');
        const options = this.model.get('options');
        _3dp_1.default(container, meshbuffers, wiresbuffer, options);
        backbone.el.append(container);
    }
}
exports.DisplayPortalView = DisplayPortalView;


/***/ }),

/***/ "@jupyter-widgets/base":
/*!****************************************!*\
  !*** external "@jupyter-widgets/base" ***!
  \****************************************/
/***/ ((module) => {

"use strict";
module.exports = __WEBPACK_EXTERNAL_MODULE__jupyter_widgets_base__;

/***/ }),

/***/ "./node_modules/.pnpm/3dp@0.0.1/node_modules/3dp/dist/3dp.umd.cjs":
/*!************************************************************************!*\
  !*** ./node_modules/.pnpm/3dp@0.0.1/node_modules/3dp/dist/3dp.umd.cjs ***!
  \************************************************************************/
/***/ (function(__unused_webpack_module, exports) {

(function(Mo,ba){ true?ba(exports):0})(this,function(Mo){"use strict";function ba(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var ke={exports:{}},ht={};/**
 * @license React
 * react.production.min.js
 *
 * Copyright (c) Facebook, Inc. and its affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */var eu=Symbol.for("react.element"),LT=Symbol.for("react.portal"),RT=Symbol.for("react.fragment"),IT=Symbol.for("react.strict_mode"),DT=Symbol.for("react.profiler"),zT=Symbol.for("react.provider"),NT=Symbol.for("react.context"),kT=Symbol.for("react.forward_ref"),OT=Symbol.for("react.suspense"),FT=Symbol.for("react.memo"),UT=Symbol.for("react.lazy"),Ix=Symbol.iterator;function BT(n){return n===null||typeof n!="object"?null:(n=Ix&&n[Ix]||n["@@iterator"],typeof n=="function"?n:null)}var Dx={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},zx=Object.assign,Nx={};function Aa(n,e,t){this.props=n,this.context=e,this.refs=Nx,this.updater=t||Dx}Aa.prototype.isReactComponent={},Aa.prototype.setState=function(n,e){if(typeof n!="object"&&typeof n!="function"&&n!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,n,e,"setState")},Aa.prototype.forceUpdate=function(n){this.updater.enqueueForceUpdate(this,n,"forceUpdate")};function kx(){}kx.prototype=Aa.prototype;function jp(n,e,t){this.props=n,this.context=e,this.refs=Nx,this.updater=t||Dx}var Yp=jp.prototype=new kx;Yp.constructor=jp,zx(Yp,Aa.prototype),Yp.isPureReactComponent=!0;var Ox=Array.isArray,Fx=Object.prototype.hasOwnProperty,qp={current:null},Ux={key:!0,ref:!0,__self:!0,__source:!0};function Bx(n,e,t){var i,r={},s=null,o=null;if(e!=null)for(i in e.ref!==void 0&&(o=e.ref),e.key!==void 0&&(s=""+e.key),e)Fx.call(e,i)&&!Ux.hasOwnProperty(i)&&(r[i]=e[i]);var l=arguments.length-2;if(l===1)r.children=t;else if(1<l){for(var c=Array(l),f=0;f<l;f++)c[f]=arguments[f+2];r.children=c}if(n&&n.defaultProps)for(i in l=n.defaultProps,l)r[i]===void 0&&(r[i]=l[i]);return{$$typeof:eu,type:n,key:s,ref:o,props:r,_owner:qp.current}}function VT(n,e){return{$$typeof:eu,type:n.type,key:e,ref:n.ref,props:n.props,_owner:n._owner}}function Zp(n){return typeof n=="object"&&n!==null&&n.$$typeof===eu}function HT(n){var e={"=":"=0",":":"=2"};return"$"+n.replace(/[=:]/g,function(t){return e[t]})}var Vx=/\/+/g;function Jp(n,e){return typeof n=="object"&&n!==null&&n.key!=null?HT(""+n.key):e.toString(36)}function lf(n,e,t,i,r){var s=typeof n;(s==="undefined"||s==="boolean")&&(n=null);var o=!1;if(n===null)o=!0;else switch(s){case"string":case"number":o=!0;break;case"object":switch(n.$$typeof){case eu:case LT:o=!0}}if(o)return o=n,r=r(o),n=i===""?"."+Jp(o,0):i,Ox(r)?(t="",n!=null&&(t=n.replace(Vx,"$&/")+"/"),lf(r,e,t,"",function(f){return f})):r!=null&&(Zp(r)&&(r=VT(r,t+(!r.key||o&&o.key===r.key?"":(""+r.key).replace(Vx,"$&/")+"/")+n)),e.push(r)),1;if(o=0,i=i===""?".":i+":",Ox(n))for(var l=0;l<n.length;l++){s=n[l];var c=i+Jp(s,l);o+=lf(s,e,t,c,r)}else if(c=BT(n),typeof c=="function")for(n=c.call(n),l=0;!(s=n.next()).done;)s=s.value,c=i+Jp(s,l++),o+=lf(s,e,t,c,r);else if(s==="object")throw e=String(n),Error("Objects are not valid as a React child (found: "+(e==="[object Object]"?"object with keys {"+Object.keys(n).join(", ")+"}":e)+"). If you meant to render a collection of children, use an array instead.");return o}function uf(n,e,t){if(n==null)return n;var i=[],r=0;return lf(n,i,"","",function(s){return e.call(t,s,r++)}),i}function WT(n){if(n._status===-1){var e=n._result;e=e(),e.then(function(t){(n._status===0||n._status===-1)&&(n._status=1,n._result=t)},function(t){(n._status===0||n._status===-1)&&(n._status=2,n._result=t)}),n._status===-1&&(n._status=0,n._result=e)}if(n._status===1)return n._result.default;throw n._result}var Xn={current:null},cf={transition:null},GT={ReactCurrentDispatcher:Xn,ReactCurrentBatchConfig:cf,ReactCurrentOwner:qp};ht.Children={map:uf,forEach:function(n,e,t){uf(n,function(){e.apply(this,arguments)},t)},count:function(n){var e=0;return uf(n,function(){e++}),e},toArray:function(n){return uf(n,function(e){return e})||[]},only:function(n){if(!Zp(n))throw Error("React.Children.only expected to receive a single React element child.");return n}},ht.Component=Aa,ht.Fragment=RT,ht.Profiler=DT,ht.PureComponent=jp,ht.StrictMode=IT,ht.Suspense=OT,ht.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=GT,ht.cloneElement=function(n,e,t){if(n==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+n+".");var i=zx({},n.props),r=n.key,s=n.ref,o=n._owner;if(e!=null){if(e.ref!==void 0&&(s=e.ref,o=qp.current),e.key!==void 0&&(r=""+e.key),n.type&&n.type.defaultProps)var l=n.type.defaultProps;for(c in e)Fx.call(e,c)&&!Ux.hasOwnProperty(c)&&(i[c]=e[c]===void 0&&l!==void 0?l[c]:e[c])}var c=arguments.length-2;if(c===1)i.children=t;else if(1<c){l=Array(c);for(var f=0;f<c;f++)l[f]=arguments[f+2];i.children=l}return{$$typeof:eu,type:n.type,key:r,ref:s,props:i,_owner:o}},ht.createContext=function(n){return n={$$typeof:NT,_currentValue:n,_currentValue2:n,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},n.Provider={$$typeof:zT,_context:n},n.Consumer=n},ht.createElement=Bx,ht.createFactory=function(n){var e=Bx.bind(null,n);return e.type=n,e},ht.createRef=function(){return{current:null}},ht.forwardRef=function(n){return{$$typeof:kT,render:n}},ht.isValidElement=Zp,ht.lazy=function(n){return{$$typeof:UT,_payload:{_status:-1,_result:n},_init:WT}},ht.memo=function(n,e){return{$$typeof:FT,type:n,compare:e===void 0?null:e}},ht.startTransition=function(n){var e=cf.transition;cf.transition={};try{n()}finally{cf.transition=e}},ht.unstable_act=function(){throw Error("act(...) is not supported in production builds of React.")},ht.useCallback=function(n,e){return Xn.current.useCallback(n,e)},ht.useContext=function(n){return Xn.current.useContext(n)},ht.useDebugValue=function(){},ht.useDeferredValue=function(n){return Xn.current.useDeferredValue(n)},ht.useEffect=function(n,e){return Xn.current.useEffect(n,e)},ht.useId=function(){return Xn.current.useId()},ht.useImperativeHandle=function(n,e,t){return Xn.current.useImperativeHandle(n,e,t)},ht.useInsertionEffect=function(n,e){return Xn.current.useInsertionEffect(n,e)},ht.useLayoutEffect=function(n,e){return Xn.current.useLayoutEffect(n,e)},ht.useMemo=function(n,e){return Xn.current.useMemo(n,e)},ht.useReducer=function(n,e,t){return Xn.current.useReducer(n,e,t)},ht.useRef=function(n){return Xn.current.useRef(n)},ht.useState=function(n){return Xn.current.useState(n)},ht.useSyncExternalStore=function(n,e,t){return Xn.current.useSyncExternalStore(n,e,t)},ht.useTransition=function(){return Xn.current.useTransition()},ht.version="18.2.0",function(n){n.exports=ht}(ke);const Hx=ba(ke.exports);var Qp={},Wx={exports:{}},gi={},Gx={exports:{}},Xx={};/**
 * @license React
 * scheduler.production.min.js
 *
 * Copyright (c) Facebook, Inc. and its affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */(function(n){function e(k,B){var F=k.length;k.push(B);e:for(;0<F;){var $=F-1>>>1,J=k[$];if(0<r(J,B))k[$]=B,k[F]=J,F=$;else break e}}function t(k){return k.length===0?null:k[0]}function i(k){if(k.length===0)return null;var B=k[0],F=k.pop();if(F!==B){k[0]=F;e:for(var $=0,J=k.length,me=J>>>1;$<me;){var Me=2*($+1)-1,Ve=k[Me],re=Me+1,Xe=k[re];if(0>r(Ve,F))re<J&&0>r(Xe,Ve)?(k[$]=Xe,k[re]=F,$=re):(k[$]=Ve,k[Me]=F,$=Me);else if(re<J&&0>r(Xe,F))k[$]=Xe,k[re]=F,$=re;else break e}}return B}function r(k,B){var F=k.sortIndex-B.sortIndex;return F!==0?F:k.id-B.id}if(typeof performance=="object"&&typeof performance.now=="function"){var s=performance;n.unstable_now=function(){return s.now()}}else{var o=Date,l=o.now();n.unstable_now=function(){return o.now()-l}}var c=[],f=[],d=1,h=null,m=3,g=!1,x=!1,y=!1,w=typeof setTimeout=="function"?setTimeout:null,_=typeof clearTimeout=="function"?clearTimeout:null,S=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function E(k){for(var B=t(f);B!==null;){if(B.callback===null)i(f);else if(B.startTime<=k)i(f),B.sortIndex=B.expirationTime,e(c,B);else break;B=t(f)}}function T(k){if(y=!1,E(k),!x)if(t(c)!==null)x=!0,ee(C);else{var B=t(f);B!==null&&pe(T,B.startTime-k)}}function C(k,B){x=!1,y&&(y=!1,_(A),A=-1),g=!0;var F=m;try{for(E(B),h=t(c);h!==null&&(!(h.expirationTime>B)||k&&!j());){var $=h.callback;if(typeof $=="function"){h.callback=null,m=h.priorityLevel;var J=$(h.expirationTime<=B);B=n.unstable_now(),typeof J=="function"?h.callback=J:h===t(c)&&i(c),E(B)}else i(c);h=t(c)}if(h!==null)var me=!0;else{var Me=t(f);Me!==null&&pe(T,Me.startTime-B),me=!1}return me}finally{h=null,m=F,g=!1}}var P=!1,I=null,A=-1,L=5,z=-1;function j(){return!(n.unstable_now()-z<L)}function ue(){if(I!==null){var k=n.unstable_now();z=k;var B=!0;try{B=I(!0,k)}finally{B?Z():(P=!1,I=null)}}else P=!1}var Z;if(typeof S=="function")Z=function(){S(ue)};else if(typeof MessageChannel<"u"){var G=new MessageChannel,ie=G.port2;G.port1.onmessage=ue,Z=function(){ie.postMessage(null)}}else Z=function(){w(ue,0)};function ee(k){I=k,P||(P=!0,Z())}function pe(k,B){A=w(function(){k(n.unstable_now())},B)}n.unstable_IdlePriority=5,n.unstable_ImmediatePriority=1,n.unstable_LowPriority=4,n.unstable_NormalPriority=3,n.unstable_Profiling=null,n.unstable_UserBlockingPriority=2,n.unstable_cancelCallback=function(k){k.callback=null},n.unstable_continueExecution=function(){x||g||(x=!0,ee(C))},n.unstable_forceFrameRate=function(k){0>k||125<k?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):L=0<k?Math.floor(1e3/k):5},n.unstable_getCurrentPriorityLevel=function(){return m},n.unstable_getFirstCallbackNode=function(){return t(c)},n.unstable_next=function(k){switch(m){case 1:case 2:case 3:var B=3;break;default:B=m}var F=m;m=B;try{return k()}finally{m=F}},n.unstable_pauseExecution=function(){},n.unstable_requestPaint=function(){},n.unstable_runWithPriority=function(k,B){switch(k){case 1:case 2:case 3:case 4:case 5:break;default:k=3}var F=m;m=k;try{return B()}finally{m=F}},n.unstable_scheduleCallback=function(k,B,F){var $=n.unstable_now();switch(typeof F=="object"&&F!==null?(F=F.delay,F=typeof F=="number"&&0<F?$+F:$):F=$,k){case 1:var J=-1;break;case 2:J=250;break;case 5:J=1073741823;break;case 4:J=1e4;break;default:J=5e3}return J=F+J,k={id:d++,callback:B,priorityLevel:k,startTime:F,expirationTime:J,sortIndex:-1},F>$?(k.sortIndex=F,e(f,k),t(c)===null&&k===t(f)&&(y?(_(A),A=-1):y=!0,pe(T,F-$))):(k.sortIndex=J,e(c,k),x||g||(x=!0,ee(C))),k},n.unstable_shouldYield=j,n.unstable_wrapCallback=function(k){var B=m;return function(){var F=m;m=B;try{return k.apply(this,arguments)}finally{m=F}}}})(Xx),function(n){n.exports=Xx}(Gx);/**
 * @license React
 * react-dom.production.min.js
 *
 * Copyright (c) Facebook, Inc. and its affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */var jx=ke.exports,vi=Gx.exports;function ge(n){for(var e="https://reactjs.org/docs/error-decoder.html?invariant="+n,t=1;t<arguments.length;t++)e+="&args[]="+encodeURIComponent(arguments[t]);return"Minified React error #"+n+"; visit "+e+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var Yx=new Set,tu={};function Eo(n,e){Ca(n,e),Ca(n+"Capture",e)}function Ca(n,e){for(tu[n]=e,n=0;n<e.length;n++)Yx.add(e[n])}var Hr=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Kp=Object.prototype.hasOwnProperty,XT=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,qx={},Zx={};function jT(n){return Kp.call(Zx,n)?!0:Kp.call(qx,n)?!1:XT.test(n)?Zx[n]=!0:(qx[n]=!0,!1)}function YT(n,e,t,i){if(t!==null&&t.type===0)return!1;switch(typeof e){case"function":case"symbol":return!0;case"boolean":return i?!1:t!==null?!t.acceptsBooleans:(n=n.toLowerCase().slice(0,5),n!=="data-"&&n!=="aria-");default:return!1}}function qT(n,e,t,i){if(e===null||typeof e>"u"||YT(n,e,t,i))return!0;if(i)return!1;if(t!==null)switch(t.type){case 3:return!e;case 4:return e===!1;case 5:return isNaN(e);case 6:return isNaN(e)||1>e}return!1}function jn(n,e,t,i,r,s,o){this.acceptsBooleans=e===2||e===3||e===4,this.attributeName=i,this.attributeNamespace=r,this.mustUseProperty=t,this.propertyName=n,this.type=e,this.sanitizeURL=s,this.removeEmptyString=o}var bn={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(n){bn[n]=new jn(n,0,!1,n,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(n){var e=n[0];bn[e]=new jn(e,1,!1,n[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(n){bn[n]=new jn(n,2,!1,n.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(n){bn[n]=new jn(n,2,!1,n,null,!1,!1)}),"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(n){bn[n]=new jn(n,3,!1,n.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(n){bn[n]=new jn(n,3,!0,n,null,!1,!1)}),["capture","download"].forEach(function(n){bn[n]=new jn(n,4,!1,n,null,!1,!1)}),["cols","rows","size","span"].forEach(function(n){bn[n]=new jn(n,6,!1,n,null,!1,!1)}),["rowSpan","start"].forEach(function(n){bn[n]=new jn(n,5,!1,n.toLowerCase(),null,!1,!1)});var $p=/[\-:]([a-z])/g;function em(n){return n[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(n){var e=n.replace($p,em);bn[e]=new jn(e,1,!1,n,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(n){var e=n.replace($p,em);bn[e]=new jn(e,1,!1,n,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(n){var e=n.replace($p,em);bn[e]=new jn(e,1,!1,n,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(n){bn[n]=new jn(n,1,!1,n.toLowerCase(),null,!1,!1)}),bn.xlinkHref=new jn("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(n){bn[n]=new jn(n,1,!1,n.toLowerCase(),null,!0,!0)});function tm(n,e,t,i){var r=bn.hasOwnProperty(e)?bn[e]:null;(r!==null?r.type!==0:i||!(2<e.length)||e[0]!=="o"&&e[0]!=="O"||e[1]!=="n"&&e[1]!=="N")&&(qT(e,t,r,i)&&(t=null),i||r===null?jT(e)&&(t===null?n.removeAttribute(e):n.setAttribute(e,""+t)):r.mustUseProperty?n[r.propertyName]=t===null?r.type===3?!1:"":t:(e=r.attributeName,i=r.attributeNamespace,t===null?n.removeAttribute(e):(r=r.type,t=r===3||r===4&&t===!0?"":""+t,i?n.setAttributeNS(i,e,t):n.setAttribute(e,t))))}var Wr=jx.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,ff=Symbol.for("react.element"),Pa=Symbol.for("react.portal"),La=Symbol.for("react.fragment"),nm=Symbol.for("react.strict_mode"),im=Symbol.for("react.profiler"),Jx=Symbol.for("react.provider"),Qx=Symbol.for("react.context"),rm=Symbol.for("react.forward_ref"),sm=Symbol.for("react.suspense"),om=Symbol.for("react.suspense_list"),am=Symbol.for("react.memo"),Ms=Symbol.for("react.lazy"),Kx=Symbol.for("react.offscreen"),$x=Symbol.iterator;function nu(n){return n===null||typeof n!="object"?null:(n=$x&&n[$x]||n["@@iterator"],typeof n=="function"?n:null)}var jt=Object.assign,lm;function iu(n){if(lm===void 0)try{throw Error()}catch(t){var e=t.stack.trim().match(/\n( *(at )?)/);lm=e&&e[1]||""}return`
`+lm+n}var um=!1;function cm(n,e){if(!n||um)return"";um=!0;var t=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(e)if(e=function(){throw Error()},Object.defineProperty(e.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(e,[])}catch(f){var i=f}Reflect.construct(n,[],e)}else{try{e.call()}catch(f){i=f}n.call(e.prototype)}else{try{throw Error()}catch(f){i=f}n()}}catch(f){if(f&&i&&typeof f.stack=="string"){for(var r=f.stack.split(`
`),s=i.stack.split(`
`),o=r.length-1,l=s.length-1;1<=o&&0<=l&&r[o]!==s[l];)l--;for(;1<=o&&0<=l;o--,l--)if(r[o]!==s[l]){if(o!==1||l!==1)do if(o--,l--,0>l||r[o]!==s[l]){var c=`
`+r[o].replace(" at new "," at ");return n.displayName&&c.includes("<anonymous>")&&(c=c.replace("<anonymous>",n.displayName)),c}while(1<=o&&0<=l);break}}}finally{um=!1,Error.prepareStackTrace=t}return(n=n?n.displayName||n.name:"")?iu(n):""}function ZT(n){switch(n.tag){case 5:return iu(n.type);case 16:return iu("Lazy");case 13:return iu("Suspense");case 19:return iu("SuspenseList");case 0:case 2:case 15:return n=cm(n.type,!1),n;case 11:return n=cm(n.type.render,!1),n;case 1:return n=cm(n.type,!0),n;default:return""}}function fm(n){if(n==null)return null;if(typeof n=="function")return n.displayName||n.name||null;if(typeof n=="string")return n;switch(n){case La:return"Fragment";case Pa:return"Portal";case im:return"Profiler";case nm:return"StrictMode";case sm:return"Suspense";case om:return"SuspenseList"}if(typeof n=="object")switch(n.$$typeof){case Qx:return(n.displayName||"Context")+".Consumer";case Jx:return(n._context.displayName||"Context")+".Provider";case rm:var e=n.render;return n=n.displayName,n||(n=e.displayName||e.name||"",n=n!==""?"ForwardRef("+n+")":"ForwardRef"),n;case am:return e=n.displayName||null,e!==null?e:fm(n.type)||"Memo";case Ms:e=n._payload,n=n._init;try{return fm(n(e))}catch{}}return null}function JT(n){var e=n.type;switch(n.tag){case 24:return"Cache";case 9:return(e.displayName||"Context")+".Consumer";case 10:return(e._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return n=e.render,n=n.displayName||n.name||"",e.displayName||(n!==""?"ForwardRef("+n+")":"ForwardRef");case 7:return"Fragment";case 5:return e;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return fm(e);case 8:return e===nm?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e}return null}function Es(n){switch(typeof n){case"boolean":case"number":case"string":case"undefined":return n;case"object":return n;default:return""}}function e_(n){var e=n.type;return(n=n.nodeName)&&n.toLowerCase()==="input"&&(e==="checkbox"||e==="radio")}function QT(n){var e=e_(n)?"checked":"value",t=Object.getOwnPropertyDescriptor(n.constructor.prototype,e),i=""+n[e];if(!n.hasOwnProperty(e)&&typeof t<"u"&&typeof t.get=="function"&&typeof t.set=="function"){var r=t.get,s=t.set;return Object.defineProperty(n,e,{configurable:!0,get:function(){return r.call(this)},set:function(o){i=""+o,s.call(this,o)}}),Object.defineProperty(n,e,{enumerable:t.enumerable}),{getValue:function(){return i},setValue:function(o){i=""+o},stopTracking:function(){n._valueTracker=null,delete n[e]}}}}function df(n){n._valueTracker||(n._valueTracker=QT(n))}function t_(n){if(!n)return!1;var e=n._valueTracker;if(!e)return!0;var t=e.getValue(),i="";return n&&(i=e_(n)?n.checked?"true":"false":n.value),n=i,n!==t?(e.setValue(n),!0):!1}function hf(n){if(n=n||(typeof document<"u"?document:void 0),typeof n>"u")return null;try{return n.activeElement||n.body}catch{return n.body}}function dm(n,e){var t=e.checked;return jt({},e,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:t!=null?t:n._wrapperState.initialChecked})}function n_(n,e){var t=e.defaultValue==null?"":e.defaultValue,i=e.checked!=null?e.checked:e.defaultChecked;t=Es(e.value!=null?e.value:t),n._wrapperState={initialChecked:i,initialValue:t,controlled:e.type==="checkbox"||e.type==="radio"?e.checked!=null:e.value!=null}}function i_(n,e){e=e.checked,e!=null&&tm(n,"checked",e,!1)}function hm(n,e){i_(n,e);var t=Es(e.value),i=e.type;if(t!=null)i==="number"?(t===0&&n.value===""||n.value!=t)&&(n.value=""+t):n.value!==""+t&&(n.value=""+t);else if(i==="submit"||i==="reset"){n.removeAttribute("value");return}e.hasOwnProperty("value")?pm(n,e.type,t):e.hasOwnProperty("defaultValue")&&pm(n,e.type,Es(e.defaultValue)),e.checked==null&&e.defaultChecked!=null&&(n.defaultChecked=!!e.defaultChecked)}function r_(n,e,t){if(e.hasOwnProperty("value")||e.hasOwnProperty("defaultValue")){var i=e.type;if(!(i!=="submit"&&i!=="reset"||e.value!==void 0&&e.value!==null))return;e=""+n._wrapperState.initialValue,t||e===n.value||(n.value=e),n.defaultValue=e}t=n.name,t!==""&&(n.name=""),n.defaultChecked=!!n._wrapperState.initialChecked,t!==""&&(n.name=t)}function pm(n,e,t){(e!=="number"||hf(n.ownerDocument)!==n)&&(t==null?n.defaultValue=""+n._wrapperState.initialValue:n.defaultValue!==""+t&&(n.defaultValue=""+t))}var ru=Array.isArray;function Ra(n,e,t,i){if(n=n.options,e){e={};for(var r=0;r<t.length;r++)e["$"+t[r]]=!0;for(t=0;t<n.length;t++)r=e.hasOwnProperty("$"+n[t].value),n[t].selected!==r&&(n[t].selected=r),r&&i&&(n[t].defaultSelected=!0)}else{for(t=""+Es(t),e=null,r=0;r<n.length;r++){if(n[r].value===t){n[r].selected=!0,i&&(n[r].defaultSelected=!0);return}e!==null||n[r].disabled||(e=n[r])}e!==null&&(e.selected=!0)}}function mm(n,e){if(e.dangerouslySetInnerHTML!=null)throw Error(ge(91));return jt({},e,{value:void 0,defaultValue:void 0,children:""+n._wrapperState.initialValue})}function s_(n,e){var t=e.value;if(t==null){if(t=e.children,e=e.defaultValue,t!=null){if(e!=null)throw Error(ge(92));if(ru(t)){if(1<t.length)throw Error(ge(93));t=t[0]}e=t}e==null&&(e=""),t=e}n._wrapperState={initialValue:Es(t)}}function o_(n,e){var t=Es(e.value),i=Es(e.defaultValue);t!=null&&(t=""+t,t!==n.value&&(n.value=t),e.defaultValue==null&&n.defaultValue!==t&&(n.defaultValue=t)),i!=null&&(n.defaultValue=""+i)}function a_(n){var e=n.textContent;e===n._wrapperState.initialValue&&e!==""&&e!==null&&(n.value=e)}function l_(n){switch(n){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function gm(n,e){return n==null||n==="http://www.w3.org/1999/xhtml"?l_(e):n==="http://www.w3.org/2000/svg"&&e==="foreignObject"?"http://www.w3.org/1999/xhtml":n}var pf,u_=function(n){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(e,t,i,r){MSApp.execUnsafeLocalFunction(function(){return n(e,t,i,r)})}:n}(function(n,e){if(n.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in n)n.innerHTML=e;else{for(pf=pf||document.createElement("div"),pf.innerHTML="<svg>"+e.valueOf().toString()+"</svg>",e=pf.firstChild;n.firstChild;)n.removeChild(n.firstChild);for(;e.firstChild;)n.appendChild(e.firstChild)}});function su(n,e){if(e){var t=n.firstChild;if(t&&t===n.lastChild&&t.nodeType===3){t.nodeValue=e;return}}n.textContent=e}var ou={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},KT=["Webkit","ms","Moz","O"];Object.keys(ou).forEach(function(n){KT.forEach(function(e){e=e+n.charAt(0).toUpperCase()+n.substring(1),ou[e]=ou[n]})});function c_(n,e,t){return e==null||typeof e=="boolean"||e===""?"":t||typeof e!="number"||e===0||ou.hasOwnProperty(n)&&ou[n]?(""+e).trim():e+"px"}function f_(n,e){n=n.style;for(var t in e)if(e.hasOwnProperty(t)){var i=t.indexOf("--")===0,r=c_(t,e[t],i);t==="float"&&(t="cssFloat"),i?n.setProperty(t,r):n[t]=r}}var $T=jt({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function vm(n,e){if(e){if($T[n]&&(e.children!=null||e.dangerouslySetInnerHTML!=null))throw Error(ge(137,n));if(e.dangerouslySetInnerHTML!=null){if(e.children!=null)throw Error(ge(60));if(typeof e.dangerouslySetInnerHTML!="object"||!("__html"in e.dangerouslySetInnerHTML))throw Error(ge(61))}if(e.style!=null&&typeof e.style!="object")throw Error(ge(62))}}function ym(n,e){if(n.indexOf("-")===-1)return typeof e.is=="string";switch(n){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var xm=null;function _m(n){return n=n.target||n.srcElement||window,n.correspondingUseElement&&(n=n.correspondingUseElement),n.nodeType===3?n.parentNode:n}var wm=null,Ia=null,Da=null;function d_(n){if(n=Cu(n)){if(typeof wm!="function")throw Error(ge(280));var e=n.stateNode;e&&(e=Of(e),wm(n.stateNode,n.type,e))}}function h_(n){Ia?Da?Da.push(n):Da=[n]:Ia=n}function p_(){if(Ia){var n=Ia,e=Da;if(Da=Ia=null,d_(n),e)for(n=0;n<e.length;n++)d_(e[n])}}function m_(n,e){return n(e)}function g_(){}var Sm=!1;function v_(n,e,t){if(Sm)return n(e,t);Sm=!0;try{return m_(n,e,t)}finally{Sm=!1,(Ia!==null||Da!==null)&&(g_(),p_())}}function au(n,e){var t=n.stateNode;if(t===null)return null;var i=Of(t);if(i===null)return null;t=i[e];e:switch(e){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(i=!i.disabled)||(n=n.type,i=!(n==="button"||n==="input"||n==="select"||n==="textarea")),n=!i;break e;default:n=!1}if(n)return null;if(t&&typeof t!="function")throw Error(ge(231,e,typeof t));return t}var Mm=!1;if(Hr)try{var lu={};Object.defineProperty(lu,"passive",{get:function(){Mm=!0}}),window.addEventListener("test",lu,lu),window.removeEventListener("test",lu,lu)}catch{Mm=!1}function eb(n,e,t,i,r,s,o,l,c){var f=Array.prototype.slice.call(arguments,3);try{e.apply(t,f)}catch(d){this.onError(d)}}var uu=!1,mf=null,gf=!1,Em=null,tb={onError:function(n){uu=!0,mf=n}};function nb(n,e,t,i,r,s,o,l,c){uu=!1,mf=null,eb.apply(tb,arguments)}function ib(n,e,t,i,r,s,o,l,c){if(nb.apply(this,arguments),uu){if(uu){var f=mf;uu=!1,mf=null}else throw Error(ge(198));gf||(gf=!0,Em=f)}}function To(n){var e=n,t=n;if(n.alternate)for(;e.return;)e=e.return;else{n=e;do e=n,(e.flags&4098)!==0&&(t=e.return),n=e.return;while(n)}return e.tag===3?t:null}function y_(n){if(n.tag===13){var e=n.memoizedState;if(e===null&&(n=n.alternate,n!==null&&(e=n.memoizedState)),e!==null)return e.dehydrated}return null}function x_(n){if(To(n)!==n)throw Error(ge(188))}function rb(n){var e=n.alternate;if(!e){if(e=To(n),e===null)throw Error(ge(188));return e!==n?null:n}for(var t=n,i=e;;){var r=t.return;if(r===null)break;var s=r.alternate;if(s===null){if(i=r.return,i!==null){t=i;continue}break}if(r.child===s.child){for(s=r.child;s;){if(s===t)return x_(r),n;if(s===i)return x_(r),e;s=s.sibling}throw Error(ge(188))}if(t.return!==i.return)t=r,i=s;else{for(var o=!1,l=r.child;l;){if(l===t){o=!0,t=r,i=s;break}if(l===i){o=!0,i=r,t=s;break}l=l.sibling}if(!o){for(l=s.child;l;){if(l===t){o=!0,t=s,i=r;break}if(l===i){o=!0,i=s,t=r;break}l=l.sibling}if(!o)throw Error(ge(189))}}if(t.alternate!==i)throw Error(ge(190))}if(t.tag!==3)throw Error(ge(188));return t.stateNode.current===t?n:e}function __(n){return n=rb(n),n!==null?w_(n):null}function w_(n){if(n.tag===5||n.tag===6)return n;for(n=n.child;n!==null;){var e=w_(n);if(e!==null)return e;n=n.sibling}return null}var S_=vi.unstable_scheduleCallback,M_=vi.unstable_cancelCallback,sb=vi.unstable_shouldYield,ob=vi.unstable_requestPaint,en=vi.unstable_now,ab=vi.unstable_getCurrentPriorityLevel,Tm=vi.unstable_ImmediatePriority,E_=vi.unstable_UserBlockingPriority,vf=vi.unstable_NormalPriority,lb=vi.unstable_LowPriority,T_=vi.unstable_IdlePriority,yf=null,wr=null;function ub(n){if(wr&&typeof wr.onCommitFiberRoot=="function")try{wr.onCommitFiberRoot(yf,n,void 0,(n.current.flags&128)===128)}catch{}}var ir=Math.clz32?Math.clz32:db,cb=Math.log,fb=Math.LN2;function db(n){return n>>>=0,n===0?32:31-(cb(n)/fb|0)|0}var xf=64,_f=4194304;function cu(n){switch(n&-n){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return n&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return n&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return n}}function wf(n,e){var t=n.pendingLanes;if(t===0)return 0;var i=0,r=n.suspendedLanes,s=n.pingedLanes,o=t&268435455;if(o!==0){var l=o&~r;l!==0?i=cu(l):(s&=o,s!==0&&(i=cu(s)))}else o=t&~r,o!==0?i=cu(o):s!==0&&(i=cu(s));if(i===0)return 0;if(e!==0&&e!==i&&(e&r)===0&&(r=i&-i,s=e&-e,r>=s||r===16&&(s&4194240)!==0))return e;if((i&4)!==0&&(i|=t&16),e=n.entangledLanes,e!==0)for(n=n.entanglements,e&=i;0<e;)t=31-ir(e),r=1<<t,i|=n[t],e&=~r;return i}function hb(n,e){switch(n){case 1:case 2:case 4:return e+250;case 8:case 16:case 32:case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e+5e3;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function pb(n,e){for(var t=n.suspendedLanes,i=n.pingedLanes,r=n.expirationTimes,s=n.pendingLanes;0<s;){var o=31-ir(s),l=1<<o,c=r[o];c===-1?((l&t)===0||(l&i)!==0)&&(r[o]=hb(l,e)):c<=e&&(n.expiredLanes|=l),s&=~l}}function bm(n){return n=n.pendingLanes&-1073741825,n!==0?n:n&1073741824?1073741824:0}function b_(){var n=xf;return xf<<=1,(xf&4194240)===0&&(xf=64),n}function Am(n){for(var e=[],t=0;31>t;t++)e.push(n);return e}function fu(n,e,t){n.pendingLanes|=e,e!==536870912&&(n.suspendedLanes=0,n.pingedLanes=0),n=n.eventTimes,e=31-ir(e),n[e]=t}function mb(n,e){var t=n.pendingLanes&~e;n.pendingLanes=e,n.suspendedLanes=0,n.pingedLanes=0,n.expiredLanes&=e,n.mutableReadLanes&=e,n.entangledLanes&=e,e=n.entanglements;var i=n.eventTimes;for(n=n.expirationTimes;0<t;){var r=31-ir(t),s=1<<r;e[r]=0,i[r]=-1,n[r]=-1,t&=~s}}function Cm(n,e){var t=n.entangledLanes|=e;for(n=n.entanglements;t;){var i=31-ir(t),r=1<<i;r&e|n[i]&e&&(n[i]|=e),t&=~r}}var Lt=0;function A_(n){return n&=-n,1<n?4<n?(n&268435455)!==0?16:536870912:4:1}var C_,Pm,P_,L_,R_,Lm=!1,Sf=[],Ts=null,bs=null,As=null,du=new Map,hu=new Map,Cs=[],gb="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset submit".split(" ");function I_(n,e){switch(n){case"focusin":case"focusout":Ts=null;break;case"dragenter":case"dragleave":bs=null;break;case"mouseover":case"mouseout":As=null;break;case"pointerover":case"pointerout":du.delete(e.pointerId);break;case"gotpointercapture":case"lostpointercapture":hu.delete(e.pointerId)}}function pu(n,e,t,i,r,s){return n===null||n.nativeEvent!==s?(n={blockedOn:e,domEventName:t,eventSystemFlags:i,nativeEvent:s,targetContainers:[r]},e!==null&&(e=Cu(e),e!==null&&Pm(e)),n):(n.eventSystemFlags|=i,e=n.targetContainers,r!==null&&e.indexOf(r)===-1&&e.push(r),n)}function vb(n,e,t,i,r){switch(e){case"focusin":return Ts=pu(Ts,n,e,t,i,r),!0;case"dragenter":return bs=pu(bs,n,e,t,i,r),!0;case"mouseover":return As=pu(As,n,e,t,i,r),!0;case"pointerover":var s=r.pointerId;return du.set(s,pu(du.get(s)||null,n,e,t,i,r)),!0;case"gotpointercapture":return s=r.pointerId,hu.set(s,pu(hu.get(s)||null,n,e,t,i,r)),!0}return!1}function D_(n){var e=bo(n.target);if(e!==null){var t=To(e);if(t!==null){if(e=t.tag,e===13){if(e=y_(t),e!==null){n.blockedOn=e,R_(n.priority,function(){P_(t)});return}}else if(e===3&&t.stateNode.current.memoizedState.isDehydrated){n.blockedOn=t.tag===3?t.stateNode.containerInfo:null;return}}}n.blockedOn=null}function Mf(n){if(n.blockedOn!==null)return!1;for(var e=n.targetContainers;0<e.length;){var t=Im(n.domEventName,n.eventSystemFlags,e[0],n.nativeEvent);if(t===null){t=n.nativeEvent;var i=new t.constructor(t.type,t);xm=i,t.target.dispatchEvent(i),xm=null}else return e=Cu(t),e!==null&&Pm(e),n.blockedOn=t,!1;e.shift()}return!0}function z_(n,e,t){Mf(n)&&t.delete(e)}function yb(){Lm=!1,Ts!==null&&Mf(Ts)&&(Ts=null),bs!==null&&Mf(bs)&&(bs=null),As!==null&&Mf(As)&&(As=null),du.forEach(z_),hu.forEach(z_)}function mu(n,e){n.blockedOn===e&&(n.blockedOn=null,Lm||(Lm=!0,vi.unstable_scheduleCallback(vi.unstable_NormalPriority,yb)))}function gu(n){function e(r){return mu(r,n)}if(0<Sf.length){mu(Sf[0],n);for(var t=1;t<Sf.length;t++){var i=Sf[t];i.blockedOn===n&&(i.blockedOn=null)}}for(Ts!==null&&mu(Ts,n),bs!==null&&mu(bs,n),As!==null&&mu(As,n),du.forEach(e),hu.forEach(e),t=0;t<Cs.length;t++)i=Cs[t],i.blockedOn===n&&(i.blockedOn=null);for(;0<Cs.length&&(t=Cs[0],t.blockedOn===null);)D_(t),t.blockedOn===null&&Cs.shift()}var za=Wr.ReactCurrentBatchConfig,Ef=!0;function xb(n,e,t,i){var r=Lt,s=za.transition;za.transition=null;try{Lt=1,Rm(n,e,t,i)}finally{Lt=r,za.transition=s}}function _b(n,e,t,i){var r=Lt,s=za.transition;za.transition=null;try{Lt=4,Rm(n,e,t,i)}finally{Lt=r,za.transition=s}}function Rm(n,e,t,i){if(Ef){var r=Im(n,e,t,i);if(r===null)Zm(n,e,i,Tf,t),I_(n,i);else if(vb(r,n,e,t,i))i.stopPropagation();else if(I_(n,i),e&4&&-1<gb.indexOf(n)){for(;r!==null;){var s=Cu(r);if(s!==null&&C_(s),s=Im(n,e,t,i),s===null&&Zm(n,e,i,Tf,t),s===r)break;r=s}r!==null&&i.stopPropagation()}else Zm(n,e,i,null,t)}}var Tf=null;function Im(n,e,t,i){if(Tf=null,n=_m(i),n=bo(n),n!==null)if(e=To(n),e===null)n=null;else if(t=e.tag,t===13){if(n=y_(e),n!==null)return n;n=null}else if(t===3){if(e.stateNode.current.memoizedState.isDehydrated)return e.tag===3?e.stateNode.containerInfo:null;n=null}else e!==n&&(n=null);return Tf=n,null}function N_(n){switch(n){case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 1;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"toggle":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 4;case"message":switch(ab()){case Tm:return 1;case E_:return 4;case vf:case lb:return 16;case T_:return 536870912;default:return 16}default:return 16}}var Ps=null,Dm=null,bf=null;function k_(){if(bf)return bf;var n,e=Dm,t=e.length,i,r="value"in Ps?Ps.value:Ps.textContent,s=r.length;for(n=0;n<t&&e[n]===r[n];n++);var o=t-n;for(i=1;i<=o&&e[t-i]===r[s-i];i++);return bf=r.slice(n,1<i?1-i:void 0)}function Af(n){var e=n.keyCode;return"charCode"in n?(n=n.charCode,n===0&&e===13&&(n=13)):n=e,n===10&&(n=13),32<=n||n===13?n:0}function Cf(){return!0}function O_(){return!1}function yi(n){function e(t,i,r,s,o){this._reactName=t,this._targetInst=r,this.type=i,this.nativeEvent=s,this.target=o,this.currentTarget=null;for(var l in n)n.hasOwnProperty(l)&&(t=n[l],this[l]=t?t(s):s[l]);return this.isDefaultPrevented=(s.defaultPrevented!=null?s.defaultPrevented:s.returnValue===!1)?Cf:O_,this.isPropagationStopped=O_,this}return jt(e.prototype,{preventDefault:function(){this.defaultPrevented=!0;var t=this.nativeEvent;t&&(t.preventDefault?t.preventDefault():typeof t.returnValue!="unknown"&&(t.returnValue=!1),this.isDefaultPrevented=Cf)},stopPropagation:function(){var t=this.nativeEvent;t&&(t.stopPropagation?t.stopPropagation():typeof t.cancelBubble!="unknown"&&(t.cancelBubble=!0),this.isPropagationStopped=Cf)},persist:function(){},isPersistent:Cf}),e}var Na={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(n){return n.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},zm=yi(Na),vu=jt({},Na,{view:0,detail:0}),wb=yi(vu),Nm,km,yu,Pf=jt({},vu,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Fm,button:0,buttons:0,relatedTarget:function(n){return n.relatedTarget===void 0?n.fromElement===n.srcElement?n.toElement:n.fromElement:n.relatedTarget},movementX:function(n){return"movementX"in n?n.movementX:(n!==yu&&(yu&&n.type==="mousemove"?(Nm=n.screenX-yu.screenX,km=n.screenY-yu.screenY):km=Nm=0,yu=n),Nm)},movementY:function(n){return"movementY"in n?n.movementY:km}}),F_=yi(Pf),Sb=jt({},Pf,{dataTransfer:0}),Mb=yi(Sb),Eb=jt({},vu,{relatedTarget:0}),Om=yi(Eb),Tb=jt({},Na,{animationName:0,elapsedTime:0,pseudoElement:0}),bb=yi(Tb),Ab=jt({},Na,{clipboardData:function(n){return"clipboardData"in n?n.clipboardData:window.clipboardData}}),Cb=yi(Ab),Pb=jt({},Na,{data:0}),U_=yi(Pb),Lb={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Rb={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},Ib={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Db(n){var e=this.nativeEvent;return e.getModifierState?e.getModifierState(n):(n=Ib[n])?!!e[n]:!1}function Fm(){return Db}var zb=jt({},vu,{key:function(n){if(n.key){var e=Lb[n.key]||n.key;if(e!=="Unidentified")return e}return n.type==="keypress"?(n=Af(n),n===13?"Enter":String.fromCharCode(n)):n.type==="keydown"||n.type==="keyup"?Rb[n.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Fm,charCode:function(n){return n.type==="keypress"?Af(n):0},keyCode:function(n){return n.type==="keydown"||n.type==="keyup"?n.keyCode:0},which:function(n){return n.type==="keypress"?Af(n):n.type==="keydown"||n.type==="keyup"?n.keyCode:0}}),Nb=yi(zb),kb=jt({},Pf,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),B_=yi(kb),Ob=jt({},vu,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Fm}),Fb=yi(Ob),Ub=jt({},Na,{propertyName:0,elapsedTime:0,pseudoElement:0}),Bb=yi(Ub),Vb=jt({},Pf,{deltaX:function(n){return"deltaX"in n?n.deltaX:"wheelDeltaX"in n?-n.wheelDeltaX:0},deltaY:function(n){return"deltaY"in n?n.deltaY:"wheelDeltaY"in n?-n.wheelDeltaY:"wheelDelta"in n?-n.wheelDelta:0},deltaZ:0,deltaMode:0}),Hb=yi(Vb),Wb=[9,13,27,32],Um=Hr&&"CompositionEvent"in window,xu=null;Hr&&"documentMode"in document&&(xu=document.documentMode);var Gb=Hr&&"TextEvent"in window&&!xu,V_=Hr&&(!Um||xu&&8<xu&&11>=xu),H_=String.fromCharCode(32),W_=!1;function G_(n,e){switch(n){case"keyup":return Wb.indexOf(e.keyCode)!==-1;case"keydown":return e.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function X_(n){return n=n.detail,typeof n=="object"&&"data"in n?n.data:null}var ka=!1;function Xb(n,e){switch(n){case"compositionend":return X_(e);case"keypress":return e.which!==32?null:(W_=!0,H_);case"textInput":return n=e.data,n===H_&&W_?null:n;default:return null}}function jb(n,e){if(ka)return n==="compositionend"||!Um&&G_(n,e)?(n=k_(),bf=Dm=Ps=null,ka=!1,n):null;switch(n){case"paste":return null;case"keypress":if(!(e.ctrlKey||e.altKey||e.metaKey)||e.ctrlKey&&e.altKey){if(e.char&&1<e.char.length)return e.char;if(e.which)return String.fromCharCode(e.which)}return null;case"compositionend":return V_&&e.locale!=="ko"?null:e.data;default:return null}}var Yb={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function j_(n){var e=n&&n.nodeName&&n.nodeName.toLowerCase();return e==="input"?!!Yb[n.type]:e==="textarea"}function Y_(n,e,t,i){h_(i),e=zf(e,"onChange"),0<e.length&&(t=new zm("onChange","change",null,t,i),n.push({event:t,listeners:e}))}var _u=null,wu=null;function qb(n){f1(n,0)}function Lf(n){var e=Va(n);if(t_(e))return n}function Zb(n,e){if(n==="change")return e}var q_=!1;if(Hr){var Bm;if(Hr){var Vm="oninput"in document;if(!Vm){var Z_=document.createElement("div");Z_.setAttribute("oninput","return;"),Vm=typeof Z_.oninput=="function"}Bm=Vm}else Bm=!1;q_=Bm&&(!document.documentMode||9<document.documentMode)}function J_(){_u&&(_u.detachEvent("onpropertychange",Q_),wu=_u=null)}function Q_(n){if(n.propertyName==="value"&&Lf(wu)){var e=[];Y_(e,wu,n,_m(n)),v_(qb,e)}}function Jb(n,e,t){n==="focusin"?(J_(),_u=e,wu=t,_u.attachEvent("onpropertychange",Q_)):n==="focusout"&&J_()}function Qb(n){if(n==="selectionchange"||n==="keyup"||n==="keydown")return Lf(wu)}function Kb(n,e){if(n==="click")return Lf(e)}function $b(n,e){if(n==="input"||n==="change")return Lf(e)}function eA(n,e){return n===e&&(n!==0||1/n===1/e)||n!==n&&e!==e}var rr=typeof Object.is=="function"?Object.is:eA;function Su(n,e){if(rr(n,e))return!0;if(typeof n!="object"||n===null||typeof e!="object"||e===null)return!1;var t=Object.keys(n),i=Object.keys(e);if(t.length!==i.length)return!1;for(i=0;i<t.length;i++){var r=t[i];if(!Kp.call(e,r)||!rr(n[r],e[r]))return!1}return!0}function K_(n){for(;n&&n.firstChild;)n=n.firstChild;return n}function $_(n,e){var t=K_(n);n=0;for(var i;t;){if(t.nodeType===3){if(i=n+t.textContent.length,n<=e&&i>=e)return{node:t,offset:e-n};n=i}e:{for(;t;){if(t.nextSibling){t=t.nextSibling;break e}t=t.parentNode}t=void 0}t=K_(t)}}function e1(n,e){return n&&e?n===e?!0:n&&n.nodeType===3?!1:e&&e.nodeType===3?e1(n,e.parentNode):"contains"in n?n.contains(e):n.compareDocumentPosition?!!(n.compareDocumentPosition(e)&16):!1:!1}function t1(){for(var n=window,e=hf();e instanceof n.HTMLIFrameElement;){try{var t=typeof e.contentWindow.location.href=="string"}catch{t=!1}if(t)n=e.contentWindow;else break;e=hf(n.document)}return e}function Hm(n){var e=n&&n.nodeName&&n.nodeName.toLowerCase();return e&&(e==="input"&&(n.type==="text"||n.type==="search"||n.type==="tel"||n.type==="url"||n.type==="password")||e==="textarea"||n.contentEditable==="true")}function tA(n){var e=t1(),t=n.focusedElem,i=n.selectionRange;if(e!==t&&t&&t.ownerDocument&&e1(t.ownerDocument.documentElement,t)){if(i!==null&&Hm(t)){if(e=i.start,n=i.end,n===void 0&&(n=e),"selectionStart"in t)t.selectionStart=e,t.selectionEnd=Math.min(n,t.value.length);else if(n=(e=t.ownerDocument||document)&&e.defaultView||window,n.getSelection){n=n.getSelection();var r=t.textContent.length,s=Math.min(i.start,r);i=i.end===void 0?s:Math.min(i.end,r),!n.extend&&s>i&&(r=i,i=s,s=r),r=$_(t,s);var o=$_(t,i);r&&o&&(n.rangeCount!==1||n.anchorNode!==r.node||n.anchorOffset!==r.offset||n.focusNode!==o.node||n.focusOffset!==o.offset)&&(e=e.createRange(),e.setStart(r.node,r.offset),n.removeAllRanges(),s>i?(n.addRange(e),n.extend(o.node,o.offset)):(e.setEnd(o.node,o.offset),n.addRange(e)))}}for(e=[],n=t;n=n.parentNode;)n.nodeType===1&&e.push({element:n,left:n.scrollLeft,top:n.scrollTop});for(typeof t.focus=="function"&&t.focus(),t=0;t<e.length;t++)n=e[t],n.element.scrollLeft=n.left,n.element.scrollTop=n.top}}var nA=Hr&&"documentMode"in document&&11>=document.documentMode,Oa=null,Wm=null,Mu=null,Gm=!1;function n1(n,e,t){var i=t.window===t?t.document:t.nodeType===9?t:t.ownerDocument;Gm||Oa==null||Oa!==hf(i)||(i=Oa,"selectionStart"in i&&Hm(i)?i={start:i.selectionStart,end:i.selectionEnd}:(i=(i.ownerDocument&&i.ownerDocument.defaultView||window).getSelection(),i={anchorNode:i.anchorNode,anchorOffset:i.anchorOffset,focusNode:i.focusNode,focusOffset:i.focusOffset}),Mu&&Su(Mu,i)||(Mu=i,i=zf(Wm,"onSelect"),0<i.length&&(e=new zm("onSelect","select",null,e,t),n.push({event:e,listeners:i}),e.target=Oa)))}function Rf(n,e){var t={};return t[n.toLowerCase()]=e.toLowerCase(),t["Webkit"+n]="webkit"+e,t["Moz"+n]="moz"+e,t}var Fa={animationend:Rf("Animation","AnimationEnd"),animationiteration:Rf("Animation","AnimationIteration"),animationstart:Rf("Animation","AnimationStart"),transitionend:Rf("Transition","TransitionEnd")},Xm={},i1={};Hr&&(i1=document.createElement("div").style,"AnimationEvent"in window||(delete Fa.animationend.animation,delete Fa.animationiteration.animation,delete Fa.animationstart.animation),"TransitionEvent"in window||delete Fa.transitionend.transition);function If(n){if(Xm[n])return Xm[n];if(!Fa[n])return n;var e=Fa[n],t;for(t in e)if(e.hasOwnProperty(t)&&t in i1)return Xm[n]=e[t];return n}var r1=If("animationend"),s1=If("animationiteration"),o1=If("animationstart"),a1=If("transitionend"),l1=new Map,u1="abort auxClick cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");function Ls(n,e){l1.set(n,e),Eo(e,[n])}for(var jm=0;jm<u1.length;jm++){var Ym=u1[jm],iA=Ym.toLowerCase(),rA=Ym[0].toUpperCase()+Ym.slice(1);Ls(iA,"on"+rA)}Ls(r1,"onAnimationEnd"),Ls(s1,"onAnimationIteration"),Ls(o1,"onAnimationStart"),Ls("dblclick","onDoubleClick"),Ls("focusin","onFocus"),Ls("focusout","onBlur"),Ls(a1,"onTransitionEnd"),Ca("onMouseEnter",["mouseout","mouseover"]),Ca("onMouseLeave",["mouseout","mouseover"]),Ca("onPointerEnter",["pointerout","pointerover"]),Ca("onPointerLeave",["pointerout","pointerover"]),Eo("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Eo("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Eo("onBeforeInput",["compositionend","keypress","textInput","paste"]),Eo("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Eo("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Eo("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Eu="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),sA=new Set("cancel close invalid load scroll toggle".split(" ").concat(Eu));function c1(n,e,t){var i=n.type||"unknown-event";n.currentTarget=t,ib(i,e,void 0,n),n.currentTarget=null}function f1(n,e){e=(e&4)!==0;for(var t=0;t<n.length;t++){var i=n[t],r=i.event;i=i.listeners;e:{var s=void 0;if(e)for(var o=i.length-1;0<=o;o--){var l=i[o],c=l.instance,f=l.currentTarget;if(l=l.listener,c!==s&&r.isPropagationStopped())break e;c1(r,l,f),s=c}else for(o=0;o<i.length;o++){if(l=i[o],c=l.instance,f=l.currentTarget,l=l.listener,c!==s&&r.isPropagationStopped())break e;c1(r,l,f),s=c}}}if(gf)throw n=Em,gf=!1,Em=null,n}function kt(n,e){var t=e[tg];t===void 0&&(t=e[tg]=new Set);var i=n+"__bubble";t.has(i)||(d1(e,n,2,!1),t.add(i))}function qm(n,e,t){var i=0;e&&(i|=4),d1(t,n,i,e)}var Df="_reactListening"+Math.random().toString(36).slice(2);function Tu(n){if(!n[Df]){n[Df]=!0,Yx.forEach(function(t){t!=="selectionchange"&&(sA.has(t)||qm(t,!1,n),qm(t,!0,n))});var e=n.nodeType===9?n:n.ownerDocument;e===null||e[Df]||(e[Df]=!0,qm("selectionchange",!1,e))}}function d1(n,e,t,i){switch(N_(e)){case 1:var r=xb;break;case 4:r=_b;break;default:r=Rm}t=r.bind(null,e,t,n),r=void 0,!Mm||e!=="touchstart"&&e!=="touchmove"&&e!=="wheel"||(r=!0),i?r!==void 0?n.addEventListener(e,t,{capture:!0,passive:r}):n.addEventListener(e,t,!0):r!==void 0?n.addEventListener(e,t,{passive:r}):n.addEventListener(e,t,!1)}function Zm(n,e,t,i,r){var s=i;if((e&1)===0&&(e&2)===0&&i!==null)e:for(;;){if(i===null)return;var o=i.tag;if(o===3||o===4){var l=i.stateNode.containerInfo;if(l===r||l.nodeType===8&&l.parentNode===r)break;if(o===4)for(o=i.return;o!==null;){var c=o.tag;if((c===3||c===4)&&(c=o.stateNode.containerInfo,c===r||c.nodeType===8&&c.parentNode===r))return;o=o.return}for(;l!==null;){if(o=bo(l),o===null)return;if(c=o.tag,c===5||c===6){i=s=o;continue e}l=l.parentNode}}i=i.return}v_(function(){var f=s,d=_m(t),h=[];e:{var m=l1.get(n);if(m!==void 0){var g=zm,x=n;switch(n){case"keypress":if(Af(t)===0)break e;case"keydown":case"keyup":g=Nb;break;case"focusin":x="focus",g=Om;break;case"focusout":x="blur",g=Om;break;case"beforeblur":case"afterblur":g=Om;break;case"click":if(t.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":g=F_;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":g=Mb;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":g=Fb;break;case r1:case s1:case o1:g=bb;break;case a1:g=Bb;break;case"scroll":g=wb;break;case"wheel":g=Hb;break;case"copy":case"cut":case"paste":g=Cb;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":g=B_}var y=(e&4)!==0,w=!y&&n==="scroll",_=y?m!==null?m+"Capture":null:m;y=[];for(var S=f,E;S!==null;){E=S;var T=E.stateNode;if(E.tag===5&&T!==null&&(E=T,_!==null&&(T=au(S,_),T!=null&&y.push(bu(S,T,E)))),w)break;S=S.return}0<y.length&&(m=new g(m,x,null,t,d),h.push({event:m,listeners:y}))}}if((e&7)===0){e:{if(m=n==="mouseover"||n==="pointerover",g=n==="mouseout"||n==="pointerout",m&&t!==xm&&(x=t.relatedTarget||t.fromElement)&&(bo(x)||x[Gr]))break e;if((g||m)&&(m=d.window===d?d:(m=d.ownerDocument)?m.defaultView||m.parentWindow:window,g?(x=t.relatedTarget||t.toElement,g=f,x=x?bo(x):null,x!==null&&(w=To(x),x!==w||x.tag!==5&&x.tag!==6)&&(x=null)):(g=null,x=f),g!==x)){if(y=F_,T="onMouseLeave",_="onMouseEnter",S="mouse",(n==="pointerout"||n==="pointerover")&&(y=B_,T="onPointerLeave",_="onPointerEnter",S="pointer"),w=g==null?m:Va(g),E=x==null?m:Va(x),m=new y(T,S+"leave",g,t,d),m.target=w,m.relatedTarget=E,T=null,bo(d)===f&&(y=new y(_,S+"enter",x,t,d),y.target=E,y.relatedTarget=w,T=y),w=T,g&&x)t:{for(y=g,_=x,S=0,E=y;E;E=Ua(E))S++;for(E=0,T=_;T;T=Ua(T))E++;for(;0<S-E;)y=Ua(y),S--;for(;0<E-S;)_=Ua(_),E--;for(;S--;){if(y===_||_!==null&&y===_.alternate)break t;y=Ua(y),_=Ua(_)}y=null}else y=null;g!==null&&h1(h,m,g,y,!1),x!==null&&w!==null&&h1(h,w,x,y,!0)}}e:{if(m=f?Va(f):window,g=m.nodeName&&m.nodeName.toLowerCase(),g==="select"||g==="input"&&m.type==="file")var C=Zb;else if(j_(m))if(q_)C=$b;else{C=Qb;var P=Jb}else(g=m.nodeName)&&g.toLowerCase()==="input"&&(m.type==="checkbox"||m.type==="radio")&&(C=Kb);if(C&&(C=C(n,f))){Y_(h,C,t,d);break e}P&&P(n,m,f),n==="focusout"&&(P=m._wrapperState)&&P.controlled&&m.type==="number"&&pm(m,"number",m.value)}switch(P=f?Va(f):window,n){case"focusin":(j_(P)||P.contentEditable==="true")&&(Oa=P,Wm=f,Mu=null);break;case"focusout":Mu=Wm=Oa=null;break;case"mousedown":Gm=!0;break;case"contextmenu":case"mouseup":case"dragend":Gm=!1,n1(h,t,d);break;case"selectionchange":if(nA)break;case"keydown":case"keyup":n1(h,t,d)}var I;if(Um)e:{switch(n){case"compositionstart":var A="onCompositionStart";break e;case"compositionend":A="onCompositionEnd";break e;case"compositionupdate":A="onCompositionUpdate";break e}A=void 0}else ka?G_(n,t)&&(A="onCompositionEnd"):n==="keydown"&&t.keyCode===229&&(A="onCompositionStart");A&&(V_&&t.locale!=="ko"&&(ka||A!=="onCompositionStart"?A==="onCompositionEnd"&&ka&&(I=k_()):(Ps=d,Dm="value"in Ps?Ps.value:Ps.textContent,ka=!0)),P=zf(f,A),0<P.length&&(A=new U_(A,n,null,t,d),h.push({event:A,listeners:P}),I?A.data=I:(I=X_(t),I!==null&&(A.data=I)))),(I=Gb?Xb(n,t):jb(n,t))&&(f=zf(f,"onBeforeInput"),0<f.length&&(d=new U_("onBeforeInput","beforeinput",null,t,d),h.push({event:d,listeners:f}),d.data=I))}f1(h,e)})}function bu(n,e,t){return{instance:n,listener:e,currentTarget:t}}function zf(n,e){for(var t=e+"Capture",i=[];n!==null;){var r=n,s=r.stateNode;r.tag===5&&s!==null&&(r=s,s=au(n,t),s!=null&&i.unshift(bu(n,s,r)),s=au(n,e),s!=null&&i.push(bu(n,s,r))),n=n.return}return i}function Ua(n){if(n===null)return null;do n=n.return;while(n&&n.tag!==5);return n||null}function h1(n,e,t,i,r){for(var s=e._reactName,o=[];t!==null&&t!==i;){var l=t,c=l.alternate,f=l.stateNode;if(c!==null&&c===i)break;l.tag===5&&f!==null&&(l=f,r?(c=au(t,s),c!=null&&o.unshift(bu(t,c,l))):r||(c=au(t,s),c!=null&&o.push(bu(t,c,l)))),t=t.return}o.length!==0&&n.push({event:e,listeners:o})}var oA=/\r\n?/g,aA=/\u0000|\uFFFD/g;function p1(n){return(typeof n=="string"?n:""+n).replace(oA,`
`).replace(aA,"")}function Nf(n,e,t){if(e=p1(e),p1(n)!==e&&t)throw Error(ge(425))}function kf(){}var Jm=null,Qm=null;function Km(n,e){return n==="textarea"||n==="noscript"||typeof e.children=="string"||typeof e.children=="number"||typeof e.dangerouslySetInnerHTML=="object"&&e.dangerouslySetInnerHTML!==null&&e.dangerouslySetInnerHTML.__html!=null}var $m=typeof setTimeout=="function"?setTimeout:void 0,lA=typeof clearTimeout=="function"?clearTimeout:void 0,m1=typeof Promise=="function"?Promise:void 0,uA=typeof queueMicrotask=="function"?queueMicrotask:typeof m1<"u"?function(n){return m1.resolve(null).then(n).catch(cA)}:$m;function cA(n){setTimeout(function(){throw n})}function eg(n,e){var t=e,i=0;do{var r=t.nextSibling;if(n.removeChild(t),r&&r.nodeType===8)if(t=r.data,t==="/$"){if(i===0){n.removeChild(r),gu(e);return}i--}else t!=="$"&&t!=="$?"&&t!=="$!"||i++;t=r}while(t);gu(e)}function Rs(n){for(;n!=null;n=n.nextSibling){var e=n.nodeType;if(e===1||e===3)break;if(e===8){if(e=n.data,e==="$"||e==="$!"||e==="$?")break;if(e==="/$")return null}}return n}function g1(n){n=n.previousSibling;for(var e=0;n;){if(n.nodeType===8){var t=n.data;if(t==="$"||t==="$!"||t==="$?"){if(e===0)return n;e--}else t==="/$"&&e++}n=n.previousSibling}return null}var Ba=Math.random().toString(36).slice(2),Sr="__reactFiber$"+Ba,Au="__reactProps$"+Ba,Gr="__reactContainer$"+Ba,tg="__reactEvents$"+Ba,fA="__reactListeners$"+Ba,dA="__reactHandles$"+Ba;function bo(n){var e=n[Sr];if(e)return e;for(var t=n.parentNode;t;){if(e=t[Gr]||t[Sr]){if(t=e.alternate,e.child!==null||t!==null&&t.child!==null)for(n=g1(n);n!==null;){if(t=n[Sr])return t;n=g1(n)}return e}n=t,t=n.parentNode}return null}function Cu(n){return n=n[Sr]||n[Gr],!n||n.tag!==5&&n.tag!==6&&n.tag!==13&&n.tag!==3?null:n}function Va(n){if(n.tag===5||n.tag===6)return n.stateNode;throw Error(ge(33))}function Of(n){return n[Au]||null}var ng=[],Ha=-1;function Is(n){return{current:n}}function Ot(n){0>Ha||(n.current=ng[Ha],ng[Ha]=null,Ha--)}function Nt(n,e){Ha++,ng[Ha]=n.current,n.current=e}var Ds={},Dn=Is(Ds),ri=Is(!1),Ao=Ds;function Wa(n,e){var t=n.type.contextTypes;if(!t)return Ds;var i=n.stateNode;if(i&&i.__reactInternalMemoizedUnmaskedChildContext===e)return i.__reactInternalMemoizedMaskedChildContext;var r={},s;for(s in t)r[s]=e[s];return i&&(n=n.stateNode,n.__reactInternalMemoizedUnmaskedChildContext=e,n.__reactInternalMemoizedMaskedChildContext=r),r}function si(n){return n=n.childContextTypes,n!=null}function Ff(){Ot(ri),Ot(Dn)}function v1(n,e,t){if(Dn.current!==Ds)throw Error(ge(168));Nt(Dn,e),Nt(ri,t)}function y1(n,e,t){var i=n.stateNode;if(e=e.childContextTypes,typeof i.getChildContext!="function")return t;i=i.getChildContext();for(var r in i)if(!(r in e))throw Error(ge(108,JT(n)||"Unknown",r));return jt({},t,i)}function Uf(n){return n=(n=n.stateNode)&&n.__reactInternalMemoizedMergedChildContext||Ds,Ao=Dn.current,Nt(Dn,n),Nt(ri,ri.current),!0}function x1(n,e,t){var i=n.stateNode;if(!i)throw Error(ge(169));t?(n=y1(n,e,Ao),i.__reactInternalMemoizedMergedChildContext=n,Ot(ri),Ot(Dn),Nt(Dn,n)):Ot(ri),Nt(ri,t)}var Xr=null,Bf=!1,ig=!1;function _1(n){Xr===null?Xr=[n]:Xr.push(n)}function hA(n){Bf=!0,_1(n)}function zs(){if(!ig&&Xr!==null){ig=!0;var n=0,e=Lt;try{var t=Xr;for(Lt=1;n<t.length;n++){var i=t[n];do i=i(!0);while(i!==null)}Xr=null,Bf=!1}catch(r){throw Xr!==null&&(Xr=Xr.slice(n+1)),S_(Tm,zs),r}finally{Lt=e,ig=!1}}return null}var Ga=[],Xa=0,Vf=null,Hf=0,Ii=[],Di=0,Co=null,jr=1,Yr="";function Po(n,e){Ga[Xa++]=Hf,Ga[Xa++]=Vf,Vf=n,Hf=e}function w1(n,e,t){Ii[Di++]=jr,Ii[Di++]=Yr,Ii[Di++]=Co,Co=n;var i=jr;n=Yr;var r=32-ir(i)-1;i&=~(1<<r),t+=1;var s=32-ir(e)+r;if(30<s){var o=r-r%5;s=(i&(1<<o)-1).toString(32),i>>=o,r-=o,jr=1<<32-ir(e)+r|t<<r|i,Yr=s+n}else jr=1<<s|t<<r|i,Yr=n}function rg(n){n.return!==null&&(Po(n,1),w1(n,1,0))}function sg(n){for(;n===Vf;)Vf=Ga[--Xa],Ga[Xa]=null,Hf=Ga[--Xa],Ga[Xa]=null;for(;n===Co;)Co=Ii[--Di],Ii[Di]=null,Yr=Ii[--Di],Ii[Di]=null,jr=Ii[--Di],Ii[Di]=null}var xi=null,_i=null,Ut=!1,sr=null;function S1(n,e){var t=Oi(5,null,null,0);t.elementType="DELETED",t.stateNode=e,t.return=n,e=n.deletions,e===null?(n.deletions=[t],n.flags|=16):e.push(t)}function M1(n,e){switch(n.tag){case 5:var t=n.type;return e=e.nodeType!==1||t.toLowerCase()!==e.nodeName.toLowerCase()?null:e,e!==null?(n.stateNode=e,xi=n,_i=Rs(e.firstChild),!0):!1;case 6:return e=n.pendingProps===""||e.nodeType!==3?null:e,e!==null?(n.stateNode=e,xi=n,_i=null,!0):!1;case 13:return e=e.nodeType!==8?null:e,e!==null?(t=Co!==null?{id:jr,overflow:Yr}:null,n.memoizedState={dehydrated:e,treeContext:t,retryLane:1073741824},t=Oi(18,null,null,0),t.stateNode=e,t.return=n,n.child=t,xi=n,_i=null,!0):!1;default:return!1}}function og(n){return(n.mode&1)!==0&&(n.flags&128)===0}function ag(n){if(Ut){var e=_i;if(e){var t=e;if(!M1(n,e)){if(og(n))throw Error(ge(418));e=Rs(t.nextSibling);var i=xi;e&&M1(n,e)?S1(i,t):(n.flags=n.flags&-4097|2,Ut=!1,xi=n)}}else{if(og(n))throw Error(ge(418));n.flags=n.flags&-4097|2,Ut=!1,xi=n}}}function E1(n){for(n=n.return;n!==null&&n.tag!==5&&n.tag!==3&&n.tag!==13;)n=n.return;xi=n}function Wf(n){if(n!==xi)return!1;if(!Ut)return E1(n),Ut=!0,!1;var e;if((e=n.tag!==3)&&!(e=n.tag!==5)&&(e=n.type,e=e!=="head"&&e!=="body"&&!Km(n.type,n.memoizedProps)),e&&(e=_i)){if(og(n))throw T1(),Error(ge(418));for(;e;)S1(n,e),e=Rs(e.nextSibling)}if(E1(n),n.tag===13){if(n=n.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(ge(317));e:{for(n=n.nextSibling,e=0;n;){if(n.nodeType===8){var t=n.data;if(t==="/$"){if(e===0){_i=Rs(n.nextSibling);break e}e--}else t!=="$"&&t!=="$!"&&t!=="$?"||e++}n=n.nextSibling}_i=null}}else _i=xi?Rs(n.stateNode.nextSibling):null;return!0}function T1(){for(var n=_i;n;)n=Rs(n.nextSibling)}function ja(){_i=xi=null,Ut=!1}function lg(n){sr===null?sr=[n]:sr.push(n)}var pA=Wr.ReactCurrentBatchConfig;function or(n,e){if(n&&n.defaultProps){e=jt({},e),n=n.defaultProps;for(var t in n)e[t]===void 0&&(e[t]=n[t]);return e}return e}var Gf=Is(null),Xf=null,Ya=null,ug=null;function cg(){ug=Ya=Xf=null}function fg(n){var e=Gf.current;Ot(Gf),n._currentValue=e}function dg(n,e,t){for(;n!==null;){var i=n.alternate;if((n.childLanes&e)!==e?(n.childLanes|=e,i!==null&&(i.childLanes|=e)):i!==null&&(i.childLanes&e)!==e&&(i.childLanes|=e),n===t)break;n=n.return}}function qa(n,e){Xf=n,ug=Ya=null,n=n.dependencies,n!==null&&n.firstContext!==null&&((n.lanes&e)!==0&&(oi=!0),n.firstContext=null)}function zi(n){var e=n._currentValue;if(ug!==n)if(n={context:n,memoizedValue:e,next:null},Ya===null){if(Xf===null)throw Error(ge(308));Ya=n,Xf.dependencies={lanes:0,firstContext:n}}else Ya=Ya.next=n;return e}var Lo=null;function hg(n){Lo===null?Lo=[n]:Lo.push(n)}function b1(n,e,t,i){var r=e.interleaved;return r===null?(t.next=t,hg(e)):(t.next=r.next,r.next=t),e.interleaved=t,qr(n,i)}function qr(n,e){n.lanes|=e;var t=n.alternate;for(t!==null&&(t.lanes|=e),t=n,n=n.return;n!==null;)n.childLanes|=e,t=n.alternate,t!==null&&(t.childLanes|=e),t=n,n=n.return;return t.tag===3?t.stateNode:null}var Ns=!1;function pg(n){n.updateQueue={baseState:n.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function A1(n,e){n=n.updateQueue,e.updateQueue===n&&(e.updateQueue={baseState:n.baseState,firstBaseUpdate:n.firstBaseUpdate,lastBaseUpdate:n.lastBaseUpdate,shared:n.shared,effects:n.effects})}function Zr(n,e){return{eventTime:n,lane:e,tag:0,payload:null,callback:null,next:null}}function ks(n,e,t){var i=n.updateQueue;if(i===null)return null;if(i=i.shared,(_t&2)!==0){var r=i.pending;return r===null?e.next=e:(e.next=r.next,r.next=e),i.pending=e,qr(n,t)}return r=i.interleaved,r===null?(e.next=e,hg(i)):(e.next=r.next,r.next=e),i.interleaved=e,qr(n,t)}function jf(n,e,t){if(e=e.updateQueue,e!==null&&(e=e.shared,(t&4194240)!==0)){var i=e.lanes;i&=n.pendingLanes,t|=i,e.lanes=t,Cm(n,t)}}function C1(n,e){var t=n.updateQueue,i=n.alternate;if(i!==null&&(i=i.updateQueue,t===i)){var r=null,s=null;if(t=t.firstBaseUpdate,t!==null){do{var o={eventTime:t.eventTime,lane:t.lane,tag:t.tag,payload:t.payload,callback:t.callback,next:null};s===null?r=s=o:s=s.next=o,t=t.next}while(t!==null);s===null?r=s=e:s=s.next=e}else r=s=e;t={baseState:i.baseState,firstBaseUpdate:r,lastBaseUpdate:s,shared:i.shared,effects:i.effects},n.updateQueue=t;return}n=t.lastBaseUpdate,n===null?t.firstBaseUpdate=e:n.next=e,t.lastBaseUpdate=e}function Yf(n,e,t,i){var r=n.updateQueue;Ns=!1;var s=r.firstBaseUpdate,o=r.lastBaseUpdate,l=r.shared.pending;if(l!==null){r.shared.pending=null;var c=l,f=c.next;c.next=null,o===null?s=f:o.next=f,o=c;var d=n.alternate;d!==null&&(d=d.updateQueue,l=d.lastBaseUpdate,l!==o&&(l===null?d.firstBaseUpdate=f:l.next=f,d.lastBaseUpdate=c))}if(s!==null){var h=r.baseState;o=0,d=f=c=null,l=s;do{var m=l.lane,g=l.eventTime;if((i&m)===m){d!==null&&(d=d.next={eventTime:g,lane:0,tag:l.tag,payload:l.payload,callback:l.callback,next:null});e:{var x=n,y=l;switch(m=e,g=t,y.tag){case 1:if(x=y.payload,typeof x=="function"){h=x.call(g,h,m);break e}h=x;break e;case 3:x.flags=x.flags&-65537|128;case 0:if(x=y.payload,m=typeof x=="function"?x.call(g,h,m):x,m==null)break e;h=jt({},h,m);break e;case 2:Ns=!0}}l.callback!==null&&l.lane!==0&&(n.flags|=64,m=r.effects,m===null?r.effects=[l]:m.push(l))}else g={eventTime:g,lane:m,tag:l.tag,payload:l.payload,callback:l.callback,next:null},d===null?(f=d=g,c=h):d=d.next=g,o|=m;if(l=l.next,l===null){if(l=r.shared.pending,l===null)break;m=l,l=m.next,m.next=null,r.lastBaseUpdate=m,r.shared.pending=null}}while(1);if(d===null&&(c=h),r.baseState=c,r.firstBaseUpdate=f,r.lastBaseUpdate=d,e=r.shared.interleaved,e!==null){r=e;do o|=r.lane,r=r.next;while(r!==e)}else s===null&&(r.shared.lanes=0);Do|=o,n.lanes=o,n.memoizedState=h}}function P1(n,e,t){if(n=e.effects,e.effects=null,n!==null)for(e=0;e<n.length;e++){var i=n[e],r=i.callback;if(r!==null){if(i.callback=null,i=t,typeof r!="function")throw Error(ge(191,r));r.call(i)}}}var L1=new jx.Component().refs;function mg(n,e,t,i){e=n.memoizedState,t=t(i,e),t=t==null?e:jt({},e,t),n.memoizedState=t,n.lanes===0&&(n.updateQueue.baseState=t)}var qf={isMounted:function(n){return(n=n._reactInternals)?To(n)===n:!1},enqueueSetState:function(n,e,t){n=n._reactInternals;var i=qn(),r=Bs(n),s=Zr(i,r);s.payload=e,t!=null&&(s.callback=t),e=ks(n,s,r),e!==null&&(ur(e,n,r,i),jf(e,n,r))},enqueueReplaceState:function(n,e,t){n=n._reactInternals;var i=qn(),r=Bs(n),s=Zr(i,r);s.tag=1,s.payload=e,t!=null&&(s.callback=t),e=ks(n,s,r),e!==null&&(ur(e,n,r,i),jf(e,n,r))},enqueueForceUpdate:function(n,e){n=n._reactInternals;var t=qn(),i=Bs(n),r=Zr(t,i);r.tag=2,e!=null&&(r.callback=e),e=ks(n,r,i),e!==null&&(ur(e,n,i,t),jf(e,n,i))}};function R1(n,e,t,i,r,s,o){return n=n.stateNode,typeof n.shouldComponentUpdate=="function"?n.shouldComponentUpdate(i,s,o):e.prototype&&e.prototype.isPureReactComponent?!Su(t,i)||!Su(r,s):!0}function I1(n,e,t){var i=!1,r=Ds,s=e.contextType;return typeof s=="object"&&s!==null?s=zi(s):(r=si(e)?Ao:Dn.current,i=e.contextTypes,s=(i=i!=null)?Wa(n,r):Ds),e=new e(t,s),n.memoizedState=e.state!==null&&e.state!==void 0?e.state:null,e.updater=qf,n.stateNode=e,e._reactInternals=n,i&&(n=n.stateNode,n.__reactInternalMemoizedUnmaskedChildContext=r,n.__reactInternalMemoizedMaskedChildContext=s),e}function D1(n,e,t,i){n=e.state,typeof e.componentWillReceiveProps=="function"&&e.componentWillReceiveProps(t,i),typeof e.UNSAFE_componentWillReceiveProps=="function"&&e.UNSAFE_componentWillReceiveProps(t,i),e.state!==n&&qf.enqueueReplaceState(e,e.state,null)}function gg(n,e,t,i){var r=n.stateNode;r.props=t,r.state=n.memoizedState,r.refs=L1,pg(n);var s=e.contextType;typeof s=="object"&&s!==null?r.context=zi(s):(s=si(e)?Ao:Dn.current,r.context=Wa(n,s)),r.state=n.memoizedState,s=e.getDerivedStateFromProps,typeof s=="function"&&(mg(n,e,s,t),r.state=n.memoizedState),typeof e.getDerivedStateFromProps=="function"||typeof r.getSnapshotBeforeUpdate=="function"||typeof r.UNSAFE_componentWillMount!="function"&&typeof r.componentWillMount!="function"||(e=r.state,typeof r.componentWillMount=="function"&&r.componentWillMount(),typeof r.UNSAFE_componentWillMount=="function"&&r.UNSAFE_componentWillMount(),e!==r.state&&qf.enqueueReplaceState(r,r.state,null),Yf(n,t,r,i),r.state=n.memoizedState),typeof r.componentDidMount=="function"&&(n.flags|=4194308)}function Pu(n,e,t){if(n=t.ref,n!==null&&typeof n!="function"&&typeof n!="object"){if(t._owner){if(t=t._owner,t){if(t.tag!==1)throw Error(ge(309));var i=t.stateNode}if(!i)throw Error(ge(147,n));var r=i,s=""+n;return e!==null&&e.ref!==null&&typeof e.ref=="function"&&e.ref._stringRef===s?e.ref:(e=function(o){var l=r.refs;l===L1&&(l=r.refs={}),o===null?delete l[s]:l[s]=o},e._stringRef=s,e)}if(typeof n!="string")throw Error(ge(284));if(!t._owner)throw Error(ge(290,n))}return n}function Zf(n,e){throw n=Object.prototype.toString.call(e),Error(ge(31,n==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":n))}function z1(n){var e=n._init;return e(n._payload)}function N1(n){function e(_,S){if(n){var E=_.deletions;E===null?(_.deletions=[S],_.flags|=16):E.push(S)}}function t(_,S){if(!n)return null;for(;S!==null;)e(_,S),S=S.sibling;return null}function i(_,S){for(_=new Map;S!==null;)S.key!==null?_.set(S.key,S):_.set(S.index,S),S=S.sibling;return _}function r(_,S){return _=Hs(_,S),_.index=0,_.sibling=null,_}function s(_,S,E){return _.index=E,n?(E=_.alternate,E!==null?(E=E.index,E<S?(_.flags|=2,S):E):(_.flags|=2,S)):(_.flags|=1048576,S)}function o(_){return n&&_.alternate===null&&(_.flags|=2),_}function l(_,S,E,T){return S===null||S.tag!==6?(S=$g(E,_.mode,T),S.return=_,S):(S=r(S,E),S.return=_,S)}function c(_,S,E,T){var C=E.type;return C===La?d(_,S,E.props.children,T,E.key):S!==null&&(S.elementType===C||typeof C=="object"&&C!==null&&C.$$typeof===Ms&&z1(C)===S.type)?(T=r(S,E.props),T.ref=Pu(_,S,E),T.return=_,T):(T=pd(E.type,E.key,E.props,null,_.mode,T),T.ref=Pu(_,S,E),T.return=_,T)}function f(_,S,E,T){return S===null||S.tag!==4||S.stateNode.containerInfo!==E.containerInfo||S.stateNode.implementation!==E.implementation?(S=e0(E,_.mode,T),S.return=_,S):(S=r(S,E.children||[]),S.return=_,S)}function d(_,S,E,T,C){return S===null||S.tag!==7?(S=Oo(E,_.mode,T,C),S.return=_,S):(S=r(S,E),S.return=_,S)}function h(_,S,E){if(typeof S=="string"&&S!==""||typeof S=="number")return S=$g(""+S,_.mode,E),S.return=_,S;if(typeof S=="object"&&S!==null){switch(S.$$typeof){case ff:return E=pd(S.type,S.key,S.props,null,_.mode,E),E.ref=Pu(_,null,S),E.return=_,E;case Pa:return S=e0(S,_.mode,E),S.return=_,S;case Ms:var T=S._init;return h(_,T(S._payload),E)}if(ru(S)||nu(S))return S=Oo(S,_.mode,E,null),S.return=_,S;Zf(_,S)}return null}function m(_,S,E,T){var C=S!==null?S.key:null;if(typeof E=="string"&&E!==""||typeof E=="number")return C!==null?null:l(_,S,""+E,T);if(typeof E=="object"&&E!==null){switch(E.$$typeof){case ff:return E.key===C?c(_,S,E,T):null;case Pa:return E.key===C?f(_,S,E,T):null;case Ms:return C=E._init,m(_,S,C(E._payload),T)}if(ru(E)||nu(E))return C!==null?null:d(_,S,E,T,null);Zf(_,E)}return null}function g(_,S,E,T,C){if(typeof T=="string"&&T!==""||typeof T=="number")return _=_.get(E)||null,l(S,_,""+T,C);if(typeof T=="object"&&T!==null){switch(T.$$typeof){case ff:return _=_.get(T.key===null?E:T.key)||null,c(S,_,T,C);case Pa:return _=_.get(T.key===null?E:T.key)||null,f(S,_,T,C);case Ms:var P=T._init;return g(_,S,E,P(T._payload),C)}if(ru(T)||nu(T))return _=_.get(E)||null,d(S,_,T,C,null);Zf(S,T)}return null}function x(_,S,E,T){for(var C=null,P=null,I=S,A=S=0,L=null;I!==null&&A<E.length;A++){I.index>A?(L=I,I=null):L=I.sibling;var z=m(_,I,E[A],T);if(z===null){I===null&&(I=L);break}n&&I&&z.alternate===null&&e(_,I),S=s(z,S,A),P===null?C=z:P.sibling=z,P=z,I=L}if(A===E.length)return t(_,I),Ut&&Po(_,A),C;if(I===null){for(;A<E.length;A++)I=h(_,E[A],T),I!==null&&(S=s(I,S,A),P===null?C=I:P.sibling=I,P=I);return Ut&&Po(_,A),C}for(I=i(_,I);A<E.length;A++)L=g(I,_,A,E[A],T),L!==null&&(n&&L.alternate!==null&&I.delete(L.key===null?A:L.key),S=s(L,S,A),P===null?C=L:P.sibling=L,P=L);return n&&I.forEach(function(j){return e(_,j)}),Ut&&Po(_,A),C}function y(_,S,E,T){var C=nu(E);if(typeof C!="function")throw Error(ge(150));if(E=C.call(E),E==null)throw Error(ge(151));for(var P=C=null,I=S,A=S=0,L=null,z=E.next();I!==null&&!z.done;A++,z=E.next()){I.index>A?(L=I,I=null):L=I.sibling;var j=m(_,I,z.value,T);if(j===null){I===null&&(I=L);break}n&&I&&j.alternate===null&&e(_,I),S=s(j,S,A),P===null?C=j:P.sibling=j,P=j,I=L}if(z.done)return t(_,I),Ut&&Po(_,A),C;if(I===null){for(;!z.done;A++,z=E.next())z=h(_,z.value,T),z!==null&&(S=s(z,S,A),P===null?C=z:P.sibling=z,P=z);return Ut&&Po(_,A),C}for(I=i(_,I);!z.done;A++,z=E.next())z=g(I,_,A,z.value,T),z!==null&&(n&&z.alternate!==null&&I.delete(z.key===null?A:z.key),S=s(z,S,A),P===null?C=z:P.sibling=z,P=z);return n&&I.forEach(function(ue){return e(_,ue)}),Ut&&Po(_,A),C}function w(_,S,E,T){if(typeof E=="object"&&E!==null&&E.type===La&&E.key===null&&(E=E.props.children),typeof E=="object"&&E!==null){switch(E.$$typeof){case ff:e:{for(var C=E.key,P=S;P!==null;){if(P.key===C){if(C=E.type,C===La){if(P.tag===7){t(_,P.sibling),S=r(P,E.props.children),S.return=_,_=S;break e}}else if(P.elementType===C||typeof C=="object"&&C!==null&&C.$$typeof===Ms&&z1(C)===P.type){t(_,P.sibling),S=r(P,E.props),S.ref=Pu(_,P,E),S.return=_,_=S;break e}t(_,P);break}else e(_,P);P=P.sibling}E.type===La?(S=Oo(E.props.children,_.mode,T,E.key),S.return=_,_=S):(T=pd(E.type,E.key,E.props,null,_.mode,T),T.ref=Pu(_,S,E),T.return=_,_=T)}return o(_);case Pa:e:{for(P=E.key;S!==null;){if(S.key===P)if(S.tag===4&&S.stateNode.containerInfo===E.containerInfo&&S.stateNode.implementation===E.implementation){t(_,S.sibling),S=r(S,E.children||[]),S.return=_,_=S;break e}else{t(_,S);break}else e(_,S);S=S.sibling}S=e0(E,_.mode,T),S.return=_,_=S}return o(_);case Ms:return P=E._init,w(_,S,P(E._payload),T)}if(ru(E))return x(_,S,E,T);if(nu(E))return y(_,S,E,T);Zf(_,E)}return typeof E=="string"&&E!==""||typeof E=="number"?(E=""+E,S!==null&&S.tag===6?(t(_,S.sibling),S=r(S,E),S.return=_,_=S):(t(_,S),S=$g(E,_.mode,T),S.return=_,_=S),o(_)):t(_,S)}return w}var Za=N1(!0),k1=N1(!1),Lu={},Mr=Is(Lu),Ru=Is(Lu),Iu=Is(Lu);function Ro(n){if(n===Lu)throw Error(ge(174));return n}function vg(n,e){switch(Nt(Iu,e),Nt(Ru,n),Nt(Mr,Lu),n=e.nodeType,n){case 9:case 11:e=(e=e.documentElement)?e.namespaceURI:gm(null,"");break;default:n=n===8?e.parentNode:e,e=n.namespaceURI||null,n=n.tagName,e=gm(e,n)}Ot(Mr),Nt(Mr,e)}function Ja(){Ot(Mr),Ot(Ru),Ot(Iu)}function O1(n){Ro(Iu.current);var e=Ro(Mr.current),t=gm(e,n.type);e!==t&&(Nt(Ru,n),Nt(Mr,t))}function yg(n){Ru.current===n&&(Ot(Mr),Ot(Ru))}var Yt=Is(0);function Jf(n){for(var e=n;e!==null;){if(e.tag===13){var t=e.memoizedState;if(t!==null&&(t=t.dehydrated,t===null||t.data==="$?"||t.data==="$!"))return e}else if(e.tag===19&&e.memoizedProps.revealOrder!==void 0){if((e.flags&128)!==0)return e}else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===n)break;for(;e.sibling===null;){if(e.return===null||e.return===n)return null;e=e.return}e.sibling.return=e.return,e=e.sibling}return null}var xg=[];function _g(){for(var n=0;n<xg.length;n++)xg[n]._workInProgressVersionPrimary=null;xg.length=0}var Qf=Wr.ReactCurrentDispatcher,wg=Wr.ReactCurrentBatchConfig,Io=0,qt=null,pn=null,yn=null,Kf=!1,Du=!1,zu=0,mA=0;function zn(){throw Error(ge(321))}function Sg(n,e){if(e===null)return!1;for(var t=0;t<e.length&&t<n.length;t++)if(!rr(n[t],e[t]))return!1;return!0}function Mg(n,e,t,i,r,s){if(Io=s,qt=e,e.memoizedState=null,e.updateQueue=null,e.lanes=0,Qf.current=n===null||n.memoizedState===null?xA:_A,n=t(i,r),Du){s=0;do{if(Du=!1,zu=0,25<=s)throw Error(ge(301));s+=1,yn=pn=null,e.updateQueue=null,Qf.current=wA,n=t(i,r)}while(Du)}if(Qf.current=td,e=pn!==null&&pn.next!==null,Io=0,yn=pn=qt=null,Kf=!1,e)throw Error(ge(300));return n}function Eg(){var n=zu!==0;return zu=0,n}function Er(){var n={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return yn===null?qt.memoizedState=yn=n:yn=yn.next=n,yn}function Ni(){if(pn===null){var n=qt.alternate;n=n!==null?n.memoizedState:null}else n=pn.next;var e=yn===null?qt.memoizedState:yn.next;if(e!==null)yn=e,pn=n;else{if(n===null)throw Error(ge(310));pn=n,n={memoizedState:pn.memoizedState,baseState:pn.baseState,baseQueue:pn.baseQueue,queue:pn.queue,next:null},yn===null?qt.memoizedState=yn=n:yn=yn.next=n}return yn}function Nu(n,e){return typeof e=="function"?e(n):e}function Tg(n){var e=Ni(),t=e.queue;if(t===null)throw Error(ge(311));t.lastRenderedReducer=n;var i=pn,r=i.baseQueue,s=t.pending;if(s!==null){if(r!==null){var o=r.next;r.next=s.next,s.next=o}i.baseQueue=r=s,t.pending=null}if(r!==null){s=r.next,i=i.baseState;var l=o=null,c=null,f=s;do{var d=f.lane;if((Io&d)===d)c!==null&&(c=c.next={lane:0,action:f.action,hasEagerState:f.hasEagerState,eagerState:f.eagerState,next:null}),i=f.hasEagerState?f.eagerState:n(i,f.action);else{var h={lane:d,action:f.action,hasEagerState:f.hasEagerState,eagerState:f.eagerState,next:null};c===null?(l=c=h,o=i):c=c.next=h,qt.lanes|=d,Do|=d}f=f.next}while(f!==null&&f!==s);c===null?o=i:c.next=l,rr(i,e.memoizedState)||(oi=!0),e.memoizedState=i,e.baseState=o,e.baseQueue=c,t.lastRenderedState=i}if(n=t.interleaved,n!==null){r=n;do s=r.lane,qt.lanes|=s,Do|=s,r=r.next;while(r!==n)}else r===null&&(t.lanes=0);return[e.memoizedState,t.dispatch]}function bg(n){var e=Ni(),t=e.queue;if(t===null)throw Error(ge(311));t.lastRenderedReducer=n;var i=t.dispatch,r=t.pending,s=e.memoizedState;if(r!==null){t.pending=null;var o=r=r.next;do s=n(s,o.action),o=o.next;while(o!==r);rr(s,e.memoizedState)||(oi=!0),e.memoizedState=s,e.baseQueue===null&&(e.baseState=s),t.lastRenderedState=s}return[s,i]}function F1(){}function U1(n,e){var t=qt,i=Ni(),r=e(),s=!rr(i.memoizedState,r);if(s&&(i.memoizedState=r,oi=!0),i=i.queue,Ag(H1.bind(null,t,i,n),[n]),i.getSnapshot!==e||s||yn!==null&&yn.memoizedState.tag&1){if(t.flags|=2048,ku(9,V1.bind(null,t,i,r,e),void 0,null),xn===null)throw Error(ge(349));(Io&30)!==0||B1(t,e,r)}return r}function B1(n,e,t){n.flags|=16384,n={getSnapshot:e,value:t},e=qt.updateQueue,e===null?(e={lastEffect:null,stores:null},qt.updateQueue=e,e.stores=[n]):(t=e.stores,t===null?e.stores=[n]:t.push(n))}function V1(n,e,t,i){e.value=t,e.getSnapshot=i,W1(e)&&G1(n)}function H1(n,e,t){return t(function(){W1(e)&&G1(n)})}function W1(n){var e=n.getSnapshot;n=n.value;try{var t=e();return!rr(n,t)}catch{return!0}}function G1(n){var e=qr(n,1);e!==null&&ur(e,n,1,-1)}function X1(n){var e=Er();return typeof n=="function"&&(n=n()),e.memoizedState=e.baseState=n,n={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Nu,lastRenderedState:n},e.queue=n,n=n.dispatch=yA.bind(null,qt,n),[e.memoizedState,n]}function ku(n,e,t,i){return n={tag:n,create:e,destroy:t,deps:i,next:null},e=qt.updateQueue,e===null?(e={lastEffect:null,stores:null},qt.updateQueue=e,e.lastEffect=n.next=n):(t=e.lastEffect,t===null?e.lastEffect=n.next=n:(i=t.next,t.next=n,n.next=i,e.lastEffect=n)),n}function j1(){return Ni().memoizedState}function $f(n,e,t,i){var r=Er();qt.flags|=n,r.memoizedState=ku(1|e,t,void 0,i===void 0?null:i)}function ed(n,e,t,i){var r=Ni();i=i===void 0?null:i;var s=void 0;if(pn!==null){var o=pn.memoizedState;if(s=o.destroy,i!==null&&Sg(i,o.deps)){r.memoizedState=ku(e,t,s,i);return}}qt.flags|=n,r.memoizedState=ku(1|e,t,s,i)}function Y1(n,e){return $f(8390656,8,n,e)}function Ag(n,e){return ed(2048,8,n,e)}function q1(n,e){return ed(4,2,n,e)}function Z1(n,e){return ed(4,4,n,e)}function J1(n,e){if(typeof e=="function")return n=n(),e(n),function(){e(null)};if(e!=null)return n=n(),e.current=n,function(){e.current=null}}function Q1(n,e,t){return t=t!=null?t.concat([n]):null,ed(4,4,J1.bind(null,e,n),t)}function Cg(){}function K1(n,e){var t=Ni();e=e===void 0?null:e;var i=t.memoizedState;return i!==null&&e!==null&&Sg(e,i[1])?i[0]:(t.memoizedState=[n,e],n)}function $1(n,e){var t=Ni();e=e===void 0?null:e;var i=t.memoizedState;return i!==null&&e!==null&&Sg(e,i[1])?i[0]:(n=n(),t.memoizedState=[n,e],n)}function ew(n,e,t){return(Io&21)===0?(n.baseState&&(n.baseState=!1,oi=!0),n.memoizedState=t):(rr(t,e)||(t=b_(),qt.lanes|=t,Do|=t,n.baseState=!0),e)}function gA(n,e){var t=Lt;Lt=t!==0&&4>t?t:4,n(!0);var i=wg.transition;wg.transition={};try{n(!1),e()}finally{Lt=t,wg.transition=i}}function tw(){return Ni().memoizedState}function vA(n,e,t){var i=Bs(n);if(t={lane:i,action:t,hasEagerState:!1,eagerState:null,next:null},nw(n))iw(e,t);else if(t=b1(n,e,t,i),t!==null){var r=qn();ur(t,n,i,r),rw(t,e,i)}}function yA(n,e,t){var i=Bs(n),r={lane:i,action:t,hasEagerState:!1,eagerState:null,next:null};if(nw(n))iw(e,r);else{var s=n.alternate;if(n.lanes===0&&(s===null||s.lanes===0)&&(s=e.lastRenderedReducer,s!==null))try{var o=e.lastRenderedState,l=s(o,t);if(r.hasEagerState=!0,r.eagerState=l,rr(l,o)){var c=e.interleaved;c===null?(r.next=r,hg(e)):(r.next=c.next,c.next=r),e.interleaved=r;return}}catch{}finally{}t=b1(n,e,r,i),t!==null&&(r=qn(),ur(t,n,i,r),rw(t,e,i))}}function nw(n){var e=n.alternate;return n===qt||e!==null&&e===qt}function iw(n,e){Du=Kf=!0;var t=n.pending;t===null?e.next=e:(e.next=t.next,t.next=e),n.pending=e}function rw(n,e,t){if((t&4194240)!==0){var i=e.lanes;i&=n.pendingLanes,t|=i,e.lanes=t,Cm(n,t)}}var td={readContext:zi,useCallback:zn,useContext:zn,useEffect:zn,useImperativeHandle:zn,useInsertionEffect:zn,useLayoutEffect:zn,useMemo:zn,useReducer:zn,useRef:zn,useState:zn,useDebugValue:zn,useDeferredValue:zn,useTransition:zn,useMutableSource:zn,useSyncExternalStore:zn,useId:zn,unstable_isNewReconciler:!1},xA={readContext:zi,useCallback:function(n,e){return Er().memoizedState=[n,e===void 0?null:e],n},useContext:zi,useEffect:Y1,useImperativeHandle:function(n,e,t){return t=t!=null?t.concat([n]):null,$f(4194308,4,J1.bind(null,e,n),t)},useLayoutEffect:function(n,e){return $f(4194308,4,n,e)},useInsertionEffect:function(n,e){return $f(4,2,n,e)},useMemo:function(n,e){var t=Er();return e=e===void 0?null:e,n=n(),t.memoizedState=[n,e],n},useReducer:function(n,e,t){var i=Er();return e=t!==void 0?t(e):e,i.memoizedState=i.baseState=e,n={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:n,lastRenderedState:e},i.queue=n,n=n.dispatch=vA.bind(null,qt,n),[i.memoizedState,n]},useRef:function(n){var e=Er();return n={current:n},e.memoizedState=n},useState:X1,useDebugValue:Cg,useDeferredValue:function(n){return Er().memoizedState=n},useTransition:function(){var n=X1(!1),e=n[0];return n=gA.bind(null,n[1]),Er().memoizedState=n,[e,n]},useMutableSource:function(){},useSyncExternalStore:function(n,e,t){var i=qt,r=Er();if(Ut){if(t===void 0)throw Error(ge(407));t=t()}else{if(t=e(),xn===null)throw Error(ge(349));(Io&30)!==0||B1(i,e,t)}r.memoizedState=t;var s={value:t,getSnapshot:e};return r.queue=s,Y1(H1.bind(null,i,s,n),[n]),i.flags|=2048,ku(9,V1.bind(null,i,s,t,e),void 0,null),t},useId:function(){var n=Er(),e=xn.identifierPrefix;if(Ut){var t=Yr,i=jr;t=(i&~(1<<32-ir(i)-1)).toString(32)+t,e=":"+e+"R"+t,t=zu++,0<t&&(e+="H"+t.toString(32)),e+=":"}else t=mA++,e=":"+e+"r"+t.toString(32)+":";return n.memoizedState=e},unstable_isNewReconciler:!1},_A={readContext:zi,useCallback:K1,useContext:zi,useEffect:Ag,useImperativeHandle:Q1,useInsertionEffect:q1,useLayoutEffect:Z1,useMemo:$1,useReducer:Tg,useRef:j1,useState:function(){return Tg(Nu)},useDebugValue:Cg,useDeferredValue:function(n){var e=Ni();return ew(e,pn.memoizedState,n)},useTransition:function(){var n=Tg(Nu)[0],e=Ni().memoizedState;return[n,e]},useMutableSource:F1,useSyncExternalStore:U1,useId:tw,unstable_isNewReconciler:!1},wA={readContext:zi,useCallback:K1,useContext:zi,useEffect:Ag,useImperativeHandle:Q1,useInsertionEffect:q1,useLayoutEffect:Z1,useMemo:$1,useReducer:bg,useRef:j1,useState:function(){return bg(Nu)},useDebugValue:Cg,useDeferredValue:function(n){var e=Ni();return pn===null?e.memoizedState=n:ew(e,pn.memoizedState,n)},useTransition:function(){var n=bg(Nu)[0],e=Ni().memoizedState;return[n,e]},useMutableSource:F1,useSyncExternalStore:U1,useId:tw,unstable_isNewReconciler:!1};function Qa(n,e){try{var t="",i=e;do t+=ZT(i),i=i.return;while(i);var r=t}catch(s){r=`
Error generating stack: `+s.message+`
`+s.stack}return{value:n,source:e,stack:r,digest:null}}function Pg(n,e,t){return{value:n,source:null,stack:t!=null?t:null,digest:e!=null?e:null}}function Lg(n,e){try{console.error(e.value)}catch(t){setTimeout(function(){throw t})}}var SA=typeof WeakMap=="function"?WeakMap:Map;function sw(n,e,t){t=Zr(-1,t),t.tag=3,t.payload={element:null};var i=e.value;return t.callback=function(){ld||(ld=!0,Xg=i),Lg(n,e)},t}function ow(n,e,t){t=Zr(-1,t),t.tag=3;var i=n.type.getDerivedStateFromError;if(typeof i=="function"){var r=e.value;t.payload=function(){return i(r)},t.callback=function(){Lg(n,e)}}var s=n.stateNode;return s!==null&&typeof s.componentDidCatch=="function"&&(t.callback=function(){Lg(n,e),typeof i!="function"&&(Fs===null?Fs=new Set([this]):Fs.add(this));var o=e.stack;this.componentDidCatch(e.value,{componentStack:o!==null?o:""})}),t}function aw(n,e,t){var i=n.pingCache;if(i===null){i=n.pingCache=new SA;var r=new Set;i.set(e,r)}else r=i.get(e),r===void 0&&(r=new Set,i.set(e,r));r.has(t)||(r.add(t),n=kA.bind(null,n,e,t),e.then(n,n))}function lw(n){do{var e;if((e=n.tag===13)&&(e=n.memoizedState,e=e!==null?e.dehydrated!==null:!0),e)return n;n=n.return}while(n!==null);return null}function uw(n,e,t,i,r){return(n.mode&1)===0?(n===e?n.flags|=65536:(n.flags|=128,t.flags|=131072,t.flags&=-52805,t.tag===1&&(t.alternate===null?t.tag=17:(e=Zr(-1,1),e.tag=2,ks(t,e,1))),t.lanes|=1),n):(n.flags|=65536,n.lanes=r,n)}var MA=Wr.ReactCurrentOwner,oi=!1;function Yn(n,e,t,i){e.child=n===null?k1(e,null,t,i):Za(e,n.child,t,i)}function cw(n,e,t,i,r){t=t.render;var s=e.ref;return qa(e,r),i=Mg(n,e,t,i,s,r),t=Eg(),n!==null&&!oi?(e.updateQueue=n.updateQueue,e.flags&=-2053,n.lanes&=~r,Jr(n,e,r)):(Ut&&t&&rg(e),e.flags|=1,Yn(n,e,i,r),e.child)}function fw(n,e,t,i,r){if(n===null){var s=t.type;return typeof s=="function"&&!Kg(s)&&s.defaultProps===void 0&&t.compare===null&&t.defaultProps===void 0?(e.tag=15,e.type=s,dw(n,e,s,i,r)):(n=pd(t.type,null,i,e,e.mode,r),n.ref=e.ref,n.return=e,e.child=n)}if(s=n.child,(n.lanes&r)===0){var o=s.memoizedProps;if(t=t.compare,t=t!==null?t:Su,t(o,i)&&n.ref===e.ref)return Jr(n,e,r)}return e.flags|=1,n=Hs(s,i),n.ref=e.ref,n.return=e,e.child=n}function dw(n,e,t,i,r){if(n!==null){var s=n.memoizedProps;if(Su(s,i)&&n.ref===e.ref)if(oi=!1,e.pendingProps=i=s,(n.lanes&r)!==0)(n.flags&131072)!==0&&(oi=!0);else return e.lanes=n.lanes,Jr(n,e,r)}return Rg(n,e,t,i,r)}function hw(n,e,t){var i=e.pendingProps,r=i.children,s=n!==null?n.memoizedState:null;if(i.mode==="hidden")if((e.mode&1)===0)e.memoizedState={baseLanes:0,cachePool:null,transitions:null},Nt($a,wi),wi|=t;else{if((t&1073741824)===0)return n=s!==null?s.baseLanes|t:t,e.lanes=e.childLanes=1073741824,e.memoizedState={baseLanes:n,cachePool:null,transitions:null},e.updateQueue=null,Nt($a,wi),wi|=n,null;e.memoizedState={baseLanes:0,cachePool:null,transitions:null},i=s!==null?s.baseLanes:t,Nt($a,wi),wi|=i}else s!==null?(i=s.baseLanes|t,e.memoizedState=null):i=t,Nt($a,wi),wi|=i;return Yn(n,e,r,t),e.child}function pw(n,e){var t=e.ref;(n===null&&t!==null||n!==null&&n.ref!==t)&&(e.flags|=512,e.flags|=2097152)}function Rg(n,e,t,i,r){var s=si(t)?Ao:Dn.current;return s=Wa(e,s),qa(e,r),t=Mg(n,e,t,i,s,r),i=Eg(),n!==null&&!oi?(e.updateQueue=n.updateQueue,e.flags&=-2053,n.lanes&=~r,Jr(n,e,r)):(Ut&&i&&rg(e),e.flags|=1,Yn(n,e,t,r),e.child)}function mw(n,e,t,i,r){if(si(t)){var s=!0;Uf(e)}else s=!1;if(qa(e,r),e.stateNode===null)id(n,e),I1(e,t,i),gg(e,t,i,r),i=!0;else if(n===null){var o=e.stateNode,l=e.memoizedProps;o.props=l;var c=o.context,f=t.contextType;typeof f=="object"&&f!==null?f=zi(f):(f=si(t)?Ao:Dn.current,f=Wa(e,f));var d=t.getDerivedStateFromProps,h=typeof d=="function"||typeof o.getSnapshotBeforeUpdate=="function";h||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(l!==i||c!==f)&&D1(e,o,i,f),Ns=!1;var m=e.memoizedState;o.state=m,Yf(e,i,o,r),c=e.memoizedState,l!==i||m!==c||ri.current||Ns?(typeof d=="function"&&(mg(e,t,d,i),c=e.memoizedState),(l=Ns||R1(e,t,l,i,m,c,f))?(h||typeof o.UNSAFE_componentWillMount!="function"&&typeof o.componentWillMount!="function"||(typeof o.componentWillMount=="function"&&o.componentWillMount(),typeof o.UNSAFE_componentWillMount=="function"&&o.UNSAFE_componentWillMount()),typeof o.componentDidMount=="function"&&(e.flags|=4194308)):(typeof o.componentDidMount=="function"&&(e.flags|=4194308),e.memoizedProps=i,e.memoizedState=c),o.props=i,o.state=c,o.context=f,i=l):(typeof o.componentDidMount=="function"&&(e.flags|=4194308),i=!1)}else{o=e.stateNode,A1(n,e),l=e.memoizedProps,f=e.type===e.elementType?l:or(e.type,l),o.props=f,h=e.pendingProps,m=o.context,c=t.contextType,typeof c=="object"&&c!==null?c=zi(c):(c=si(t)?Ao:Dn.current,c=Wa(e,c));var g=t.getDerivedStateFromProps;(d=typeof g=="function"||typeof o.getSnapshotBeforeUpdate=="function")||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(l!==h||m!==c)&&D1(e,o,i,c),Ns=!1,m=e.memoizedState,o.state=m,Yf(e,i,o,r);var x=e.memoizedState;l!==h||m!==x||ri.current||Ns?(typeof g=="function"&&(mg(e,t,g,i),x=e.memoizedState),(f=Ns||R1(e,t,f,i,m,x,c)||!1)?(d||typeof o.UNSAFE_componentWillUpdate!="function"&&typeof o.componentWillUpdate!="function"||(typeof o.componentWillUpdate=="function"&&o.componentWillUpdate(i,x,c),typeof o.UNSAFE_componentWillUpdate=="function"&&o.UNSAFE_componentWillUpdate(i,x,c)),typeof o.componentDidUpdate=="function"&&(e.flags|=4),typeof o.getSnapshotBeforeUpdate=="function"&&(e.flags|=1024)):(typeof o.componentDidUpdate!="function"||l===n.memoizedProps&&m===n.memoizedState||(e.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||l===n.memoizedProps&&m===n.memoizedState||(e.flags|=1024),e.memoizedProps=i,e.memoizedState=x),o.props=i,o.state=x,o.context=c,i=f):(typeof o.componentDidUpdate!="function"||l===n.memoizedProps&&m===n.memoizedState||(e.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||l===n.memoizedProps&&m===n.memoizedState||(e.flags|=1024),i=!1)}return Ig(n,e,t,i,s,r)}function Ig(n,e,t,i,r,s){pw(n,e);var o=(e.flags&128)!==0;if(!i&&!o)return r&&x1(e,t,!1),Jr(n,e,s);i=e.stateNode,MA.current=e;var l=o&&typeof t.getDerivedStateFromError!="function"?null:i.render();return e.flags|=1,n!==null&&o?(e.child=Za(e,n.child,null,s),e.child=Za(e,null,l,s)):Yn(n,e,l,s),e.memoizedState=i.state,r&&x1(e,t,!0),e.child}function gw(n){var e=n.stateNode;e.pendingContext?v1(n,e.pendingContext,e.pendingContext!==e.context):e.context&&v1(n,e.context,!1),vg(n,e.containerInfo)}function vw(n,e,t,i,r){return ja(),lg(r),e.flags|=256,Yn(n,e,t,i),e.child}var Dg={dehydrated:null,treeContext:null,retryLane:0};function zg(n){return{baseLanes:n,cachePool:null,transitions:null}}function yw(n,e,t){var i=e.pendingProps,r=Yt.current,s=!1,o=(e.flags&128)!==0,l;if((l=o)||(l=n!==null&&n.memoizedState===null?!1:(r&2)!==0),l?(s=!0,e.flags&=-129):(n===null||n.memoizedState!==null)&&(r|=1),Nt(Yt,r&1),n===null)return ag(e),n=e.memoizedState,n!==null&&(n=n.dehydrated,n!==null)?((e.mode&1)===0?e.lanes=1:n.data==="$!"?e.lanes=8:e.lanes=1073741824,null):(o=i.children,n=i.fallback,s?(i=e.mode,s=e.child,o={mode:"hidden",children:o},(i&1)===0&&s!==null?(s.childLanes=0,s.pendingProps=o):s=md(o,i,0,null),n=Oo(n,i,t,null),s.return=e,n.return=e,s.sibling=n,e.child=s,e.child.memoizedState=zg(t),e.memoizedState=Dg,n):Ng(e,o));if(r=n.memoizedState,r!==null&&(l=r.dehydrated,l!==null))return EA(n,e,o,i,l,r,t);if(s){s=i.fallback,o=e.mode,r=n.child,l=r.sibling;var c={mode:"hidden",children:i.children};return(o&1)===0&&e.child!==r?(i=e.child,i.childLanes=0,i.pendingProps=c,e.deletions=null):(i=Hs(r,c),i.subtreeFlags=r.subtreeFlags&14680064),l!==null?s=Hs(l,s):(s=Oo(s,o,t,null),s.flags|=2),s.return=e,i.return=e,i.sibling=s,e.child=i,i=s,s=e.child,o=n.child.memoizedState,o=o===null?zg(t):{baseLanes:o.baseLanes|t,cachePool:null,transitions:o.transitions},s.memoizedState=o,s.childLanes=n.childLanes&~t,e.memoizedState=Dg,i}return s=n.child,n=s.sibling,i=Hs(s,{mode:"visible",children:i.children}),(e.mode&1)===0&&(i.lanes=t),i.return=e,i.sibling=null,n!==null&&(t=e.deletions,t===null?(e.deletions=[n],e.flags|=16):t.push(n)),e.child=i,e.memoizedState=null,i}function Ng(n,e){return e=md({mode:"visible",children:e},n.mode,0,null),e.return=n,n.child=e}function nd(n,e,t,i){return i!==null&&lg(i),Za(e,n.child,null,t),n=Ng(e,e.pendingProps.children),n.flags|=2,e.memoizedState=null,n}function EA(n,e,t,i,r,s,o){if(t)return e.flags&256?(e.flags&=-257,i=Pg(Error(ge(422))),nd(n,e,o,i)):e.memoizedState!==null?(e.child=n.child,e.flags|=128,null):(s=i.fallback,r=e.mode,i=md({mode:"visible",children:i.children},r,0,null),s=Oo(s,r,o,null),s.flags|=2,i.return=e,s.return=e,i.sibling=s,e.child=i,(e.mode&1)!==0&&Za(e,n.child,null,o),e.child.memoizedState=zg(o),e.memoizedState=Dg,s);if((e.mode&1)===0)return nd(n,e,o,null);if(r.data==="$!"){if(i=r.nextSibling&&r.nextSibling.dataset,i)var l=i.dgst;return i=l,s=Error(ge(419)),i=Pg(s,i,void 0),nd(n,e,o,i)}if(l=(o&n.childLanes)!==0,oi||l){if(i=xn,i!==null){switch(o&-o){case 4:r=2;break;case 16:r=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:r=32;break;case 536870912:r=268435456;break;default:r=0}r=(r&(i.suspendedLanes|o))!==0?0:r,r!==0&&r!==s.retryLane&&(s.retryLane=r,qr(n,r),ur(i,n,r,-1))}return Qg(),i=Pg(Error(ge(421))),nd(n,e,o,i)}return r.data==="$?"?(e.flags|=128,e.child=n.child,e=OA.bind(null,n),r._reactRetry=e,null):(n=s.treeContext,_i=Rs(r.nextSibling),xi=e,Ut=!0,sr=null,n!==null&&(Ii[Di++]=jr,Ii[Di++]=Yr,Ii[Di++]=Co,jr=n.id,Yr=n.overflow,Co=e),e=Ng(e,i.children),e.flags|=4096,e)}function xw(n,e,t){n.lanes|=e;var i=n.alternate;i!==null&&(i.lanes|=e),dg(n.return,e,t)}function kg(n,e,t,i,r){var s=n.memoizedState;s===null?n.memoizedState={isBackwards:e,rendering:null,renderingStartTime:0,last:i,tail:t,tailMode:r}:(s.isBackwards=e,s.rendering=null,s.renderingStartTime=0,s.last=i,s.tail=t,s.tailMode=r)}function _w(n,e,t){var i=e.pendingProps,r=i.revealOrder,s=i.tail;if(Yn(n,e,i.children,t),i=Yt.current,(i&2)!==0)i=i&1|2,e.flags|=128;else{if(n!==null&&(n.flags&128)!==0)e:for(n=e.child;n!==null;){if(n.tag===13)n.memoizedState!==null&&xw(n,t,e);else if(n.tag===19)xw(n,t,e);else if(n.child!==null){n.child.return=n,n=n.child;continue}if(n===e)break e;for(;n.sibling===null;){if(n.return===null||n.return===e)break e;n=n.return}n.sibling.return=n.return,n=n.sibling}i&=1}if(Nt(Yt,i),(e.mode&1)===0)e.memoizedState=null;else switch(r){case"forwards":for(t=e.child,r=null;t!==null;)n=t.alternate,n!==null&&Jf(n)===null&&(r=t),t=t.sibling;t=r,t===null?(r=e.child,e.child=null):(r=t.sibling,t.sibling=null),kg(e,!1,r,t,s);break;case"backwards":for(t=null,r=e.child,e.child=null;r!==null;){if(n=r.alternate,n!==null&&Jf(n)===null){e.child=r;break}n=r.sibling,r.sibling=t,t=r,r=n}kg(e,!0,t,null,s);break;case"together":kg(e,!1,null,null,void 0);break;default:e.memoizedState=null}return e.child}function id(n,e){(e.mode&1)===0&&n!==null&&(n.alternate=null,e.alternate=null,e.flags|=2)}function Jr(n,e,t){if(n!==null&&(e.dependencies=n.dependencies),Do|=e.lanes,(t&e.childLanes)===0)return null;if(n!==null&&e.child!==n.child)throw Error(ge(153));if(e.child!==null){for(n=e.child,t=Hs(n,n.pendingProps),e.child=t,t.return=e;n.sibling!==null;)n=n.sibling,t=t.sibling=Hs(n,n.pendingProps),t.return=e;t.sibling=null}return e.child}function TA(n,e,t){switch(e.tag){case 3:gw(e),ja();break;case 5:O1(e);break;case 1:si(e.type)&&Uf(e);break;case 4:vg(e,e.stateNode.containerInfo);break;case 10:var i=e.type._context,r=e.memoizedProps.value;Nt(Gf,i._currentValue),i._currentValue=r;break;case 13:if(i=e.memoizedState,i!==null)return i.dehydrated!==null?(Nt(Yt,Yt.current&1),e.flags|=128,null):(t&e.child.childLanes)!==0?yw(n,e,t):(Nt(Yt,Yt.current&1),n=Jr(n,e,t),n!==null?n.sibling:null);Nt(Yt,Yt.current&1);break;case 19:if(i=(t&e.childLanes)!==0,(n.flags&128)!==0){if(i)return _w(n,e,t);e.flags|=128}if(r=e.memoizedState,r!==null&&(r.rendering=null,r.tail=null,r.lastEffect=null),Nt(Yt,Yt.current),i)break;return null;case 22:case 23:return e.lanes=0,hw(n,e,t)}return Jr(n,e,t)}var ww,Og,Sw,Mw;ww=function(n,e){for(var t=e.child;t!==null;){if(t.tag===5||t.tag===6)n.appendChild(t.stateNode);else if(t.tag!==4&&t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return;t=t.return}t.sibling.return=t.return,t=t.sibling}},Og=function(){},Sw=function(n,e,t,i){var r=n.memoizedProps;if(r!==i){n=e.stateNode,Ro(Mr.current);var s=null;switch(t){case"input":r=dm(n,r),i=dm(n,i),s=[];break;case"select":r=jt({},r,{value:void 0}),i=jt({},i,{value:void 0}),s=[];break;case"textarea":r=mm(n,r),i=mm(n,i),s=[];break;default:typeof r.onClick!="function"&&typeof i.onClick=="function"&&(n.onclick=kf)}vm(t,i);var o;t=null;for(f in r)if(!i.hasOwnProperty(f)&&r.hasOwnProperty(f)&&r[f]!=null)if(f==="style"){var l=r[f];for(o in l)l.hasOwnProperty(o)&&(t||(t={}),t[o]="")}else f!=="dangerouslySetInnerHTML"&&f!=="children"&&f!=="suppressContentEditableWarning"&&f!=="suppressHydrationWarning"&&f!=="autoFocus"&&(tu.hasOwnProperty(f)?s||(s=[]):(s=s||[]).push(f,null));for(f in i){var c=i[f];if(l=r!=null?r[f]:void 0,i.hasOwnProperty(f)&&c!==l&&(c!=null||l!=null))if(f==="style")if(l){for(o in l)!l.hasOwnProperty(o)||c&&c.hasOwnProperty(o)||(t||(t={}),t[o]="");for(o in c)c.hasOwnProperty(o)&&l[o]!==c[o]&&(t||(t={}),t[o]=c[o])}else t||(s||(s=[]),s.push(f,t)),t=c;else f==="dangerouslySetInnerHTML"?(c=c?c.__html:void 0,l=l?l.__html:void 0,c!=null&&l!==c&&(s=s||[]).push(f,c)):f==="children"?typeof c!="string"&&typeof c!="number"||(s=s||[]).push(f,""+c):f!=="suppressContentEditableWarning"&&f!=="suppressHydrationWarning"&&(tu.hasOwnProperty(f)?(c!=null&&f==="onScroll"&&kt("scroll",n),s||l===c||(s=[])):(s=s||[]).push(f,c))}t&&(s=s||[]).push("style",t);var f=s;(e.updateQueue=f)&&(e.flags|=4)}},Mw=function(n,e,t,i){t!==i&&(e.flags|=4)};function Ou(n,e){if(!Ut)switch(n.tailMode){case"hidden":e=n.tail;for(var t=null;e!==null;)e.alternate!==null&&(t=e),e=e.sibling;t===null?n.tail=null:t.sibling=null;break;case"collapsed":t=n.tail;for(var i=null;t!==null;)t.alternate!==null&&(i=t),t=t.sibling;i===null?e||n.tail===null?n.tail=null:n.tail.sibling=null:i.sibling=null}}function Nn(n){var e=n.alternate!==null&&n.alternate.child===n.child,t=0,i=0;if(e)for(var r=n.child;r!==null;)t|=r.lanes|r.childLanes,i|=r.subtreeFlags&14680064,i|=r.flags&14680064,r.return=n,r=r.sibling;else for(r=n.child;r!==null;)t|=r.lanes|r.childLanes,i|=r.subtreeFlags,i|=r.flags,r.return=n,r=r.sibling;return n.subtreeFlags|=i,n.childLanes=t,e}function bA(n,e,t){var i=e.pendingProps;switch(sg(e),e.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Nn(e),null;case 1:return si(e.type)&&Ff(),Nn(e),null;case 3:return i=e.stateNode,Ja(),Ot(ri),Ot(Dn),_g(),i.pendingContext&&(i.context=i.pendingContext,i.pendingContext=null),(n===null||n.child===null)&&(Wf(e)?e.flags|=4:n===null||n.memoizedState.isDehydrated&&(e.flags&256)===0||(e.flags|=1024,sr!==null&&(qg(sr),sr=null))),Og(n,e),Nn(e),null;case 5:yg(e);var r=Ro(Iu.current);if(t=e.type,n!==null&&e.stateNode!=null)Sw(n,e,t,i,r),n.ref!==e.ref&&(e.flags|=512,e.flags|=2097152);else{if(!i){if(e.stateNode===null)throw Error(ge(166));return Nn(e),null}if(n=Ro(Mr.current),Wf(e)){i=e.stateNode,t=e.type;var s=e.memoizedProps;switch(i[Sr]=e,i[Au]=s,n=(e.mode&1)!==0,t){case"dialog":kt("cancel",i),kt("close",i);break;case"iframe":case"object":case"embed":kt("load",i);break;case"video":case"audio":for(r=0;r<Eu.length;r++)kt(Eu[r],i);break;case"source":kt("error",i);break;case"img":case"image":case"link":kt("error",i),kt("load",i);break;case"details":kt("toggle",i);break;case"input":n_(i,s),kt("invalid",i);break;case"select":i._wrapperState={wasMultiple:!!s.multiple},kt("invalid",i);break;case"textarea":s_(i,s),kt("invalid",i)}vm(t,s),r=null;for(var o in s)if(s.hasOwnProperty(o)){var l=s[o];o==="children"?typeof l=="string"?i.textContent!==l&&(s.suppressHydrationWarning!==!0&&Nf(i.textContent,l,n),r=["children",l]):typeof l=="number"&&i.textContent!==""+l&&(s.suppressHydrationWarning!==!0&&Nf(i.textContent,l,n),r=["children",""+l]):tu.hasOwnProperty(o)&&l!=null&&o==="onScroll"&&kt("scroll",i)}switch(t){case"input":df(i),r_(i,s,!0);break;case"textarea":df(i),a_(i);break;case"select":case"option":break;default:typeof s.onClick=="function"&&(i.onclick=kf)}i=r,e.updateQueue=i,i!==null&&(e.flags|=4)}else{o=r.nodeType===9?r:r.ownerDocument,n==="http://www.w3.org/1999/xhtml"&&(n=l_(t)),n==="http://www.w3.org/1999/xhtml"?t==="script"?(n=o.createElement("div"),n.innerHTML="<script><\/script>",n=n.removeChild(n.firstChild)):typeof i.is=="string"?n=o.createElement(t,{is:i.is}):(n=o.createElement(t),t==="select"&&(o=n,i.multiple?o.multiple=!0:i.size&&(o.size=i.size))):n=o.createElementNS(n,t),n[Sr]=e,n[Au]=i,ww(n,e,!1,!1),e.stateNode=n;e:{switch(o=ym(t,i),t){case"dialog":kt("cancel",n),kt("close",n),r=i;break;case"iframe":case"object":case"embed":kt("load",n),r=i;break;case"video":case"audio":for(r=0;r<Eu.length;r++)kt(Eu[r],n);r=i;break;case"source":kt("error",n),r=i;break;case"img":case"image":case"link":kt("error",n),kt("load",n),r=i;break;case"details":kt("toggle",n),r=i;break;case"input":n_(n,i),r=dm(n,i),kt("invalid",n);break;case"option":r=i;break;case"select":n._wrapperState={wasMultiple:!!i.multiple},r=jt({},i,{value:void 0}),kt("invalid",n);break;case"textarea":s_(n,i),r=mm(n,i),kt("invalid",n);break;default:r=i}vm(t,r),l=r;for(s in l)if(l.hasOwnProperty(s)){var c=l[s];s==="style"?f_(n,c):s==="dangerouslySetInnerHTML"?(c=c?c.__html:void 0,c!=null&&u_(n,c)):s==="children"?typeof c=="string"?(t!=="textarea"||c!=="")&&su(n,c):typeof c=="number"&&su(n,""+c):s!=="suppressContentEditableWarning"&&s!=="suppressHydrationWarning"&&s!=="autoFocus"&&(tu.hasOwnProperty(s)?c!=null&&s==="onScroll"&&kt("scroll",n):c!=null&&tm(n,s,c,o))}switch(t){case"input":df(n),r_(n,i,!1);break;case"textarea":df(n),a_(n);break;case"option":i.value!=null&&n.setAttribute("value",""+Es(i.value));break;case"select":n.multiple=!!i.multiple,s=i.value,s!=null?Ra(n,!!i.multiple,s,!1):i.defaultValue!=null&&Ra(n,!!i.multiple,i.defaultValue,!0);break;default:typeof r.onClick=="function"&&(n.onclick=kf)}switch(t){case"button":case"input":case"select":case"textarea":i=!!i.autoFocus;break e;case"img":i=!0;break e;default:i=!1}}i&&(e.flags|=4)}e.ref!==null&&(e.flags|=512,e.flags|=2097152)}return Nn(e),null;case 6:if(n&&e.stateNode!=null)Mw(n,e,n.memoizedProps,i);else{if(typeof i!="string"&&e.stateNode===null)throw Error(ge(166));if(t=Ro(Iu.current),Ro(Mr.current),Wf(e)){if(i=e.stateNode,t=e.memoizedProps,i[Sr]=e,(s=i.nodeValue!==t)&&(n=xi,n!==null))switch(n.tag){case 3:Nf(i.nodeValue,t,(n.mode&1)!==0);break;case 5:n.memoizedProps.suppressHydrationWarning!==!0&&Nf(i.nodeValue,t,(n.mode&1)!==0)}s&&(e.flags|=4)}else i=(t.nodeType===9?t:t.ownerDocument).createTextNode(i),i[Sr]=e,e.stateNode=i}return Nn(e),null;case 13:if(Ot(Yt),i=e.memoizedState,n===null||n.memoizedState!==null&&n.memoizedState.dehydrated!==null){if(Ut&&_i!==null&&(e.mode&1)!==0&&(e.flags&128)===0)T1(),ja(),e.flags|=98560,s=!1;else if(s=Wf(e),i!==null&&i.dehydrated!==null){if(n===null){if(!s)throw Error(ge(318));if(s=e.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(ge(317));s[Sr]=e}else ja(),(e.flags&128)===0&&(e.memoizedState=null),e.flags|=4;Nn(e),s=!1}else sr!==null&&(qg(sr),sr=null),s=!0;if(!s)return e.flags&65536?e:null}return(e.flags&128)!==0?(e.lanes=t,e):(i=i!==null,i!==(n!==null&&n.memoizedState!==null)&&i&&(e.child.flags|=8192,(e.mode&1)!==0&&(n===null||(Yt.current&1)!==0?mn===0&&(mn=3):Qg())),e.updateQueue!==null&&(e.flags|=4),Nn(e),null);case 4:return Ja(),Og(n,e),n===null&&Tu(e.stateNode.containerInfo),Nn(e),null;case 10:return fg(e.type._context),Nn(e),null;case 17:return si(e.type)&&Ff(),Nn(e),null;case 19:if(Ot(Yt),s=e.memoizedState,s===null)return Nn(e),null;if(i=(e.flags&128)!==0,o=s.rendering,o===null)if(i)Ou(s,!1);else{if(mn!==0||n!==null&&(n.flags&128)!==0)for(n=e.child;n!==null;){if(o=Jf(n),o!==null){for(e.flags|=128,Ou(s,!1),i=o.updateQueue,i!==null&&(e.updateQueue=i,e.flags|=4),e.subtreeFlags=0,i=t,t=e.child;t!==null;)s=t,n=i,s.flags&=14680066,o=s.alternate,o===null?(s.childLanes=0,s.lanes=n,s.child=null,s.subtreeFlags=0,s.memoizedProps=null,s.memoizedState=null,s.updateQueue=null,s.dependencies=null,s.stateNode=null):(s.childLanes=o.childLanes,s.lanes=o.lanes,s.child=o.child,s.subtreeFlags=0,s.deletions=null,s.memoizedProps=o.memoizedProps,s.memoizedState=o.memoizedState,s.updateQueue=o.updateQueue,s.type=o.type,n=o.dependencies,s.dependencies=n===null?null:{lanes:n.lanes,firstContext:n.firstContext}),t=t.sibling;return Nt(Yt,Yt.current&1|2),e.child}n=n.sibling}s.tail!==null&&en()>el&&(e.flags|=128,i=!0,Ou(s,!1),e.lanes=4194304)}else{if(!i)if(n=Jf(o),n!==null){if(e.flags|=128,i=!0,t=n.updateQueue,t!==null&&(e.updateQueue=t,e.flags|=4),Ou(s,!0),s.tail===null&&s.tailMode==="hidden"&&!o.alternate&&!Ut)return Nn(e),null}else 2*en()-s.renderingStartTime>el&&t!==1073741824&&(e.flags|=128,i=!0,Ou(s,!1),e.lanes=4194304);s.isBackwards?(o.sibling=e.child,e.child=o):(t=s.last,t!==null?t.sibling=o:e.child=o,s.last=o)}return s.tail!==null?(e=s.tail,s.rendering=e,s.tail=e.sibling,s.renderingStartTime=en(),e.sibling=null,t=Yt.current,Nt(Yt,i?t&1|2:t&1),e):(Nn(e),null);case 22:case 23:return Jg(),i=e.memoizedState!==null,n!==null&&n.memoizedState!==null!==i&&(e.flags|=8192),i&&(e.mode&1)!==0?(wi&1073741824)!==0&&(Nn(e),e.subtreeFlags&6&&(e.flags|=8192)):Nn(e),null;case 24:return null;case 25:return null}throw Error(ge(156,e.tag))}function AA(n,e){switch(sg(e),e.tag){case 1:return si(e.type)&&Ff(),n=e.flags,n&65536?(e.flags=n&-65537|128,e):null;case 3:return Ja(),Ot(ri),Ot(Dn),_g(),n=e.flags,(n&65536)!==0&&(n&128)===0?(e.flags=n&-65537|128,e):null;case 5:return yg(e),null;case 13:if(Ot(Yt),n=e.memoizedState,n!==null&&n.dehydrated!==null){if(e.alternate===null)throw Error(ge(340));ja()}return n=e.flags,n&65536?(e.flags=n&-65537|128,e):null;case 19:return Ot(Yt),null;case 4:return Ja(),null;case 10:return fg(e.type._context),null;case 22:case 23:return Jg(),null;case 24:return null;default:return null}}var rd=!1,kn=!1,CA=typeof WeakSet=="function"?WeakSet:Set,ze=null;function Ka(n,e){var t=n.ref;if(t!==null)if(typeof t=="function")try{t(null)}catch(i){Qt(n,e,i)}else t.current=null}function Fg(n,e,t){try{t()}catch(i){Qt(n,e,i)}}var Ew=!1;function PA(n,e){if(Jm=Ef,n=t1(),Hm(n)){if("selectionStart"in n)var t={start:n.selectionStart,end:n.selectionEnd};else e:{t=(t=n.ownerDocument)&&t.defaultView||window;var i=t.getSelection&&t.getSelection();if(i&&i.rangeCount!==0){t=i.anchorNode;var r=i.anchorOffset,s=i.focusNode;i=i.focusOffset;try{t.nodeType,s.nodeType}catch{t=null;break e}var o=0,l=-1,c=-1,f=0,d=0,h=n,m=null;t:for(;;){for(var g;h!==t||r!==0&&h.nodeType!==3||(l=o+r),h!==s||i!==0&&h.nodeType!==3||(c=o+i),h.nodeType===3&&(o+=h.nodeValue.length),(g=h.firstChild)!==null;)m=h,h=g;for(;;){if(h===n)break t;if(m===t&&++f===r&&(l=o),m===s&&++d===i&&(c=o),(g=h.nextSibling)!==null)break;h=m,m=h.parentNode}h=g}t=l===-1||c===-1?null:{start:l,end:c}}else t=null}t=t||{start:0,end:0}}else t=null;for(Qm={focusedElem:n,selectionRange:t},Ef=!1,ze=e;ze!==null;)if(e=ze,n=e.child,(e.subtreeFlags&1028)!==0&&n!==null)n.return=e,ze=n;else for(;ze!==null;){e=ze;try{var x=e.alternate;if((e.flags&1024)!==0)switch(e.tag){case 0:case 11:case 15:break;case 1:if(x!==null){var y=x.memoizedProps,w=x.memoizedState,_=e.stateNode,S=_.getSnapshotBeforeUpdate(e.elementType===e.type?y:or(e.type,y),w);_.__reactInternalSnapshotBeforeUpdate=S}break;case 3:var E=e.stateNode.containerInfo;E.nodeType===1?E.textContent="":E.nodeType===9&&E.documentElement&&E.removeChild(E.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(ge(163))}}catch(T){Qt(e,e.return,T)}if(n=e.sibling,n!==null){n.return=e.return,ze=n;break}ze=e.return}return x=Ew,Ew=!1,x}function Fu(n,e,t){var i=e.updateQueue;if(i=i!==null?i.lastEffect:null,i!==null){var r=i=i.next;do{if((r.tag&n)===n){var s=r.destroy;r.destroy=void 0,s!==void 0&&Fg(e,t,s)}r=r.next}while(r!==i)}}function sd(n,e){if(e=e.updateQueue,e=e!==null?e.lastEffect:null,e!==null){var t=e=e.next;do{if((t.tag&n)===n){var i=t.create;t.destroy=i()}t=t.next}while(t!==e)}}function Ug(n){var e=n.ref;if(e!==null){var t=n.stateNode;switch(n.tag){case 5:n=t;break;default:n=t}typeof e=="function"?e(n):e.current=n}}function Tw(n){var e=n.alternate;e!==null&&(n.alternate=null,Tw(e)),n.child=null,n.deletions=null,n.sibling=null,n.tag===5&&(e=n.stateNode,e!==null&&(delete e[Sr],delete e[Au],delete e[tg],delete e[fA],delete e[dA])),n.stateNode=null,n.return=null,n.dependencies=null,n.memoizedProps=null,n.memoizedState=null,n.pendingProps=null,n.stateNode=null,n.updateQueue=null}function bw(n){return n.tag===5||n.tag===3||n.tag===4}function Aw(n){e:for(;;){for(;n.sibling===null;){if(n.return===null||bw(n.return))return null;n=n.return}for(n.sibling.return=n.return,n=n.sibling;n.tag!==5&&n.tag!==6&&n.tag!==18;){if(n.flags&2||n.child===null||n.tag===4)continue e;n.child.return=n,n=n.child}if(!(n.flags&2))return n.stateNode}}function Bg(n,e,t){var i=n.tag;if(i===5||i===6)n=n.stateNode,e?t.nodeType===8?t.parentNode.insertBefore(n,e):t.insertBefore(n,e):(t.nodeType===8?(e=t.parentNode,e.insertBefore(n,t)):(e=t,e.appendChild(n)),t=t._reactRootContainer,t!=null||e.onclick!==null||(e.onclick=kf));else if(i!==4&&(n=n.child,n!==null))for(Bg(n,e,t),n=n.sibling;n!==null;)Bg(n,e,t),n=n.sibling}function Vg(n,e,t){var i=n.tag;if(i===5||i===6)n=n.stateNode,e?t.insertBefore(n,e):t.appendChild(n);else if(i!==4&&(n=n.child,n!==null))for(Vg(n,e,t),n=n.sibling;n!==null;)Vg(n,e,t),n=n.sibling}var An=null,ar=!1;function Os(n,e,t){for(t=t.child;t!==null;)Cw(n,e,t),t=t.sibling}function Cw(n,e,t){if(wr&&typeof wr.onCommitFiberUnmount=="function")try{wr.onCommitFiberUnmount(yf,t)}catch{}switch(t.tag){case 5:kn||Ka(t,e);case 6:var i=An,r=ar;An=null,Os(n,e,t),An=i,ar=r,An!==null&&(ar?(n=An,t=t.stateNode,n.nodeType===8?n.parentNode.removeChild(t):n.removeChild(t)):An.removeChild(t.stateNode));break;case 18:An!==null&&(ar?(n=An,t=t.stateNode,n.nodeType===8?eg(n.parentNode,t):n.nodeType===1&&eg(n,t),gu(n)):eg(An,t.stateNode));break;case 4:i=An,r=ar,An=t.stateNode.containerInfo,ar=!0,Os(n,e,t),An=i,ar=r;break;case 0:case 11:case 14:case 15:if(!kn&&(i=t.updateQueue,i!==null&&(i=i.lastEffect,i!==null))){r=i=i.next;do{var s=r,o=s.destroy;s=s.tag,o!==void 0&&((s&2)!==0||(s&4)!==0)&&Fg(t,e,o),r=r.next}while(r!==i)}Os(n,e,t);break;case 1:if(!kn&&(Ka(t,e),i=t.stateNode,typeof i.componentWillUnmount=="function"))try{i.props=t.memoizedProps,i.state=t.memoizedState,i.componentWillUnmount()}catch(l){Qt(t,e,l)}Os(n,e,t);break;case 21:Os(n,e,t);break;case 22:t.mode&1?(kn=(i=kn)||t.memoizedState!==null,Os(n,e,t),kn=i):Os(n,e,t);break;default:Os(n,e,t)}}function Pw(n){var e=n.updateQueue;if(e!==null){n.updateQueue=null;var t=n.stateNode;t===null&&(t=n.stateNode=new CA),e.forEach(function(i){var r=FA.bind(null,n,i);t.has(i)||(t.add(i),i.then(r,r))})}}function lr(n,e){var t=e.deletions;if(t!==null)for(var i=0;i<t.length;i++){var r=t[i];try{var s=n,o=e,l=o;e:for(;l!==null;){switch(l.tag){case 5:An=l.stateNode,ar=!1;break e;case 3:An=l.stateNode.containerInfo,ar=!0;break e;case 4:An=l.stateNode.containerInfo,ar=!0;break e}l=l.return}if(An===null)throw Error(ge(160));Cw(s,o,r),An=null,ar=!1;var c=r.alternate;c!==null&&(c.return=null),r.return=null}catch(f){Qt(r,e,f)}}if(e.subtreeFlags&12854)for(e=e.child;e!==null;)Lw(e,n),e=e.sibling}function Lw(n,e){var t=n.alternate,i=n.flags;switch(n.tag){case 0:case 11:case 14:case 15:if(lr(e,n),Tr(n),i&4){try{Fu(3,n,n.return),sd(3,n)}catch(y){Qt(n,n.return,y)}try{Fu(5,n,n.return)}catch(y){Qt(n,n.return,y)}}break;case 1:lr(e,n),Tr(n),i&512&&t!==null&&Ka(t,t.return);break;case 5:if(lr(e,n),Tr(n),i&512&&t!==null&&Ka(t,t.return),n.flags&32){var r=n.stateNode;try{su(r,"")}catch(y){Qt(n,n.return,y)}}if(i&4&&(r=n.stateNode,r!=null)){var s=n.memoizedProps,o=t!==null?t.memoizedProps:s,l=n.type,c=n.updateQueue;if(n.updateQueue=null,c!==null)try{l==="input"&&s.type==="radio"&&s.name!=null&&i_(r,s),ym(l,o);var f=ym(l,s);for(o=0;o<c.length;o+=2){var d=c[o],h=c[o+1];d==="style"?f_(r,h):d==="dangerouslySetInnerHTML"?u_(r,h):d==="children"?su(r,h):tm(r,d,h,f)}switch(l){case"input":hm(r,s);break;case"textarea":o_(r,s);break;case"select":var m=r._wrapperState.wasMultiple;r._wrapperState.wasMultiple=!!s.multiple;var g=s.value;g!=null?Ra(r,!!s.multiple,g,!1):m!==!!s.multiple&&(s.defaultValue!=null?Ra(r,!!s.multiple,s.defaultValue,!0):Ra(r,!!s.multiple,s.multiple?[]:"",!1))}r[Au]=s}catch(y){Qt(n,n.return,y)}}break;case 6:if(lr(e,n),Tr(n),i&4){if(n.stateNode===null)throw Error(ge(162));r=n.stateNode,s=n.memoizedProps;try{r.nodeValue=s}catch(y){Qt(n,n.return,y)}}break;case 3:if(lr(e,n),Tr(n),i&4&&t!==null&&t.memoizedState.isDehydrated)try{gu(e.containerInfo)}catch(y){Qt(n,n.return,y)}break;case 4:lr(e,n),Tr(n);break;case 13:lr(e,n),Tr(n),r=n.child,r.flags&8192&&(s=r.memoizedState!==null,r.stateNode.isHidden=s,!s||r.alternate!==null&&r.alternate.memoizedState!==null||(Gg=en())),i&4&&Pw(n);break;case 22:if(d=t!==null&&t.memoizedState!==null,n.mode&1?(kn=(f=kn)||d,lr(e,n),kn=f):lr(e,n),Tr(n),i&8192){if(f=n.memoizedState!==null,(n.stateNode.isHidden=f)&&!d&&(n.mode&1)!==0)for(ze=n,d=n.child;d!==null;){for(h=ze=d;ze!==null;){switch(m=ze,g=m.child,m.tag){case 0:case 11:case 14:case 15:Fu(4,m,m.return);break;case 1:Ka(m,m.return);var x=m.stateNode;if(typeof x.componentWillUnmount=="function"){i=m,t=m.return;try{e=i,x.props=e.memoizedProps,x.state=e.memoizedState,x.componentWillUnmount()}catch(y){Qt(i,t,y)}}break;case 5:Ka(m,m.return);break;case 22:if(m.memoizedState!==null){Dw(h);continue}}g!==null?(g.return=m,ze=g):Dw(h)}d=d.sibling}e:for(d=null,h=n;;){if(h.tag===5){if(d===null){d=h;try{r=h.stateNode,f?(s=r.style,typeof s.setProperty=="function"?s.setProperty("display","none","important"):s.display="none"):(l=h.stateNode,c=h.memoizedProps.style,o=c!=null&&c.hasOwnProperty("display")?c.display:null,l.style.display=c_("display",o))}catch(y){Qt(n,n.return,y)}}}else if(h.tag===6){if(d===null)try{h.stateNode.nodeValue=f?"":h.memoizedProps}catch(y){Qt(n,n.return,y)}}else if((h.tag!==22&&h.tag!==23||h.memoizedState===null||h===n)&&h.child!==null){h.child.return=h,h=h.child;continue}if(h===n)break e;for(;h.sibling===null;){if(h.return===null||h.return===n)break e;d===h&&(d=null),h=h.return}d===h&&(d=null),h.sibling.return=h.return,h=h.sibling}}break;case 19:lr(e,n),Tr(n),i&4&&Pw(n);break;case 21:break;default:lr(e,n),Tr(n)}}function Tr(n){var e=n.flags;if(e&2){try{e:{for(var t=n.return;t!==null;){if(bw(t)){var i=t;break e}t=t.return}throw Error(ge(160))}switch(i.tag){case 5:var r=i.stateNode;i.flags&32&&(su(r,""),i.flags&=-33);var s=Aw(n);Vg(n,s,r);break;case 3:case 4:var o=i.stateNode.containerInfo,l=Aw(n);Bg(n,l,o);break;default:throw Error(ge(161))}}catch(c){Qt(n,n.return,c)}n.flags&=-3}e&4096&&(n.flags&=-4097)}function LA(n,e,t){ze=n,Rw(n)}function Rw(n,e,t){for(var i=(n.mode&1)!==0;ze!==null;){var r=ze,s=r.child;if(r.tag===22&&i){var o=r.memoizedState!==null||rd;if(!o){var l=r.alternate,c=l!==null&&l.memoizedState!==null||kn;l=rd;var f=kn;if(rd=o,(kn=c)&&!f)for(ze=r;ze!==null;)o=ze,c=o.child,o.tag===22&&o.memoizedState!==null?zw(r):c!==null?(c.return=o,ze=c):zw(r);for(;s!==null;)ze=s,Rw(s),s=s.sibling;ze=r,rd=l,kn=f}Iw(n)}else(r.subtreeFlags&8772)!==0&&s!==null?(s.return=r,ze=s):Iw(n)}}function Iw(n){for(;ze!==null;){var e=ze;if((e.flags&8772)!==0){var t=e.alternate;try{if((e.flags&8772)!==0)switch(e.tag){case 0:case 11:case 15:kn||sd(5,e);break;case 1:var i=e.stateNode;if(e.flags&4&&!kn)if(t===null)i.componentDidMount();else{var r=e.elementType===e.type?t.memoizedProps:or(e.type,t.memoizedProps);i.componentDidUpdate(r,t.memoizedState,i.__reactInternalSnapshotBeforeUpdate)}var s=e.updateQueue;s!==null&&P1(e,s,i);break;case 3:var o=e.updateQueue;if(o!==null){if(t=null,e.child!==null)switch(e.child.tag){case 5:t=e.child.stateNode;break;case 1:t=e.child.stateNode}P1(e,o,t)}break;case 5:var l=e.stateNode;if(t===null&&e.flags&4){t=l;var c=e.memoizedProps;switch(e.type){case"button":case"input":case"select":case"textarea":c.autoFocus&&t.focus();break;case"img":c.src&&(t.src=c.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(e.memoizedState===null){var f=e.alternate;if(f!==null){var d=f.memoizedState;if(d!==null){var h=d.dehydrated;h!==null&&gu(h)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(ge(163))}kn||e.flags&512&&Ug(e)}catch(m){Qt(e,e.return,m)}}if(e===n){ze=null;break}if(t=e.sibling,t!==null){t.return=e.return,ze=t;break}ze=e.return}}function Dw(n){for(;ze!==null;){var e=ze;if(e===n){ze=null;break}var t=e.sibling;if(t!==null){t.return=e.return,ze=t;break}ze=e.return}}function zw(n){for(;ze!==null;){var e=ze;try{switch(e.tag){case 0:case 11:case 15:var t=e.return;try{sd(4,e)}catch(c){Qt(e,t,c)}break;case 1:var i=e.stateNode;if(typeof i.componentDidMount=="function"){var r=e.return;try{i.componentDidMount()}catch(c){Qt(e,r,c)}}var s=e.return;try{Ug(e)}catch(c){Qt(e,s,c)}break;case 5:var o=e.return;try{Ug(e)}catch(c){Qt(e,o,c)}}}catch(c){Qt(e,e.return,c)}if(e===n){ze=null;break}var l=e.sibling;if(l!==null){l.return=e.return,ze=l;break}ze=e.return}}var RA=Math.ceil,od=Wr.ReactCurrentDispatcher,Hg=Wr.ReactCurrentOwner,ki=Wr.ReactCurrentBatchConfig,_t=0,xn=null,an=null,Cn=0,wi=0,$a=Is(0),mn=0,Uu=null,Do=0,ad=0,Wg=0,Bu=null,ai=null,Gg=0,el=1/0,Qr=null,ld=!1,Xg=null,Fs=null,ud=!1,Us=null,cd=0,Vu=0,jg=null,fd=-1,dd=0;function qn(){return(_t&6)!==0?en():fd!==-1?fd:fd=en()}function Bs(n){return(n.mode&1)===0?1:(_t&2)!==0&&Cn!==0?Cn&-Cn:pA.transition!==null?(dd===0&&(dd=b_()),dd):(n=Lt,n!==0||(n=window.event,n=n===void 0?16:N_(n.type)),n)}function ur(n,e,t,i){if(50<Vu)throw Vu=0,jg=null,Error(ge(185));fu(n,t,i),((_t&2)===0||n!==xn)&&(n===xn&&((_t&2)===0&&(ad|=t),mn===4&&Vs(n,Cn)),li(n,i),t===1&&_t===0&&(e.mode&1)===0&&(el=en()+500,Bf&&zs()))}function li(n,e){var t=n.callbackNode;pb(n,e);var i=wf(n,n===xn?Cn:0);if(i===0)t!==null&&M_(t),n.callbackNode=null,n.callbackPriority=0;else if(e=i&-i,n.callbackPriority!==e){if(t!=null&&M_(t),e===1)n.tag===0?hA(kw.bind(null,n)):_1(kw.bind(null,n)),uA(function(){(_t&6)===0&&zs()}),t=null;else{switch(A_(i)){case 1:t=Tm;break;case 4:t=E_;break;case 16:t=vf;break;case 536870912:t=T_;break;default:t=vf}t=Gw(t,Nw.bind(null,n))}n.callbackPriority=e,n.callbackNode=t}}function Nw(n,e){if(fd=-1,dd=0,(_t&6)!==0)throw Error(ge(327));var t=n.callbackNode;if(tl()&&n.callbackNode!==t)return null;var i=wf(n,n===xn?Cn:0);if(i===0)return null;if((i&30)!==0||(i&n.expiredLanes)!==0||e)e=hd(n,i);else{e=i;var r=_t;_t|=2;var s=Fw();(xn!==n||Cn!==e)&&(Qr=null,el=en()+500,No(n,e));do try{zA();break}catch(l){Ow(n,l)}while(1);cg(),od.current=s,_t=r,an!==null?e=0:(xn=null,Cn=0,e=mn)}if(e!==0){if(e===2&&(r=bm(n),r!==0&&(i=r,e=Yg(n,r))),e===1)throw t=Uu,No(n,0),Vs(n,i),li(n,en()),t;if(e===6)Vs(n,i);else{if(r=n.current.alternate,(i&30)===0&&!IA(r)&&(e=hd(n,i),e===2&&(s=bm(n),s!==0&&(i=s,e=Yg(n,s))),e===1))throw t=Uu,No(n,0),Vs(n,i),li(n,en()),t;switch(n.finishedWork=r,n.finishedLanes=i,e){case 0:case 1:throw Error(ge(345));case 2:ko(n,ai,Qr);break;case 3:if(Vs(n,i),(i&130023424)===i&&(e=Gg+500-en(),10<e)){if(wf(n,0)!==0)break;if(r=n.suspendedLanes,(r&i)!==i){qn(),n.pingedLanes|=n.suspendedLanes&r;break}n.timeoutHandle=$m(ko.bind(null,n,ai,Qr),e);break}ko(n,ai,Qr);break;case 4:if(Vs(n,i),(i&4194240)===i)break;for(e=n.eventTimes,r=-1;0<i;){var o=31-ir(i);s=1<<o,o=e[o],o>r&&(r=o),i&=~s}if(i=r,i=en()-i,i=(120>i?120:480>i?480:1080>i?1080:1920>i?1920:3e3>i?3e3:4320>i?4320:1960*RA(i/1960))-i,10<i){n.timeoutHandle=$m(ko.bind(null,n,ai,Qr),i);break}ko(n,ai,Qr);break;case 5:ko(n,ai,Qr);break;default:throw Error(ge(329))}}}return li(n,en()),n.callbackNode===t?Nw.bind(null,n):null}function Yg(n,e){var t=Bu;return n.current.memoizedState.isDehydrated&&(No(n,e).flags|=256),n=hd(n,e),n!==2&&(e=ai,ai=t,e!==null&&qg(e)),n}function qg(n){ai===null?ai=n:ai.push.apply(ai,n)}function IA(n){for(var e=n;;){if(e.flags&16384){var t=e.updateQueue;if(t!==null&&(t=t.stores,t!==null))for(var i=0;i<t.length;i++){var r=t[i],s=r.getSnapshot;r=r.value;try{if(!rr(s(),r))return!1}catch{return!1}}}if(t=e.child,e.subtreeFlags&16384&&t!==null)t.return=e,e=t;else{if(e===n)break;for(;e.sibling===null;){if(e.return===null||e.return===n)return!0;e=e.return}e.sibling.return=e.return,e=e.sibling}}return!0}function Vs(n,e){for(e&=~Wg,e&=~ad,n.suspendedLanes|=e,n.pingedLanes&=~e,n=n.expirationTimes;0<e;){var t=31-ir(e),i=1<<t;n[t]=-1,e&=~i}}function kw(n){if((_t&6)!==0)throw Error(ge(327));tl();var e=wf(n,0);if((e&1)===0)return li(n,en()),null;var t=hd(n,e);if(n.tag!==0&&t===2){var i=bm(n);i!==0&&(e=i,t=Yg(n,i))}if(t===1)throw t=Uu,No(n,0),Vs(n,e),li(n,en()),t;if(t===6)throw Error(ge(345));return n.finishedWork=n.current.alternate,n.finishedLanes=e,ko(n,ai,Qr),li(n,en()),null}function Zg(n,e){var t=_t;_t|=1;try{return n(e)}finally{_t=t,_t===0&&(el=en()+500,Bf&&zs())}}function zo(n){Us!==null&&Us.tag===0&&(_t&6)===0&&tl();var e=_t;_t|=1;var t=ki.transition,i=Lt;try{if(ki.transition=null,Lt=1,n)return n()}finally{Lt=i,ki.transition=t,_t=e,(_t&6)===0&&zs()}}function Jg(){wi=$a.current,Ot($a)}function No(n,e){n.finishedWork=null,n.finishedLanes=0;var t=n.timeoutHandle;if(t!==-1&&(n.timeoutHandle=-1,lA(t)),an!==null)for(t=an.return;t!==null;){var i=t;switch(sg(i),i.tag){case 1:i=i.type.childContextTypes,i!=null&&Ff();break;case 3:Ja(),Ot(ri),Ot(Dn),_g();break;case 5:yg(i);break;case 4:Ja();break;case 13:Ot(Yt);break;case 19:Ot(Yt);break;case 10:fg(i.type._context);break;case 22:case 23:Jg()}t=t.return}if(xn=n,an=n=Hs(n.current,null),Cn=wi=e,mn=0,Uu=null,Wg=ad=Do=0,ai=Bu=null,Lo!==null){for(e=0;e<Lo.length;e++)if(t=Lo[e],i=t.interleaved,i!==null){t.interleaved=null;var r=i.next,s=t.pending;if(s!==null){var o=s.next;s.next=r,i.next=o}t.pending=i}Lo=null}return n}function Ow(n,e){do{var t=an;try{if(cg(),Qf.current=td,Kf){for(var i=qt.memoizedState;i!==null;){var r=i.queue;r!==null&&(r.pending=null),i=i.next}Kf=!1}if(Io=0,yn=pn=qt=null,Du=!1,zu=0,Hg.current=null,t===null||t.return===null){mn=1,Uu=e,an=null;break}e:{var s=n,o=t.return,l=t,c=e;if(e=Cn,l.flags|=32768,c!==null&&typeof c=="object"&&typeof c.then=="function"){var f=c,d=l,h=d.tag;if((d.mode&1)===0&&(h===0||h===11||h===15)){var m=d.alternate;m?(d.updateQueue=m.updateQueue,d.memoizedState=m.memoizedState,d.lanes=m.lanes):(d.updateQueue=null,d.memoizedState=null)}var g=lw(o);if(g!==null){g.flags&=-257,uw(g,o,l,s,e),g.mode&1&&aw(s,f,e),e=g,c=f;var x=e.updateQueue;if(x===null){var y=new Set;y.add(c),e.updateQueue=y}else x.add(c);break e}else{if((e&1)===0){aw(s,f,e),Qg();break e}c=Error(ge(426))}}else if(Ut&&l.mode&1){var w=lw(o);if(w!==null){(w.flags&65536)===0&&(w.flags|=256),uw(w,o,l,s,e),lg(Qa(c,l));break e}}s=c=Qa(c,l),mn!==4&&(mn=2),Bu===null?Bu=[s]:Bu.push(s),s=o;do{switch(s.tag){case 3:s.flags|=65536,e&=-e,s.lanes|=e;var _=sw(s,c,e);C1(s,_);break e;case 1:l=c;var S=s.type,E=s.stateNode;if((s.flags&128)===0&&(typeof S.getDerivedStateFromError=="function"||E!==null&&typeof E.componentDidCatch=="function"&&(Fs===null||!Fs.has(E)))){s.flags|=65536,e&=-e,s.lanes|=e;var T=ow(s,l,e);C1(s,T);break e}}s=s.return}while(s!==null)}Bw(t)}catch(C){e=C,an===t&&t!==null&&(an=t=t.return);continue}break}while(1)}function Fw(){var n=od.current;return od.current=td,n===null?td:n}function Qg(){(mn===0||mn===3||mn===2)&&(mn=4),xn===null||(Do&268435455)===0&&(ad&268435455)===0||Vs(xn,Cn)}function hd(n,e){var t=_t;_t|=2;var i=Fw();(xn!==n||Cn!==e)&&(Qr=null,No(n,e));do try{DA();break}catch(r){Ow(n,r)}while(1);if(cg(),_t=t,od.current=i,an!==null)throw Error(ge(261));return xn=null,Cn=0,mn}function DA(){for(;an!==null;)Uw(an)}function zA(){for(;an!==null&&!sb();)Uw(an)}function Uw(n){var e=Ww(n.alternate,n,wi);n.memoizedProps=n.pendingProps,e===null?Bw(n):an=e,Hg.current=null}function Bw(n){var e=n;do{var t=e.alternate;if(n=e.return,(e.flags&32768)===0){if(t=bA(t,e,wi),t!==null){an=t;return}}else{if(t=AA(t,e),t!==null){t.flags&=32767,an=t;return}if(n!==null)n.flags|=32768,n.subtreeFlags=0,n.deletions=null;else{mn=6,an=null;return}}if(e=e.sibling,e!==null){an=e;return}an=e=n}while(e!==null);mn===0&&(mn=5)}function ko(n,e,t){var i=Lt,r=ki.transition;try{ki.transition=null,Lt=1,NA(n,e,t,i)}finally{ki.transition=r,Lt=i}return null}function NA(n,e,t,i){do tl();while(Us!==null);if((_t&6)!==0)throw Error(ge(327));t=n.finishedWork;var r=n.finishedLanes;if(t===null)return null;if(n.finishedWork=null,n.finishedLanes=0,t===n.current)throw Error(ge(177));n.callbackNode=null,n.callbackPriority=0;var s=t.lanes|t.childLanes;if(mb(n,s),n===xn&&(an=xn=null,Cn=0),(t.subtreeFlags&2064)===0&&(t.flags&2064)===0||ud||(ud=!0,Gw(vf,function(){return tl(),null})),s=(t.flags&15990)!==0,(t.subtreeFlags&15990)!==0||s){s=ki.transition,ki.transition=null;var o=Lt;Lt=1;var l=_t;_t|=4,Hg.current=null,PA(n,t),Lw(t,n),tA(Qm),Ef=!!Jm,Qm=Jm=null,n.current=t,LA(t),ob(),_t=l,Lt=o,ki.transition=s}else n.current=t;if(ud&&(ud=!1,Us=n,cd=r),s=n.pendingLanes,s===0&&(Fs=null),ub(t.stateNode),li(n,en()),e!==null)for(i=n.onRecoverableError,t=0;t<e.length;t++)r=e[t],i(r.value,{componentStack:r.stack,digest:r.digest});if(ld)throw ld=!1,n=Xg,Xg=null,n;return(cd&1)!==0&&n.tag!==0&&tl(),s=n.pendingLanes,(s&1)!==0?n===jg?Vu++:(Vu=0,jg=n):Vu=0,zs(),null}function tl(){if(Us!==null){var n=A_(cd),e=ki.transition,t=Lt;try{if(ki.transition=null,Lt=16>n?16:n,Us===null)var i=!1;else{if(n=Us,Us=null,cd=0,(_t&6)!==0)throw Error(ge(331));var r=_t;for(_t|=4,ze=n.current;ze!==null;){var s=ze,o=s.child;if((ze.flags&16)!==0){var l=s.deletions;if(l!==null){for(var c=0;c<l.length;c++){var f=l[c];for(ze=f;ze!==null;){var d=ze;switch(d.tag){case 0:case 11:case 15:Fu(8,d,s)}var h=d.child;if(h!==null)h.return=d,ze=h;else for(;ze!==null;){d=ze;var m=d.sibling,g=d.return;if(Tw(d),d===f){ze=null;break}if(m!==null){m.return=g,ze=m;break}ze=g}}}var x=s.alternate;if(x!==null){var y=x.child;if(y!==null){x.child=null;do{var w=y.sibling;y.sibling=null,y=w}while(y!==null)}}ze=s}}if((s.subtreeFlags&2064)!==0&&o!==null)o.return=s,ze=o;else e:for(;ze!==null;){if(s=ze,(s.flags&2048)!==0)switch(s.tag){case 0:case 11:case 15:Fu(9,s,s.return)}var _=s.sibling;if(_!==null){_.return=s.return,ze=_;break e}ze=s.return}}var S=n.current;for(ze=S;ze!==null;){o=ze;var E=o.child;if((o.subtreeFlags&2064)!==0&&E!==null)E.return=o,ze=E;else e:for(o=S;ze!==null;){if(l=ze,(l.flags&2048)!==0)try{switch(l.tag){case 0:case 11:case 15:sd(9,l)}}catch(C){Qt(l,l.return,C)}if(l===o){ze=null;break e}var T=l.sibling;if(T!==null){T.return=l.return,ze=T;break e}ze=l.return}}if(_t=r,zs(),wr&&typeof wr.onPostCommitFiberRoot=="function")try{wr.onPostCommitFiberRoot(yf,n)}catch{}i=!0}return i}finally{Lt=t,ki.transition=e}}return!1}function Vw(n,e,t){e=Qa(t,e),e=sw(n,e,1),n=ks(n,e,1),e=qn(),n!==null&&(fu(n,1,e),li(n,e))}function Qt(n,e,t){if(n.tag===3)Vw(n,n,t);else for(;e!==null;){if(e.tag===3){Vw(e,n,t);break}else if(e.tag===1){var i=e.stateNode;if(typeof e.type.getDerivedStateFromError=="function"||typeof i.componentDidCatch=="function"&&(Fs===null||!Fs.has(i))){n=Qa(t,n),n=ow(e,n,1),e=ks(e,n,1),n=qn(),e!==null&&(fu(e,1,n),li(e,n));break}}e=e.return}}function kA(n,e,t){var i=n.pingCache;i!==null&&i.delete(e),e=qn(),n.pingedLanes|=n.suspendedLanes&t,xn===n&&(Cn&t)===t&&(mn===4||mn===3&&(Cn&130023424)===Cn&&500>en()-Gg?No(n,0):Wg|=t),li(n,e)}function Hw(n,e){e===0&&((n.mode&1)===0?e=1:(e=_f,_f<<=1,(_f&130023424)===0&&(_f=4194304)));var t=qn();n=qr(n,e),n!==null&&(fu(n,e,t),li(n,t))}function OA(n){var e=n.memoizedState,t=0;e!==null&&(t=e.retryLane),Hw(n,t)}function FA(n,e){var t=0;switch(n.tag){case 13:var i=n.stateNode,r=n.memoizedState;r!==null&&(t=r.retryLane);break;case 19:i=n.stateNode;break;default:throw Error(ge(314))}i!==null&&i.delete(e),Hw(n,t)}var Ww;Ww=function(n,e,t){if(n!==null)if(n.memoizedProps!==e.pendingProps||ri.current)oi=!0;else{if((n.lanes&t)===0&&(e.flags&128)===0)return oi=!1,TA(n,e,t);oi=(n.flags&131072)!==0}else oi=!1,Ut&&(e.flags&1048576)!==0&&w1(e,Hf,e.index);switch(e.lanes=0,e.tag){case 2:var i=e.type;id(n,e),n=e.pendingProps;var r=Wa(e,Dn.current);qa(e,t),r=Mg(null,e,i,n,r,t);var s=Eg();return e.flags|=1,typeof r=="object"&&r!==null&&typeof r.render=="function"&&r.$$typeof===void 0?(e.tag=1,e.memoizedState=null,e.updateQueue=null,si(i)?(s=!0,Uf(e)):s=!1,e.memoizedState=r.state!==null&&r.state!==void 0?r.state:null,pg(e),r.updater=qf,e.stateNode=r,r._reactInternals=e,gg(e,i,n,t),e=Ig(null,e,i,!0,s,t)):(e.tag=0,Ut&&s&&rg(e),Yn(null,e,r,t),e=e.child),e;case 16:i=e.elementType;e:{switch(id(n,e),n=e.pendingProps,r=i._init,i=r(i._payload),e.type=i,r=e.tag=BA(i),n=or(i,n),r){case 0:e=Rg(null,e,i,n,t);break e;case 1:e=mw(null,e,i,n,t);break e;case 11:e=cw(null,e,i,n,t);break e;case 14:e=fw(null,e,i,or(i.type,n),t);break e}throw Error(ge(306,i,""))}return e;case 0:return i=e.type,r=e.pendingProps,r=e.elementType===i?r:or(i,r),Rg(n,e,i,r,t);case 1:return i=e.type,r=e.pendingProps,r=e.elementType===i?r:or(i,r),mw(n,e,i,r,t);case 3:e:{if(gw(e),n===null)throw Error(ge(387));i=e.pendingProps,s=e.memoizedState,r=s.element,A1(n,e),Yf(e,i,null,t);var o=e.memoizedState;if(i=o.element,s.isDehydrated)if(s={element:i,isDehydrated:!1,cache:o.cache,pendingSuspenseBoundaries:o.pendingSuspenseBoundaries,transitions:o.transitions},e.updateQueue.baseState=s,e.memoizedState=s,e.flags&256){r=Qa(Error(ge(423)),e),e=vw(n,e,i,t,r);break e}else if(i!==r){r=Qa(Error(ge(424)),e),e=vw(n,e,i,t,r);break e}else for(_i=Rs(e.stateNode.containerInfo.firstChild),xi=e,Ut=!0,sr=null,t=k1(e,null,i,t),e.child=t;t;)t.flags=t.flags&-3|4096,t=t.sibling;else{if(ja(),i===r){e=Jr(n,e,t);break e}Yn(n,e,i,t)}e=e.child}return e;case 5:return O1(e),n===null&&ag(e),i=e.type,r=e.pendingProps,s=n!==null?n.memoizedProps:null,o=r.children,Km(i,r)?o=null:s!==null&&Km(i,s)&&(e.flags|=32),pw(n,e),Yn(n,e,o,t),e.child;case 6:return n===null&&ag(e),null;case 13:return yw(n,e,t);case 4:return vg(e,e.stateNode.containerInfo),i=e.pendingProps,n===null?e.child=Za(e,null,i,t):Yn(n,e,i,t),e.child;case 11:return i=e.type,r=e.pendingProps,r=e.elementType===i?r:or(i,r),cw(n,e,i,r,t);case 7:return Yn(n,e,e.pendingProps,t),e.child;case 8:return Yn(n,e,e.pendingProps.children,t),e.child;case 12:return Yn(n,e,e.pendingProps.children,t),e.child;case 10:e:{if(i=e.type._context,r=e.pendingProps,s=e.memoizedProps,o=r.value,Nt(Gf,i._currentValue),i._currentValue=o,s!==null)if(rr(s.value,o)){if(s.children===r.children&&!ri.current){e=Jr(n,e,t);break e}}else for(s=e.child,s!==null&&(s.return=e);s!==null;){var l=s.dependencies;if(l!==null){o=s.child;for(var c=l.firstContext;c!==null;){if(c.context===i){if(s.tag===1){c=Zr(-1,t&-t),c.tag=2;var f=s.updateQueue;if(f!==null){f=f.shared;var d=f.pending;d===null?c.next=c:(c.next=d.next,d.next=c),f.pending=c}}s.lanes|=t,c=s.alternate,c!==null&&(c.lanes|=t),dg(s.return,t,e),l.lanes|=t;break}c=c.next}}else if(s.tag===10)o=s.type===e.type?null:s.child;else if(s.tag===18){if(o=s.return,o===null)throw Error(ge(341));o.lanes|=t,l=o.alternate,l!==null&&(l.lanes|=t),dg(o,t,e),o=s.sibling}else o=s.child;if(o!==null)o.return=s;else for(o=s;o!==null;){if(o===e){o=null;break}if(s=o.sibling,s!==null){s.return=o.return,o=s;break}o=o.return}s=o}Yn(n,e,r.children,t),e=e.child}return e;case 9:return r=e.type,i=e.pendingProps.children,qa(e,t),r=zi(r),i=i(r),e.flags|=1,Yn(n,e,i,t),e.child;case 14:return i=e.type,r=or(i,e.pendingProps),r=or(i.type,r),fw(n,e,i,r,t);case 15:return dw(n,e,e.type,e.pendingProps,t);case 17:return i=e.type,r=e.pendingProps,r=e.elementType===i?r:or(i,r),id(n,e),e.tag=1,si(i)?(n=!0,Uf(e)):n=!1,qa(e,t),I1(e,i,r),gg(e,i,r,t),Ig(null,e,i,!0,n,t);case 19:return _w(n,e,t);case 22:return hw(n,e,t)}throw Error(ge(156,e.tag))};function Gw(n,e){return S_(n,e)}function UA(n,e,t,i){this.tag=n,this.key=t,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=e,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=i,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Oi(n,e,t,i){return new UA(n,e,t,i)}function Kg(n){return n=n.prototype,!(!n||!n.isReactComponent)}function BA(n){if(typeof n=="function")return Kg(n)?1:0;if(n!=null){if(n=n.$$typeof,n===rm)return 11;if(n===am)return 14}return 2}function Hs(n,e){var t=n.alternate;return t===null?(t=Oi(n.tag,e,n.key,n.mode),t.elementType=n.elementType,t.type=n.type,t.stateNode=n.stateNode,t.alternate=n,n.alternate=t):(t.pendingProps=e,t.type=n.type,t.flags=0,t.subtreeFlags=0,t.deletions=null),t.flags=n.flags&14680064,t.childLanes=n.childLanes,t.lanes=n.lanes,t.child=n.child,t.memoizedProps=n.memoizedProps,t.memoizedState=n.memoizedState,t.updateQueue=n.updateQueue,e=n.dependencies,t.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext},t.sibling=n.sibling,t.index=n.index,t.ref=n.ref,t}function pd(n,e,t,i,r,s){var o=2;if(i=n,typeof n=="function")Kg(n)&&(o=1);else if(typeof n=="string")o=5;else e:switch(n){case La:return Oo(t.children,r,s,e);case nm:o=8,r|=8;break;case im:return n=Oi(12,t,e,r|2),n.elementType=im,n.lanes=s,n;case sm:return n=Oi(13,t,e,r),n.elementType=sm,n.lanes=s,n;case om:return n=Oi(19,t,e,r),n.elementType=om,n.lanes=s,n;case Kx:return md(t,r,s,e);default:if(typeof n=="object"&&n!==null)switch(n.$$typeof){case Jx:o=10;break e;case Qx:o=9;break e;case rm:o=11;break e;case am:o=14;break e;case Ms:o=16,i=null;break e}throw Error(ge(130,n==null?n:typeof n,""))}return e=Oi(o,t,e,r),e.elementType=n,e.type=i,e.lanes=s,e}function Oo(n,e,t,i){return n=Oi(7,n,i,e),n.lanes=t,n}function md(n,e,t,i){return n=Oi(22,n,i,e),n.elementType=Kx,n.lanes=t,n.stateNode={isHidden:!1},n}function $g(n,e,t){return n=Oi(6,n,null,e),n.lanes=t,n}function e0(n,e,t){return e=Oi(4,n.children!==null?n.children:[],n.key,e),e.lanes=t,e.stateNode={containerInfo:n.containerInfo,pendingChildren:null,implementation:n.implementation},e}function VA(n,e,t,i,r){this.tag=e,this.containerInfo=n,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Am(0),this.expirationTimes=Am(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Am(0),this.identifierPrefix=i,this.onRecoverableError=r,this.mutableSourceEagerHydrationData=null}function t0(n,e,t,i,r,s,o,l,c){return n=new VA(n,e,t,l,c),e===1?(e=1,s===!0&&(e|=8)):e=0,s=Oi(3,null,null,e),n.current=s,s.stateNode=n,s.memoizedState={element:i,isDehydrated:t,cache:null,transitions:null,pendingSuspenseBoundaries:null},pg(s),n}function HA(n,e,t){var i=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:Pa,key:i==null?null:""+i,children:n,containerInfo:e,implementation:t}}function Xw(n){if(!n)return Ds;n=n._reactInternals;e:{if(To(n)!==n||n.tag!==1)throw Error(ge(170));var e=n;do{switch(e.tag){case 3:e=e.stateNode.context;break e;case 1:if(si(e.type)){e=e.stateNode.__reactInternalMemoizedMergedChildContext;break e}}e=e.return}while(e!==null);throw Error(ge(171))}if(n.tag===1){var t=n.type;if(si(t))return y1(n,t,e)}return e}function jw(n,e,t,i,r,s,o,l,c){return n=t0(t,i,!0,n,r,s,o,l,c),n.context=Xw(null),t=n.current,i=qn(),r=Bs(t),s=Zr(i,r),s.callback=e!=null?e:null,ks(t,s,r),n.current.lanes=r,fu(n,r,i),li(n,i),n}function gd(n,e,t,i){var r=e.current,s=qn(),o=Bs(r);return t=Xw(t),e.context===null?e.context=t:e.pendingContext=t,e=Zr(s,o),e.payload={element:n},i=i===void 0?null:i,i!==null&&(e.callback=i),n=ks(r,e,o),n!==null&&(ur(n,r,o,s),jf(n,r,o)),o}function vd(n){if(n=n.current,!n.child)return null;switch(n.child.tag){case 5:return n.child.stateNode;default:return n.child.stateNode}}function Yw(n,e){if(n=n.memoizedState,n!==null&&n.dehydrated!==null){var t=n.retryLane;n.retryLane=t!==0&&t<e?t:e}}function n0(n,e){Yw(n,e),(n=n.alternate)&&Yw(n,e)}function WA(){return null}var qw=typeof reportError=="function"?reportError:function(n){console.error(n)};function i0(n){this._internalRoot=n}yd.prototype.render=i0.prototype.render=function(n){var e=this._internalRoot;if(e===null)throw Error(ge(409));gd(n,e,null,null)},yd.prototype.unmount=i0.prototype.unmount=function(){var n=this._internalRoot;if(n!==null){this._internalRoot=null;var e=n.containerInfo;zo(function(){gd(null,n,null,null)}),e[Gr]=null}};function yd(n){this._internalRoot=n}yd.prototype.unstable_scheduleHydration=function(n){if(n){var e=L_();n={blockedOn:null,target:n,priority:e};for(var t=0;t<Cs.length&&e!==0&&e<Cs[t].priority;t++);Cs.splice(t,0,n),t===0&&D_(n)}};function r0(n){return!(!n||n.nodeType!==1&&n.nodeType!==9&&n.nodeType!==11)}function xd(n){return!(!n||n.nodeType!==1&&n.nodeType!==9&&n.nodeType!==11&&(n.nodeType!==8||n.nodeValue!==" react-mount-point-unstable "))}function Zw(){}function GA(n,e,t,i,r){if(r){if(typeof i=="function"){var s=i;i=function(){var f=vd(o);s.call(f)}}var o=jw(e,i,n,0,null,!1,!1,"",Zw);return n._reactRootContainer=o,n[Gr]=o.current,Tu(n.nodeType===8?n.parentNode:n),zo(),o}for(;r=n.lastChild;)n.removeChild(r);if(typeof i=="function"){var l=i;i=function(){var f=vd(c);l.call(f)}}var c=t0(n,0,!1,null,null,!1,!1,"",Zw);return n._reactRootContainer=c,n[Gr]=c.current,Tu(n.nodeType===8?n.parentNode:n),zo(function(){gd(e,c,t,i)}),c}function _d(n,e,t,i,r){var s=t._reactRootContainer;if(s){var o=s;if(typeof r=="function"){var l=r;r=function(){var c=vd(o);l.call(c)}}gd(e,o,n,r)}else o=GA(t,e,n,r,i);return vd(o)}C_=function(n){switch(n.tag){case 3:var e=n.stateNode;if(e.current.memoizedState.isDehydrated){var t=cu(e.pendingLanes);t!==0&&(Cm(e,t|1),li(e,en()),(_t&6)===0&&(el=en()+500,zs()))}break;case 13:zo(function(){var i=qr(n,1);if(i!==null){var r=qn();ur(i,n,1,r)}}),n0(n,1)}},Pm=function(n){if(n.tag===13){var e=qr(n,134217728);if(e!==null){var t=qn();ur(e,n,134217728,t)}n0(n,134217728)}},P_=function(n){if(n.tag===13){var e=Bs(n),t=qr(n,e);if(t!==null){var i=qn();ur(t,n,e,i)}n0(n,e)}},L_=function(){return Lt},R_=function(n,e){var t=Lt;try{return Lt=n,e()}finally{Lt=t}},wm=function(n,e,t){switch(e){case"input":if(hm(n,t),e=t.name,t.type==="radio"&&e!=null){for(t=n;t.parentNode;)t=t.parentNode;for(t=t.querySelectorAll("input[name="+JSON.stringify(""+e)+'][type="radio"]'),e=0;e<t.length;e++){var i=t[e];if(i!==n&&i.form===n.form){var r=Of(i);if(!r)throw Error(ge(90));t_(i),hm(i,r)}}}break;case"textarea":o_(n,t);break;case"select":e=t.value,e!=null&&Ra(n,!!t.multiple,e,!1)}},m_=Zg,g_=zo;var XA={usingClientEntryPoint:!1,Events:[Cu,Va,Of,h_,p_,Zg]},Hu={findFiberByHostInstance:bo,bundleType:0,version:"18.2.0",rendererPackageName:"react-dom"},jA={bundleType:Hu.bundleType,version:Hu.version,rendererPackageName:Hu.rendererPackageName,rendererConfig:Hu.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:Wr.ReactCurrentDispatcher,findHostInstanceByFiber:function(n){return n=__(n),n===null?null:n.stateNode},findFiberByHostInstance:Hu.findFiberByHostInstance||WA,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.2.0-next-9e3b772b8-20220608"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var wd=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!wd.isDisabled&&wd.supportsFiber)try{yf=wd.inject(jA),wr=wd}catch{}}gi.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=XA,gi.createPortal=function(n,e){var t=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!r0(e))throw Error(ge(200));return HA(n,e,null,t)},gi.createRoot=function(n,e){if(!r0(n))throw Error(ge(299));var t=!1,i="",r=qw;return e!=null&&(e.unstable_strictMode===!0&&(t=!0),e.identifierPrefix!==void 0&&(i=e.identifierPrefix),e.onRecoverableError!==void 0&&(r=e.onRecoverableError)),e=t0(n,1,!1,null,null,t,!1,i,r),n[Gr]=e.current,Tu(n.nodeType===8?n.parentNode:n),new i0(e)},gi.findDOMNode=function(n){if(n==null)return null;if(n.nodeType===1)return n;var e=n._reactInternals;if(e===void 0)throw typeof n.render=="function"?Error(ge(188)):(n=Object.keys(n).join(","),Error(ge(268,n)));return n=__(e),n=n===null?null:n.stateNode,n},gi.flushSync=function(n){return zo(n)},gi.hydrate=function(n,e,t){if(!xd(e))throw Error(ge(200));return _d(null,n,e,!0,t)},gi.hydrateRoot=function(n,e,t){if(!r0(n))throw Error(ge(405));var i=t!=null&&t.hydratedSources||null,r=!1,s="",o=qw;if(t!=null&&(t.unstable_strictMode===!0&&(r=!0),t.identifierPrefix!==void 0&&(s=t.identifierPrefix),t.onRecoverableError!==void 0&&(o=t.onRecoverableError)),e=jw(e,null,n,1,t!=null?t:null,r,!1,s,o),n[Gr]=e.current,Tu(n),i)for(n=0;n<i.length;n++)t=i[n],r=t._getVersion,r=r(t._source),e.mutableSourceEagerHydrationData==null?e.mutableSourceEagerHydrationData=[t,r]:e.mutableSourceEagerHydrationData.push(t,r);return new yd(e)},gi.render=function(n,e,t){if(!xd(e))throw Error(ge(200));return _d(null,n,e,!1,t)},gi.unmountComponentAtNode=function(n){if(!xd(n))throw Error(ge(40));return n._reactRootContainer?(zo(function(){_d(null,null,n,!1,function(){n._reactRootContainer=null,n[Gr]=null})}),!0):!1},gi.unstable_batchedUpdates=Zg,gi.unstable_renderSubtreeIntoContainer=function(n,e,t,i){if(!xd(t))throw Error(ge(200));if(n==null||n._reactInternals===void 0)throw Error(ge(38));return _d(n,e,t,!1,i)},gi.version="18.2.0-next-9e3b772b8-20220608",function(n){function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}e(),n.exports=gi}(Wx);var Jw=Wx.exports;Qp.createRoot=Jw.createRoot,Qp.hydrateRoot=Jw.hydrateRoot;/**
 * @license
 * Copyright 2010-2022 Three.js Authors
 * SPDX-License-Identifier: MIT
 */const Sd="144",Fo={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},Uo={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},Qw=0,s0=1,Kw=2,YA=3,qA=0,o0=1,a0=2,nl=3,Bo=0,Si=1,Kr=2,$r=0,Vo=1,l0=2,u0=3,c0=4,$w=5,Ho=100,eS=101,tS=102,f0=103,d0=104,nS=200,iS=201,rS=202,sS=203,h0=204,p0=205,oS=206,aS=207,lS=208,uS=209,cS=210,fS=0,dS=1,hS=2,Md=3,pS=4,mS=5,gS=6,vS=7,Wu=0,yS=1,xS=2,cr=0,_S=1,wS=2,SS=3,m0=4,MS=5,Ed=300,Ws=301,Gs=302,Gu=303,Xu=304,il=306,ju=1e3,Zn=1001,Yu=1002,ln=1003,Td=1004,ZA=1004,bd=1005,JA=1005,tn=1006,g0=1007,QA=1007,Wo=1008,KA=1008,Xs=1009,ES=1010,TS=1011,v0=1012,bS=1013,js=1014,es=1015,rl=1016,AS=1017,CS=1018,Go=1020,PS=1021,LS=1022,Fi=1023,RS=1024,IS=1025,Ys=1026,Xo=1027,DS=1028,zS=1029,NS=1030,kS=1031,OS=1033,Ad=33776,Cd=33777,Pd=33778,Ld=33779,y0=35840,x0=35841,_0=35842,w0=35843,FS=36196,S0=37492,M0=37496,E0=37808,T0=37809,b0=37810,A0=37811,C0=37812,P0=37813,L0=37814,R0=37815,I0=37816,D0=37817,z0=37818,N0=37819,k0=37820,O0=37821,F0=36492,US=2200,BS=2201,VS=2202,qu=2300,Zu=2301,Rd=2302,jo=2400,Yo=2401,Ju=2402,Id=2500,U0=2501,$A=0,eC=1,tC=2,ts=3e3,Ft=3001,HS=3200,WS=3201,qs=0,GS=1,nC="",br="srgb",Zs="srgb-linear",iC=0,Dd=7680,rC=7681,sC=7682,oC=7683,aC=34055,lC=34056,uC=5386,cC=512,fC=513,dC=514,hC=515,pC=516,mC=517,gC=518,XS=519,Qu=35044,vC=35048,yC=35040,xC=35045,_C=35049,wC=35041,SC=35046,MC=35050,EC=35042,TC="100",B0="300 es",zd=1035;class Ar{addEventListener(e,t){this._listeners===void 0&&(this._listeners={});const i=this._listeners;i[e]===void 0&&(i[e]=[]),i[e].indexOf(t)===-1&&i[e].push(t)}hasEventListener(e,t){if(this._listeners===void 0)return!1;const i=this._listeners;return i[e]!==void 0&&i[e].indexOf(t)!==-1}removeEventListener(e,t){if(this._listeners===void 0)return;const r=this._listeners[e];if(r!==void 0){const s=r.indexOf(t);s!==-1&&r.splice(s,1)}}dispatchEvent(e){if(this._listeners===void 0)return;const i=this._listeners[e.type];if(i!==void 0){e.target=this;const r=i.slice(0);for(let s=0,o=r.length;s<o;s++)r[s].call(this,e);e.target=null}}}const On=["00","01","02","03","04","05","06","07","08","09","0a","0b","0c","0d","0e","0f","10","11","12","13","14","15","16","17","18","19","1a","1b","1c","1d","1e","1f","20","21","22","23","24","25","26","27","28","29","2a","2b","2c","2d","2e","2f","30","31","32","33","34","35","36","37","38","39","3a","3b","3c","3d","3e","3f","40","41","42","43","44","45","46","47","48","49","4a","4b","4c","4d","4e","4f","50","51","52","53","54","55","56","57","58","59","5a","5b","5c","5d","5e","5f","60","61","62","63","64","65","66","67","68","69","6a","6b","6c","6d","6e","6f","70","71","72","73","74","75","76","77","78","79","7a","7b","7c","7d","7e","7f","80","81","82","83","84","85","86","87","88","89","8a","8b","8c","8d","8e","8f","90","91","92","93","94","95","96","97","98","99","9a","9b","9c","9d","9e","9f","a0","a1","a2","a3","a4","a5","a6","a7","a8","a9","aa","ab","ac","ad","ae","af","b0","b1","b2","b3","b4","b5","b6","b7","b8","b9","ba","bb","bc","bd","be","bf","c0","c1","c2","c3","c4","c5","c6","c7","c8","c9","ca","cb","cc","cd","ce","cf","d0","d1","d2","d3","d4","d5","d6","d7","d8","d9","da","db","dc","dd","de","df","e0","e1","e2","e3","e4","e5","e6","e7","e8","e9","ea","eb","ec","ed","ee","ef","f0","f1","f2","f3","f4","f5","f6","f7","f8","f9","fa","fb","fc","fd","fe","ff"];let jS=1234567;const qo=Math.PI/180,Ku=180/Math.PI;function Mi(){const n=Math.random()*4294967295|0,e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,i=Math.random()*4294967295|0;return(On[n&255]+On[n>>8&255]+On[n>>16&255]+On[n>>24&255]+"-"+On[e&255]+On[e>>8&255]+"-"+On[e>>16&15|64]+On[e>>24&255]+"-"+On[t&63|128]+On[t>>8&255]+"-"+On[t>>16&255]+On[t>>24&255]+On[i&255]+On[i>>8&255]+On[i>>16&255]+On[i>>24&255]).toLowerCase()}function nn(n,e,t){return Math.max(e,Math.min(t,n))}function V0(n,e){return(n%e+e)%e}function bC(n,e,t,i,r){return i+(n-e)*(r-i)/(t-e)}function AC(n,e,t){return n!==e?(t-n)/(e-n):0}function $u(n,e,t){return(1-t)*n+t*e}function CC(n,e,t,i){return $u(n,e,1-Math.exp(-t*i))}function PC(n,e=1){return e-Math.abs(V0(n,e*2)-e)}function LC(n,e,t){return n<=e?0:n>=t?1:(n=(n-e)/(t-e),n*n*(3-2*n))}function RC(n,e,t){return n<=e?0:n>=t?1:(n=(n-e)/(t-e),n*n*n*(n*(n*6-15)+10))}function IC(n,e){return n+Math.floor(Math.random()*(e-n+1))}function DC(n,e){return n+Math.random()*(e-n)}function zC(n){return n*(.5-Math.random())}function NC(n){n!==void 0&&(jS=n);let e=jS+=1831565813;return e=Math.imul(e^e>>>15,e|1),e^=e+Math.imul(e^e>>>7,e|61),((e^e>>>14)>>>0)/4294967296}function kC(n){return n*qo}function OC(n){return n*Ku}function H0(n){return(n&n-1)===0&&n!==0}function YS(n){return Math.pow(2,Math.ceil(Math.log(n)/Math.LN2))}function Nd(n){return Math.pow(2,Math.floor(Math.log(n)/Math.LN2))}function FC(n,e,t,i,r){const s=Math.cos,o=Math.sin,l=s(t/2),c=o(t/2),f=s((e+i)/2),d=o((e+i)/2),h=s((e-i)/2),m=o((e-i)/2),g=s((i-e)/2),x=o((i-e)/2);switch(r){case"XYX":n.set(l*d,c*h,c*m,l*f);break;case"YZY":n.set(c*m,l*d,c*h,l*f);break;case"ZXZ":n.set(c*h,c*m,l*d,l*f);break;case"XZX":n.set(l*d,c*x,c*g,l*f);break;case"YXY":n.set(c*g,l*d,c*x,l*f);break;case"ZYZ":n.set(c*x,c*g,l*d,l*f);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+r)}}function ns(n,e){switch(e.constructor){case Float32Array:return n;case Uint16Array:return n/65535;case Uint8Array:return n/255;case Int16Array:return Math.max(n/32767,-1);case Int8Array:return Math.max(n/127,-1);default:throw new Error("Invalid component type.")}}function Rt(n,e){switch(e.constructor){case Float32Array:return n;case Uint16Array:return Math.round(n*65535);case Uint8Array:return Math.round(n*255);case Int16Array:return Math.round(n*32767);case Int8Array:return Math.round(n*127);default:throw new Error("Invalid component type.")}}var qS=Object.freeze({__proto__:null,DEG2RAD:qo,RAD2DEG:Ku,generateUUID:Mi,clamp:nn,euclideanModulo:V0,mapLinear:bC,inverseLerp:AC,lerp:$u,damp:CC,pingpong:PC,smoothstep:LC,smootherstep:RC,randInt:IC,randFloat:DC,randFloatSpread:zC,seededRandom:NC,degToRad:kC,radToDeg:OC,isPowerOfTwo:H0,ceilPowerOfTwo:YS,floorPowerOfTwo:Nd,setQuaternionFromProperEuler:FC,normalize:Rt,denormalize:ns});class fe{constructor(e=0,t=0){fe.prototype.isVector2=!0,this.x=e,this.y=t}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){const t=this.x,i=this.y,r=e.elements;return this.x=r[0]*t+r[3]*i+r[6],this.y=r[1]*t+r[4]*i+r[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this}clampLength(e,t){const i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(e,Math.min(t,i)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,i=this.y-e.y;return t*t+i*i}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,i){return this.x=e.x+(t.x-e.x)*i,this.y=e.y+(t.y-e.y)*i,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){const i=Math.cos(t),r=Math.sin(t),s=this.x-e.x,o=this.y-e.y;return this.x=s*i-o*r+e.x,this.y=s*r+o*i+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class ui{constructor(){ui.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1]}set(e,t,i,r,s,o,l,c,f){const d=this.elements;return d[0]=e,d[1]=r,d[2]=l,d[3]=t,d[4]=s,d[5]=c,d[6]=i,d[7]=o,d[8]=f,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const t=this.elements,i=e.elements;return t[0]=i[0],t[1]=i[1],t[2]=i[2],t[3]=i[3],t[4]=i[4],t[5]=i[5],t[6]=i[6],t[7]=i[7],t[8]=i[8],this}extractBasis(e,t,i){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),i.setFromMatrix3Column(this,2),this}setFromMatrix4(e){const t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const i=e.elements,r=t.elements,s=this.elements,o=i[0],l=i[3],c=i[6],f=i[1],d=i[4],h=i[7],m=i[2],g=i[5],x=i[8],y=r[0],w=r[3],_=r[6],S=r[1],E=r[4],T=r[7],C=r[2],P=r[5],I=r[8];return s[0]=o*y+l*S+c*C,s[3]=o*w+l*E+c*P,s[6]=o*_+l*T+c*I,s[1]=f*y+d*S+h*C,s[4]=f*w+d*E+h*P,s[7]=f*_+d*T+h*I,s[2]=m*y+g*S+x*C,s[5]=m*w+g*E+x*P,s[8]=m*_+g*T+x*I,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){const e=this.elements,t=e[0],i=e[1],r=e[2],s=e[3],o=e[4],l=e[5],c=e[6],f=e[7],d=e[8];return t*o*d-t*l*f-i*s*d+i*l*c+r*s*f-r*o*c}invert(){const e=this.elements,t=e[0],i=e[1],r=e[2],s=e[3],o=e[4],l=e[5],c=e[6],f=e[7],d=e[8],h=d*o-l*f,m=l*c-d*s,g=f*s-o*c,x=t*h+i*m+r*g;if(x===0)return this.set(0,0,0,0,0,0,0,0,0);const y=1/x;return e[0]=h*y,e[1]=(r*f-d*i)*y,e[2]=(l*i-r*o)*y,e[3]=m*y,e[4]=(d*t-r*c)*y,e[5]=(r*s-l*t)*y,e[6]=g*y,e[7]=(i*c-f*t)*y,e[8]=(o*t-i*s)*y,this}transpose(){let e;const t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){const t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,i,r,s,o,l){const c=Math.cos(s),f=Math.sin(s);return this.set(i*c,i*f,-i*(c*o+f*l)+o+e,-r*f,r*c,-r*(-f*o+c*l)+l+t,0,0,1),this}scale(e,t){const i=this.elements;return i[0]*=e,i[3]*=e,i[6]*=e,i[1]*=t,i[4]*=t,i[7]*=t,this}rotate(e){const t=Math.cos(e),i=Math.sin(e),r=this.elements,s=r[0],o=r[3],l=r[6],c=r[1],f=r[4],d=r[7];return r[0]=t*s+i*c,r[3]=t*o+i*f,r[6]=t*l+i*d,r[1]=-i*s+t*c,r[4]=-i*o+t*f,r[7]=-i*l+t*d,this}translate(e,t){const i=this.elements;return i[0]+=e*i[2],i[3]+=e*i[5],i[6]+=e*i[8],i[1]+=t*i[2],i[4]+=t*i[5],i[7]+=t*i[8],this}equals(e){const t=this.elements,i=e.elements;for(let r=0;r<9;r++)if(t[r]!==i[r])return!1;return!0}fromArray(e,t=0){for(let i=0;i<9;i++)this.elements[i]=e[i+t];return this}toArray(e=[],t=0){const i=this.elements;return e[t]=i[0],e[t+1]=i[1],e[t+2]=i[2],e[t+3]=i[3],e[t+4]=i[4],e[t+5]=i[5],e[t+6]=i[6],e[t+7]=i[7],e[t+8]=i[8],e}clone(){return new this.constructor().fromArray(this.elements)}}function ZS(n){for(let e=n.length-1;e>=0;--e)if(n[e]>=65535)return!0;return!1}const UC={Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array};function sl(n,e){return new UC[n](e)}function ec(n){return document.createElementNS("http://www.w3.org/1999/xhtml",n)}function Zo(n){return n<.04045?n*.0773993808:Math.pow(n*.9478672986+.0521327014,2.4)}function kd(n){return n<.0031308?n*12.92:1.055*Math.pow(n,.41666)-.055}const W0={[br]:{[Zs]:Zo},[Zs]:{[br]:kd}},Ui={legacyMode:!0,get workingColorSpace(){return Zs},set workingColorSpace(n){console.warn("THREE.ColorManagement: .workingColorSpace is readonly.")},convert:function(n,e,t){if(this.legacyMode||e===t||!e||!t)return n;if(W0[e]&&W0[e][t]!==void 0){const i=W0[e][t];return n.r=i(n.r),n.g=i(n.g),n.b=i(n.b),n}throw new Error("Unsupported color space conversion.")},fromWorkingColorSpace:function(n,e){return this.convert(n,this.workingColorSpace,e)},toWorkingColorSpace:function(n,e){return this.convert(n,e,this.workingColorSpace)}},JS={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},gn={r:0,g:0,b:0},fr={h:0,s:0,l:0},Od={h:0,s:0,l:0};function G0(n,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?n+(e-n)*6*t:t<1/2?e:t<2/3?n+(e-n)*6*(2/3-t):n}function Fd(n,e){return e.r=n.r,e.g=n.g,e.b=n.b,e}class De{constructor(e,t,i){return this.isColor=!0,this.r=1,this.g=1,this.b=1,t===void 0&&i===void 0?this.set(e):this.setRGB(e,t,i)}set(e){return e&&e.isColor?this.copy(e):typeof e=="number"?this.setHex(e):typeof e=="string"&&this.setStyle(e),this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=br){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,Ui.toWorkingColorSpace(this,t),this}setRGB(e,t,i,r=Zs){return this.r=e,this.g=t,this.b=i,Ui.toWorkingColorSpace(this,r),this}setHSL(e,t,i,r=Zs){if(e=V0(e,1),t=nn(t,0,1),i=nn(i,0,1),t===0)this.r=this.g=this.b=i;else{const s=i<=.5?i*(1+t):i+t-i*t,o=2*i-s;this.r=G0(o,s,e+1/3),this.g=G0(o,s,e),this.b=G0(o,s,e-1/3)}return Ui.toWorkingColorSpace(this,r),this}setStyle(e,t=br){function i(s){s!==void 0&&parseFloat(s)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}let r;if(r=/^((?:rgb|hsl)a?)\(([^\)]*)\)/.exec(e)){let s;const o=r[1],l=r[2];switch(o){case"rgb":case"rgba":if(s=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(l))return this.r=Math.min(255,parseInt(s[1],10))/255,this.g=Math.min(255,parseInt(s[2],10))/255,this.b=Math.min(255,parseInt(s[3],10))/255,Ui.toWorkingColorSpace(this,t),i(s[4]),this;if(s=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(l))return this.r=Math.min(100,parseInt(s[1],10))/100,this.g=Math.min(100,parseInt(s[2],10))/100,this.b=Math.min(100,parseInt(s[3],10))/100,Ui.toWorkingColorSpace(this,t),i(s[4]),this;break;case"hsl":case"hsla":if(s=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(l)){const c=parseFloat(s[1])/360,f=parseFloat(s[2])/100,d=parseFloat(s[3])/100;return i(s[4]),this.setHSL(c,f,d,t)}break}}else if(r=/^\#([A-Fa-f\d]+)$/.exec(e)){const s=r[1],o=s.length;if(o===3)return this.r=parseInt(s.charAt(0)+s.charAt(0),16)/255,this.g=parseInt(s.charAt(1)+s.charAt(1),16)/255,this.b=parseInt(s.charAt(2)+s.charAt(2),16)/255,Ui.toWorkingColorSpace(this,t),this;if(o===6)return this.r=parseInt(s.charAt(0)+s.charAt(1),16)/255,this.g=parseInt(s.charAt(2)+s.charAt(3),16)/255,this.b=parseInt(s.charAt(4)+s.charAt(5),16)/255,Ui.toWorkingColorSpace(this,t),this}return e&&e.length>0?this.setColorName(e,t):this}setColorName(e,t=br){const i=JS[e.toLowerCase()];return i!==void 0?this.setHex(i,t):console.warn("THREE.Color: Unknown color "+e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=Zo(e.r),this.g=Zo(e.g),this.b=Zo(e.b),this}copyLinearToSRGB(e){return this.r=kd(e.r),this.g=kd(e.g),this.b=kd(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=br){return Ui.fromWorkingColorSpace(Fd(this,gn),e),nn(gn.r*255,0,255)<<16^nn(gn.g*255,0,255)<<8^nn(gn.b*255,0,255)<<0}getHexString(e=br){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=Zs){Ui.fromWorkingColorSpace(Fd(this,gn),t);const i=gn.r,r=gn.g,s=gn.b,o=Math.max(i,r,s),l=Math.min(i,r,s);let c,f;const d=(l+o)/2;if(l===o)c=0,f=0;else{const h=o-l;switch(f=d<=.5?h/(o+l):h/(2-o-l),o){case i:c=(r-s)/h+(r<s?6:0);break;case r:c=(s-i)/h+2;break;case s:c=(i-r)/h+4;break}c/=6}return e.h=c,e.s=f,e.l=d,e}getRGB(e,t=Zs){return Ui.fromWorkingColorSpace(Fd(this,gn),t),e.r=gn.r,e.g=gn.g,e.b=gn.b,e}getStyle(e=br){return Ui.fromWorkingColorSpace(Fd(this,gn),e),e!==br?`color(${e} ${gn.r} ${gn.g} ${gn.b})`:`rgb(${gn.r*255|0},${gn.g*255|0},${gn.b*255|0})`}offsetHSL(e,t,i){return this.getHSL(fr),fr.h+=e,fr.s+=t,fr.l+=i,this.setHSL(fr.h,fr.s,fr.l),this}add(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this}addColors(e,t){return this.r=e.r+t.r,this.g=e.g+t.g,this.b=e.b+t.b,this}addScalar(e){return this.r+=e,this.g+=e,this.b+=e,this}sub(e){return this.r=Math.max(0,this.r-e.r),this.g=Math.max(0,this.g-e.g),this.b=Math.max(0,this.b-e.b),this}multiply(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this}multiplyScalar(e){return this.r*=e,this.g*=e,this.b*=e,this}lerp(e,t){return this.r+=(e.r-this.r)*t,this.g+=(e.g-this.g)*t,this.b+=(e.b-this.b)*t,this}lerpColors(e,t,i){return this.r=e.r+(t.r-e.r)*i,this.g=e.g+(t.g-e.g)*i,this.b=e.b+(t.b-e.b)*i,this}lerpHSL(e,t){this.getHSL(fr),e.getHSL(Od);const i=$u(fr.h,Od.h,t),r=$u(fr.s,Od.s,t),s=$u(fr.l,Od.l,t);return this.setHSL(i,r,s),this}equals(e){return e.r===this.r&&e.g===this.g&&e.b===this.b}fromArray(e,t=0){return this.r=e[t],this.g=e[t+1],this.b=e[t+2],this}toArray(e=[],t=0){return e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e}fromBufferAttribute(e,t){return this.r=e.getX(t),this.g=e.getY(t),this.b=e.getZ(t),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}}De.NAMES=JS;let ol;class X0{static getDataURL(e){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let t;if(e instanceof HTMLCanvasElement)t=e;else{ol===void 0&&(ol=ec("canvas")),ol.width=e.width,ol.height=e.height;const i=ol.getContext("2d");e instanceof ImageData?i.putImageData(e,0,0):i.drawImage(e,0,0,e.width,e.height),t=ol}return t.width>2048||t.height>2048?(console.warn("THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons",e),t.toDataURL("image/jpeg",.6)):t.toDataURL("image/png")}static sRGBToLinear(e){if(typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap){const t=ec("canvas");t.width=e.width,t.height=e.height;const i=t.getContext("2d");i.drawImage(e,0,0,e.width,e.height);const r=i.getImageData(0,0,e.width,e.height),s=r.data;for(let o=0;o<s.length;o++)s[o]=Zo(s[o]/255)*255;return i.putImageData(r,0,0),t}else if(e.data){const t=e.data.slice(0);for(let i=0;i<t.length;i++)t instanceof Uint8Array||t instanceof Uint8ClampedArray?t[i]=Math.floor(Zo(t[i]/255)*255):t[i]=Zo(t[i]);return{data:t,width:e.width,height:e.height}}else return console.warn("THREE.ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),e}}class Jo{constructor(e=null){this.isSource=!0,this.uuid=Mi(),this.data=e,this.version=0}set needsUpdate(e){e===!0&&this.version++}toJSON(e){const t=e===void 0||typeof e=="string";if(!t&&e.images[this.uuid]!==void 0)return e.images[this.uuid];const i={uuid:this.uuid,url:""},r=this.data;if(r!==null){let s;if(Array.isArray(r)){s=[];for(let o=0,l=r.length;o<l;o++)r[o].isDataTexture?s.push(j0(r[o].image)):s.push(j0(r[o]))}else s=j0(r);i.url=s}return t||(e.images[this.uuid]=i),i}}function j0(n){return typeof HTMLImageElement<"u"&&n instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&n instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&n instanceof ImageBitmap?X0.getDataURL(n):n.data?{data:Array.from(n.data),width:n.width,height:n.height,type:n.data.constructor.name}:(console.warn("THREE.Texture: Unable to serialize Texture."),{})}let BC=0;class un extends Ar{constructor(e=un.DEFAULT_IMAGE,t=un.DEFAULT_MAPPING,i=Zn,r=Zn,s=tn,o=Wo,l=Fi,c=Xs,f=1,d=ts){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:BC++}),this.uuid=Mi(),this.name="",this.source=new Jo(e),this.mipmaps=[],this.mapping=t,this.wrapS=i,this.wrapT=r,this.magFilter=s,this.minFilter=o,this.anisotropy=f,this.format=l,this.internalFormat=null,this.type=c,this.offset=new fe(0,0),this.repeat=new fe(1,1),this.center=new fe(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new ui,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.encoding=d,this.userData={},this.version=0,this.onUpdate=null,this.isRenderTargetTexture=!1,this.needsPMREMUpdate=!1}get image(){return this.source.data}set image(e){this.source.data=e}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}clone(){return new this.constructor().copy(this)}copy(e){return this.name=e.name,this.source=e.source,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.internalFormat=e.internalFormat,this.type=e.type,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.encoding=e.encoding,this.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,this}toJSON(e){const t=e===void 0||typeof e=="string";if(!t&&e.textures[this.uuid]!==void 0)return e.textures[this.uuid];const i={metadata:{version:4.5,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(e).uuid,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};return JSON.stringify(this.userData)!=="{}"&&(i.userData=this.userData),t||(e.textures[this.uuid]=i),i}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==Ed)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case ju:e.x=e.x-Math.floor(e.x);break;case Zn:e.x=e.x<0?0:1;break;case Yu:Math.abs(Math.floor(e.x)%2)===1?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x);break}if(e.y<0||e.y>1)switch(this.wrapT){case ju:e.y=e.y-Math.floor(e.y);break;case Zn:e.y=e.y<0?0:1;break;case Yu:Math.abs(Math.floor(e.y)%2)===1?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y);break}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){e===!0&&(this.version++,this.source.needsUpdate=!0)}}un.DEFAULT_IMAGE=null,un.DEFAULT_MAPPING=Ed;class wt{constructor(e=0,t=0,i=0,r=1){wt.prototype.isVector4=!0,this.x=e,this.y=t,this.z=i,this.w=r}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,i,r){return this.x=e,this.y=t,this.z=i,this.w=r,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w!==void 0?e.w:1,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){const t=this.x,i=this.y,r=this.z,s=this.w,o=e.elements;return this.x=o[0]*t+o[4]*i+o[8]*r+o[12]*s,this.y=o[1]*t+o[5]*i+o[9]*r+o[13]*s,this.z=o[2]*t+o[6]*i+o[10]*r+o[14]*s,this.w=o[3]*t+o[7]*i+o[11]*r+o[15]*s,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);const t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}setAxisAngleFromRotationMatrix(e){let t,i,r,s;const c=e.elements,f=c[0],d=c[4],h=c[8],m=c[1],g=c[5],x=c[9],y=c[2],w=c[6],_=c[10];if(Math.abs(d-m)<.01&&Math.abs(h-y)<.01&&Math.abs(x-w)<.01){if(Math.abs(d+m)<.1&&Math.abs(h+y)<.1&&Math.abs(x+w)<.1&&Math.abs(f+g+_-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;const E=(f+1)/2,T=(g+1)/2,C=(_+1)/2,P=(d+m)/4,I=(h+y)/4,A=(x+w)/4;return E>T&&E>C?E<.01?(i=0,r=.707106781,s=.707106781):(i=Math.sqrt(E),r=P/i,s=I/i):T>C?T<.01?(i=.707106781,r=0,s=.707106781):(r=Math.sqrt(T),i=P/r,s=A/r):C<.01?(i=.707106781,r=.707106781,s=0):(s=Math.sqrt(C),i=I/s,r=A/s),this.set(i,r,s,t),this}let S=Math.sqrt((w-x)*(w-x)+(h-y)*(h-y)+(m-d)*(m-d));return Math.abs(S)<.001&&(S=1),this.x=(w-x)/S,this.y=(h-y)/S,this.z=(m-d)/S,this.w=Math.acos((f+g+_-1)/2),this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this.w=Math.max(e.w,Math.min(t.w,this.w)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this.w=Math.max(e,Math.min(t,this.w)),this}clampLength(e,t){const i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(e,Math.min(t,i)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this.w=this.w<0?Math.ceil(this.w):Math.floor(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this}lerpVectors(e,t,i){return this.x=e.x+(t.x-e.x)*i,this.y=e.y+(t.y-e.y)*i,this.z=e.z+(t.z-e.z)*i,this.w=e.w+(t.w-e.w)*i,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}}class Bi extends Ar{constructor(e,t,i={}){super(),this.isWebGLRenderTarget=!0,this.width=e,this.height=t,this.depth=1,this.scissor=new wt(0,0,e,t),this.scissorTest=!1,this.viewport=new wt(0,0,e,t);const r={width:e,height:t,depth:1};this.texture=new un(r,i.mapping,i.wrapS,i.wrapT,i.magFilter,i.minFilter,i.format,i.type,i.anisotropy,i.encoding),this.texture.isRenderTargetTexture=!0,this.texture.flipY=!1,this.texture.generateMipmaps=i.generateMipmaps!==void 0?i.generateMipmaps:!1,this.texture.internalFormat=i.internalFormat!==void 0?i.internalFormat:null,this.texture.minFilter=i.minFilter!==void 0?i.minFilter:tn,this.depthBuffer=i.depthBuffer!==void 0?i.depthBuffer:!0,this.stencilBuffer=i.stencilBuffer!==void 0?i.stencilBuffer:!1,this.depthTexture=i.depthTexture!==void 0?i.depthTexture:null,this.samples=i.samples!==void 0?i.samples:0}setSize(e,t,i=1){(this.width!==e||this.height!==t||this.depth!==i)&&(this.width=e,this.height=t,this.depth=i,this.texture.image.width=e,this.texture.image.height=t,this.texture.image.depth=i,this.dispose()),this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}clone(){return new this.constructor().copy(this)}copy(e){this.width=e.width,this.height=e.height,this.depth=e.depth,this.viewport.copy(e.viewport),this.texture=e.texture.clone(),this.texture.isRenderTargetTexture=!0;const t=Object.assign({},e.texture.image);return this.texture.source=new Jo(t),this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,e.depthTexture!==null&&(this.depthTexture=e.depthTexture.clone()),this.samples=e.samples,this}dispose(){this.dispatchEvent({type:"dispose"})}}class tc extends un{constructor(e=null,t=1,i=1,r=1){super(null),this.isDataArrayTexture=!0,this.image={data:e,width:t,height:i,depth:r},this.magFilter=ln,this.minFilter=ln,this.wrapR=Zn,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class VC extends Bi{constructor(e,t,i){super(e,t),this.isWebGLArrayRenderTarget=!0,this.depth=i,this.texture=new tc(null,e,t,i),this.texture.isRenderTargetTexture=!0}}class Ud extends un{constructor(e=null,t=1,i=1,r=1){super(null),this.isData3DTexture=!0,this.image={data:e,width:t,height:i,depth:r},this.magFilter=ln,this.minFilter=ln,this.wrapR=Zn,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class HC extends Bi{constructor(e,t,i){super(e,t),this.isWebGL3DRenderTarget=!0,this.depth=i,this.texture=new Ud(null,e,t,i),this.texture.isRenderTargetTexture=!0}}class WC extends Bi{constructor(e,t,i,r={}){super(e,t,r),this.isWebGLMultipleRenderTargets=!0;const s=this.texture;this.texture=[];for(let o=0;o<i;o++)this.texture[o]=s.clone(),this.texture[o].isRenderTargetTexture=!0}setSize(e,t,i=1){if(this.width!==e||this.height!==t||this.depth!==i){this.width=e,this.height=t,this.depth=i;for(let r=0,s=this.texture.length;r<s;r++)this.texture[r].image.width=e,this.texture[r].image.height=t,this.texture[r].image.depth=i;this.dispose()}return this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t),this}copy(e){this.dispose(),this.width=e.width,this.height=e.height,this.depth=e.depth,this.viewport.set(0,0,this.width,this.height),this.scissor.set(0,0,this.width,this.height),this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,e.depthTexture!==null&&(this.depthTexture=e.depthTexture.clone()),this.texture.length=0;for(let t=0,i=e.texture.length;t<i;t++)this.texture[t]=e.texture[t].clone(),this.texture[t].isRenderTargetTexture=!0;return this}}class Fn{constructor(e=0,t=0,i=0,r=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=i,this._w=r}static slerpFlat(e,t,i,r,s,o,l){let c=i[r+0],f=i[r+1],d=i[r+2],h=i[r+3];const m=s[o+0],g=s[o+1],x=s[o+2],y=s[o+3];if(l===0){e[t+0]=c,e[t+1]=f,e[t+2]=d,e[t+3]=h;return}if(l===1){e[t+0]=m,e[t+1]=g,e[t+2]=x,e[t+3]=y;return}if(h!==y||c!==m||f!==g||d!==x){let w=1-l;const _=c*m+f*g+d*x+h*y,S=_>=0?1:-1,E=1-_*_;if(E>Number.EPSILON){const C=Math.sqrt(E),P=Math.atan2(C,_*S);w=Math.sin(w*P)/C,l=Math.sin(l*P)/C}const T=l*S;if(c=c*w+m*T,f=f*w+g*T,d=d*w+x*T,h=h*w+y*T,w===1-l){const C=1/Math.sqrt(c*c+f*f+d*d+h*h);c*=C,f*=C,d*=C,h*=C}}e[t]=c,e[t+1]=f,e[t+2]=d,e[t+3]=h}static multiplyQuaternionsFlat(e,t,i,r,s,o){const l=i[r],c=i[r+1],f=i[r+2],d=i[r+3],h=s[o],m=s[o+1],g=s[o+2],x=s[o+3];return e[t]=l*x+d*h+c*g-f*m,e[t+1]=c*x+d*m+f*h-l*g,e[t+2]=f*x+d*g+l*m-c*h,e[t+3]=d*x-l*h-c*m-f*g,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,i,r){return this._x=e,this._y=t,this._z=i,this._w=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t){const i=e._x,r=e._y,s=e._z,o=e._order,l=Math.cos,c=Math.sin,f=l(i/2),d=l(r/2),h=l(s/2),m=c(i/2),g=c(r/2),x=c(s/2);switch(o){case"XYZ":this._x=m*d*h+f*g*x,this._y=f*g*h-m*d*x,this._z=f*d*x+m*g*h,this._w=f*d*h-m*g*x;break;case"YXZ":this._x=m*d*h+f*g*x,this._y=f*g*h-m*d*x,this._z=f*d*x-m*g*h,this._w=f*d*h+m*g*x;break;case"ZXY":this._x=m*d*h-f*g*x,this._y=f*g*h+m*d*x,this._z=f*d*x+m*g*h,this._w=f*d*h-m*g*x;break;case"ZYX":this._x=m*d*h-f*g*x,this._y=f*g*h+m*d*x,this._z=f*d*x-m*g*h,this._w=f*d*h+m*g*x;break;case"YZX":this._x=m*d*h+f*g*x,this._y=f*g*h+m*d*x,this._z=f*d*x-m*g*h,this._w=f*d*h-m*g*x;break;case"XZY":this._x=m*d*h-f*g*x,this._y=f*g*h-m*d*x,this._z=f*d*x+m*g*h,this._w=f*d*h+m*g*x;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+o)}return t!==!1&&this._onChangeCallback(),this}setFromAxisAngle(e,t){const i=t/2,r=Math.sin(i);return this._x=e.x*r,this._y=e.y*r,this._z=e.z*r,this._w=Math.cos(i),this._onChangeCallback(),this}setFromRotationMatrix(e){const t=e.elements,i=t[0],r=t[4],s=t[8],o=t[1],l=t[5],c=t[9],f=t[2],d=t[6],h=t[10],m=i+l+h;if(m>0){const g=.5/Math.sqrt(m+1);this._w=.25/g,this._x=(d-c)*g,this._y=(s-f)*g,this._z=(o-r)*g}else if(i>l&&i>h){const g=2*Math.sqrt(1+i-l-h);this._w=(d-c)/g,this._x=.25*g,this._y=(r+o)/g,this._z=(s+f)/g}else if(l>h){const g=2*Math.sqrt(1+l-i-h);this._w=(s-f)/g,this._x=(r+o)/g,this._y=.25*g,this._z=(c+d)/g}else{const g=2*Math.sqrt(1+h-i-l);this._w=(o-r)/g,this._x=(s+f)/g,this._y=(c+d)/g,this._z=.25*g}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let i=e.dot(t)+1;return i<Number.EPSILON?(i=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=i):(this._x=0,this._y=-e.z,this._z=e.y,this._w=i)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=i),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(nn(this.dot(e),-1,1)))}rotateTowards(e,t){const i=this.angleTo(e);if(i===0)return this;const r=Math.min(1,t/i);return this.slerp(e,r),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){const i=e._x,r=e._y,s=e._z,o=e._w,l=t._x,c=t._y,f=t._z,d=t._w;return this._x=i*d+o*l+r*f-s*c,this._y=r*d+o*c+s*l-i*f,this._z=s*d+o*f+i*c-r*l,this._w=o*d-i*l-r*c-s*f,this._onChangeCallback(),this}slerp(e,t){if(t===0)return this;if(t===1)return this.copy(e);const i=this._x,r=this._y,s=this._z,o=this._w;let l=o*e._w+i*e._x+r*e._y+s*e._z;if(l<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,l=-l):this.copy(e),l>=1)return this._w=o,this._x=i,this._y=r,this._z=s,this;const c=1-l*l;if(c<=Number.EPSILON){const g=1-t;return this._w=g*o+t*this._w,this._x=g*i+t*this._x,this._y=g*r+t*this._y,this._z=g*s+t*this._z,this.normalize(),this._onChangeCallback(),this}const f=Math.sqrt(c),d=Math.atan2(f,l),h=Math.sin((1-t)*d)/f,m=Math.sin(t*d)/f;return this._w=o*h+this._w*m,this._x=i*h+this._x*m,this._y=r*h+this._y*m,this._z=s*h+this._z*m,this._onChangeCallback(),this}slerpQuaternions(e,t,i){return this.copy(e).slerp(t,i)}random(){const e=Math.random(),t=Math.sqrt(1-e),i=Math.sqrt(e),r=2*Math.PI*Math.random(),s=2*Math.PI*Math.random();return this.set(t*Math.cos(r),i*Math.sin(s),i*Math.cos(s),t*Math.sin(r))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class R{constructor(e=0,t=0,i=0){R.prototype.isVector3=!0,this.x=e,this.y=t,this.z=i}set(e,t,i){return i===void 0&&(i=this.z),this.x=e,this.y=t,this.z=i,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return this.applyQuaternion(QS.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(QS.setFromAxisAngle(e,t))}applyMatrix3(e){const t=this.x,i=this.y,r=this.z,s=e.elements;return this.x=s[0]*t+s[3]*i+s[6]*r,this.y=s[1]*t+s[4]*i+s[7]*r,this.z=s[2]*t+s[5]*i+s[8]*r,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const t=this.x,i=this.y,r=this.z,s=e.elements,o=1/(s[3]*t+s[7]*i+s[11]*r+s[15]);return this.x=(s[0]*t+s[4]*i+s[8]*r+s[12])*o,this.y=(s[1]*t+s[5]*i+s[9]*r+s[13])*o,this.z=(s[2]*t+s[6]*i+s[10]*r+s[14])*o,this}applyQuaternion(e){const t=this.x,i=this.y,r=this.z,s=e.x,o=e.y,l=e.z,c=e.w,f=c*t+o*r-l*i,d=c*i+l*t-s*r,h=c*r+s*i-o*t,m=-s*t-o*i-l*r;return this.x=f*c+m*-s+d*-l-h*-o,this.y=d*c+m*-o+h*-s-f*-l,this.z=h*c+m*-l+f*-o-d*-s,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){const t=this.x,i=this.y,r=this.z,s=e.elements;return this.x=s[0]*t+s[4]*i+s[8]*r,this.y=s[1]*t+s[5]*i+s[9]*r,this.z=s[2]*t+s[6]*i+s[10]*r,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this}clampLength(e,t){const i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(e,Math.min(t,i)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,i){return this.x=e.x+(t.x-e.x)*i,this.y=e.y+(t.y-e.y)*i,this.z=e.z+(t.z-e.z)*i,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){const i=e.x,r=e.y,s=e.z,o=t.x,l=t.y,c=t.z;return this.x=r*c-s*l,this.y=s*o-i*c,this.z=i*l-r*o,this}projectOnVector(e){const t=e.lengthSq();if(t===0)return this.set(0,0,0);const i=e.dot(this)/t;return this.copy(e).multiplyScalar(i)}projectOnPlane(e){return Y0.copy(this).projectOnVector(e),this.sub(Y0)}reflect(e){return this.sub(Y0.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const i=this.dot(e)/t;return Math.acos(nn(i,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,i=this.y-e.y,r=this.z-e.z;return t*t+i*i+r*r}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,i){const r=Math.sin(t)*e;return this.x=r*Math.sin(i),this.y=Math.cos(t)*e,this.z=r*Math.cos(i),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,i){return this.x=e*Math.sin(t),this.y=i,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){const t=this.setFromMatrixColumn(e,0).length(),i=this.setFromMatrixColumn(e,1).length(),r=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=i,this.z=r,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,t*4)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,t*3)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const e=(Math.random()-.5)*2,t=Math.random()*Math.PI*2,i=Math.sqrt(1-e**2);return this.x=i*Math.cos(t),this.y=i*Math.sin(t),this.z=e,this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const Y0=new R,QS=new Fn;class Cr{constructor(e=new R(1/0,1/0,1/0),t=new R(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(e){let t=1/0,i=1/0,r=1/0,s=-1/0,o=-1/0,l=-1/0;for(let c=0,f=e.length;c<f;c+=3){const d=e[c],h=e[c+1],m=e[c+2];d<t&&(t=d),h<i&&(i=h),m<r&&(r=m),d>s&&(s=d),h>o&&(o=h),m>l&&(l=m)}return this.min.set(t,i,r),this.max.set(s,o,l),this}setFromBufferAttribute(e){let t=1/0,i=1/0,r=1/0,s=-1/0,o=-1/0,l=-1/0;for(let c=0,f=e.count;c<f;c++){const d=e.getX(c),h=e.getY(c),m=e.getZ(c);d<t&&(t=d),h<i&&(i=h),m<r&&(r=m),d>s&&(s=d),h>o&&(o=h),m>l&&(l=m)}return this.min.set(t,i,r),this.max.set(s,o,l),this}setFromPoints(e){this.makeEmpty();for(let t=0,i=e.length;t<i;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){const i=Qo.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(i),this.max.copy(e).add(i),this}setFromObject(e,t=!1){return this.makeEmpty(),this.expandByObject(e,t)}clone(){return new this.constructor().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(e){return this.isEmpty()?e.set(0,0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}expandByObject(e,t=!1){e.updateWorldMatrix(!1,!1);const i=e.geometry;if(i!==void 0)if(t&&i.attributes!=null&&i.attributes.position!==void 0){const s=i.attributes.position;for(let o=0,l=s.count;o<l;o++)Qo.fromBufferAttribute(s,o).applyMatrix4(e.matrixWorld),this.expandByPoint(Qo)}else i.boundingBox===null&&i.computeBoundingBox(),q0.copy(i.boundingBox),q0.applyMatrix4(e.matrixWorld),this.union(q0);const r=e.children;for(let s=0,o=r.length;s<o;s++)this.expandByObject(r[s],t);return this}containsPoint(e){return!(e.x<this.min.x||e.x>this.max.x||e.y<this.min.y||e.y>this.max.y||e.z<this.min.z||e.z>this.max.z)}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return!(e.max.x<this.min.x||e.min.x>this.max.x||e.max.y<this.min.y||e.min.y>this.max.y||e.max.z<this.min.z||e.min.z>this.max.z)}intersectsSphere(e){return this.clampPoint(e.center,Qo),Qo.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,i;return e.normal.x>0?(t=e.normal.x*this.min.x,i=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,i=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,i+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,i+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,i+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,i+=e.normal.z*this.min.z),t<=-e.constant&&i>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(nc),Bd.subVectors(this.max,nc),al.subVectors(e.a,nc),ll.subVectors(e.b,nc),ul.subVectors(e.c,nc),Js.subVectors(ll,al),Qs.subVectors(ul,ll),Ko.subVectors(al,ul);let t=[0,-Js.z,Js.y,0,-Qs.z,Qs.y,0,-Ko.z,Ko.y,Js.z,0,-Js.x,Qs.z,0,-Qs.x,Ko.z,0,-Ko.x,-Js.y,Js.x,0,-Qs.y,Qs.x,0,-Ko.y,Ko.x,0];return!Z0(t,al,ll,ul,Bd)||(t=[1,0,0,0,1,0,0,0,1],!Z0(t,al,ll,ul,Bd))?!1:(Vd.crossVectors(Js,Qs),t=[Vd.x,Vd.y,Vd.z],Z0(t,al,ll,ul,Bd))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return Qo.copy(e).clamp(this.min,this.max).sub(e).length()}getBoundingSphere(e){return this.getCenter(e.center),e.radius=this.getSize(Qo).length()*.5,e}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}applyMatrix4(e){return this.isEmpty()?this:(is[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),is[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),is[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),is[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),is[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),is[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),is[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),is[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(is),this)}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}const is=[new R,new R,new R,new R,new R,new R,new R,new R],Qo=new R,q0=new Cr,al=new R,ll=new R,ul=new R,Js=new R,Qs=new R,Ko=new R,nc=new R,Bd=new R,Vd=new R,$o=new R;function Z0(n,e,t,i,r){for(let s=0,o=n.length-3;s<=o;s+=3){$o.fromArray(n,s);const l=r.x*Math.abs($o.x)+r.y*Math.abs($o.y)+r.z*Math.abs($o.z),c=e.dot($o),f=t.dot($o),d=i.dot($o);if(Math.max(-Math.max(c,f,d),Math.min(c,f,d))>l)return!1}return!0}const GC=new Cr,KS=new R,Hd=new R,J0=new R;class rs{constructor(e=new R,t=-1){this.center=e,this.radius=t}set(e,t){return this.center.copy(e),this.radius=t,this}setFromPoints(e,t){const i=this.center;t!==void 0?i.copy(t):GC.setFromPoints(e).getCenter(i);let r=0;for(let s=0,o=e.length;s<o;s++)r=Math.max(r,i.distanceToSquared(e[s]));return this.radius=Math.sqrt(r),this}copy(e){return this.center.copy(e.center),this.radius=e.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(e){return e.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(e){return e.distanceTo(this.center)-this.radius}intersectsSphere(e){const t=this.radius+e.radius;return e.center.distanceToSquared(this.center)<=t*t}intersectsBox(e){return e.intersectsSphere(this)}intersectsPlane(e){return Math.abs(e.distanceToPoint(this.center))<=this.radius}clampPoint(e,t){const i=this.center.distanceToSquared(e);return t.copy(e),i>this.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}getBoundingBox(e){return this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){J0.subVectors(e,this.center);const t=J0.lengthSq();if(t>this.radius*this.radius){const i=Math.sqrt(t),r=(i-this.radius)*.5;this.center.add(J0.multiplyScalar(r/i)),this.radius+=r}return this}union(e){return this.center.equals(e.center)===!0?Hd.set(0,0,1).multiplyScalar(e.radius):Hd.subVectors(e.center,this.center).normalize().multiplyScalar(e.radius),this.expandByPoint(KS.copy(e.center).add(Hd)),this.expandByPoint(KS.copy(e.center).sub(Hd)),this}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}}const ss=new R,Q0=new R,Wd=new R,Ks=new R,K0=new R,Gd=new R,$0=new R;class ic{constructor(e=new R,t=new R(0,0,-1)){this.origin=e,this.direction=t}set(e,t){return this.origin.copy(e),this.direction.copy(t),this}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,t){return t.copy(this.direction).multiplyScalar(e).add(this.origin)}lookAt(e){return this.direction.copy(e).sub(this.origin).normalize(),this}recast(e){return this.origin.copy(this.at(e,ss)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);const i=t.dot(this.direction);return i<0?t.copy(this.origin):t.copy(this.direction).multiplyScalar(i).add(this.origin)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){const t=ss.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(ss.copy(this.direction).multiplyScalar(t).add(this.origin),ss.distanceToSquared(e))}distanceSqToSegment(e,t,i,r){Q0.copy(e).add(t).multiplyScalar(.5),Wd.copy(t).sub(e).normalize(),Ks.copy(this.origin).sub(Q0);const s=e.distanceTo(t)*.5,o=-this.direction.dot(Wd),l=Ks.dot(this.direction),c=-Ks.dot(Wd),f=Ks.lengthSq(),d=Math.abs(1-o*o);let h,m,g,x;if(d>0)if(h=o*c-l,m=o*l-c,x=s*d,h>=0)if(m>=-x)if(m<=x){const y=1/d;h*=y,m*=y,g=h*(h+o*m+2*l)+m*(o*h+m+2*c)+f}else m=s,h=Math.max(0,-(o*m+l)),g=-h*h+m*(m+2*c)+f;else m=-s,h=Math.max(0,-(o*m+l)),g=-h*h+m*(m+2*c)+f;else m<=-x?(h=Math.max(0,-(-o*s+l)),m=h>0?-s:Math.min(Math.max(-s,-c),s),g=-h*h+m*(m+2*c)+f):m<=x?(h=0,m=Math.min(Math.max(-s,-c),s),g=m*(m+2*c)+f):(h=Math.max(0,-(o*s+l)),m=h>0?s:Math.min(Math.max(-s,-c),s),g=-h*h+m*(m+2*c)+f);else m=o>0?-s:s,h=Math.max(0,-(o*m+l)),g=-h*h+m*(m+2*c)+f;return i&&i.copy(this.direction).multiplyScalar(h).add(this.origin),r&&r.copy(Wd).multiplyScalar(m).add(Q0),g}intersectSphere(e,t){ss.subVectors(e.center,this.origin);const i=ss.dot(this.direction),r=ss.dot(ss)-i*i,s=e.radius*e.radius;if(r>s)return null;const o=Math.sqrt(s-r),l=i-o,c=i+o;return l<0&&c<0?null:l<0?this.at(c,t):this.at(l,t)}intersectsSphere(e){return this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){const t=e.normal.dot(this.direction);if(t===0)return e.distanceToPoint(this.origin)===0?0:null;const i=-(this.origin.dot(e.normal)+e.constant)/t;return i>=0?i:null}intersectPlane(e,t){const i=this.distanceToPlane(e);return i===null?null:this.at(i,t)}intersectsPlane(e){const t=e.distanceToPoint(this.origin);return t===0||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let i,r,s,o,l,c;const f=1/this.direction.x,d=1/this.direction.y,h=1/this.direction.z,m=this.origin;return f>=0?(i=(e.min.x-m.x)*f,r=(e.max.x-m.x)*f):(i=(e.max.x-m.x)*f,r=(e.min.x-m.x)*f),d>=0?(s=(e.min.y-m.y)*d,o=(e.max.y-m.y)*d):(s=(e.max.y-m.y)*d,o=(e.min.y-m.y)*d),i>o||s>r||((s>i||i!==i)&&(i=s),(o<r||r!==r)&&(r=o),h>=0?(l=(e.min.z-m.z)*h,c=(e.max.z-m.z)*h):(l=(e.max.z-m.z)*h,c=(e.min.z-m.z)*h),i>c||l>r)||((l>i||i!==i)&&(i=l),(c<r||r!==r)&&(r=c),r<0)?null:this.at(i>=0?i:r,t)}intersectsBox(e){return this.intersectBox(e,ss)!==null}intersectTriangle(e,t,i,r,s){K0.subVectors(t,e),Gd.subVectors(i,e),$0.crossVectors(K0,Gd);let o=this.direction.dot($0),l;if(o>0){if(r)return null;l=1}else if(o<0)l=-1,o=-o;else return null;Ks.subVectors(this.origin,e);const c=l*this.direction.dot(Gd.crossVectors(Ks,Gd));if(c<0)return null;const f=l*this.direction.dot(K0.cross(Ks));if(f<0||c+f>o)return null;const d=-l*Ks.dot($0);return d<0?null:this.at(d/o,s)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}}class st{constructor(){st.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]}set(e,t,i,r,s,o,l,c,f,d,h,m,g,x,y,w){const _=this.elements;return _[0]=e,_[4]=t,_[8]=i,_[12]=r,_[1]=s,_[5]=o,_[9]=l,_[13]=c,_[2]=f,_[6]=d,_[10]=h,_[14]=m,_[3]=g,_[7]=x,_[11]=y,_[15]=w,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return new st().fromArray(this.elements)}copy(e){const t=this.elements,i=e.elements;return t[0]=i[0],t[1]=i[1],t[2]=i[2],t[3]=i[3],t[4]=i[4],t[5]=i[5],t[6]=i[6],t[7]=i[7],t[8]=i[8],t[9]=i[9],t[10]=i[10],t[11]=i[11],t[12]=i[12],t[13]=i[13],t[14]=i[14],t[15]=i[15],this}copyPosition(e){const t=this.elements,i=e.elements;return t[12]=i[12],t[13]=i[13],t[14]=i[14],this}setFromMatrix3(e){const t=e.elements;return this.set(t[0],t[3],t[6],0,t[1],t[4],t[7],0,t[2],t[5],t[8],0,0,0,0,1),this}extractBasis(e,t,i){return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),i.setFromMatrixColumn(this,2),this}makeBasis(e,t,i){return this.set(e.x,t.x,i.x,0,e.y,t.y,i.y,0,e.z,t.z,i.z,0,0,0,0,1),this}extractRotation(e){const t=this.elements,i=e.elements,r=1/cl.setFromMatrixColumn(e,0).length(),s=1/cl.setFromMatrixColumn(e,1).length(),o=1/cl.setFromMatrixColumn(e,2).length();return t[0]=i[0]*r,t[1]=i[1]*r,t[2]=i[2]*r,t[3]=0,t[4]=i[4]*s,t[5]=i[5]*s,t[6]=i[6]*s,t[7]=0,t[8]=i[8]*o,t[9]=i[9]*o,t[10]=i[10]*o,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){const t=this.elements,i=e.x,r=e.y,s=e.z,o=Math.cos(i),l=Math.sin(i),c=Math.cos(r),f=Math.sin(r),d=Math.cos(s),h=Math.sin(s);if(e.order==="XYZ"){const m=o*d,g=o*h,x=l*d,y=l*h;t[0]=c*d,t[4]=-c*h,t[8]=f,t[1]=g+x*f,t[5]=m-y*f,t[9]=-l*c,t[2]=y-m*f,t[6]=x+g*f,t[10]=o*c}else if(e.order==="YXZ"){const m=c*d,g=c*h,x=f*d,y=f*h;t[0]=m+y*l,t[4]=x*l-g,t[8]=o*f,t[1]=o*h,t[5]=o*d,t[9]=-l,t[2]=g*l-x,t[6]=y+m*l,t[10]=o*c}else if(e.order==="ZXY"){const m=c*d,g=c*h,x=f*d,y=f*h;t[0]=m-y*l,t[4]=-o*h,t[8]=x+g*l,t[1]=g+x*l,t[5]=o*d,t[9]=y-m*l,t[2]=-o*f,t[6]=l,t[10]=o*c}else if(e.order==="ZYX"){const m=o*d,g=o*h,x=l*d,y=l*h;t[0]=c*d,t[4]=x*f-g,t[8]=m*f+y,t[1]=c*h,t[5]=y*f+m,t[9]=g*f-x,t[2]=-f,t[6]=l*c,t[10]=o*c}else if(e.order==="YZX"){const m=o*c,g=o*f,x=l*c,y=l*f;t[0]=c*d,t[4]=y-m*h,t[8]=x*h+g,t[1]=h,t[5]=o*d,t[9]=-l*d,t[2]=-f*d,t[6]=g*h+x,t[10]=m-y*h}else if(e.order==="XZY"){const m=o*c,g=o*f,x=l*c,y=l*f;t[0]=c*d,t[4]=-h,t[8]=f*d,t[1]=m*h+y,t[5]=o*d,t[9]=g*h-x,t[2]=x*h-g,t[6]=l*d,t[10]=y*h+m}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromQuaternion(e){return this.compose(XC,e,jC)}lookAt(e,t,i){const r=this.elements;return Ei.subVectors(e,t),Ei.lengthSq()===0&&(Ei.z=1),Ei.normalize(),$s.crossVectors(i,Ei),$s.lengthSq()===0&&(Math.abs(i.z)===1?Ei.x+=1e-4:Ei.z+=1e-4,Ei.normalize(),$s.crossVectors(i,Ei)),$s.normalize(),Xd.crossVectors(Ei,$s),r[0]=$s.x,r[4]=Xd.x,r[8]=Ei.x,r[1]=$s.y,r[5]=Xd.y,r[9]=Ei.y,r[2]=$s.z,r[6]=Xd.z,r[10]=Ei.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const i=e.elements,r=t.elements,s=this.elements,o=i[0],l=i[4],c=i[8],f=i[12],d=i[1],h=i[5],m=i[9],g=i[13],x=i[2],y=i[6],w=i[10],_=i[14],S=i[3],E=i[7],T=i[11],C=i[15],P=r[0],I=r[4],A=r[8],L=r[12],z=r[1],j=r[5],ue=r[9],Z=r[13],G=r[2],ie=r[6],ee=r[10],pe=r[14],k=r[3],B=r[7],F=r[11],$=r[15];return s[0]=o*P+l*z+c*G+f*k,s[4]=o*I+l*j+c*ie+f*B,s[8]=o*A+l*ue+c*ee+f*F,s[12]=o*L+l*Z+c*pe+f*$,s[1]=d*P+h*z+m*G+g*k,s[5]=d*I+h*j+m*ie+g*B,s[9]=d*A+h*ue+m*ee+g*F,s[13]=d*L+h*Z+m*pe+g*$,s[2]=x*P+y*z+w*G+_*k,s[6]=x*I+y*j+w*ie+_*B,s[10]=x*A+y*ue+w*ee+_*F,s[14]=x*L+y*Z+w*pe+_*$,s[3]=S*P+E*z+T*G+C*k,s[7]=S*I+E*j+T*ie+C*B,s[11]=S*A+E*ue+T*ee+C*F,s[15]=S*L+E*Z+T*pe+C*$,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this}determinant(){const e=this.elements,t=e[0],i=e[4],r=e[8],s=e[12],o=e[1],l=e[5],c=e[9],f=e[13],d=e[2],h=e[6],m=e[10],g=e[14],x=e[3],y=e[7],w=e[11],_=e[15];return x*(+s*c*h-r*f*h-s*l*m+i*f*m+r*l*g-i*c*g)+y*(+t*c*g-t*f*m+s*o*m-r*o*g+r*f*d-s*c*d)+w*(+t*f*h-t*l*g-s*o*h+i*o*g+s*l*d-i*f*d)+_*(-r*l*d-t*c*h+t*l*m+r*o*h-i*o*m+i*c*d)}transpose(){const e=this.elements;let t;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}setPosition(e,t,i){const r=this.elements;return e.isVector3?(r[12]=e.x,r[13]=e.y,r[14]=e.z):(r[12]=e,r[13]=t,r[14]=i),this}invert(){const e=this.elements,t=e[0],i=e[1],r=e[2],s=e[3],o=e[4],l=e[5],c=e[6],f=e[7],d=e[8],h=e[9],m=e[10],g=e[11],x=e[12],y=e[13],w=e[14],_=e[15],S=h*w*f-y*m*f+y*c*g-l*w*g-h*c*_+l*m*_,E=x*m*f-d*w*f-x*c*g+o*w*g+d*c*_-o*m*_,T=d*y*f-x*h*f+x*l*g-o*y*g-d*l*_+o*h*_,C=x*h*c-d*y*c-x*l*m+o*y*m+d*l*w-o*h*w,P=t*S+i*E+r*T+s*C;if(P===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const I=1/P;return e[0]=S*I,e[1]=(y*m*s-h*w*s-y*r*g+i*w*g+h*r*_-i*m*_)*I,e[2]=(l*w*s-y*c*s+y*r*f-i*w*f-l*r*_+i*c*_)*I,e[3]=(h*c*s-l*m*s-h*r*f+i*m*f+l*r*g-i*c*g)*I,e[4]=E*I,e[5]=(d*w*s-x*m*s+x*r*g-t*w*g-d*r*_+t*m*_)*I,e[6]=(x*c*s-o*w*s-x*r*f+t*w*f+o*r*_-t*c*_)*I,e[7]=(o*m*s-d*c*s+d*r*f-t*m*f-o*r*g+t*c*g)*I,e[8]=T*I,e[9]=(x*h*s-d*y*s-x*i*g+t*y*g+d*i*_-t*h*_)*I,e[10]=(o*y*s-x*l*s+x*i*f-t*y*f-o*i*_+t*l*_)*I,e[11]=(d*l*s-o*h*s-d*i*f+t*h*f+o*i*g-t*l*g)*I,e[12]=C*I,e[13]=(d*y*r-x*h*r+x*i*m-t*y*m-d*i*w+t*h*w)*I,e[14]=(x*l*r-o*y*r-x*i*c+t*y*c+o*i*w-t*l*w)*I,e[15]=(o*h*r-d*l*r+d*i*c-t*h*c-o*i*m+t*l*m)*I,this}scale(e){const t=this.elements,i=e.x,r=e.y,s=e.z;return t[0]*=i,t[4]*=r,t[8]*=s,t[1]*=i,t[5]*=r,t[9]*=s,t[2]*=i,t[6]*=r,t[10]*=s,t[3]*=i,t[7]*=r,t[11]*=s,this}getMaxScaleOnAxis(){const e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],i=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],r=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,i,r))}makeTranslation(e,t,i){return this.set(1,0,0,e,0,1,0,t,0,0,1,i,0,0,0,1),this}makeRotationX(e){const t=Math.cos(e),i=Math.sin(e);return this.set(1,0,0,0,0,t,-i,0,0,i,t,0,0,0,0,1),this}makeRotationY(e){const t=Math.cos(e),i=Math.sin(e);return this.set(t,0,i,0,0,1,0,0,-i,0,t,0,0,0,0,1),this}makeRotationZ(e){const t=Math.cos(e),i=Math.sin(e);return this.set(t,-i,0,0,i,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){const i=Math.cos(t),r=Math.sin(t),s=1-i,o=e.x,l=e.y,c=e.z,f=s*o,d=s*l;return this.set(f*o+i,f*l-r*c,f*c+r*l,0,f*l+r*c,d*l+i,d*c-r*o,0,f*c-r*l,d*c+r*o,s*c*c+i,0,0,0,0,1),this}makeScale(e,t,i){return this.set(e,0,0,0,0,t,0,0,0,0,i,0,0,0,0,1),this}makeShear(e,t,i,r,s,o){return this.set(1,i,s,0,e,1,o,0,t,r,1,0,0,0,0,1),this}compose(e,t,i){const r=this.elements,s=t._x,o=t._y,l=t._z,c=t._w,f=s+s,d=o+o,h=l+l,m=s*f,g=s*d,x=s*h,y=o*d,w=o*h,_=l*h,S=c*f,E=c*d,T=c*h,C=i.x,P=i.y,I=i.z;return r[0]=(1-(y+_))*C,r[1]=(g+T)*C,r[2]=(x-E)*C,r[3]=0,r[4]=(g-T)*P,r[5]=(1-(m+_))*P,r[6]=(w+S)*P,r[7]=0,r[8]=(x+E)*I,r[9]=(w-S)*I,r[10]=(1-(m+y))*I,r[11]=0,r[12]=e.x,r[13]=e.y,r[14]=e.z,r[15]=1,this}decompose(e,t,i){const r=this.elements;let s=cl.set(r[0],r[1],r[2]).length();const o=cl.set(r[4],r[5],r[6]).length(),l=cl.set(r[8],r[9],r[10]).length();this.determinant()<0&&(s=-s),e.x=r[12],e.y=r[13],e.z=r[14],dr.copy(this);const f=1/s,d=1/o,h=1/l;return dr.elements[0]*=f,dr.elements[1]*=f,dr.elements[2]*=f,dr.elements[4]*=d,dr.elements[5]*=d,dr.elements[6]*=d,dr.elements[8]*=h,dr.elements[9]*=h,dr.elements[10]*=h,t.setFromRotationMatrix(dr),i.x=s,i.y=o,i.z=l,this}makePerspective(e,t,i,r,s,o){const l=this.elements,c=2*s/(t-e),f=2*s/(i-r),d=(t+e)/(t-e),h=(i+r)/(i-r),m=-(o+s)/(o-s),g=-2*o*s/(o-s);return l[0]=c,l[4]=0,l[8]=d,l[12]=0,l[1]=0,l[5]=f,l[9]=h,l[13]=0,l[2]=0,l[6]=0,l[10]=m,l[14]=g,l[3]=0,l[7]=0,l[11]=-1,l[15]=0,this}makeOrthographic(e,t,i,r,s,o){const l=this.elements,c=1/(t-e),f=1/(i-r),d=1/(o-s),h=(t+e)*c,m=(i+r)*f,g=(o+s)*d;return l[0]=2*c,l[4]=0,l[8]=0,l[12]=-h,l[1]=0,l[5]=2*f,l[9]=0,l[13]=-m,l[2]=0,l[6]=0,l[10]=-2*d,l[14]=-g,l[3]=0,l[7]=0,l[11]=0,l[15]=1,this}equals(e){const t=this.elements,i=e.elements;for(let r=0;r<16;r++)if(t[r]!==i[r])return!1;return!0}fromArray(e,t=0){for(let i=0;i<16;i++)this.elements[i]=e[i+t];return this}toArray(e=[],t=0){const i=this.elements;return e[t]=i[0],e[t+1]=i[1],e[t+2]=i[2],e[t+3]=i[3],e[t+4]=i[4],e[t+5]=i[5],e[t+6]=i[6],e[t+7]=i[7],e[t+8]=i[8],e[t+9]=i[9],e[t+10]=i[10],e[t+11]=i[11],e[t+12]=i[12],e[t+13]=i[13],e[t+14]=i[14],e[t+15]=i[15],e}}const cl=new R,dr=new st,XC=new R(0,0,0),jC=new R(1,1,1),$s=new R,Xd=new R,Ei=new R,$S=new st,eM=new Fn;class fl{constructor(e=0,t=0,i=0,r=fl.DefaultOrder){this.isEuler=!0,this._x=e,this._y=t,this._z=i,this._order=r}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,t,i,r=this._order){return this._x=e,this._y=t,this._z=i,this._order=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,t=this._order,i=!0){const r=e.elements,s=r[0],o=r[4],l=r[8],c=r[1],f=r[5],d=r[9],h=r[2],m=r[6],g=r[10];switch(t){case"XYZ":this._y=Math.asin(nn(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-d,g),this._z=Math.atan2(-o,s)):(this._x=Math.atan2(m,f),this._z=0);break;case"YXZ":this._x=Math.asin(-nn(d,-1,1)),Math.abs(d)<.9999999?(this._y=Math.atan2(l,g),this._z=Math.atan2(c,f)):(this._y=Math.atan2(-h,s),this._z=0);break;case"ZXY":this._x=Math.asin(nn(m,-1,1)),Math.abs(m)<.9999999?(this._y=Math.atan2(-h,g),this._z=Math.atan2(-o,f)):(this._y=0,this._z=Math.atan2(c,s));break;case"ZYX":this._y=Math.asin(-nn(h,-1,1)),Math.abs(h)<.9999999?(this._x=Math.atan2(m,g),this._z=Math.atan2(c,s)):(this._x=0,this._z=Math.atan2(-o,f));break;case"YZX":this._z=Math.asin(nn(c,-1,1)),Math.abs(c)<.9999999?(this._x=Math.atan2(-d,f),this._y=Math.atan2(-h,s)):(this._x=0,this._y=Math.atan2(l,g));break;case"XZY":this._z=Math.asin(-nn(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(m,f),this._y=Math.atan2(l,s)):(this._x=Math.atan2(-d,g),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,i===!0&&this._onChangeCallback(),this}setFromQuaternion(e,t,i){return $S.makeRotationFromQuaternion(e),this.setFromRotationMatrix($S,t,i)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return eM.setFromEuler(this),this.setFromQuaternion(eM,e)}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order}fromArray(e){return this._x=e[0],this._y=e[1],this._z=e[2],e[3]!==void 0&&(this._order=e[3]),this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}toVector3(){console.error("THREE.Euler: .toVector3() has been removed. Use Vector3.setFromEuler() instead")}}fl.DefaultOrder="XYZ",fl.RotationOrders=["XYZ","YZX","ZXY","XZY","YXZ","ZYX"];class ea{constructor(){this.mask=1}set(e){this.mask=(1<<e|0)>>>0}enable(e){this.mask|=1<<e|0}enableAll(){this.mask=-1}toggle(e){this.mask^=1<<e|0}disable(e){this.mask&=~(1<<e|0)}disableAll(){this.mask=0}test(e){return(this.mask&e.mask)!==0}isEnabled(e){return(this.mask&(1<<e|0))!==0}}let YC=0;const tM=new R,dl=new Fn,os=new st,jd=new R,rc=new R,qC=new R,ZC=new Fn,nM=new R(1,0,0),iM=new R(0,1,0),rM=new R(0,0,1),JC={type:"added"},sM={type:"removed"};class Mt extends Ar{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:YC++}),this.uuid=Mi(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=Mt.DefaultUp.clone();const e=new R,t=new fl,i=new Fn,r=new R(1,1,1);function s(){i.setFromEuler(t,!1)}function o(){t.setFromQuaternion(i,void 0,!1)}t._onChange(s),i._onChange(o),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:e},rotation:{configurable:!0,enumerable:!0,value:t},quaternion:{configurable:!0,enumerable:!0,value:i},scale:{configurable:!0,enumerable:!0,value:r},modelViewMatrix:{value:new st},normalMatrix:{value:new ui}}),this.matrix=new st,this.matrixWorld=new st,this.matrixAutoUpdate=Mt.DefaultMatrixAutoUpdate,this.matrixWorldNeedsUpdate=!1,this.matrixWorldAutoUpdate=Mt.DefaultMatrixWorldAutoUpdate,this.layers=new ea,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.userData={}}onBeforeRender(){}onAfterRender(){}applyMatrix4(e){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(e),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(e){return this.quaternion.premultiply(e),this}setRotationFromAxisAngle(e,t){this.quaternion.setFromAxisAngle(e,t)}setRotationFromEuler(e){this.quaternion.setFromEuler(e,!0)}setRotationFromMatrix(e){this.quaternion.setFromRotationMatrix(e)}setRotationFromQuaternion(e){this.quaternion.copy(e)}rotateOnAxis(e,t){return dl.setFromAxisAngle(e,t),this.quaternion.multiply(dl),this}rotateOnWorldAxis(e,t){return dl.setFromAxisAngle(e,t),this.quaternion.premultiply(dl),this}rotateX(e){return this.rotateOnAxis(nM,e)}rotateY(e){return this.rotateOnAxis(iM,e)}rotateZ(e){return this.rotateOnAxis(rM,e)}translateOnAxis(e,t){return tM.copy(e).applyQuaternion(this.quaternion),this.position.add(tM.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(nM,e)}translateY(e){return this.translateOnAxis(iM,e)}translateZ(e){return this.translateOnAxis(rM,e)}localToWorld(e){return e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return e.applyMatrix4(os.copy(this.matrixWorld).invert())}lookAt(e,t,i){e.isVector3?jd.copy(e):jd.set(e,t,i);const r=this.parent;this.updateWorldMatrix(!0,!1),rc.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?os.lookAt(rc,jd,this.up):os.lookAt(jd,rc,this.up),this.quaternion.setFromRotationMatrix(os),r&&(os.extractRotation(r.matrixWorld),dl.setFromRotationMatrix(os),this.quaternion.premultiply(dl.invert()))}add(e){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.add(arguments[t]);return this}return e===this?(console.error("THREE.Object3D.add: object can't be added as a child of itself.",e),this):(e&&e.isObject3D?(e.parent!==null&&e.parent.remove(e),e.parent=this,this.children.push(e),e.dispatchEvent(JC)):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",e),this)}remove(e){if(arguments.length>1){for(let i=0;i<arguments.length;i++)this.remove(arguments[i]);return this}const t=this.children.indexOf(e);return t!==-1&&(e.parent=null,this.children.splice(t,1),e.dispatchEvent(sM)),this}removeFromParent(){const e=this.parent;return e!==null&&e.remove(this),this}clear(){for(let e=0;e<this.children.length;e++){const t=this.children[e];t.parent=null,t.dispatchEvent(sM)}return this.children.length=0,this}attach(e){return this.updateWorldMatrix(!0,!1),os.copy(this.matrixWorld).invert(),e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),os.multiply(e.parent.matrixWorld)),e.applyMatrix4(os),this.add(e),e.updateWorldMatrix(!1,!0),this}getObjectById(e){return this.getObjectByProperty("id",e)}getObjectByName(e){return this.getObjectByProperty("name",e)}getObjectByProperty(e,t){if(this[e]===t)return this;for(let i=0,r=this.children.length;i<r;i++){const o=this.children[i].getObjectByProperty(e,t);if(o!==void 0)return o}}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(rc,e,qC),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(rc,ZC,e),e}getWorldDirection(e){this.updateWorldMatrix(!0,!1);const t=this.matrixWorld.elements;return e.set(t[8],t[9],t[10]).normalize()}raycast(){}traverse(e){e(this);const t=this.children;for(let i=0,r=t.length;i<r;i++)t[i].traverse(e)}traverseVisible(e){if(this.visible===!1)return;e(this);const t=this.children;for(let i=0,r=t.length;i<r;i++)t[i].traverseVisible(e)}traverseAncestors(e){const t=this.parent;t!==null&&(e(t),t.traverseAncestors(e))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||e)&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.matrixWorldNeedsUpdate=!1,e=!0);const t=this.children;for(let i=0,r=t.length;i<r;i++){const s=t[i];(s.matrixWorldAutoUpdate===!0||e===!0)&&s.updateMatrixWorld(e)}}updateWorldMatrix(e,t){const i=this.parent;if(e===!0&&i!==null&&i.matrixWorldAutoUpdate===!0&&i.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),t===!0){const r=this.children;for(let s=0,o=r.length;s<o;s++){const l=r[s];l.matrixWorldAutoUpdate===!0&&l.updateWorldMatrix(!1,!0)}}}toJSON(e){const t=e===void 0||typeof e=="string",i={};t&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},i.metadata={version:4.5,type:"Object",generator:"Object3D.toJSON"});const r={};r.uuid=this.uuid,r.type=this.type,this.name!==""&&(r.name=this.name),this.castShadow===!0&&(r.castShadow=!0),this.receiveShadow===!0&&(r.receiveShadow=!0),this.visible===!1&&(r.visible=!1),this.frustumCulled===!1&&(r.frustumCulled=!1),this.renderOrder!==0&&(r.renderOrder=this.renderOrder),JSON.stringify(this.userData)!=="{}"&&(r.userData=this.userData),r.layers=this.layers.mask,r.matrix=this.matrix.toArray(),this.matrixAutoUpdate===!1&&(r.matrixAutoUpdate=!1),this.isInstancedMesh&&(r.type="InstancedMesh",r.count=this.count,r.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(r.instanceColor=this.instanceColor.toJSON()));function s(l,c){return l[c.uuid]===void 0&&(l[c.uuid]=c.toJSON(e)),c.uuid}if(this.isScene)this.background&&(this.background.isColor?r.background=this.background.toJSON():this.background.isTexture&&(r.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(r.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){r.geometry=s(e.geometries,this.geometry);const l=this.geometry.parameters;if(l!==void 0&&l.shapes!==void 0){const c=l.shapes;if(Array.isArray(c))for(let f=0,d=c.length;f<d;f++){const h=c[f];s(e.shapes,h)}else s(e.shapes,c)}}if(this.isSkinnedMesh&&(r.bindMode=this.bindMode,r.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(s(e.skeletons,this.skeleton),r.skeleton=this.skeleton.uuid)),this.material!==void 0)if(Array.isArray(this.material)){const l=[];for(let c=0,f=this.material.length;c<f;c++)l.push(s(e.materials,this.material[c]));r.material=l}else r.material=s(e.materials,this.material);if(this.children.length>0){r.children=[];for(let l=0;l<this.children.length;l++)r.children.push(this.children[l].toJSON(e).object)}if(this.animations.length>0){r.animations=[];for(let l=0;l<this.animations.length;l++){const c=this.animations[l];r.animations.push(s(e.animations,c))}}if(t){const l=o(e.geometries),c=o(e.materials),f=o(e.textures),d=o(e.images),h=o(e.shapes),m=o(e.skeletons),g=o(e.animations),x=o(e.nodes);l.length>0&&(i.geometries=l),c.length>0&&(i.materials=c),f.length>0&&(i.textures=f),d.length>0&&(i.images=d),h.length>0&&(i.shapes=h),m.length>0&&(i.skeletons=m),g.length>0&&(i.animations=g),x.length>0&&(i.nodes=x)}return i.object=r,i;function o(l){const c=[];for(const f in l){const d=l[f];delete d.metadata,c.push(d)}return c}}clone(e){return new this.constructor().copy(this,e)}copy(e,t=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.userData=JSON.parse(JSON.stringify(e.userData)),t===!0)for(let i=0;i<e.children.length;i++){const r=e.children[i];this.add(r.clone())}return this}}Mt.DefaultUp=new R(0,1,0),Mt.DefaultMatrixAutoUpdate=!0,Mt.DefaultMatrixWorldAutoUpdate=!0;const hr=new R,as=new R,ev=new R,ls=new R,hl=new R,pl=new R,oM=new R,tv=new R,nv=new R,iv=new R;class Vi{constructor(e=new R,t=new R,i=new R){this.a=e,this.b=t,this.c=i}static getNormal(e,t,i,r){r.subVectors(i,t),hr.subVectors(e,t),r.cross(hr);const s=r.lengthSq();return s>0?r.multiplyScalar(1/Math.sqrt(s)):r.set(0,0,0)}static getBarycoord(e,t,i,r,s){hr.subVectors(r,t),as.subVectors(i,t),ev.subVectors(e,t);const o=hr.dot(hr),l=hr.dot(as),c=hr.dot(ev),f=as.dot(as),d=as.dot(ev),h=o*f-l*l;if(h===0)return s.set(-2,-1,-1);const m=1/h,g=(f*c-l*d)*m,x=(o*d-l*c)*m;return s.set(1-g-x,x,g)}static containsPoint(e,t,i,r){return this.getBarycoord(e,t,i,r,ls),ls.x>=0&&ls.y>=0&&ls.x+ls.y<=1}static getUV(e,t,i,r,s,o,l,c){return this.getBarycoord(e,t,i,r,ls),c.set(0,0),c.addScaledVector(s,ls.x),c.addScaledVector(o,ls.y),c.addScaledVector(l,ls.z),c}static isFrontFacing(e,t,i,r){return hr.subVectors(i,t),as.subVectors(e,t),hr.cross(as).dot(r)<0}set(e,t,i){return this.a.copy(e),this.b.copy(t),this.c.copy(i),this}setFromPointsAndIndices(e,t,i,r){return this.a.copy(e[t]),this.b.copy(e[i]),this.c.copy(e[r]),this}setFromAttributeAndIndices(e,t,i,r){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,i),this.c.fromBufferAttribute(e,r),this}clone(){return new this.constructor().copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return hr.subVectors(this.c,this.b),as.subVectors(this.a,this.b),hr.cross(as).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return Vi.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return Vi.getBarycoord(e,this.a,this.b,this.c,t)}getUV(e,t,i,r,s){return Vi.getUV(e,this.a,this.b,this.c,t,i,r,s)}containsPoint(e){return Vi.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return Vi.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){const i=this.a,r=this.b,s=this.c;let o,l;hl.subVectors(r,i),pl.subVectors(s,i),tv.subVectors(e,i);const c=hl.dot(tv),f=pl.dot(tv);if(c<=0&&f<=0)return t.copy(i);nv.subVectors(e,r);const d=hl.dot(nv),h=pl.dot(nv);if(d>=0&&h<=d)return t.copy(r);const m=c*h-d*f;if(m<=0&&c>=0&&d<=0)return o=c/(c-d),t.copy(i).addScaledVector(hl,o);iv.subVectors(e,s);const g=hl.dot(iv),x=pl.dot(iv);if(x>=0&&g<=x)return t.copy(s);const y=g*f-c*x;if(y<=0&&f>=0&&x<=0)return l=f/(f-x),t.copy(i).addScaledVector(pl,l);const w=d*x-g*h;if(w<=0&&h-d>=0&&g-x>=0)return oM.subVectors(s,r),l=(h-d)/(h-d+(g-x)),t.copy(r).addScaledVector(oM,l);const _=1/(w+y+m);return o=y*_,l=m*_,t.copy(i).addScaledVector(hl,o).addScaledVector(pl,l)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}let QC=0;class Pn extends Ar{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:QC++}),this.uuid=Mi(),this.name="",this.type="Material",this.blending=Vo,this.side=Bo,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.blendSrc=h0,this.blendDst=p0,this.blendEquation=Ho,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.depthFunc=Md,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=XS,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=Dd,this.stencilZFail=Dd,this.stencilZPass=Dd,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(e){this._alphaTest>0!=e>0&&this.version++,this._alphaTest=e}onBuild(){}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(e!==void 0)for(const t in e){const i=e[t];if(i===void 0){console.warn("THREE.Material: '"+t+"' parameter is undefined.");continue}const r=this[t];if(r===void 0){console.warn("THREE."+this.type+": '"+t+"' is not a property of this material.");continue}r&&r.isColor?r.set(i):r&&r.isVector3&&i&&i.isVector3?r.copy(i):this[t]=i}}toJSON(e){const t=e===void 0||typeof e=="string";t&&(e={textures:{},images:{}});const i={metadata:{version:4.5,type:"Material",generator:"Material.toJSON"}};i.uuid=this.uuid,i.type=this.type,this.name!==""&&(i.name=this.name),this.color&&this.color.isColor&&(i.color=this.color.getHex()),this.roughness!==void 0&&(i.roughness=this.roughness),this.metalness!==void 0&&(i.metalness=this.metalness),this.sheen!==void 0&&(i.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(i.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(i.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(i.emissive=this.emissive.getHex()),this.emissiveIntensity&&this.emissiveIntensity!==1&&(i.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(i.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(i.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(i.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(i.shininess=this.shininess),this.clearcoat!==void 0&&(i.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(i.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(i.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(i.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(i.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,i.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.iridescence!==void 0&&(i.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(i.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(i.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(i.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(i.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(i.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(i.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(i.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(i.lightMap=this.lightMap.toJSON(e).uuid,i.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(i.aoMap=this.aoMap.toJSON(e).uuid,i.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(i.bumpMap=this.bumpMap.toJSON(e).uuid,i.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(i.normalMap=this.normalMap.toJSON(e).uuid,i.normalMapType=this.normalMapType,i.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(i.displacementMap=this.displacementMap.toJSON(e).uuid,i.displacementScale=this.displacementScale,i.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(i.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(i.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(i.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(i.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(i.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(i.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(i.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(i.combine=this.combine)),this.envMapIntensity!==void 0&&(i.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(i.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(i.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(i.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(i.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(i.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(i.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(i.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&(i.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(i.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(i.size=this.size),this.shadowSide!==null&&(i.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(i.sizeAttenuation=this.sizeAttenuation),this.blending!==Vo&&(i.blending=this.blending),this.side!==Bo&&(i.side=this.side),this.vertexColors&&(i.vertexColors=!0),this.opacity<1&&(i.opacity=this.opacity),this.transparent===!0&&(i.transparent=this.transparent),i.depthFunc=this.depthFunc,i.depthTest=this.depthTest,i.depthWrite=this.depthWrite,i.colorWrite=this.colorWrite,i.stencilWrite=this.stencilWrite,i.stencilWriteMask=this.stencilWriteMask,i.stencilFunc=this.stencilFunc,i.stencilRef=this.stencilRef,i.stencilFuncMask=this.stencilFuncMask,i.stencilFail=this.stencilFail,i.stencilZFail=this.stencilZFail,i.stencilZPass=this.stencilZPass,this.rotation!==void 0&&this.rotation!==0&&(i.rotation=this.rotation),this.polygonOffset===!0&&(i.polygonOffset=!0),this.polygonOffsetFactor!==0&&(i.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(i.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(i.linewidth=this.linewidth),this.dashSize!==void 0&&(i.dashSize=this.dashSize),this.gapSize!==void 0&&(i.gapSize=this.gapSize),this.scale!==void 0&&(i.scale=this.scale),this.dithering===!0&&(i.dithering=!0),this.alphaTest>0&&(i.alphaTest=this.alphaTest),this.alphaToCoverage===!0&&(i.alphaToCoverage=this.alphaToCoverage),this.premultipliedAlpha===!0&&(i.premultipliedAlpha=this.premultipliedAlpha),this.wireframe===!0&&(i.wireframe=this.wireframe),this.wireframeLinewidth>1&&(i.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(i.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(i.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(i.flatShading=this.flatShading),this.visible===!1&&(i.visible=!1),this.toneMapped===!1&&(i.toneMapped=!1),this.fog===!1&&(i.fog=!1),JSON.stringify(this.userData)!=="{}"&&(i.userData=this.userData);function r(s){const o=[];for(const l in s){const c=s[l];delete c.metadata,o.push(c)}return o}if(t){const s=r(e.textures),o=r(e.images);s.length>0&&(i.textures=s),o.length>0&&(i.images=o)}return i}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;const t=e.clippingPlanes;let i=null;if(t!==null){const r=t.length;i=new Array(r);for(let s=0;s!==r;++s)i[s]=t[s].clone()}return this.clippingPlanes=i,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){e===!0&&this.version++}}class eo extends Pn{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new De(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=Wu,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}const cn=new R,Yd=new fe;class It{constructor(e,t,i){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=i===!0,this.usage=Qu,this.updateRange={offset:0,count:-1},this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this}copyAt(e,t,i){e*=this.itemSize,i*=t.itemSize;for(let r=0,s=this.itemSize;r<s;r++)this.array[e+r]=t.array[i+r];return this}copyArray(e){return this.array.set(e),this}applyMatrix3(e){if(this.itemSize===2)for(let t=0,i=this.count;t<i;t++)Yd.fromBufferAttribute(this,t),Yd.applyMatrix3(e),this.setXY(t,Yd.x,Yd.y);else if(this.itemSize===3)for(let t=0,i=this.count;t<i;t++)cn.fromBufferAttribute(this,t),cn.applyMatrix3(e),this.setXYZ(t,cn.x,cn.y,cn.z);return this}applyMatrix4(e){for(let t=0,i=this.count;t<i;t++)cn.fromBufferAttribute(this,t),cn.applyMatrix4(e),this.setXYZ(t,cn.x,cn.y,cn.z);return this}applyNormalMatrix(e){for(let t=0,i=this.count;t<i;t++)cn.fromBufferAttribute(this,t),cn.applyNormalMatrix(e),this.setXYZ(t,cn.x,cn.y,cn.z);return this}transformDirection(e){for(let t=0,i=this.count;t<i;t++)cn.fromBufferAttribute(this,t),cn.transformDirection(e),this.setXYZ(t,cn.x,cn.y,cn.z);return this}set(e,t=0){return this.array.set(e,t),this}getX(e){let t=this.array[e*this.itemSize];return this.normalized&&(t=ns(t,this.array)),t}setX(e,t){return this.normalized&&(t=Rt(t,this.array)),this.array[e*this.itemSize]=t,this}getY(e){let t=this.array[e*this.itemSize+1];return this.normalized&&(t=ns(t,this.array)),t}setY(e,t){return this.normalized&&(t=Rt(t,this.array)),this.array[e*this.itemSize+1]=t,this}getZ(e){let t=this.array[e*this.itemSize+2];return this.normalized&&(t=ns(t,this.array)),t}setZ(e,t){return this.normalized&&(t=Rt(t,this.array)),this.array[e*this.itemSize+2]=t,this}getW(e){let t=this.array[e*this.itemSize+3];return this.normalized&&(t=ns(t,this.array)),t}setW(e,t){return this.normalized&&(t=Rt(t,this.array)),this.array[e*this.itemSize+3]=t,this}setXY(e,t,i){return e*=this.itemSize,this.normalized&&(t=Rt(t,this.array),i=Rt(i,this.array)),this.array[e+0]=t,this.array[e+1]=i,this}setXYZ(e,t,i,r){return e*=this.itemSize,this.normalized&&(t=Rt(t,this.array),i=Rt(i,this.array),r=Rt(r,this.array)),this.array[e+0]=t,this.array[e+1]=i,this.array[e+2]=r,this}setXYZW(e,t,i,r,s){return e*=this.itemSize,this.normalized&&(t=Rt(t,this.array),i=Rt(i,this.array),r=Rt(r,this.array),s=Rt(s,this.array)),this.array[e+0]=t,this.array[e+1]=i,this.array[e+2]=r,this.array[e+3]=s,this}onUpload(e){return this.onUploadCallback=e,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){const e={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return this.name!==""&&(e.name=this.name),this.usage!==Qu&&(e.usage=this.usage),(this.updateRange.offset!==0||this.updateRange.count!==-1)&&(e.updateRange=this.updateRange),e}copyColorsArray(){console.error("THREE.BufferAttribute: copyColorsArray() was removed in r144.")}copyVector2sArray(){console.error("THREE.BufferAttribute: copyVector2sArray() was removed in r144.")}copyVector3sArray(){console.error("THREE.BufferAttribute: copyVector3sArray() was removed in r144.")}copyVector4sArray(){console.error("THREE.BufferAttribute: copyVector4sArray() was removed in r144.")}}class KC extends It{constructor(e,t,i){super(new Int8Array(e),t,i)}}class $C extends It{constructor(e,t,i){super(new Uint8Array(e),t,i)}}class eP extends It{constructor(e,t,i){super(new Uint8ClampedArray(e),t,i)}}class tP extends It{constructor(e,t,i){super(new Int16Array(e),t,i)}}class rv extends It{constructor(e,t,i){super(new Uint16Array(e),t,i)}}class nP extends It{constructor(e,t,i){super(new Int32Array(e),t,i)}}class sv extends It{constructor(e,t,i){super(new Uint32Array(e),t,i)}}class iP extends It{constructor(e,t,i){super(new Uint16Array(e),t,i),this.isFloat16BufferAttribute=!0}}class Fe extends It{constructor(e,t,i){super(new Float32Array(e),t,i)}}class rP extends It{constructor(e,t,i){super(new Float64Array(e),t,i)}}let sP=0;const Hi=new st,ov=new Mt,ml=new R,Ti=new Cr,sc=new Cr,_n=new R;class lt extends Ar{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:sP++}),this.uuid=Mi(),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={}}getIndex(){return this.index}setIndex(e){return Array.isArray(e)?this.index=new(ZS(e)?sv:rv)(e,1):this.index=e,this}getAttribute(e){return this.attributes[e]}setAttribute(e,t){return this.attributes[e]=t,this}deleteAttribute(e){return delete this.attributes[e],this}hasAttribute(e){return this.attributes[e]!==void 0}addGroup(e,t,i=0){this.groups.push({start:e,count:t,materialIndex:i})}clearGroups(){this.groups=[]}setDrawRange(e,t){this.drawRange.start=e,this.drawRange.count=t}applyMatrix4(e){const t=this.attributes.position;t!==void 0&&(t.applyMatrix4(e),t.needsUpdate=!0);const i=this.attributes.normal;if(i!==void 0){const s=new ui().getNormalMatrix(e);i.applyNormalMatrix(s),i.needsUpdate=!0}const r=this.attributes.tangent;return r!==void 0&&(r.transformDirection(e),r.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}applyQuaternion(e){return Hi.makeRotationFromQuaternion(e),this.applyMatrix4(Hi),this}rotateX(e){return Hi.makeRotationX(e),this.applyMatrix4(Hi),this}rotateY(e){return Hi.makeRotationY(e),this.applyMatrix4(Hi),this}rotateZ(e){return Hi.makeRotationZ(e),this.applyMatrix4(Hi),this}translate(e,t,i){return Hi.makeTranslation(e,t,i),this.applyMatrix4(Hi),this}scale(e,t,i){return Hi.makeScale(e,t,i),this.applyMatrix4(Hi),this}lookAt(e){return ov.lookAt(e),ov.updateMatrix(),this.applyMatrix4(ov.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(ml).negate(),this.translate(ml.x,ml.y,ml.z),this}setFromPoints(e){const t=[];for(let i=0,r=e.length;i<r;i++){const s=e[i];t.push(s.x,s.y,s.z||0)}return this.setAttribute("position",new Fe(t,3)),this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new Cr);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){console.error('THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box. Alternatively set "mesh.frustumCulled" to "false".',this),this.boundingBox.set(new R(-1/0,-1/0,-1/0),new R(1/0,1/0,1/0));return}if(e!==void 0){if(this.boundingBox.setFromBufferAttribute(e),t)for(let i=0,r=t.length;i<r;i++){const s=t[i];Ti.setFromBufferAttribute(s),this.morphTargetsRelative?(_n.addVectors(this.boundingBox.min,Ti.min),this.boundingBox.expandByPoint(_n),_n.addVectors(this.boundingBox.max,Ti.max),this.boundingBox.expandByPoint(_n)):(this.boundingBox.expandByPoint(Ti.min),this.boundingBox.expandByPoint(Ti.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(){this.boundingSphere===null&&(this.boundingSphere=new rs);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){console.error('THREE.BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere. Alternatively set "mesh.frustumCulled" to "false".',this),this.boundingSphere.set(new R,1/0);return}if(e){const i=this.boundingSphere.center;if(Ti.setFromBufferAttribute(e),t)for(let s=0,o=t.length;s<o;s++){const l=t[s];sc.setFromBufferAttribute(l),this.morphTargetsRelative?(_n.addVectors(Ti.min,sc.min),Ti.expandByPoint(_n),_n.addVectors(Ti.max,sc.max),Ti.expandByPoint(_n)):(Ti.expandByPoint(sc.min),Ti.expandByPoint(sc.max))}Ti.getCenter(i);let r=0;for(let s=0,o=e.count;s<o;s++)_n.fromBufferAttribute(e,s),r=Math.max(r,i.distanceToSquared(_n));if(t)for(let s=0,o=t.length;s<o;s++){const l=t[s],c=this.morphTargetsRelative;for(let f=0,d=l.count;f<d;f++)_n.fromBufferAttribute(l,f),c&&(ml.fromBufferAttribute(e,f),_n.add(ml)),r=Math.max(r,i.distanceToSquared(_n))}this.boundingSphere.radius=Math.sqrt(r),isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeTangents(){const e=this.index,t=this.attributes;if(e===null||t.position===void 0||t.normal===void 0||t.uv===void 0){console.error("THREE.BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");return}const i=e.array,r=t.position.array,s=t.normal.array,o=t.uv.array,l=r.length/3;this.hasAttribute("tangent")===!1&&this.setAttribute("tangent",new It(new Float32Array(4*l),4));const c=this.getAttribute("tangent").array,f=[],d=[];for(let z=0;z<l;z++)f[z]=new R,d[z]=new R;const h=new R,m=new R,g=new R,x=new fe,y=new fe,w=new fe,_=new R,S=new R;function E(z,j,ue){h.fromArray(r,z*3),m.fromArray(r,j*3),g.fromArray(r,ue*3),x.fromArray(o,z*2),y.fromArray(o,j*2),w.fromArray(o,ue*2),m.sub(h),g.sub(h),y.sub(x),w.sub(x);const Z=1/(y.x*w.y-w.x*y.y);!isFinite(Z)||(_.copy(m).multiplyScalar(w.y).addScaledVector(g,-y.y).multiplyScalar(Z),S.copy(g).multiplyScalar(y.x).addScaledVector(m,-w.x).multiplyScalar(Z),f[z].add(_),f[j].add(_),f[ue].add(_),d[z].add(S),d[j].add(S),d[ue].add(S))}let T=this.groups;T.length===0&&(T=[{start:0,count:i.length}]);for(let z=0,j=T.length;z<j;++z){const ue=T[z],Z=ue.start,G=ue.count;for(let ie=Z,ee=Z+G;ie<ee;ie+=3)E(i[ie+0],i[ie+1],i[ie+2])}const C=new R,P=new R,I=new R,A=new R;function L(z){I.fromArray(s,z*3),A.copy(I);const j=f[z];C.copy(j),C.sub(I.multiplyScalar(I.dot(j))).normalize(),P.crossVectors(A,j);const Z=P.dot(d[z])<0?-1:1;c[z*4]=C.x,c[z*4+1]=C.y,c[z*4+2]=C.z,c[z*4+3]=Z}for(let z=0,j=T.length;z<j;++z){const ue=T[z],Z=ue.start,G=ue.count;for(let ie=Z,ee=Z+G;ie<ee;ie+=3)L(i[ie+0]),L(i[ie+1]),L(i[ie+2])}}computeVertexNormals(){const e=this.index,t=this.getAttribute("position");if(t!==void 0){let i=this.getAttribute("normal");if(i===void 0)i=new It(new Float32Array(t.count*3),3),this.setAttribute("normal",i);else for(let m=0,g=i.count;m<g;m++)i.setXYZ(m,0,0,0);const r=new R,s=new R,o=new R,l=new R,c=new R,f=new R,d=new R,h=new R;if(e)for(let m=0,g=e.count;m<g;m+=3){const x=e.getX(m+0),y=e.getX(m+1),w=e.getX(m+2);r.fromBufferAttribute(t,x),s.fromBufferAttribute(t,y),o.fromBufferAttribute(t,w),d.subVectors(o,s),h.subVectors(r,s),d.cross(h),l.fromBufferAttribute(i,x),c.fromBufferAttribute(i,y),f.fromBufferAttribute(i,w),l.add(d),c.add(d),f.add(d),i.setXYZ(x,l.x,l.y,l.z),i.setXYZ(y,c.x,c.y,c.z),i.setXYZ(w,f.x,f.y,f.z)}else for(let m=0,g=t.count;m<g;m+=3)r.fromBufferAttribute(t,m+0),s.fromBufferAttribute(t,m+1),o.fromBufferAttribute(t,m+2),d.subVectors(o,s),h.subVectors(r,s),d.cross(h),i.setXYZ(m+0,d.x,d.y,d.z),i.setXYZ(m+1,d.x,d.y,d.z),i.setXYZ(m+2,d.x,d.y,d.z);this.normalizeNormals(),i.needsUpdate=!0}}merge(){return console.error("THREE.BufferGeometry.merge() has been removed. Use THREE.BufferGeometryUtils.mergeBufferGeometries() instead."),this}normalizeNormals(){const e=this.attributes.normal;for(let t=0,i=e.count;t<i;t++)_n.fromBufferAttribute(e,t),_n.normalize(),e.setXYZ(t,_n.x,_n.y,_n.z)}toNonIndexed(){function e(l,c){const f=l.array,d=l.itemSize,h=l.normalized,m=new f.constructor(c.length*d);let g=0,x=0;for(let y=0,w=c.length;y<w;y++){l.isInterleavedBufferAttribute?g=c[y]*l.data.stride+l.offset:g=c[y]*d;for(let _=0;_<d;_++)m[x++]=f[g++]}return new It(m,d,h)}if(this.index===null)return console.warn("THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;const t=new lt,i=this.index.array,r=this.attributes;for(const l in r){const c=r[l],f=e(c,i);t.setAttribute(l,f)}const s=this.morphAttributes;for(const l in s){const c=[],f=s[l];for(let d=0,h=f.length;d<h;d++){const m=f[d],g=e(m,i);c.push(g)}t.morphAttributes[l]=c}t.morphTargetsRelative=this.morphTargetsRelative;const o=this.groups;for(let l=0,c=o.length;l<c;l++){const f=o[l];t.addGroup(f.start,f.count,f.materialIndex)}return t}toJSON(){const e={metadata:{version:4.5,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(e.uuid=this.uuid,e.type=this.type,this.name!==""&&(e.name=this.name),Object.keys(this.userData).length>0&&(e.userData=this.userData),this.parameters!==void 0){const c=this.parameters;for(const f in c)c[f]!==void 0&&(e[f]=c[f]);return e}e.data={attributes:{}};const t=this.index;t!==null&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});const i=this.attributes;for(const c in i){const f=i[c];e.data.attributes[c]=f.toJSON(e.data)}const r={};let s=!1;for(const c in this.morphAttributes){const f=this.morphAttributes[c],d=[];for(let h=0,m=f.length;h<m;h++){const g=f[h];d.push(g.toJSON(e.data))}d.length>0&&(r[c]=d,s=!0)}s&&(e.data.morphAttributes=r,e.data.morphTargetsRelative=this.morphTargetsRelative);const o=this.groups;o.length>0&&(e.data.groups=JSON.parse(JSON.stringify(o)));const l=this.boundingSphere;return l!==null&&(e.data.boundingSphere={center:l.center.toArray(),radius:l.radius}),e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const t={};this.name=e.name;const i=e.index;i!==null&&this.setIndex(i.clone(t));const r=e.attributes;for(const f in r){const d=r[f];this.setAttribute(f,d.clone(t))}const s=e.morphAttributes;for(const f in s){const d=[],h=s[f];for(let m=0,g=h.length;m<g;m++)d.push(h[m].clone(t));this.morphAttributes[f]=d}this.morphTargetsRelative=e.morphTargetsRelative;const o=e.groups;for(let f=0,d=o.length;f<d;f++){const h=o[f];this.addGroup(h.start,h.count,h.materialIndex)}const l=e.boundingBox;l!==null&&(this.boundingBox=l.clone());const c=e.boundingSphere;return c!==null&&(this.boundingSphere=c.clone()),this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,e.parameters!==void 0&&(this.parameters=Object.assign({},e.parameters)),this}dispose(){this.dispatchEvent({type:"dispose"})}}const aM=new st,gl=new ic,av=new rs,to=new R,no=new R,io=new R,lv=new R,uv=new R,cv=new R,qd=new R,Zd=new R,Jd=new R,Qd=new fe,Kd=new fe,$d=new fe,fv=new R,eh=new R;class wn extends Mt{constructor(e=new lt,t=new eo){super(),this.isMesh=!0,this.type="Mesh",this.geometry=e,this.material=t,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),e.morphTargetInfluences!==void 0&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),e.morphTargetDictionary!==void 0&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this.material=e.material,this.geometry=e.geometry,this}updateMorphTargets(){const t=this.geometry.morphAttributes,i=Object.keys(t);if(i.length>0){const r=t[i[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=r.length;s<o;s++){const l=r[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[l]=s}}}}raycast(e,t){const i=this.geometry,r=this.material,s=this.matrixWorld;if(r===void 0||(i.boundingSphere===null&&i.computeBoundingSphere(),av.copy(i.boundingSphere),av.applyMatrix4(s),e.ray.intersectsSphere(av)===!1)||(aM.copy(s).invert(),gl.copy(e.ray).applyMatrix4(aM),i.boundingBox!==null&&gl.intersectsBox(i.boundingBox)===!1))return;let o;const l=i.index,c=i.attributes.position,f=i.morphAttributes.position,d=i.morphTargetsRelative,h=i.attributes.uv,m=i.attributes.uv2,g=i.groups,x=i.drawRange;if(l!==null)if(Array.isArray(r))for(let y=0,w=g.length;y<w;y++){const _=g[y],S=r[_.materialIndex],E=Math.max(_.start,x.start),T=Math.min(l.count,Math.min(_.start+_.count,x.start+x.count));for(let C=E,P=T;C<P;C+=3){const I=l.getX(C),A=l.getX(C+1),L=l.getX(C+2);o=th(this,S,e,gl,c,f,d,h,m,I,A,L),o&&(o.faceIndex=Math.floor(C/3),o.face.materialIndex=_.materialIndex,t.push(o))}}else{const y=Math.max(0,x.start),w=Math.min(l.count,x.start+x.count);for(let _=y,S=w;_<S;_+=3){const E=l.getX(_),T=l.getX(_+1),C=l.getX(_+2);o=th(this,r,e,gl,c,f,d,h,m,E,T,C),o&&(o.faceIndex=Math.floor(_/3),t.push(o))}}else if(c!==void 0)if(Array.isArray(r))for(let y=0,w=g.length;y<w;y++){const _=g[y],S=r[_.materialIndex],E=Math.max(_.start,x.start),T=Math.min(c.count,Math.min(_.start+_.count,x.start+x.count));for(let C=E,P=T;C<P;C+=3){const I=C,A=C+1,L=C+2;o=th(this,S,e,gl,c,f,d,h,m,I,A,L),o&&(o.faceIndex=Math.floor(C/3),o.face.materialIndex=_.materialIndex,t.push(o))}}else{const y=Math.max(0,x.start),w=Math.min(c.count,x.start+x.count);for(let _=y,S=w;_<S;_+=3){const E=_,T=_+1,C=_+2;o=th(this,r,e,gl,c,f,d,h,m,E,T,C),o&&(o.faceIndex=Math.floor(_/3),t.push(o))}}}}function oP(n,e,t,i,r,s,o,l){let c;if(e.side===Si?c=i.intersectTriangle(o,s,r,!0,l):c=i.intersectTriangle(r,s,o,e.side!==Kr,l),c===null)return null;eh.copy(l),eh.applyMatrix4(n.matrixWorld);const f=t.ray.origin.distanceTo(eh);return f<t.near||f>t.far?null:{distance:f,point:eh.clone(),object:n}}function th(n,e,t,i,r,s,o,l,c,f,d,h){to.fromBufferAttribute(r,f),no.fromBufferAttribute(r,d),io.fromBufferAttribute(r,h);const m=n.morphTargetInfluences;if(s&&m){qd.set(0,0,0),Zd.set(0,0,0),Jd.set(0,0,0);for(let x=0,y=s.length;x<y;x++){const w=m[x],_=s[x];w!==0&&(lv.fromBufferAttribute(_,f),uv.fromBufferAttribute(_,d),cv.fromBufferAttribute(_,h),o?(qd.addScaledVector(lv,w),Zd.addScaledVector(uv,w),Jd.addScaledVector(cv,w)):(qd.addScaledVector(lv.sub(to),w),Zd.addScaledVector(uv.sub(no),w),Jd.addScaledVector(cv.sub(io),w)))}to.add(qd),no.add(Zd),io.add(Jd)}n.isSkinnedMesh&&(n.boneTransform(f,to),n.boneTransform(d,no),n.boneTransform(h,io));const g=oP(n,e,t,i,to,no,io,fv);if(g){l&&(Qd.fromBufferAttribute(l,f),Kd.fromBufferAttribute(l,d),$d.fromBufferAttribute(l,h),g.uv=Vi.getUV(fv,to,no,io,Qd,Kd,$d,new fe)),c&&(Qd.fromBufferAttribute(c,f),Kd.fromBufferAttribute(c,d),$d.fromBufferAttribute(c,h),g.uv2=Vi.getUV(fv,to,no,io,Qd,Kd,$d,new fe));const x={a:f,b:d,c:h,normal:new R,materialIndex:0};Vi.getNormal(to,no,io,x.normal),g.face=x}return g}class ro extends lt{constructor(e=1,t=1,i=1,r=1,s=1,o=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:i,widthSegments:r,heightSegments:s,depthSegments:o};const l=this;r=Math.floor(r),s=Math.floor(s),o=Math.floor(o);const c=[],f=[],d=[],h=[];let m=0,g=0;x("z","y","x",-1,-1,i,t,e,o,s,0),x("z","y","x",1,-1,i,t,-e,o,s,1),x("x","z","y",1,1,e,i,t,r,o,2),x("x","z","y",1,-1,e,i,-t,r,o,3),x("x","y","z",1,-1,e,t,i,r,s,4),x("x","y","z",-1,-1,e,t,-i,r,s,5),this.setIndex(c),this.setAttribute("position",new Fe(f,3)),this.setAttribute("normal",new Fe(d,3)),this.setAttribute("uv",new Fe(h,2));function x(y,w,_,S,E,T,C,P,I,A,L){const z=T/I,j=C/A,ue=T/2,Z=C/2,G=P/2,ie=I+1,ee=A+1;let pe=0,k=0;const B=new R;for(let F=0;F<ee;F++){const $=F*j-Z;for(let J=0;J<ie;J++){const me=J*z-ue;B[y]=me*S,B[w]=$*E,B[_]=G,f.push(B.x,B.y,B.z),B[y]=0,B[w]=0,B[_]=P>0?1:-1,d.push(B.x,B.y,B.z),h.push(J/I),h.push(1-F/A),pe+=1}}for(let F=0;F<A;F++)for(let $=0;$<I;$++){const J=m+$+ie*F,me=m+$+ie*(F+1),Me=m+($+1)+ie*(F+1),Ve=m+($+1)+ie*F;c.push(J,me,Ve),c.push(me,Me,Ve),k+=6}l.addGroup(g,k,L),g+=k,m+=pe}}static fromJSON(e){return new ro(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}}function vl(n){const e={};for(const t in n){e[t]={};for(const i in n[t]){const r=n[t][i];r&&(r.isColor||r.isMatrix3||r.isMatrix4||r.isVector2||r.isVector3||r.isVector4||r.isTexture||r.isQuaternion)?e[t][i]=r.clone():Array.isArray(r)?e[t][i]=r.slice():e[t][i]=r}}return e}function Un(n){const e={};for(let t=0;t<n.length;t++){const i=vl(n[t]);for(const r in i)e[r]=i[r]}return e}function aP(n){const e=[];for(let t=0;t<n.length;t++)e.push(n[t].clone());return e}const nh={clone:vl,merge:Un};var lP=`void main() {
	gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
}`,uP=`void main() {
	gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );
}`;class pr extends Pn{constructor(e){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=lP,this.fragmentShader=uP,this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!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,e!==void 0&&this.setValues(e)}copy(e){return super.copy(e),this.fragmentShader=e.fragmentShader,this.vertexShader=e.vertexShader,this.uniforms=vl(e.uniforms),this.uniformsGroups=aP(e.uniformsGroups),this.defines=Object.assign({},e.defines),this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.fog=e.fog,this.lights=e.lights,this.clipping=e.clipping,this.extensions=Object.assign({},e.extensions),this.glslVersion=e.glslVersion,this}toJSON(e){const t=super.toJSON(e);t.glslVersion=this.glslVersion,t.uniforms={};for(const r in this.uniforms){const o=this.uniforms[r].value;o&&o.isTexture?t.uniforms[r]={type:"t",value:o.toJSON(e).uuid}:o&&o.isColor?t.uniforms[r]={type:"c",value:o.getHex()}:o&&o.isVector2?t.uniforms[r]={type:"v2",value:o.toArray()}:o&&o.isVector3?t.uniforms[r]={type:"v3",value:o.toArray()}:o&&o.isVector4?t.uniforms[r]={type:"v4",value:o.toArray()}:o&&o.isMatrix3?t.uniforms[r]={type:"m3",value:o.toArray()}:o&&o.isMatrix4?t.uniforms[r]={type:"m4",value:o.toArray()}:t.uniforms[r]={value:o}}Object.keys(this.defines).length>0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader;const i={};for(const r in this.extensions)this.extensions[r]===!0&&(i[r]=!0);return Object.keys(i).length>0&&(t.extensions=i),t}}class oc extends Mt{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new st,this.projectionMatrix=new st,this.projectionMatrixInverse=new st}copy(e,t){return super.copy(e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this}getWorldDirection(e){this.updateWorldMatrix(!0,!1);const t=this.matrixWorld.elements;return e.set(-t[8],-t[9],-t[10]).normalize()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(e,t){super.updateWorldMatrix(e,t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return new this.constructor().copy(this)}}class Bt extends oc{constructor(e=50,t=1,i=.1,r=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=i,this.far=r,this.focus=10,this.aspect=t,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=e.view===null?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this}setFocalLength(e){const t=.5*this.getFilmHeight()/e;this.fov=Ku*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(qo*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return Ku*2*Math.atan(Math.tan(qo*.5*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}setViewOffset(e,t,i,r,s,o){this.aspect=e/t,this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=i,this.view.offsetY=r,this.view.width=s,this.view.height=o,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=this.near;let t=e*Math.tan(qo*.5*this.fov)/this.zoom,i=2*t,r=this.aspect*i,s=-.5*r;const o=this.view;if(this.view!==null&&this.view.enabled){const c=o.fullWidth,f=o.fullHeight;s+=o.offsetX*r/c,t-=o.offsetY*i/f,r*=o.width/c,i*=o.height/f}const l=this.filmOffset;l!==0&&(s+=e*l/this.getFilmWidth()),this.projectionMatrix.makePerspective(s,s+r,t,t-i,e,this.far),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.fov=this.fov,t.object.zoom=this.zoom,t.object.near=this.near,t.object.far=this.far,t.object.focus=this.focus,t.object.aspect=this.aspect,this.view!==null&&(t.object.view=Object.assign({},this.view)),t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}}const yl=90,xl=1;class lM extends Mt{constructor(e,t,i){super(),this.type="CubeCamera",this.renderTarget=i;const r=new Bt(yl,xl,e,t);r.layers=this.layers,r.up.set(0,-1,0),r.lookAt(new R(1,0,0)),this.add(r);const s=new Bt(yl,xl,e,t);s.layers=this.layers,s.up.set(0,-1,0),s.lookAt(new R(-1,0,0)),this.add(s);const o=new Bt(yl,xl,e,t);o.layers=this.layers,o.up.set(0,0,1),o.lookAt(new R(0,1,0)),this.add(o);const l=new Bt(yl,xl,e,t);l.layers=this.layers,l.up.set(0,0,-1),l.lookAt(new R(0,-1,0)),this.add(l);const c=new Bt(yl,xl,e,t);c.layers=this.layers,c.up.set(0,-1,0),c.lookAt(new R(0,0,1)),this.add(c);const f=new Bt(yl,xl,e,t);f.layers=this.layers,f.up.set(0,-1,0),f.lookAt(new R(0,0,-1)),this.add(f)}update(e,t){this.parent===null&&this.updateMatrixWorld();const i=this.renderTarget,[r,s,o,l,c,f]=this.children,d=e.getRenderTarget(),h=e.toneMapping,m=e.xr.enabled;e.toneMapping=cr,e.xr.enabled=!1;const g=i.texture.generateMipmaps;i.texture.generateMipmaps=!1,e.setRenderTarget(i,0),e.render(t,r),e.setRenderTarget(i,1),e.render(t,s),e.setRenderTarget(i,2),e.render(t,o),e.setRenderTarget(i,3),e.render(t,l),e.setRenderTarget(i,4),e.render(t,c),i.texture.generateMipmaps=g,e.setRenderTarget(i,5),e.render(t,f),e.setRenderTarget(d),e.toneMapping=h,e.xr.enabled=m,i.texture.needsPMREMUpdate=!0}}class ac extends un{constructor(e,t,i,r,s,o,l,c,f,d){e=e!==void 0?e:[],t=t!==void 0?t:Ws,super(e,t,i,r,s,o,l,c,f,d),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class uM extends Bi{constructor(e,t={}){super(e,e,t),this.isWebGLCubeRenderTarget=!0;const i={width:e,height:e,depth:1},r=[i,i,i,i,i,i];this.texture=new ac(r,t.mapping,t.wrapS,t.wrapT,t.magFilter,t.minFilter,t.format,t.type,t.anisotropy,t.encoding),this.texture.isRenderTargetTexture=!0,this.texture.generateMipmaps=t.generateMipmaps!==void 0?t.generateMipmaps:!1,this.texture.minFilter=t.minFilter!==void 0?t.minFilter:tn}fromEquirectangularTexture(e,t){this.texture.type=t.type,this.texture.encoding=t.encoding,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;const i={uniforms:{tEquirect:{value:null}},vertexShader:`

				varying vec3 vWorldDirection;

				vec3 transformDirection( in vec3 dir, in mat4 matrix ) {

					return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );

				}

				void main() {

					vWorldDirection = transformDirection( position, modelMatrix );

					#include <begin_vertex>
					#include <project_vertex>

				}
			`,fragmentShader:`

				uniform sampler2D tEquirect;

				varying vec3 vWorldDirection;

				#include <common>

				void main() {

					vec3 direction = normalize( vWorldDirection );

					vec2 sampleUV = equirectUv( direction );

					gl_FragColor = texture2D( tEquirect, sampleUV );

				}
			`},r=new ro(5,5,5),s=new pr({name:"CubemapFromEquirect",uniforms:vl(i.uniforms),vertexShader:i.vertexShader,fragmentShader:i.fragmentShader,side:Si,blending:$r});s.uniforms.tEquirect.value=t;const o=new wn(r,s),l=t.minFilter;return t.minFilter===Wo&&(t.minFilter=tn),new lM(1,10,this).update(e,o),t.minFilter=l,o.geometry.dispose(),o.material.dispose(),this}clear(e,t,i,r){const s=e.getRenderTarget();for(let o=0;o<6;o++)e.setRenderTarget(this,o),e.clear(t,i,r);e.setRenderTarget(s)}}const dv=new R,cP=new R,fP=new ui;class so{constructor(e=new R(1,0,0),t=0){this.isPlane=!0,this.normal=e,this.constant=t}set(e,t){return this.normal.copy(e),this.constant=t,this}setComponents(e,t,i,r){return this.normal.set(e,t,i),this.constant=r,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}setFromCoplanarPoints(e,t,i){const r=dv.subVectors(i,t).cross(cP.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(r,e),this}copy(e){return this.normal.copy(e.normal),this.constant=e.constant,this}normalize(){const e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(e){return this.normal.dot(e)+this.constant}distanceToSphere(e){return this.distanceToPoint(e.center)-e.radius}projectPoint(e,t){return t.copy(this.normal).multiplyScalar(-this.distanceToPoint(e)).add(e)}intersectLine(e,t){const i=e.delta(dv),r=this.normal.dot(i);if(r===0)return this.distanceToPoint(e.start)===0?t.copy(e.start):null;const s=-(e.start.dot(this.normal)+this.constant)/r;return s<0||s>1?null:t.copy(i).multiplyScalar(s).add(e.start)}intersectsLine(e){const t=this.distanceToPoint(e.start),i=this.distanceToPoint(e.end);return t<0&&i>0||i<0&&t>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,t){const i=t||fP.getNormalMatrix(e),r=this.coplanarPoint(dv).applyMatrix4(e),s=this.normal.applyMatrix3(i).normalize();return this.constant=-r.dot(s),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return new this.constructor().copy(this)}}const _l=new rs,ih=new R;class rh{constructor(e=new so,t=new so,i=new so,r=new so,s=new so,o=new so){this.planes=[e,t,i,r,s,o]}set(e,t,i,r,s,o){const l=this.planes;return l[0].copy(e),l[1].copy(t),l[2].copy(i),l[3].copy(r),l[4].copy(s),l[5].copy(o),this}copy(e){const t=this.planes;for(let i=0;i<6;i++)t[i].copy(e.planes[i]);return this}setFromProjectionMatrix(e){const t=this.planes,i=e.elements,r=i[0],s=i[1],o=i[2],l=i[3],c=i[4],f=i[5],d=i[6],h=i[7],m=i[8],g=i[9],x=i[10],y=i[11],w=i[12],_=i[13],S=i[14],E=i[15];return t[0].setComponents(l-r,h-c,y-m,E-w).normalize(),t[1].setComponents(l+r,h+c,y+m,E+w).normalize(),t[2].setComponents(l+s,h+f,y+g,E+_).normalize(),t[3].setComponents(l-s,h-f,y-g,E-_).normalize(),t[4].setComponents(l-o,h-d,y-x,E-S).normalize(),t[5].setComponents(l+o,h+d,y+x,E+S).normalize(),this}intersectsObject(e){const t=e.geometry;return t.boundingSphere===null&&t.computeBoundingSphere(),_l.copy(t.boundingSphere).applyMatrix4(e.matrixWorld),this.intersectsSphere(_l)}intersectsSprite(e){return _l.center.set(0,0,0),_l.radius=.7071067811865476,_l.applyMatrix4(e.matrixWorld),this.intersectsSphere(_l)}intersectsSphere(e){const t=this.planes,i=e.center,r=-e.radius;for(let s=0;s<6;s++)if(t[s].distanceToPoint(i)<r)return!1;return!0}intersectsBox(e){const t=this.planes;for(let i=0;i<6;i++){const r=t[i];if(ih.x=r.normal.x>0?e.max.x:e.min.x,ih.y=r.normal.y>0?e.max.y:e.min.y,ih.z=r.normal.z>0?e.max.z:e.min.z,r.distanceToPoint(ih)<0)return!1}return!0}containsPoint(e){const t=this.planes;for(let i=0;i<6;i++)if(t[i].distanceToPoint(e)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}}function cM(){let n=null,e=!1,t=null,i=null;function r(s,o){t(s,o),i=n.requestAnimationFrame(r)}return{start:function(){e!==!0&&t!==null&&(i=n.requestAnimationFrame(r),e=!0)},stop:function(){n.cancelAnimationFrame(i),e=!1},setAnimationLoop:function(s){t=s},setContext:function(s){n=s}}}function dP(n,e){const t=e.isWebGL2,i=new WeakMap;function r(f,d){const h=f.array,m=f.usage,g=n.createBuffer();n.bindBuffer(d,g),n.bufferData(d,h,m),f.onUploadCallback();let x;if(h instanceof Float32Array)x=5126;else if(h instanceof Uint16Array)if(f.isFloat16BufferAttribute)if(t)x=5131;else throw new Error("THREE.WebGLAttributes: Usage of Float16BufferAttribute requires WebGL2.");else x=5123;else if(h instanceof Int16Array)x=5122;else if(h instanceof Uint32Array)x=5125;else if(h instanceof Int32Array)x=5124;else if(h instanceof Int8Array)x=5120;else if(h instanceof Uint8Array)x=5121;else if(h instanceof Uint8ClampedArray)x=5121;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+h);return{buffer:g,type:x,bytesPerElement:h.BYTES_PER_ELEMENT,version:f.version}}function s(f,d,h){const m=d.array,g=d.updateRange;n.bindBuffer(h,f),g.count===-1?n.bufferSubData(h,0,m):(t?n.bufferSubData(h,g.offset*m.BYTES_PER_ELEMENT,m,g.offset,g.count):n.bufferSubData(h,g.offset*m.BYTES_PER_ELEMENT,m.subarray(g.offset,g.offset+g.count)),g.count=-1)}function o(f){return f.isInterleavedBufferAttribute&&(f=f.data),i.get(f)}function l(f){f.isInterleavedBufferAttribute&&(f=f.data);const d=i.get(f);d&&(n.deleteBuffer(d.buffer),i.delete(f))}function c(f,d){if(f.isGLBufferAttribute){const m=i.get(f);(!m||m.version<f.version)&&i.set(f,{buffer:f.buffer,type:f.type,bytesPerElement:f.elementSize,version:f.version});return}f.isInterleavedBufferAttribute&&(f=f.data);const h=i.get(f);h===void 0?i.set(f,r(f,d)):h.version<f.version&&(s(h.buffer,f,d),h.version=f.version)}return{get:o,remove:l,update:c}}class wl extends lt{constructor(e=1,t=1,i=1,r=1){super(),this.type="PlaneGeometry",this.parameters={width:e,height:t,widthSegments:i,heightSegments:r};const s=e/2,o=t/2,l=Math.floor(i),c=Math.floor(r),f=l+1,d=c+1,h=e/l,m=t/c,g=[],x=[],y=[],w=[];for(let _=0;_<d;_++){const S=_*m-o;for(let E=0;E<f;E++){const T=E*h-s;x.push(T,-S,0),y.push(0,0,1),w.push(E/l),w.push(1-_/c)}}for(let _=0;_<c;_++)for(let S=0;S<l;S++){const E=S+f*_,T=S+f*(_+1),C=S+1+f*(_+1),P=S+1+f*_;g.push(E,T,P),g.push(T,C,P)}this.setIndex(g),this.setAttribute("position",new Fe(x,3)),this.setAttribute("normal",new Fe(y,3)),this.setAttribute("uv",new Fe(w,2))}static fromJSON(e){return new wl(e.width,e.height,e.widthSegments,e.heightSegments)}}var hP=`#ifdef USE_ALPHAMAP
	diffuseColor.a *= texture2D( alphaMap, vUv ).g;
#endif`,pP=`#ifdef USE_ALPHAMAP
	uniform sampler2D alphaMap;
#endif`,mP=`#ifdef USE_ALPHATEST
	if ( diffuseColor.a < alphaTest ) discard;
#endif`,gP=`#ifdef USE_ALPHATEST
	uniform float alphaTest;
#endif`,vP=`#ifdef USE_AOMAP
	float ambientOcclusion = ( texture2D( aoMap, vUv2 ).r - 1.0 ) * aoMapIntensity + 1.0;
	reflectedLight.indirectDiffuse *= ambientOcclusion;
	#if defined( USE_ENVMAP ) && defined( STANDARD )
		float dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );
		reflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness );
	#endif
#endif`,yP=`#ifdef USE_AOMAP
	uniform sampler2D aoMap;
	uniform float aoMapIntensity;
#endif`,xP="vec3 transformed = vec3( position );",_P=`vec3 objectNormal = vec3( normal );
#ifdef USE_TANGENT
	vec3 objectTangent = vec3( tangent.xyz );
#endif`,wP=`vec3 BRDF_Lambert( const in vec3 diffuseColor ) {
	return RECIPROCAL_PI * diffuseColor;
}
vec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {
	float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );
	return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );
}
float F_Schlick( const in float f0, const in float f90, const in float dotVH ) {
	float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );
	return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );
}
vec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) {
    float x = clamp( 1.0 - dotVH, 0.0, 1.0 );
    float x2 = x * x;
    float x5 = clamp( x * x2 * x2, 0.0, 0.9999 );
    return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 );
}
float V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {
	float a2 = pow2( alpha );
	float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );
	float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );
	return 0.5 / max( gv + gl, EPSILON );
}
float D_GGX( const in float alpha, const in float dotNH ) {
	float a2 = pow2( alpha );
	float denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;
	return RECIPROCAL_PI * a2 / pow2( denom );
}
vec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 f0, const in float f90, const in float roughness ) {
	float alpha = pow2( roughness );
	vec3 halfDir = normalize( lightDir + viewDir );
	float dotNL = saturate( dot( normal, lightDir ) );
	float dotNV = saturate( dot( normal, viewDir ) );
	float dotNH = saturate( dot( normal, halfDir ) );
	float dotVH = saturate( dot( viewDir, halfDir ) );
	vec3 F = F_Schlick( f0, f90, dotVH );
	float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );
	float D = D_GGX( alpha, dotNH );
	return F * ( V * D );
}
#ifdef USE_IRIDESCENCE
	vec3 BRDF_GGX_Iridescence( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 f0, const in float f90, const in float iridescence, const in vec3 iridescenceFresnel, const in float roughness ) {
		float alpha = pow2( roughness );
		vec3 halfDir = normalize( lightDir + viewDir );
		float dotNL = saturate( dot( normal, lightDir ) );
		float dotNV = saturate( dot( normal, viewDir ) );
		float dotNH = saturate( dot( normal, halfDir ) );
		float dotVH = saturate( dot( viewDir, halfDir ) );
		vec3 F = mix( F_Schlick( f0, f90, dotVH ), iridescenceFresnel, iridescence );
		float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );
		float D = D_GGX( alpha, dotNH );
		return F * ( V * D );
	}
#endif
vec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {
	const float LUT_SIZE = 64.0;
	const float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;
	const float LUT_BIAS = 0.5 / LUT_SIZE;
	float dotNV = saturate( dot( N, V ) );
	vec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );
	uv = uv * LUT_SCALE + LUT_BIAS;
	return uv;
}
float LTC_ClippedSphereFormFactor( const in vec3 f ) {
	float l = length( f );
	return max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );
}
vec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {
	float x = dot( v1, v2 );
	float y = abs( x );
	float a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;
	float b = 3.4175940 + ( 4.1616724 + y ) * y;
	float v = a / b;
	float theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;
	return cross( v1, v2 ) * theta_sintheta;
}
vec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {
	vec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];
	vec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];
	vec3 lightNormal = cross( v1, v2 );
	if( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );
	vec3 T1, T2;
	T1 = normalize( V - N * dot( V, N ) );
	T2 = - cross( N, T1 );
	mat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );
	vec3 coords[ 4 ];
	coords[ 0 ] = mat * ( rectCoords[ 0 ] - P );
	coords[ 1 ] = mat * ( rectCoords[ 1 ] - P );
	coords[ 2 ] = mat * ( rectCoords[ 2 ] - P );
	coords[ 3 ] = mat * ( rectCoords[ 3 ] - P );
	coords[ 0 ] = normalize( coords[ 0 ] );
	coords[ 1 ] = normalize( coords[ 1 ] );
	coords[ 2 ] = normalize( coords[ 2 ] );
	coords[ 3 ] = normalize( coords[ 3 ] );
	vec3 vectorFormFactor = vec3( 0.0 );
	vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );
	vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );
	vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );
	vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );
	float result = LTC_ClippedSphereFormFactor( vectorFormFactor );
	return vec3( result );
}
float G_BlinnPhong_Implicit( ) {
	return 0.25;
}
float D_BlinnPhong( const in float shininess, const in float dotNH ) {
	return RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );
}
vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float shininess ) {
	vec3 halfDir = normalize( lightDir + viewDir );
	float dotNH = saturate( dot( normal, halfDir ) );
	float dotVH = saturate( dot( viewDir, halfDir ) );
	vec3 F = F_Schlick( specularColor, 1.0, dotVH );
	float G = G_BlinnPhong_Implicit( );
	float D = D_BlinnPhong( shininess, dotNH );
	return F * ( G * D );
}
#if defined( USE_SHEEN )
float D_Charlie( float roughness, float dotNH ) {
	float alpha = pow2( roughness );
	float invAlpha = 1.0 / alpha;
	float cos2h = dotNH * dotNH;
	float sin2h = max( 1.0 - cos2h, 0.0078125 );
	return ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );
}
float V_Neubelt( float dotNV, float dotNL ) {
	return saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) );
}
vec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) {
	vec3 halfDir = normalize( lightDir + viewDir );
	float dotNL = saturate( dot( normal, lightDir ) );
	float dotNV = saturate( dot( normal, viewDir ) );
	float dotNH = saturate( dot( normal, halfDir ) );
	float D = D_Charlie( sheenRoughness, dotNH );
	float V = V_Neubelt( dotNV, dotNL );
	return sheenColor * ( D * V );
}
#endif`,SP=`#ifdef USE_IRIDESCENCE
	const mat3 XYZ_TO_REC709 = mat3(
		 3.2404542, -0.9692660,  0.0556434,
		-1.5371385,  1.8760108, -0.2040259,
		-0.4985314,  0.0415560,  1.0572252
	);
	vec3 Fresnel0ToIor( vec3 fresnel0 ) {
		vec3 sqrtF0 = sqrt( fresnel0 );
		return ( vec3( 1.0 ) + sqrtF0 ) / ( vec3( 1.0 ) - sqrtF0 );
	}
	vec3 IorToFresnel0( vec3 transmittedIor, float incidentIor ) {
		return pow2( ( transmittedIor - vec3( incidentIor ) ) / ( transmittedIor + vec3( incidentIor ) ) );
	}
	float IorToFresnel0( float transmittedIor, float incidentIor ) {
		return pow2( ( transmittedIor - incidentIor ) / ( transmittedIor + incidentIor ));
	}
	vec3 evalSensitivity( float OPD, vec3 shift ) {
		float phase = 2.0 * PI * OPD * 1.0e-9;
		vec3 val = vec3( 5.4856e-13, 4.4201e-13, 5.2481e-13 );
		vec3 pos = vec3( 1.6810e+06, 1.7953e+06, 2.2084e+06 );
		vec3 var = vec3( 4.3278e+09, 9.3046e+09, 6.6121e+09 );
		vec3 xyz = val * sqrt( 2.0 * PI * var ) * cos( pos * phase + shift ) * exp( - pow2( phase ) * var );
		xyz.x += 9.7470e-14 * sqrt( 2.0 * PI * 4.5282e+09 ) * cos( 2.2399e+06 * phase + shift[ 0 ] ) * exp( - 4.5282e+09 * pow2( phase ) );
		xyz /= 1.0685e-7;
		vec3 rgb = XYZ_TO_REC709 * xyz;
		return rgb;
	}
	vec3 evalIridescence( float outsideIOR, float eta2, float cosTheta1, float thinFilmThickness, vec3 baseF0 ) {
		vec3 I;
		float iridescenceIOR = mix( outsideIOR, eta2, smoothstep( 0.0, 0.03, thinFilmThickness ) );
		float sinTheta2Sq = pow2( outsideIOR / iridescenceIOR ) * ( 1.0 - pow2( cosTheta1 ) );
		float cosTheta2Sq = 1.0 - sinTheta2Sq;
		if ( cosTheta2Sq < 0.0 ) {
			 return vec3( 1.0 );
		}
		float cosTheta2 = sqrt( cosTheta2Sq );
		float R0 = IorToFresnel0( iridescenceIOR, outsideIOR );
		float R12 = F_Schlick( R0, 1.0, cosTheta1 );
		float R21 = R12;
		float T121 = 1.0 - R12;
		float phi12 = 0.0;
		if ( iridescenceIOR < outsideIOR ) phi12 = PI;
		float phi21 = PI - phi12;
		vec3 baseIOR = Fresnel0ToIor( clamp( baseF0, 0.0, 0.9999 ) );		vec3 R1 = IorToFresnel0( baseIOR, iridescenceIOR );
		vec3 R23 = F_Schlick( R1, 1.0, cosTheta2 );
		vec3 phi23 = vec3( 0.0 );
		if ( baseIOR[ 0 ] < iridescenceIOR ) phi23[ 0 ] = PI;
		if ( baseIOR[ 1 ] < iridescenceIOR ) phi23[ 1 ] = PI;
		if ( baseIOR[ 2 ] < iridescenceIOR ) phi23[ 2 ] = PI;
		float OPD = 2.0 * iridescenceIOR * thinFilmThickness * cosTheta2;
		vec3 phi = vec3( phi21 ) + phi23;
		vec3 R123 = clamp( R12 * R23, 1e-5, 0.9999 );
		vec3 r123 = sqrt( R123 );
		vec3 Rs = pow2( T121 ) * R23 / ( vec3( 1.0 ) - R123 );
		vec3 C0 = R12 + Rs;
		I = C0;
		vec3 Cm = Rs - T121;
		for ( int m = 1; m <= 2; ++ m ) {
			Cm *= r123;
			vec3 Sm = 2.0 * evalSensitivity( float( m ) * OPD, float( m ) * phi );
			I += Cm * Sm;
		}
		return max( I, vec3( 0.0 ) );
	}
#endif`,MP=`#ifdef USE_BUMPMAP
	uniform sampler2D bumpMap;
	uniform float bumpScale;
	vec2 dHdxy_fwd() {
		vec2 dSTdx = dFdx( vUv );
		vec2 dSTdy = dFdy( vUv );
		float Hll = bumpScale * texture2D( bumpMap, vUv ).x;
		float dBx = bumpScale * texture2D( bumpMap, vUv + dSTdx ).x - Hll;
		float dBy = bumpScale * texture2D( bumpMap, vUv + dSTdy ).x - Hll;
		return vec2( dBx, dBy );
	}
	vec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) {
		vec3 vSigmaX = dFdx( surf_pos.xyz );
		vec3 vSigmaY = dFdy( surf_pos.xyz );
		vec3 vN = surf_norm;
		vec3 R1 = cross( vSigmaY, vN );
		vec3 R2 = cross( vN, vSigmaX );
		float fDet = dot( vSigmaX, R1 ) * faceDirection;
		vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );
		return normalize( abs( fDet ) * surf_norm - vGrad );
	}
#endif`,EP=`#if NUM_CLIPPING_PLANES > 0
	vec4 plane;
	#pragma unroll_loop_start
	for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {
		plane = clippingPlanes[ i ];
		if ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;
	}
	#pragma unroll_loop_end
	#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES
		bool clipped = true;
		#pragma unroll_loop_start
		for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {
			plane = clippingPlanes[ i ];
			clipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;
		}
		#pragma unroll_loop_end
		if ( clipped ) discard;
	#endif
#endif`,TP=`#if NUM_CLIPPING_PLANES > 0
	varying vec3 vClipPosition;
	uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];
#endif`,bP=`#if NUM_CLIPPING_PLANES > 0
	varying vec3 vClipPosition;
#endif`,AP=`#if NUM_CLIPPING_PLANES > 0
	vClipPosition = - mvPosition.xyz;
#endif`,CP=`#if defined( USE_COLOR_ALPHA )
	diffuseColor *= vColor;
#elif defined( USE_COLOR )
	diffuseColor.rgb *= vColor;
#endif`,PP=`#if defined( USE_COLOR_ALPHA )
	varying vec4 vColor;
#elif defined( USE_COLOR )
	varying vec3 vColor;
#endif`,LP=`#if defined( USE_COLOR_ALPHA )
	varying vec4 vColor;
#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )
	varying vec3 vColor;
#endif`,RP=`#if defined( USE_COLOR_ALPHA )
	vColor = vec4( 1.0 );
#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )
	vColor = vec3( 1.0 );
#endif
#ifdef USE_COLOR
	vColor *= color;
#endif
#ifdef USE_INSTANCING_COLOR
	vColor.xyz *= instanceColor.xyz;
#endif`,IP=`#define PI 3.141592653589793
#define PI2 6.283185307179586
#define PI_HALF 1.5707963267948966
#define RECIPROCAL_PI 0.3183098861837907
#define RECIPROCAL_PI2 0.15915494309189535
#define EPSILON 1e-6
#ifndef saturate
#define saturate( a ) clamp( a, 0.0, 1.0 )
#endif
#define whiteComplement( a ) ( 1.0 - saturate( a ) )
float pow2( const in float x ) { return x*x; }
vec3 pow2( const in vec3 x ) { return x*x; }
float pow3( const in float x ) { return x*x*x; }
float pow4( const in float x ) { float x2 = x*x; return x2*x2; }
float max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); }
float average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); }
highp float rand( const in vec2 uv ) {
	const highp float a = 12.9898, b = 78.233, c = 43758.5453;
	highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );
	return fract( sin( sn ) * c );
}
#ifdef HIGH_PRECISION
	float precisionSafeLength( vec3 v ) { return length( v ); }
#else
	float precisionSafeLength( vec3 v ) {
		float maxComponent = max3( abs( v ) );
		return length( v / maxComponent ) * maxComponent;
	}
#endif
struct IncidentLight {
	vec3 color;
	vec3 direction;
	bool visible;
};
struct ReflectedLight {
	vec3 directDiffuse;
	vec3 directSpecular;
	vec3 indirectDiffuse;
	vec3 indirectSpecular;
};
struct GeometricContext {
	vec3 position;
	vec3 normal;
	vec3 viewDir;
#ifdef USE_CLEARCOAT
	vec3 clearcoatNormal;
#endif
};
vec3 transformDirection( in vec3 dir, in mat4 matrix ) {
	return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );
}
vec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {
	return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );
}
mat3 transposeMat3( const in mat3 m ) {
	mat3 tmp;
	tmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );
	tmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );
	tmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );
	return tmp;
}
float luminance( const in vec3 rgb ) {
	const vec3 weights = vec3( 0.2126729, 0.7151522, 0.0721750 );
	return dot( weights, rgb );
}
bool isPerspectiveMatrix( mat4 m ) {
	return m[ 2 ][ 3 ] == - 1.0;
}
vec2 equirectUv( in vec3 dir ) {
	float u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;
	float v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;
	return vec2( u, v );
}`,DP=`#ifdef ENVMAP_TYPE_CUBE_UV
	#define cubeUV_minMipLevel 4.0
	#define cubeUV_minTileSize 16.0
	float getFace( vec3 direction ) {
		vec3 absDirection = abs( direction );
		float face = - 1.0;
		if ( absDirection.x > absDirection.z ) {
			if ( absDirection.x > absDirection.y )
				face = direction.x > 0.0 ? 0.0 : 3.0;
			else
				face = direction.y > 0.0 ? 1.0 : 4.0;
		} else {
			if ( absDirection.z > absDirection.y )
				face = direction.z > 0.0 ? 2.0 : 5.0;
			else
				face = direction.y > 0.0 ? 1.0 : 4.0;
		}
		return face;
	}
	vec2 getUV( vec3 direction, float face ) {
		vec2 uv;
		if ( face == 0.0 ) {
			uv = vec2( direction.z, direction.y ) / abs( direction.x );
		} else if ( face == 1.0 ) {
			uv = vec2( - direction.x, - direction.z ) / abs( direction.y );
		} else if ( face == 2.0 ) {
			uv = vec2( - direction.x, direction.y ) / abs( direction.z );
		} else if ( face == 3.0 ) {
			uv = vec2( - direction.z, direction.y ) / abs( direction.x );
		} else if ( face == 4.0 ) {
			uv = vec2( - direction.x, direction.z ) / abs( direction.y );
		} else {
			uv = vec2( direction.x, direction.y ) / abs( direction.z );
		}
		return 0.5 * ( uv + 1.0 );
	}
	vec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {
		float face = getFace( direction );
		float filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );
		mipInt = max( mipInt, cubeUV_minMipLevel );
		float faceSize = exp2( mipInt );
		vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0;
		if ( face > 2.0 ) {
			uv.y += faceSize;
			face -= 3.0;
		}
		uv.x += face * faceSize;
		uv.x += filterInt * 3.0 * cubeUV_minTileSize;
		uv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize );
		uv.x *= CUBEUV_TEXEL_WIDTH;
		uv.y *= CUBEUV_TEXEL_HEIGHT;
		#ifdef texture2DGradEXT
			return texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb;
		#else
			return texture2D( envMap, uv ).rgb;
		#endif
	}
	#define cubeUV_r0 1.0
	#define cubeUV_v0 0.339
	#define cubeUV_m0 - 2.0
	#define cubeUV_r1 0.8
	#define cubeUV_v1 0.276
	#define cubeUV_m1 - 1.0
	#define cubeUV_r4 0.4
	#define cubeUV_v4 0.046
	#define cubeUV_m4 2.0
	#define cubeUV_r5 0.305
	#define cubeUV_v5 0.016
	#define cubeUV_m5 3.0
	#define cubeUV_r6 0.21
	#define cubeUV_v6 0.0038
	#define cubeUV_m6 4.0
	float roughnessToMip( float roughness ) {
		float mip = 0.0;
		if ( roughness >= cubeUV_r1 ) {
			mip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0;
		} else if ( roughness >= cubeUV_r4 ) {
			mip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1;
		} else if ( roughness >= cubeUV_r5 ) {
			mip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4;
		} else if ( roughness >= cubeUV_r6 ) {
			mip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5;
		} else {
			mip = - 2.0 * log2( 1.16 * roughness );		}
		return mip;
	}
	vec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {
		float mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP );
		float mipF = fract( mip );
		float mipInt = floor( mip );
		vec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );
		if ( mipF == 0.0 ) {
			return vec4( color0, 1.0 );
		} else {
			vec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );
			return vec4( mix( color0, color1, mipF ), 1.0 );
		}
	}
#endif`,zP=`vec3 transformedNormal = objectNormal;
#ifdef USE_INSTANCING
	mat3 m = mat3( instanceMatrix );
	transformedNormal /= vec3( dot( m[ 0 ], m[ 0 ] ), dot( m[ 1 ], m[ 1 ] ), dot( m[ 2 ], m[ 2 ] ) );
	transformedNormal = m * transformedNormal;
#endif
transformedNormal = normalMatrix * transformedNormal;
#ifdef FLIP_SIDED
	transformedNormal = - transformedNormal;
#endif
#ifdef USE_TANGENT
	vec3 transformedTangent = ( modelViewMatrix * vec4( objectTangent, 0.0 ) ).xyz;
	#ifdef FLIP_SIDED
		transformedTangent = - transformedTangent;
	#endif
#endif`,NP=`#ifdef USE_DISPLACEMENTMAP
	uniform sampler2D displacementMap;
	uniform float displacementScale;
	uniform float displacementBias;
#endif`,kP=`#ifdef USE_DISPLACEMENTMAP
	transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vUv ).x * displacementScale + displacementBias );
#endif`,OP=`#ifdef USE_EMISSIVEMAP
	vec4 emissiveColor = texture2D( emissiveMap, vUv );
	totalEmissiveRadiance *= emissiveColor.rgb;
#endif`,FP=`#ifdef USE_EMISSIVEMAP
	uniform sampler2D emissiveMap;
#endif`,UP="gl_FragColor = linearToOutputTexel( gl_FragColor );",BP=`vec4 LinearToLinear( in vec4 value ) {
	return value;
}
vec4 LinearTosRGB( in vec4 value ) {
	return vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a );
}`,VP=`#ifdef USE_ENVMAP
	#ifdef ENV_WORLDPOS
		vec3 cameraToFrag;
		if ( isOrthographic ) {
			cameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );
		} else {
			cameraToFrag = normalize( vWorldPosition - cameraPosition );
		}
		vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
		#ifdef ENVMAP_MODE_REFLECTION
			vec3 reflectVec = reflect( cameraToFrag, worldNormal );
		#else
			vec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );
		#endif
	#else
		vec3 reflectVec = vReflect;
	#endif
	#ifdef ENVMAP_TYPE_CUBE
		vec4 envColor = textureCube( envMap, vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );
	#elif defined( ENVMAP_TYPE_CUBE_UV )
		vec4 envColor = textureCubeUV( envMap, reflectVec, 0.0 );
	#else
		vec4 envColor = vec4( 0.0 );
	#endif
	#ifdef ENVMAP_BLENDING_MULTIPLY
		outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );
	#elif defined( ENVMAP_BLENDING_MIX )
		outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );
	#elif defined( ENVMAP_BLENDING_ADD )
		outgoingLight += envColor.xyz * specularStrength * reflectivity;
	#endif
#endif`,HP=`#ifdef USE_ENVMAP
	uniform float envMapIntensity;
	uniform float flipEnvMap;
	#ifdef ENVMAP_TYPE_CUBE
		uniform samplerCube envMap;
	#else
		uniform sampler2D envMap;
	#endif
	
#endif`,WP=`#ifdef USE_ENVMAP
	uniform float reflectivity;
	#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )
		#define ENV_WORLDPOS
	#endif
	#ifdef ENV_WORLDPOS
		varying vec3 vWorldPosition;
		uniform float refractionRatio;
	#else
		varying vec3 vReflect;
	#endif
#endif`,GP=`#ifdef USE_ENVMAP
	#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )
		#define ENV_WORLDPOS
	#endif
	#ifdef ENV_WORLDPOS
		
		varying vec3 vWorldPosition;
	#else
		varying vec3 vReflect;
		uniform float refractionRatio;
	#endif
#endif`,XP=`#ifdef USE_ENVMAP
	#ifdef ENV_WORLDPOS
		vWorldPosition = worldPosition.xyz;
	#else
		vec3 cameraToVertex;
		if ( isOrthographic ) {
			cameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );
		} else {
			cameraToVertex = normalize( worldPosition.xyz - cameraPosition );
		}
		vec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );
		#ifdef ENVMAP_MODE_REFLECTION
			vReflect = reflect( cameraToVertex, worldNormal );
		#else
			vReflect = refract( cameraToVertex, worldNormal, refractionRatio );
		#endif
	#endif
#endif`,jP=`#ifdef USE_FOG
	vFogDepth = - mvPosition.z;
#endif`,YP=`#ifdef USE_FOG
	varying float vFogDepth;
#endif`,qP=`#ifdef USE_FOG
	#ifdef FOG_EXP2
		float fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );
	#else
		float fogFactor = smoothstep( fogNear, fogFar, vFogDepth );
	#endif
	gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );
#endif`,ZP=`#ifdef USE_FOG
	uniform vec3 fogColor;
	varying float vFogDepth;
	#ifdef FOG_EXP2
		uniform float fogDensity;
	#else
		uniform float fogNear;
		uniform float fogFar;
	#endif
#endif`,JP=`#ifdef USE_GRADIENTMAP
	uniform sampler2D gradientMap;
#endif
vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {
	float dotNL = dot( normal, lightDirection );
	vec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );
	#ifdef USE_GRADIENTMAP
		return vec3( texture2D( gradientMap, coord ).r );
	#else
		vec2 fw = fwidth( coord ) * 0.5;
		return mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) );
	#endif
}`,QP=`#ifdef USE_LIGHTMAP
	vec4 lightMapTexel = texture2D( lightMap, vUv2 );
	vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;
	reflectedLight.indirectDiffuse += lightMapIrradiance;
#endif`,KP=`#ifdef USE_LIGHTMAP
	uniform sampler2D lightMap;
	uniform float lightMapIntensity;
#endif`,$P=`LambertMaterial material;
material.diffuseColor = diffuseColor.rgb;
material.specularStrength = specularStrength;`,eL=`varying vec3 vViewPosition;
struct LambertMaterial {
	vec3 diffuseColor;
	float specularStrength;
};
void RE_Direct_Lambert( const in IncidentLight directLight, const in GeometricContext geometry, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {
	float dotNL = saturate( dot( geometry.normal, directLight.direction ) );
	vec3 irradiance = dotNL * directLight.color;
	reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
}
void RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in GeometricContext geometry, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {
	reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
}
#define RE_Direct				RE_Direct_Lambert
#define RE_IndirectDiffuse		RE_IndirectDiffuse_Lambert
#define Material_LightProbeLOD( material )	(0)`,tL=`uniform bool receiveShadow;
uniform vec3 ambientLightColor;
uniform vec3 lightProbe[ 9 ];
vec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {
	float x = normal.x, y = normal.y, z = normal.z;
	vec3 result = shCoefficients[ 0 ] * 0.886227;
	result += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;
	result += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;
	result += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;
	result += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;
	result += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;
	result += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );
	result += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;
	result += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );
	return result;
}
vec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) {
	vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
	vec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );
	return irradiance;
}
vec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {
	vec3 irradiance = ambientLightColor;
	return irradiance;
}
float getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {
	#if defined ( PHYSICALLY_CORRECT_LIGHTS )
		float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );
		if ( cutoffDistance > 0.0 ) {
			distanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );
		}
		return distanceFalloff;
	#else
		if ( cutoffDistance > 0.0 && decayExponent > 0.0 ) {
			return pow( saturate( - lightDistance / cutoffDistance + 1.0 ), decayExponent );
		}
		return 1.0;
	#endif
}
float getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) {
	return smoothstep( coneCosine, penumbraCosine, angleCosine );
}
#if NUM_DIR_LIGHTS > 0
	struct DirectionalLight {
		vec3 direction;
		vec3 color;
	};
	uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];
	void getDirectionalLightInfo( const in DirectionalLight directionalLight, const in GeometricContext geometry, out IncidentLight light ) {
		light.color = directionalLight.color;
		light.direction = directionalLight.direction;
		light.visible = true;
	}
#endif
#if NUM_POINT_LIGHTS > 0
	struct PointLight {
		vec3 position;
		vec3 color;
		float distance;
		float decay;
	};
	uniform PointLight pointLights[ NUM_POINT_LIGHTS ];
	void getPointLightInfo( const in PointLight pointLight, const in GeometricContext geometry, out IncidentLight light ) {
		vec3 lVector = pointLight.position - geometry.position;
		light.direction = normalize( lVector );
		float lightDistance = length( lVector );
		light.color = pointLight.color;
		light.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay );
		light.visible = ( light.color != vec3( 0.0 ) );
	}
#endif
#if NUM_SPOT_LIGHTS > 0
	struct SpotLight {
		vec3 position;
		vec3 direction;
		vec3 color;
		float distance;
		float decay;
		float coneCos;
		float penumbraCos;
	};
	uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];
	void getSpotLightInfo( const in SpotLight spotLight, const in GeometricContext geometry, out IncidentLight light ) {
		vec3 lVector = spotLight.position - geometry.position;
		light.direction = normalize( lVector );
		float angleCos = dot( light.direction, spotLight.direction );
		float spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos );
		if ( spotAttenuation > 0.0 ) {
			float lightDistance = length( lVector );
			light.color = spotLight.color * spotAttenuation;
			light.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay );
			light.visible = ( light.color != vec3( 0.0 ) );
		} else {
			light.color = vec3( 0.0 );
			light.visible = false;
		}
	}
#endif
#if NUM_RECT_AREA_LIGHTS > 0
	struct RectAreaLight {
		vec3 color;
		vec3 position;
		vec3 halfWidth;
		vec3 halfHeight;
	};
	uniform sampler2D ltc_1;	uniform sampler2D ltc_2;
	uniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];
#endif
#if NUM_HEMI_LIGHTS > 0
	struct HemisphereLight {
		vec3 direction;
		vec3 skyColor;
		vec3 groundColor;
	};
	uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];
	vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) {
		float dotNL = dot( normal, hemiLight.direction );
		float hemiDiffuseWeight = 0.5 * dotNL + 0.5;
		vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );
		return irradiance;
	}
#endif`,nL=`#if defined( USE_ENVMAP )
	vec3 getIBLIrradiance( const in vec3 normal ) {
		#if defined( ENVMAP_TYPE_CUBE_UV )
			vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
			vec4 envMapColor = textureCubeUV( envMap, worldNormal, 1.0 );
			return PI * envMapColor.rgb * envMapIntensity;
		#else
			return vec3( 0.0 );
		#endif
	}
	vec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {
		#if defined( ENVMAP_TYPE_CUBE_UV )
			vec3 reflectVec = reflect( - viewDir, normal );
			reflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );
			reflectVec = inverseTransformDirection( reflectVec, viewMatrix );
			vec4 envMapColor = textureCubeUV( envMap, reflectVec, roughness );
			return envMapColor.rgb * envMapIntensity;
		#else
			return vec3( 0.0 );
		#endif
	}
#endif`,iL=`ToonMaterial material;
material.diffuseColor = diffuseColor.rgb;`,rL=`varying vec3 vViewPosition;
struct ToonMaterial {
	vec3 diffuseColor;
};
void RE_Direct_Toon( const in IncidentLight directLight, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {
	vec3 irradiance = getGradientIrradiance( geometry.normal, directLight.direction ) * directLight.color;
	reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
}
void RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {
	reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
}
#define RE_Direct				RE_Direct_Toon
#define RE_IndirectDiffuse		RE_IndirectDiffuse_Toon
#define Material_LightProbeLOD( material )	(0)`,sL=`BlinnPhongMaterial material;
material.diffuseColor = diffuseColor.rgb;
material.specularColor = specular;
material.specularShininess = shininess;
material.specularStrength = specularStrength;`,oL=`varying vec3 vViewPosition;
struct BlinnPhongMaterial {
	vec3 diffuseColor;
	vec3 specularColor;
	float specularShininess;
	float specularStrength;
};
void RE_Direct_BlinnPhong( const in IncidentLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {
	float dotNL = saturate( dot( geometry.normal, directLight.direction ) );
	vec3 irradiance = dotNL * directLight.color;
	reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
	reflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometry.viewDir, geometry.normal, material.specularColor, material.specularShininess ) * material.specularStrength;
}
void RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {
	reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
}
#define RE_Direct				RE_Direct_BlinnPhong
#define RE_IndirectDiffuse		RE_IndirectDiffuse_BlinnPhong
#define Material_LightProbeLOD( material )	(0)`,aL=`PhysicalMaterial material;
material.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );
vec3 dxy = max( abs( dFdx( geometryNormal ) ), abs( dFdy( geometryNormal ) ) );
float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );
material.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness;
material.roughness = min( material.roughness, 1.0 );
#ifdef IOR
	material.ior = ior;
	#ifdef SPECULAR
		float specularIntensityFactor = specularIntensity;
		vec3 specularColorFactor = specularColor;
		#ifdef USE_SPECULARINTENSITYMAP
			specularIntensityFactor *= texture2D( specularIntensityMap, vUv ).a;
		#endif
		#ifdef USE_SPECULARCOLORMAP
			specularColorFactor *= texture2D( specularColorMap, vUv ).rgb;
		#endif
		material.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor );
	#else
		float specularIntensityFactor = 1.0;
		vec3 specularColorFactor = vec3( 1.0 );
		material.specularF90 = 1.0;
	#endif
	material.specularColor = mix( min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor );
#else
	material.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor );
	material.specularF90 = 1.0;
#endif
#ifdef USE_CLEARCOAT
	material.clearcoat = clearcoat;
	material.clearcoatRoughness = clearcoatRoughness;
	material.clearcoatF0 = vec3( 0.04 );
	material.clearcoatF90 = 1.0;
	#ifdef USE_CLEARCOATMAP
		material.clearcoat *= texture2D( clearcoatMap, vUv ).x;
	#endif
	#ifdef USE_CLEARCOAT_ROUGHNESSMAP
		material.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vUv ).y;
	#endif
	material.clearcoat = saturate( material.clearcoat );	material.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );
	material.clearcoatRoughness += geometryRoughness;
	material.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );
#endif
#ifdef USE_IRIDESCENCE
	material.iridescence = iridescence;
	material.iridescenceIOR = iridescenceIOR;
	#ifdef USE_IRIDESCENCEMAP
		material.iridescence *= texture2D( iridescenceMap, vUv ).r;
	#endif
	#ifdef USE_IRIDESCENCE_THICKNESSMAP
		material.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vUv ).g + iridescenceThicknessMinimum;
	#else
		material.iridescenceThickness = iridescenceThicknessMaximum;
	#endif
#endif
#ifdef USE_SHEEN
	material.sheenColor = sheenColor;
	#ifdef USE_SHEENCOLORMAP
		material.sheenColor *= texture2D( sheenColorMap, vUv ).rgb;
	#endif
	material.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 );
	#ifdef USE_SHEENROUGHNESSMAP
		material.sheenRoughness *= texture2D( sheenRoughnessMap, vUv ).a;
	#endif
#endif`,lL=`struct PhysicalMaterial {
	vec3 diffuseColor;
	float roughness;
	vec3 specularColor;
	float specularF90;
	#ifdef USE_CLEARCOAT
		float clearcoat;
		float clearcoatRoughness;
		vec3 clearcoatF0;
		float clearcoatF90;
	#endif
	#ifdef USE_IRIDESCENCE
		float iridescence;
		float iridescenceIOR;
		float iridescenceThickness;
		vec3 iridescenceFresnel;
		vec3 iridescenceF0;
	#endif
	#ifdef USE_SHEEN
		vec3 sheenColor;
		float sheenRoughness;
	#endif
	#ifdef IOR
		float ior;
	#endif
	#ifdef USE_TRANSMISSION
		float transmission;
		float transmissionAlpha;
		float thickness;
		float attenuationDistance;
		vec3 attenuationColor;
	#endif
};
vec3 clearcoatSpecular = vec3( 0.0 );
vec3 sheenSpecular = vec3( 0.0 );
float IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {
	float dotNV = saturate( dot( normal, viewDir ) );
	float r2 = roughness * roughness;
	float a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95;
	float b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72;
	float DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) );
	return saturate( DG * RECIPROCAL_PI );
}
vec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {
	float dotNV = saturate( dot( normal, viewDir ) );
	const vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );
	const vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );
	vec4 r = roughness * c0 + c1;
	float a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;
	vec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw;
	return fab;
}
vec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {
	vec2 fab = DFGApprox( normal, viewDir, roughness );
	return specularColor * fab.x + specularF90 * fab.y;
}
#ifdef USE_IRIDESCENCE
void computeMultiscatteringIridescence( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float iridescence, const in vec3 iridescenceF0, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {
#else
void computeMultiscattering( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {
#endif
	vec2 fab = DFGApprox( normal, viewDir, roughness );
	#ifdef USE_IRIDESCENCE
		vec3 Fr = mix( specularColor, iridescenceF0, iridescence );
	#else
		vec3 Fr = specularColor;
	#endif
	vec3 FssEss = Fr * fab.x + specularF90 * fab.y;
	float Ess = fab.x + fab.y;
	float Ems = 1.0 - Ess;
	vec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619;	vec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );
	singleScatter += FssEss;
	multiScatter += Fms * Ems;
}
#if NUM_RECT_AREA_LIGHTS > 0
	void RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {
		vec3 normal = geometry.normal;
		vec3 viewDir = geometry.viewDir;
		vec3 position = geometry.position;
		vec3 lightPos = rectAreaLight.position;
		vec3 halfWidth = rectAreaLight.halfWidth;
		vec3 halfHeight = rectAreaLight.halfHeight;
		vec3 lightColor = rectAreaLight.color;
		float roughness = material.roughness;
		vec3 rectCoords[ 4 ];
		rectCoords[ 0 ] = lightPos + halfWidth - halfHeight;		rectCoords[ 1 ] = lightPos - halfWidth - halfHeight;
		rectCoords[ 2 ] = lightPos - halfWidth + halfHeight;
		rectCoords[ 3 ] = lightPos + halfWidth + halfHeight;
		vec2 uv = LTC_Uv( normal, viewDir, roughness );
		vec4 t1 = texture2D( ltc_1, uv );
		vec4 t2 = texture2D( ltc_2, uv );
		mat3 mInv = mat3(
			vec3( t1.x, 0, t1.y ),
			vec3(    0, 1,    0 ),
			vec3( t1.z, 0, t1.w )
		);
		vec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );
		reflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );
		reflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );
	}
#endif
void RE_Direct_Physical( const in IncidentLight directLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {
	float dotNL = saturate( dot( geometry.normal, directLight.direction ) );
	vec3 irradiance = dotNL * directLight.color;
	#ifdef USE_CLEARCOAT
		float dotNLcc = saturate( dot( geometry.clearcoatNormal, directLight.direction ) );
		vec3 ccIrradiance = dotNLcc * directLight.color;
		clearcoatSpecular += ccIrradiance * BRDF_GGX( directLight.direction, geometry.viewDir, geometry.clearcoatNormal, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );
	#endif
	#ifdef USE_SHEEN
		sheenSpecular += irradiance * BRDF_Sheen( directLight.direction, geometry.viewDir, geometry.normal, material.sheenColor, material.sheenRoughness );
	#endif
	#ifdef USE_IRIDESCENCE
		reflectedLight.directSpecular += irradiance * BRDF_GGX_Iridescence( directLight.direction, geometry.viewDir, geometry.normal, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness );
	#else
		reflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometry.viewDir, geometry.normal, material.specularColor, material.specularF90, material.roughness );
	#endif
	reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
}
void RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {
	reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
}
void 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) {
	#ifdef USE_CLEARCOAT
		clearcoatSpecular += clearcoatRadiance * EnvironmentBRDF( geometry.clearcoatNormal, geometry.viewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );
	#endif
	#ifdef USE_SHEEN
		sheenSpecular += irradiance * material.sheenColor * IBLSheenBRDF( geometry.normal, geometry.viewDir, material.sheenRoughness );
	#endif
	vec3 singleScattering = vec3( 0.0 );
	vec3 multiScattering = vec3( 0.0 );
	vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;
	#ifdef USE_IRIDESCENCE
		computeMultiscatteringIridescence( geometry.normal, geometry.viewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness, singleScattering, multiScattering );
	#else
		computeMultiscattering( geometry.normal, geometry.viewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering );
	#endif
	vec3 totalScattering = singleScattering + multiScattering;
	vec3 diffuse = material.diffuseColor * ( 1.0 - max( max( totalScattering.r, totalScattering.g ), totalScattering.b ) );
	reflectedLight.indirectSpecular += radiance * singleScattering;
	reflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;
	reflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;
}
#define RE_Direct				RE_Direct_Physical
#define RE_Direct_RectArea		RE_Direct_RectArea_Physical
#define RE_IndirectDiffuse		RE_IndirectDiffuse_Physical
#define RE_IndirectSpecular		RE_IndirectSpecular_Physical
float computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {
	return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );
}`,uL=`
GeometricContext geometry;
geometry.position = - vViewPosition;
geometry.normal = normal;
geometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );
#ifdef USE_CLEARCOAT
	geometry.clearcoatNormal = clearcoatNormal;
#endif
#ifdef USE_IRIDESCENCE
	float dotNVi = saturate( dot( normal, geometry.viewDir ) );
	if ( material.iridescenceThickness == 0.0 ) {
		material.iridescence = 0.0;
	} else {
		material.iridescence = saturate( material.iridescence );
	}
	if ( material.iridescence > 0.0 ) {
		material.iridescenceFresnel = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor );
		material.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi );
	}
#endif
IncidentLight directLight;
#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )
	PointLight pointLight;
	#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0
	PointLightShadow pointLightShadow;
	#endif
	#pragma unroll_loop_start
	for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {
		pointLight = pointLights[ i ];
		getPointLightInfo( pointLight, geometry, directLight );
		#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )
		pointLightShadow = pointLightShadows[ i ];
		directLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;
		#endif
		RE_Direct( directLight, geometry, material, reflectedLight );
	}
	#pragma unroll_loop_end
#endif
#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )
	SpotLight spotLight;
	vec4 spotColor;
	vec3 spotLightCoord;
	bool inSpotLightMap;
	#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0
	SpotLightShadow spotLightShadow;
	#endif
	#pragma unroll_loop_start
	for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {
		spotLight = spotLights[ i ];
		getSpotLightInfo( spotLight, geometry, directLight );
		#if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )
		#define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX
		#elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
		#define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS
		#else
		#define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )
		#endif
		#if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS )
			spotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w;
			inSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) );
			spotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy );
			directLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color;
		#endif
		#undef SPOT_LIGHT_MAP_INDEX
		#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
		spotLightShadow = spotLightShadows[ i ];
		directLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;
		#endif
		RE_Direct( directLight, geometry, material, reflectedLight );
	}
	#pragma unroll_loop_end
#endif
#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )
	DirectionalLight directionalLight;
	#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0
	DirectionalLightShadow directionalLightShadow;
	#endif
	#pragma unroll_loop_start
	for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {
		directionalLight = directionalLights[ i ];
		getDirectionalLightInfo( directionalLight, geometry, directLight );
		#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )
		directionalLightShadow = directionalLightShadows[ i ];
		directLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;
		#endif
		RE_Direct( directLight, geometry, material, reflectedLight );
	}
	#pragma unroll_loop_end
#endif
#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )
	RectAreaLight rectAreaLight;
	#pragma unroll_loop_start
	for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {
		rectAreaLight = rectAreaLights[ i ];
		RE_Direct_RectArea( rectAreaLight, geometry, material, reflectedLight );
	}
	#pragma unroll_loop_end
#endif
#if defined( RE_IndirectDiffuse )
	vec3 iblIrradiance = vec3( 0.0 );
	vec3 irradiance = getAmbientLightIrradiance( ambientLightColor );
	irradiance += getLightProbeIrradiance( lightProbe, geometry.normal );
	#if ( NUM_HEMI_LIGHTS > 0 )
		#pragma unroll_loop_start
		for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {
			irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry.normal );
		}
		#pragma unroll_loop_end
	#endif
#endif
#if defined( RE_IndirectSpecular )
	vec3 radiance = vec3( 0.0 );
	vec3 clearcoatRadiance = vec3( 0.0 );
#endif`,cL=`#if defined( RE_IndirectDiffuse )
	#ifdef USE_LIGHTMAP
		vec4 lightMapTexel = texture2D( lightMap, vUv2 );
		vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;
		irradiance += lightMapIrradiance;
	#endif
	#if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )
		iblIrradiance += getIBLIrradiance( geometry.normal );
	#endif
#endif
#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )
	radiance += getIBLRadiance( geometry.viewDir, geometry.normal, material.roughness );
	#ifdef USE_CLEARCOAT
		clearcoatRadiance += getIBLRadiance( geometry.viewDir, geometry.clearcoatNormal, material.clearcoatRoughness );
	#endif
#endif`,fL=`#if defined( RE_IndirectDiffuse )
	RE_IndirectDiffuse( irradiance, geometry, material, reflectedLight );
#endif
#if defined( RE_IndirectSpecular )
	RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometry, material, reflectedLight );
#endif`,dL=`#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )
	gl_FragDepthEXT = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;
#endif`,hL=`#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )
	uniform float logDepthBufFC;
	varying float vFragDepth;
	varying float vIsPerspective;
#endif`,pL=`#ifdef USE_LOGDEPTHBUF
	#ifdef USE_LOGDEPTHBUF_EXT
		varying float vFragDepth;
		varying float vIsPerspective;
	#else
		uniform float logDepthBufFC;
	#endif
#endif`,mL=`#ifdef USE_LOGDEPTHBUF
	#ifdef USE_LOGDEPTHBUF_EXT
		vFragDepth = 1.0 + gl_Position.w;
		vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );
	#else
		if ( isPerspectiveMatrix( projectionMatrix ) ) {
			gl_Position.z = log2( max( EPSILON, gl_Position.w + 1.0 ) ) * logDepthBufFC - 1.0;
			gl_Position.z *= gl_Position.w;
		}
	#endif
#endif`,gL=`#ifdef USE_MAP
	vec4 sampledDiffuseColor = texture2D( map, vUv );
	#ifdef DECODE_VIDEO_TEXTURE
		sampledDiffuseColor = vec4( mix( pow( sampledDiffuseColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), sampledDiffuseColor.rgb * 0.0773993808, vec3( lessThanEqual( sampledDiffuseColor.rgb, vec3( 0.04045 ) ) ) ), sampledDiffuseColor.w );
	#endif
	diffuseColor *= sampledDiffuseColor;
#endif`,vL=`#ifdef USE_MAP
	uniform sampler2D map;
#endif`,yL=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP )
	vec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;
#endif
#ifdef USE_MAP
	diffuseColor *= texture2D( map, uv );
#endif
#ifdef USE_ALPHAMAP
	diffuseColor.a *= texture2D( alphaMap, uv ).g;
#endif`,xL=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP )
	uniform mat3 uvTransform;
#endif
#ifdef USE_MAP
	uniform sampler2D map;
#endif
#ifdef USE_ALPHAMAP
	uniform sampler2D alphaMap;
#endif`,_L=`float metalnessFactor = metalness;
#ifdef USE_METALNESSMAP
	vec4 texelMetalness = texture2D( metalnessMap, vUv );
	metalnessFactor *= texelMetalness.b;
#endif`,wL=`#ifdef USE_METALNESSMAP
	uniform sampler2D metalnessMap;
#endif`,SL=`#if defined( USE_MORPHCOLORS ) && defined( MORPHTARGETS_TEXTURE )
	vColor *= morphTargetBaseInfluence;
	for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
		#if defined( USE_COLOR_ALPHA )
			if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ];
		#elif defined( USE_COLOR )
			if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ];
		#endif
	}
#endif`,ML=`#ifdef USE_MORPHNORMALS
	objectNormal *= morphTargetBaseInfluence;
	#ifdef MORPHTARGETS_TEXTURE
		for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
			if ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ];
		}
	#else
		objectNormal += morphNormal0 * morphTargetInfluences[ 0 ];
		objectNormal += morphNormal1 * morphTargetInfluences[ 1 ];
		objectNormal += morphNormal2 * morphTargetInfluences[ 2 ];
		objectNormal += morphNormal3 * morphTargetInfluences[ 3 ];
	#endif
#endif`,EL=`#ifdef USE_MORPHTARGETS
	uniform float morphTargetBaseInfluence;
	#ifdef MORPHTARGETS_TEXTURE
		uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];
		uniform sampler2DArray morphTargetsTexture;
		uniform ivec2 morphTargetsTextureSize;
		vec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) {
			int texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset;
			int y = texelIndex / morphTargetsTextureSize.x;
			int x = texelIndex - y * morphTargetsTextureSize.x;
			ivec3 morphUV = ivec3( x, y, morphTargetIndex );
			return texelFetch( morphTargetsTexture, morphUV, 0 );
		}
	#else
		#ifndef USE_MORPHNORMALS
			uniform float morphTargetInfluences[ 8 ];
		#else
			uniform float morphTargetInfluences[ 4 ];
		#endif
	#endif
#endif`,TL=`#ifdef USE_MORPHTARGETS
	transformed *= morphTargetBaseInfluence;
	#ifdef MORPHTARGETS_TEXTURE
		for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
			if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];
		}
	#else
		transformed += morphTarget0 * morphTargetInfluences[ 0 ];
		transformed += morphTarget1 * morphTargetInfluences[ 1 ];
		transformed += morphTarget2 * morphTargetInfluences[ 2 ];
		transformed += morphTarget3 * morphTargetInfluences[ 3 ];
		#ifndef USE_MORPHNORMALS
			transformed += morphTarget4 * morphTargetInfluences[ 4 ];
			transformed += morphTarget5 * morphTargetInfluences[ 5 ];
			transformed += morphTarget6 * morphTargetInfluences[ 6 ];
			transformed += morphTarget7 * morphTargetInfluences[ 7 ];
		#endif
	#endif
#endif`,bL=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;
#ifdef FLAT_SHADED
	vec3 fdx = vec3( dFdx( vViewPosition.x ), dFdx( vViewPosition.y ), dFdx( vViewPosition.z ) );
	vec3 fdy = vec3( dFdy( vViewPosition.x ), dFdy( vViewPosition.y ), dFdy( vViewPosition.z ) );
	vec3 normal = normalize( cross( fdx, fdy ) );
#else
	vec3 normal = normalize( vNormal );
	#ifdef DOUBLE_SIDED
		normal = normal * faceDirection;
	#endif
	#ifdef USE_TANGENT
		vec3 tangent = normalize( vTangent );
		vec3 bitangent = normalize( vBitangent );
		#ifdef DOUBLE_SIDED
			tangent = tangent * faceDirection;
			bitangent = bitangent * faceDirection;
		#endif
		#if defined( TANGENTSPACE_NORMALMAP ) || defined( USE_CLEARCOAT_NORMALMAP )
			mat3 vTBN = mat3( tangent, bitangent, normal );
		#endif
	#endif
#endif
vec3 geometryNormal = normal;`,AL=`#ifdef OBJECTSPACE_NORMALMAP
	normal = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;
	#ifdef FLIP_SIDED
		normal = - normal;
	#endif
	#ifdef DOUBLE_SIDED
		normal = normal * faceDirection;
	#endif
	normal = normalize( normalMatrix * normal );
#elif defined( TANGENTSPACE_NORMALMAP )
	vec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;
	mapN.xy *= normalScale;
	#ifdef USE_TANGENT
		normal = normalize( vTBN * mapN );
	#else
		normal = perturbNormal2Arb( - vViewPosition, normal, mapN, faceDirection );
	#endif
#elif defined( USE_BUMPMAP )
	normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );
#endif`,CL=`#ifndef FLAT_SHADED
	varying vec3 vNormal;
	#ifdef USE_TANGENT
		varying vec3 vTangent;
		varying vec3 vBitangent;
	#endif
#endif`,PL=`#ifndef FLAT_SHADED
	varying vec3 vNormal;
	#ifdef USE_TANGENT
		varying vec3 vTangent;
		varying vec3 vBitangent;
	#endif
#endif`,LL=`#ifndef FLAT_SHADED
	vNormal = normalize( transformedNormal );
	#ifdef USE_TANGENT
		vTangent = normalize( transformedTangent );
		vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );
	#endif
#endif`,RL=`#ifdef USE_NORMALMAP
	uniform sampler2D normalMap;
	uniform vec2 normalScale;
#endif
#ifdef OBJECTSPACE_NORMALMAP
	uniform mat3 normalMatrix;
#endif
#if ! defined ( USE_TANGENT ) && ( defined ( TANGENTSPACE_NORMALMAP ) || defined ( USE_CLEARCOAT_NORMALMAP ) )
	vec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm, vec3 mapN, float faceDirection ) {
		vec3 q0 = dFdx( eye_pos.xyz );
		vec3 q1 = dFdy( eye_pos.xyz );
		vec2 st0 = dFdx( vUv.st );
		vec2 st1 = dFdy( vUv.st );
		vec3 N = surf_norm;
		vec3 q1perp = cross( q1, N );
		vec3 q0perp = cross( N, q0 );
		vec3 T = q1perp * st0.x + q0perp * st1.x;
		vec3 B = q1perp * st0.y + q0perp * st1.y;
		float det = max( dot( T, T ), dot( B, B ) );
		float scale = ( det == 0.0 ) ? 0.0 : faceDirection * inversesqrt( det );
		return normalize( T * ( mapN.x * scale ) + B * ( mapN.y * scale ) + N * mapN.z );
	}
#endif`,IL=`#ifdef USE_CLEARCOAT
	vec3 clearcoatNormal = geometryNormal;
#endif`,DL=`#ifdef USE_CLEARCOAT_NORMALMAP
	vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vUv ).xyz * 2.0 - 1.0;
	clearcoatMapN.xy *= clearcoatNormalScale;
	#ifdef USE_TANGENT
		clearcoatNormal = normalize( vTBN * clearcoatMapN );
	#else
		clearcoatNormal = perturbNormal2Arb( - vViewPosition, clearcoatNormal, clearcoatMapN, faceDirection );
	#endif
#endif`,zL=`#ifdef USE_CLEARCOATMAP
	uniform sampler2D clearcoatMap;
#endif
#ifdef USE_CLEARCOAT_ROUGHNESSMAP
	uniform sampler2D clearcoatRoughnessMap;
#endif
#ifdef USE_CLEARCOAT_NORMALMAP
	uniform sampler2D clearcoatNormalMap;
	uniform vec2 clearcoatNormalScale;
#endif`,NL=`#ifdef USE_IRIDESCENCEMAP
	uniform sampler2D iridescenceMap;
#endif
#ifdef USE_IRIDESCENCE_THICKNESSMAP
	uniform sampler2D iridescenceThicknessMap;
#endif`,kL=`#ifdef OPAQUE
diffuseColor.a = 1.0;
#endif
#ifdef USE_TRANSMISSION
diffuseColor.a *= material.transmissionAlpha + 0.1;
#endif
gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,OL=`vec3 packNormalToRGB( const in vec3 normal ) {
	return normalize( normal ) * 0.5 + 0.5;
}
vec3 unpackRGBToNormal( const in vec3 rgb ) {
	return 2.0 * rgb.xyz - 1.0;
}
const float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;
const vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );
const vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. );
const float ShiftRight8 = 1. / 256.;
vec4 packDepthToRGBA( const in float v ) {
	vec4 r = vec4( fract( v * PackFactors ), v );
	r.yzw -= r.xyz * ShiftRight8;	return r * PackUpscale;
}
float unpackRGBAToDepth( const in vec4 v ) {
	return dot( v, UnpackFactors );
}
vec4 pack2HalfToRGBA( vec2 v ) {
	vec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) );
	return vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w );
}
vec2 unpackRGBATo2Half( vec4 v ) {
	return vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );
}
float viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {
	return ( viewZ + near ) / ( near - far );
}
float orthographicDepthToViewZ( const in float linearClipZ, const in float near, const in float far ) {
	return linearClipZ * ( near - far ) - near;
}
float viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {
	return ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ );
}
float perspectiveDepthToViewZ( const in float invClipZ, const in float near, const in float far ) {
	return ( near * far ) / ( ( far - near ) * invClipZ - far );
}`,FL=`#ifdef PREMULTIPLIED_ALPHA
	gl_FragColor.rgb *= gl_FragColor.a;
#endif`,UL=`vec4 mvPosition = vec4( transformed, 1.0 );
#ifdef USE_INSTANCING
	mvPosition = instanceMatrix * mvPosition;
#endif
mvPosition = modelViewMatrix * mvPosition;
gl_Position = projectionMatrix * mvPosition;`,BL=`#ifdef DITHERING
	gl_FragColor.rgb = dithering( gl_FragColor.rgb );
#endif`,VL=`#ifdef DITHERING
	vec3 dithering( vec3 color ) {
		float grid_position = rand( gl_FragCoord.xy );
		vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );
		dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );
		return color + dither_shift_RGB;
	}
#endif`,HL=`float roughnessFactor = roughness;
#ifdef USE_ROUGHNESSMAP
	vec4 texelRoughness = texture2D( roughnessMap, vUv );
	roughnessFactor *= texelRoughness.g;
#endif`,WL=`#ifdef USE_ROUGHNESSMAP
	uniform sampler2D roughnessMap;
#endif`,GL=`#if NUM_SPOT_LIGHT_COORDS > 0
  varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];
#endif
#if NUM_SPOT_LIGHT_MAPS > 0
  uniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ];
#endif
#ifdef USE_SHADOWMAP
	#if NUM_DIR_LIGHT_SHADOWS > 0
		uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];
		varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];
		struct DirectionalLightShadow {
			float shadowBias;
			float shadowNormalBias;
			float shadowRadius;
			vec2 shadowMapSize;
		};
		uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];
	#endif
	#if NUM_SPOT_LIGHT_SHADOWS > 0
		uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];
		struct SpotLightShadow {
			float shadowBias;
			float shadowNormalBias;
			float shadowRadius;
			vec2 shadowMapSize;
		};
		uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];
	#endif
	#if NUM_POINT_LIGHT_SHADOWS > 0
		uniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];
		varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];
		struct PointLightShadow {
			float shadowBias;
			float shadowNormalBias;
			float shadowRadius;
			vec2 shadowMapSize;
			float shadowCameraNear;
			float shadowCameraFar;
		};
		uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];
	#endif
	float texture2DCompare( sampler2D depths, vec2 uv, float compare ) {
		return step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );
	}
	vec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {
		return unpackRGBATo2Half( texture2D( shadow, uv ) );
	}
	float VSMShadow (sampler2D shadow, vec2 uv, float compare ){
		float occlusion = 1.0;
		vec2 distribution = texture2DDistribution( shadow, uv );
		float hard_shadow = step( compare , distribution.x );
		if (hard_shadow != 1.0 ) {
			float distance = compare - distribution.x ;
			float variance = max( 0.00000, distribution.y * distribution.y );
			float softness_probability = variance / (variance + distance * distance );			softness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 );			occlusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 );
		}
		return occlusion;
	}
	float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {
		float shadow = 1.0;
		shadowCoord.xyz /= shadowCoord.w;
		shadowCoord.z += shadowBias;
		bvec4 inFrustumVec = bvec4 ( shadowCoord.x >= 0.0, shadowCoord.x <= 1.0, shadowCoord.y >= 0.0, shadowCoord.y <= 1.0 );
		bool inFrustum = all( inFrustumVec );
		bvec2 frustumTestVec = bvec2( inFrustum, shadowCoord.z <= 1.0 );
		bool frustumTest = all( frustumTestVec );
		if ( frustumTest ) {
		#if defined( SHADOWMAP_TYPE_PCF )
			vec2 texelSize = vec2( 1.0 ) / shadowMapSize;
			float dx0 = - texelSize.x * shadowRadius;
			float dy0 = - texelSize.y * shadowRadius;
			float dx1 = + texelSize.x * shadowRadius;
			float dy1 = + texelSize.y * shadowRadius;
			float dx2 = dx0 / 2.0;
			float dy2 = dy0 / 2.0;
			float dx3 = dx1 / 2.0;
			float dy3 = dy1 / 2.0;
			shadow = (
				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +
				texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +
				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +
				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) +
				texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) +
				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) +
				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +
				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) +
				texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +
				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) +
				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +
				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) +
				texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) +
				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) +
				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +
				texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +
				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )
			) * ( 1.0 / 17.0 );
		#elif defined( SHADOWMAP_TYPE_PCF_SOFT )
			vec2 texelSize = vec2( 1.0 ) / shadowMapSize;
			float dx = texelSize.x;
			float dy = texelSize.y;
			vec2 uv = shadowCoord.xy;
			vec2 f = fract( uv * shadowMapSize + 0.5 );
			uv -= f * texelSize;
			shadow = (
				texture2DCompare( shadowMap, uv, shadowCoord.z ) +
				texture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) +
				texture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) +
				texture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) +
				mix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ),
					 texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ),
					 f.x ) +
				mix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ),
					 texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ),
					 f.x ) +
				mix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ),
					 texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ),
					 f.y ) +
				mix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ),
					 texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ),
					 f.y ) +
				mix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ),
						  texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ),
						  f.x ),
					 mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ),
						  texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ),
						  f.x ),
					 f.y )
			) * ( 1.0 / 9.0 );
		#elif defined( SHADOWMAP_TYPE_VSM )
			shadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );
		#else
			shadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );
		#endif
		}
		return shadow;
	}
	vec2 cubeToUV( vec3 v, float texelSizeY ) {
		vec3 absV = abs( v );
		float scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );
		absV *= scaleToCube;
		v *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );
		vec2 planar = v.xy;
		float almostATexel = 1.5 * texelSizeY;
		float almostOne = 1.0 - almostATexel;
		if ( absV.z >= almostOne ) {
			if ( v.z > 0.0 )
				planar.x = 4.0 - v.x;
		} else if ( absV.x >= almostOne ) {
			float signX = sign( v.x );
			planar.x = v.z * signX + 2.0 * signX;
		} else if ( absV.y >= almostOne ) {
			float signY = sign( v.y );
			planar.x = v.x + 2.0 * signY + 2.0;
			planar.y = v.z * signY - 2.0;
		}
		return vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );
	}
	float getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {
		vec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );
		vec3 lightToPosition = shadowCoord.xyz;
		float dp = ( length( lightToPosition ) - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear );		dp += shadowBias;
		vec3 bd3D = normalize( lightToPosition );
		#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )
			vec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;
			return (
				texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +
				texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +
				texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +
				texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +
				texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +
				texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +
				texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +
				texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +
				texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )
			) * ( 1.0 / 9.0 );
		#else
			return texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );
		#endif
	}
#endif`,XL=`#if NUM_SPOT_LIGHT_COORDS > 0
  uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ];
  varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];
#endif
#ifdef USE_SHADOWMAP
	#if NUM_DIR_LIGHT_SHADOWS > 0
		uniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];
		varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];
		struct DirectionalLightShadow {
			float shadowBias;
			float shadowNormalBias;
			float shadowRadius;
			vec2 shadowMapSize;
		};
		uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];
	#endif
	#if NUM_SPOT_LIGHT_SHADOWS > 0
		struct SpotLightShadow {
			float shadowBias;
			float shadowNormalBias;
			float shadowRadius;
			vec2 shadowMapSize;
		};
		uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];
	#endif
	#if NUM_POINT_LIGHT_SHADOWS > 0
		uniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];
		varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];
		struct PointLightShadow {
			float shadowBias;
			float shadowNormalBias;
			float shadowRadius;
			vec2 shadowMapSize;
			float shadowCameraNear;
			float shadowCameraFar;
		};
		uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];
	#endif
#endif`,jL=`#if defined( USE_SHADOWMAP ) || ( NUM_SPOT_LIGHT_COORDS > 0 )
	#if NUM_DIR_LIGHT_SHADOWS > 0 || NUM_SPOT_LIGHT_COORDS > 0 || NUM_POINT_LIGHT_SHADOWS > 0
		vec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );
		vec4 shadowWorldPosition;
	#endif
	#if NUM_DIR_LIGHT_SHADOWS > 0
	#pragma unroll_loop_start
	for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {
		shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );
		vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;
	}
	#pragma unroll_loop_end
	#endif
	#if NUM_SPOT_LIGHT_COORDS > 0
	#pragma unroll_loop_start
	for ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) {
		shadowWorldPosition = worldPosition;
		#if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
			shadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias;
		#endif
		vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition;
	}
	#pragma unroll_loop_end
	#endif
	#if NUM_POINT_LIGHT_SHADOWS > 0
	#pragma unroll_loop_start
	for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {
		shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );
		vPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;
	}
	#pragma unroll_loop_end
	#endif
#endif`,YL=`float getShadowMask() {
	float shadow = 1.0;
	#ifdef USE_SHADOWMAP
	#if NUM_DIR_LIGHT_SHADOWS > 0
	DirectionalLightShadow directionalLight;
	#pragma unroll_loop_start
	for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {
		directionalLight = directionalLightShadows[ i ];
		shadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;
	}
	#pragma unroll_loop_end
	#endif
	#if NUM_SPOT_LIGHT_SHADOWS > 0
	SpotLightShadow spotLight;
	#pragma unroll_loop_start
	for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {
		spotLight = spotLightShadows[ i ];
		shadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;
	}
	#pragma unroll_loop_end
	#endif
	#if NUM_POINT_LIGHT_SHADOWS > 0
	PointLightShadow pointLight;
	#pragma unroll_loop_start
	for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {
		pointLight = pointLightShadows[ i ];
		shadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;
	}
	#pragma unroll_loop_end
	#endif
	#endif
	return shadow;
}`,qL=`#ifdef USE_SKINNING
	mat4 boneMatX = getBoneMatrix( skinIndex.x );
	mat4 boneMatY = getBoneMatrix( skinIndex.y );
	mat4 boneMatZ = getBoneMatrix( skinIndex.z );
	mat4 boneMatW = getBoneMatrix( skinIndex.w );
#endif`,ZL=`#ifdef USE_SKINNING
	uniform mat4 bindMatrix;
	uniform mat4 bindMatrixInverse;
	uniform highp sampler2D boneTexture;
	uniform int boneTextureSize;
	mat4 getBoneMatrix( const in float i ) {
		float j = i * 4.0;
		float x = mod( j, float( boneTextureSize ) );
		float y = floor( j / float( boneTextureSize ) );
		float dx = 1.0 / float( boneTextureSize );
		float dy = 1.0 / float( boneTextureSize );
		y = dy * ( y + 0.5 );
		vec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) );
		vec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) );
		vec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) );
		vec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) );
		mat4 bone = mat4( v1, v2, v3, v4 );
		return bone;
	}
#endif`,JL=`#ifdef USE_SKINNING
	vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );
	vec4 skinned = vec4( 0.0 );
	skinned += boneMatX * skinVertex * skinWeight.x;
	skinned += boneMatY * skinVertex * skinWeight.y;
	skinned += boneMatZ * skinVertex * skinWeight.z;
	skinned += boneMatW * skinVertex * skinWeight.w;
	transformed = ( bindMatrixInverse * skinned ).xyz;
#endif`,QL=`#ifdef USE_SKINNING
	mat4 skinMatrix = mat4( 0.0 );
	skinMatrix += skinWeight.x * boneMatX;
	skinMatrix += skinWeight.y * boneMatY;
	skinMatrix += skinWeight.z * boneMatZ;
	skinMatrix += skinWeight.w * boneMatW;
	skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;
	objectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;
	#ifdef USE_TANGENT
		objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;
	#endif
#endif`,KL=`float specularStrength;
#ifdef USE_SPECULARMAP
	vec4 texelSpecular = texture2D( specularMap, vUv );
	specularStrength = texelSpecular.r;
#else
	specularStrength = 1.0;
#endif`,$L=`#ifdef USE_SPECULARMAP
	uniform sampler2D specularMap;
#endif`,eR=`#if defined( TONE_MAPPING )
	gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );
#endif`,tR=`#ifndef saturate
#define saturate( a ) clamp( a, 0.0, 1.0 )
#endif
uniform float toneMappingExposure;
vec3 LinearToneMapping( vec3 color ) {
	return toneMappingExposure * color;
}
vec3 ReinhardToneMapping( vec3 color ) {
	color *= toneMappingExposure;
	return saturate( color / ( vec3( 1.0 ) + color ) );
}
vec3 OptimizedCineonToneMapping( vec3 color ) {
	color *= toneMappingExposure;
	color = max( vec3( 0.0 ), color - 0.004 );
	return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );
}
vec3 RRTAndODTFit( vec3 v ) {
	vec3 a = v * ( v + 0.0245786 ) - 0.000090537;
	vec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;
	return a / b;
}
vec3 ACESFilmicToneMapping( vec3 color ) {
	const mat3 ACESInputMat = mat3(
		vec3( 0.59719, 0.07600, 0.02840 ),		vec3( 0.35458, 0.90834, 0.13383 ),
		vec3( 0.04823, 0.01566, 0.83777 )
	);
	const mat3 ACESOutputMat = mat3(
		vec3(  1.60475, -0.10208, -0.00327 ),		vec3( -0.53108,  1.10813, -0.07276 ),
		vec3( -0.07367, -0.00605,  1.07602 )
	);
	color *= toneMappingExposure / 0.6;
	color = ACESInputMat * color;
	color = RRTAndODTFit( color );
	color = ACESOutputMat * color;
	return saturate( color );
}
vec3 CustomToneMapping( vec3 color ) { return color; }`,nR=`#ifdef USE_TRANSMISSION
	material.transmission = transmission;
	material.transmissionAlpha = 1.0;
	material.thickness = thickness;
	material.attenuationDistance = attenuationDistance;
	material.attenuationColor = attenuationColor;
	#ifdef USE_TRANSMISSIONMAP
		material.transmission *= texture2D( transmissionMap, vUv ).r;
	#endif
	#ifdef USE_THICKNESSMAP
		material.thickness *= texture2D( thicknessMap, vUv ).g;
	#endif
	vec3 pos = vWorldPosition;
	vec3 v = normalize( cameraPosition - pos );
	vec3 n = inverseTransformDirection( normal, viewMatrix );
	vec4 transmission = getIBLVolumeRefraction(
		n, v, material.roughness, material.diffuseColor, material.specularColor, material.specularF90,
		pos, modelMatrix, viewMatrix, projectionMatrix, material.ior, material.thickness,
		material.attenuationColor, material.attenuationDistance );
	material.transmissionAlpha = mix( material.transmissionAlpha, transmission.a, material.transmission );
	totalDiffuse = mix( totalDiffuse, transmission.rgb, material.transmission );
#endif`,iR=`#ifdef USE_TRANSMISSION
	uniform float transmission;
	uniform float thickness;
	uniform float attenuationDistance;
	uniform vec3 attenuationColor;
	#ifdef USE_TRANSMISSIONMAP
		uniform sampler2D transmissionMap;
	#endif
	#ifdef USE_THICKNESSMAP
		uniform sampler2D thicknessMap;
	#endif
	uniform vec2 transmissionSamplerSize;
	uniform sampler2D transmissionSamplerMap;
	uniform mat4 modelMatrix;
	uniform mat4 projectionMatrix;
	varying vec3 vWorldPosition;
	vec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) {
		vec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );
		vec3 modelScale;
		modelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );
		modelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );
		modelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );
		return normalize( refractionVector ) * thickness * modelScale;
	}
	float applyIorToRoughness( const in float roughness, const in float ior ) {
		return roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );
	}
	vec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) {
		float framebufferLod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );
		#ifdef texture2DLodEXT
			return texture2DLodEXT( transmissionSamplerMap, fragCoord.xy, framebufferLod );
		#else
			return texture2D( transmissionSamplerMap, fragCoord.xy, framebufferLod );
		#endif
	}
	vec3 applyVolumeAttenuation( const in vec3 radiance, const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) {
		if ( attenuationDistance == 0.0 ) {
			return radiance;
		} else {
			vec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;
			vec3 transmittance = exp( - attenuationCoefficient * transmissionDistance );			return transmittance * radiance;
		}
	}
	vec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor,
		const in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix,
		const in mat4 viewMatrix, const in mat4 projMatrix, const in float ior, const in float thickness,
		const in vec3 attenuationColor, const in float attenuationDistance ) {
		vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );
		vec3 refractedRayExit = position + transmissionRay;
		vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );
		vec2 refractionCoords = ndcPos.xy / ndcPos.w;
		refractionCoords += 1.0;
		refractionCoords /= 2.0;
		vec4 transmittedLight = getTransmissionSample( refractionCoords, roughness, ior );
		vec3 attenuatedColor = applyVolumeAttenuation( transmittedLight.rgb, length( transmissionRay ), attenuationColor, attenuationDistance );
		vec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );
		return vec4( ( 1.0 - F ) * attenuatedColor * diffuseColor, transmittedLight.a );
	}
#endif`,rR=`#if ( defined( USE_UV ) && ! defined( UVS_VERTEX_ONLY ) )
	varying vec2 vUv;
#endif`,sR=`#ifdef USE_UV
	#ifdef UVS_VERTEX_ONLY
		vec2 vUv;
	#else
		varying vec2 vUv;
	#endif
	uniform mat3 uvTransform;
#endif`,oR=`#ifdef USE_UV
	vUv = ( uvTransform * vec3( uv, 1 ) ).xy;
#endif`,aR=`#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )
	varying vec2 vUv2;
#endif`,lR=`#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )
	attribute vec2 uv2;
	varying vec2 vUv2;
	uniform mat3 uv2Transform;
#endif`,uR=`#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )
	vUv2 = ( uv2Transform * vec3( uv2, 1 ) ).xy;
#endif`,cR=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0
	vec4 worldPosition = vec4( transformed, 1.0 );
	#ifdef USE_INSTANCING
		worldPosition = instanceMatrix * worldPosition;
	#endif
	worldPosition = modelMatrix * worldPosition;
#endif`;const dt={alphamap_fragment:hP,alphamap_pars_fragment:pP,alphatest_fragment:mP,alphatest_pars_fragment:gP,aomap_fragment:vP,aomap_pars_fragment:yP,begin_vertex:xP,beginnormal_vertex:_P,bsdfs:wP,iridescence_fragment:SP,bumpmap_pars_fragment:MP,clipping_planes_fragment:EP,clipping_planes_pars_fragment:TP,clipping_planes_pars_vertex:bP,clipping_planes_vertex:AP,color_fragment:CP,color_pars_fragment:PP,color_pars_vertex:LP,color_vertex:RP,common:IP,cube_uv_reflection_fragment:DP,defaultnormal_vertex:zP,displacementmap_pars_vertex:NP,displacementmap_vertex:kP,emissivemap_fragment:OP,emissivemap_pars_fragment:FP,encodings_fragment:UP,encodings_pars_fragment:BP,envmap_fragment:VP,envmap_common_pars_fragment:HP,envmap_pars_fragment:WP,envmap_pars_vertex:GP,envmap_physical_pars_fragment:nL,envmap_vertex:XP,fog_vertex:jP,fog_pars_vertex:YP,fog_fragment:qP,fog_pars_fragment:ZP,gradientmap_pars_fragment:JP,lightmap_fragment:QP,lightmap_pars_fragment:KP,lights_lambert_fragment:$P,lights_lambert_pars_fragment:eL,lights_pars_begin:tL,lights_toon_fragment:iL,lights_toon_pars_fragment:rL,lights_phong_fragment:sL,lights_phong_pars_fragment:oL,lights_physical_fragment:aL,lights_physical_pars_fragment:lL,lights_fragment_begin:uL,lights_fragment_maps:cL,lights_fragment_end:fL,logdepthbuf_fragment:dL,logdepthbuf_pars_fragment:hL,logdepthbuf_pars_vertex:pL,logdepthbuf_vertex:mL,map_fragment:gL,map_pars_fragment:vL,map_particle_fragment:yL,map_particle_pars_fragment:xL,metalnessmap_fragment:_L,metalnessmap_pars_fragment:wL,morphcolor_vertex:SL,morphnormal_vertex:ML,morphtarget_pars_vertex:EL,morphtarget_vertex:TL,normal_fragment_begin:bL,normal_fragment_maps:AL,normal_pars_fragment:CL,normal_pars_vertex:PL,normal_vertex:LL,normalmap_pars_fragment:RL,clearcoat_normal_fragment_begin:IL,clearcoat_normal_fragment_maps:DL,clearcoat_pars_fragment:zL,iridescence_pars_fragment:NL,output_fragment:kL,packing:OL,premultiplied_alpha_fragment:FL,project_vertex:UL,dithering_fragment:BL,dithering_pars_fragment:VL,roughnessmap_fragment:HL,roughnessmap_pars_fragment:WL,shadowmap_pars_fragment:GL,shadowmap_pars_vertex:XL,shadowmap_vertex:jL,shadowmask_pars_fragment:YL,skinbase_vertex:qL,skinning_pars_vertex:ZL,skinning_vertex:JL,skinnormal_vertex:QL,specularmap_fragment:KL,specularmap_pars_fragment:$L,tonemapping_fragment:eR,tonemapping_pars_fragment:tR,transmission_fragment:nR,transmission_pars_fragment:iR,uv_pars_fragment:rR,uv_pars_vertex:sR,uv_vertex:oR,uv2_pars_fragment:aR,uv2_pars_vertex:lR,uv2_vertex:uR,worldpos_vertex:cR,background_vert:`varying vec2 vUv;
uniform mat3 uvTransform;
void main() {
	vUv = ( uvTransform * vec3( uv, 1 ) ).xy;
	gl_Position = vec4( position.xy, 1.0, 1.0 );
}`,background_frag:`uniform sampler2D t2D;
varying vec2 vUv;
void main() {
	gl_FragColor = texture2D( t2D, vUv );
	#ifdef DECODE_VIDEO_TEXTURE
		gl_FragColor = vec4( mix( pow( gl_FragColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), gl_FragColor.rgb * 0.0773993808, vec3( lessThanEqual( gl_FragColor.rgb, vec3( 0.04045 ) ) ) ), gl_FragColor.w );
	#endif
	#include <tonemapping_fragment>
	#include <encodings_fragment>
}`,cube_vert:`varying vec3 vWorldDirection;
#include <common>
void main() {
	vWorldDirection = transformDirection( position, modelMatrix );
	#include <begin_vertex>
	#include <project_vertex>
	gl_Position.z = gl_Position.w;
}`,cube_frag:`#include <envmap_common_pars_fragment>
uniform float opacity;
varying vec3 vWorldDirection;
#include <cube_uv_reflection_fragment>
void main() {
	vec3 vReflect = vWorldDirection;
	#include <envmap_fragment>
	gl_FragColor = envColor;
	gl_FragColor.a *= opacity;
	#include <tonemapping_fragment>
	#include <encodings_fragment>
}`,depth_vert:`#include <common>
#include <uv_pars_vertex>
#include <displacementmap_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
varying vec2 vHighPrecisionZW;
void main() {
	#include <uv_vertex>
	#include <skinbase_vertex>
	#ifdef USE_DISPLACEMENTMAP
		#include <beginnormal_vertex>
		#include <morphnormal_vertex>
		#include <skinnormal_vertex>
	#endif
	#include <begin_vertex>
	#include <morphtarget_vertex>
	#include <skinning_vertex>
	#include <displacementmap_vertex>
	#include <project_vertex>
	#include <logdepthbuf_vertex>
	#include <clipping_planes_vertex>
	vHighPrecisionZW = gl_Position.zw;
}`,depth_frag:`#if DEPTH_PACKING == 3200
	uniform float opacity;
#endif
#include <common>
#include <packing>
#include <uv_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <alphatest_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
varying vec2 vHighPrecisionZW;
void main() {
	#include <clipping_planes_fragment>
	vec4 diffuseColor = vec4( 1.0 );
	#if DEPTH_PACKING == 3200
		diffuseColor.a = opacity;
	#endif
	#include <map_fragment>
	#include <alphamap_fragment>
	#include <alphatest_fragment>
	#include <logdepthbuf_fragment>
	float fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;
	#if DEPTH_PACKING == 3200
		gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );
	#elif DEPTH_PACKING == 3201
		gl_FragColor = packDepthToRGBA( fragCoordZ );
	#endif
}`,distanceRGBA_vert:`#define DISTANCE
varying vec3 vWorldPosition;
#include <common>
#include <uv_pars_vertex>
#include <displacementmap_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
	#include <uv_vertex>
	#include <skinbase_vertex>
	#ifdef USE_DISPLACEMENTMAP
		#include <beginnormal_vertex>
		#include <morphnormal_vertex>
		#include <skinnormal_vertex>
	#endif
	#include <begin_vertex>
	#include <morphtarget_vertex>
	#include <skinning_vertex>
	#include <displacementmap_vertex>
	#include <project_vertex>
	#include <worldpos_vertex>
	#include <clipping_planes_vertex>
	vWorldPosition = worldPosition.xyz;
}`,distanceRGBA_frag:`#define DISTANCE
uniform vec3 referencePosition;
uniform float nearDistance;
uniform float farDistance;
varying vec3 vWorldPosition;
#include <common>
#include <packing>
#include <uv_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <alphatest_pars_fragment>
#include <clipping_planes_pars_fragment>
void main () {
	#include <clipping_planes_fragment>
	vec4 diffuseColor = vec4( 1.0 );
	#include <map_fragment>
	#include <alphamap_fragment>
	#include <alphatest_fragment>
	float dist = length( vWorldPosition - referencePosition );
	dist = ( dist - nearDistance ) / ( farDistance - nearDistance );
	dist = saturate( dist );
	gl_FragColor = packDepthToRGBA( dist );
}`,equirect_vert:`varying vec3 vWorldDirection;
#include <common>
void main() {
	vWorldDirection = transformDirection( position, modelMatrix );
	#include <begin_vertex>
	#include <project_vertex>
}`,equirect_frag:`uniform sampler2D tEquirect;
varying vec3 vWorldDirection;
#include <common>
void main() {
	vec3 direction = normalize( vWorldDirection );
	vec2 sampleUV = equirectUv( direction );
	gl_FragColor = texture2D( tEquirect, sampleUV );
	#include <tonemapping_fragment>
	#include <encodings_fragment>
}`,linedashed_vert:`uniform float scale;
attribute float lineDistance;
varying float vLineDistance;
#include <common>
#include <color_pars_vertex>
#include <fog_pars_vertex>
#include <morphtarget_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
	vLineDistance = scale * lineDistance;
	#include <color_vertex>
	#include <morphcolor_vertex>
	#include <begin_vertex>
	#include <morphtarget_vertex>
	#include <project_vertex>
	#include <logdepthbuf_vertex>
	#include <clipping_planes_vertex>
	#include <fog_vertex>
}`,linedashed_frag:`uniform vec3 diffuse;
uniform float opacity;
uniform float dashSize;
uniform float totalSize;
varying float vLineDistance;
#include <common>
#include <color_pars_fragment>
#include <fog_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
	#include <clipping_planes_fragment>
	if ( mod( vLineDistance, totalSize ) > dashSize ) {
		discard;
	}
	vec3 outgoingLight = vec3( 0.0 );
	vec4 diffuseColor = vec4( diffuse, opacity );
	#include <logdepthbuf_fragment>
	#include <color_fragment>
	outgoingLight = diffuseColor.rgb;
	#include <output_fragment>
	#include <tonemapping_fragment>
	#include <encodings_fragment>
	#include <fog_fragment>
	#include <premultiplied_alpha_fragment>
}`,meshbasic_vert:`#include <common>
#include <uv_pars_vertex>
#include <uv2_pars_vertex>
#include <envmap_pars_vertex>
#include <color_pars_vertex>
#include <fog_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
	#include <uv_vertex>
	#include <uv2_vertex>
	#include <color_vertex>
	#include <morphcolor_vertex>
	#if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )
		#include <beginnormal_vertex>
		#include <morphnormal_vertex>
		#include <skinbase_vertex>
		#include <skinnormal_vertex>
		#include <defaultnormal_vertex>
	#endif
	#include <begin_vertex>
	#include <morphtarget_vertex>
	#include <skinning_vertex>
	#include <project_vertex>
	#include <logdepthbuf_vertex>
	#include <clipping_planes_vertex>
	#include <worldpos_vertex>
	#include <envmap_vertex>
	#include <fog_vertex>
}`,meshbasic_frag:`uniform vec3 diffuse;
uniform float opacity;
#ifndef FLAT_SHADED
	varying vec3 vNormal;
#endif
#include <common>
#include <dithering_pars_fragment>
#include <color_pars_fragment>
#include <uv_pars_fragment>
#include <uv2_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <alphatest_pars_fragment>
#include <aomap_pars_fragment>
#include <lightmap_pars_fragment>
#include <envmap_common_pars_fragment>
#include <envmap_pars_fragment>
#include <fog_pars_fragment>
#include <specularmap_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
	#include <clipping_planes_fragment>
	vec4 diffuseColor = vec4( diffuse, opacity );
	#include <logdepthbuf_fragment>
	#include <map_fragment>
	#include <color_fragment>
	#include <alphamap_fragment>
	#include <alphatest_fragment>
	#include <specularmap_fragment>
	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
	#ifdef USE_LIGHTMAP
		vec4 lightMapTexel = texture2D( lightMap, vUv2 );
		reflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI;
	#else
		reflectedLight.indirectDiffuse += vec3( 1.0 );
	#endif
	#include <aomap_fragment>
	reflectedLight.indirectDiffuse *= diffuseColor.rgb;
	vec3 outgoingLight = reflectedLight.indirectDiffuse;
	#include <envmap_fragment>
	#include <output_fragment>
	#include <tonemapping_fragment>
	#include <encodings_fragment>
	#include <fog_fragment>
	#include <premultiplied_alpha_fragment>
	#include <dithering_fragment>
}`,meshlambert_vert:`#define LAMBERT
varying vec3 vViewPosition;
#include <common>
#include <uv_pars_vertex>
#include <uv2_pars_vertex>
#include <displacementmap_pars_vertex>
#include <envmap_pars_vertex>
#include <color_pars_vertex>
#include <fog_pars_vertex>
#include <normal_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <shadowmap_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
	#include <uv_vertex>
	#include <uv2_vertex>
	#include <color_vertex>
	#include <morphcolor_vertex>
	#include <beginnormal_vertex>
	#include <morphnormal_vertex>
	#include <skinbase_vertex>
	#include <skinnormal_vertex>
	#include <defaultnormal_vertex>
	#include <normal_vertex>
	#include <begin_vertex>
	#include <morphtarget_vertex>
	#include <skinning_vertex>
	#include <displacementmap_vertex>
	#include <project_vertex>
	#include <logdepthbuf_vertex>
	#include <clipping_planes_vertex>
	vViewPosition = - mvPosition.xyz;
	#include <worldpos_vertex>
	#include <envmap_vertex>
	#include <shadowmap_vertex>
	#include <fog_vertex>
}`,meshlambert_frag:`#define LAMBERT
uniform vec3 diffuse;
uniform vec3 emissive;
uniform float opacity;
#include <common>
#include <packing>
#include <dithering_pars_fragment>
#include <color_pars_fragment>
#include <uv_pars_fragment>
#include <uv2_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <alphatest_pars_fragment>
#include <aomap_pars_fragment>
#include <lightmap_pars_fragment>
#include <emissivemap_pars_fragment>
#include <envmap_common_pars_fragment>
#include <envmap_pars_fragment>
#include <fog_pars_fragment>
#include <bsdfs>
#include <lights_pars_begin>
#include <normal_pars_fragment>
#include <lights_lambert_pars_fragment>
#include <shadowmap_pars_fragment>
#include <bumpmap_pars_fragment>
#include <normalmap_pars_fragment>
#include <specularmap_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
	#include <clipping_planes_fragment>
	vec4 diffuseColor = vec4( diffuse, opacity );
	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
	vec3 totalEmissiveRadiance = emissive;
	#include <logdepthbuf_fragment>
	#include <map_fragment>
	#include <color_fragment>
	#include <alphamap_fragment>
	#include <alphatest_fragment>
	#include <specularmap_fragment>
	#include <normal_fragment_begin>
	#include <normal_fragment_maps>
	#include <emissivemap_fragment>
	#include <lights_lambert_fragment>
	#include <lights_fragment_begin>
	#include <lights_fragment_maps>
	#include <lights_fragment_end>
	#include <aomap_fragment>
	vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;
	#include <envmap_fragment>
	#include <output_fragment>
	#include <tonemapping_fragment>
	#include <encodings_fragment>
	#include <fog_fragment>
	#include <premultiplied_alpha_fragment>
	#include <dithering_fragment>
}`,meshmatcap_vert:`#define MATCAP
varying vec3 vViewPosition;
#include <common>
#include <uv_pars_vertex>
#include <color_pars_vertex>
#include <displacementmap_pars_vertex>
#include <fog_pars_vertex>
#include <normal_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
	#include <uv_vertex>
	#include <color_vertex>
	#include <morphcolor_vertex>
	#include <beginnormal_vertex>
	#include <morphnormal_vertex>
	#include <skinbase_vertex>
	#include <skinnormal_vertex>
	#include <defaultnormal_vertex>
	#include <normal_vertex>
	#include <begin_vertex>
	#include <morphtarget_vertex>
	#include <skinning_vertex>
	#include <displacementmap_vertex>
	#include <project_vertex>
	#include <logdepthbuf_vertex>
	#include <clipping_planes_vertex>
	#include <fog_vertex>
	vViewPosition = - mvPosition.xyz;
}`,meshmatcap_frag:`#define MATCAP
uniform vec3 diffuse;
uniform float opacity;
uniform sampler2D matcap;
varying vec3 vViewPosition;
#include <common>
#include <dithering_pars_fragment>
#include <color_pars_fragment>
#include <uv_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <alphatest_pars_fragment>
#include <fog_pars_fragment>
#include <normal_pars_fragment>
#include <bumpmap_pars_fragment>
#include <normalmap_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
	#include <clipping_planes_fragment>
	vec4 diffuseColor = vec4( diffuse, opacity );
	#include <logdepthbuf_fragment>
	#include <map_fragment>
	#include <color_fragment>
	#include <alphamap_fragment>
	#include <alphatest_fragment>
	#include <normal_fragment_begin>
	#include <normal_fragment_maps>
	vec3 viewDir = normalize( vViewPosition );
	vec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );
	vec3 y = cross( viewDir, x );
	vec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;
	#ifdef USE_MATCAP
		vec4 matcapColor = texture2D( matcap, uv );
	#else
		vec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 );
	#endif
	vec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;
	#include <output_fragment>
	#include <tonemapping_fragment>
	#include <encodings_fragment>
	#include <fog_fragment>
	#include <premultiplied_alpha_fragment>
	#include <dithering_fragment>
}`,meshnormal_vert:`#define NORMAL
#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )
	varying vec3 vViewPosition;
#endif
#include <common>
#include <uv_pars_vertex>
#include <displacementmap_pars_vertex>
#include <normal_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
	#include <uv_vertex>
	#include <beginnormal_vertex>
	#include <morphnormal_vertex>
	#include <skinbase_vertex>
	#include <skinnormal_vertex>
	#include <defaultnormal_vertex>
	#include <normal_vertex>
	#include <begin_vertex>
	#include <morphtarget_vertex>
	#include <skinning_vertex>
	#include <displacementmap_vertex>
	#include <project_vertex>
	#include <logdepthbuf_vertex>
	#include <clipping_planes_vertex>
#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )
	vViewPosition = - mvPosition.xyz;
#endif
}`,meshnormal_frag:`#define NORMAL
uniform float opacity;
#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )
	varying vec3 vViewPosition;
#endif
#include <packing>
#include <uv_pars_fragment>
#include <normal_pars_fragment>
#include <bumpmap_pars_fragment>
#include <normalmap_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
	#include <clipping_planes_fragment>
	#include <logdepthbuf_fragment>
	#include <normal_fragment_begin>
	#include <normal_fragment_maps>
	gl_FragColor = vec4( packNormalToRGB( normal ), opacity );
	#ifdef OPAQUE
		gl_FragColor.a = 1.0;
	#endif
}`,meshphong_vert:`#define PHONG
varying vec3 vViewPosition;
#include <common>
#include <uv_pars_vertex>
#include <uv2_pars_vertex>
#include <displacementmap_pars_vertex>
#include <envmap_pars_vertex>
#include <color_pars_vertex>
#include <fog_pars_vertex>
#include <normal_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <shadowmap_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
	#include <uv_vertex>
	#include <uv2_vertex>
	#include <color_vertex>
	#include <morphcolor_vertex>
	#include <beginnormal_vertex>
	#include <morphnormal_vertex>
	#include <skinbase_vertex>
	#include <skinnormal_vertex>
	#include <defaultnormal_vertex>
	#include <normal_vertex>
	#include <begin_vertex>
	#include <morphtarget_vertex>
	#include <skinning_vertex>
	#include <displacementmap_vertex>
	#include <project_vertex>
	#include <logdepthbuf_vertex>
	#include <clipping_planes_vertex>
	vViewPosition = - mvPosition.xyz;
	#include <worldpos_vertex>
	#include <envmap_vertex>
	#include <shadowmap_vertex>
	#include <fog_vertex>
}`,meshphong_frag:`#define PHONG
uniform vec3 diffuse;
uniform vec3 emissive;
uniform vec3 specular;
uniform float shininess;
uniform float opacity;
#include <common>
#include <packing>
#include <dithering_pars_fragment>
#include <color_pars_fragment>
#include <uv_pars_fragment>
#include <uv2_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <alphatest_pars_fragment>
#include <aomap_pars_fragment>
#include <lightmap_pars_fragment>
#include <emissivemap_pars_fragment>
#include <envmap_common_pars_fragment>
#include <envmap_pars_fragment>
#include <fog_pars_fragment>
#include <bsdfs>
#include <lights_pars_begin>
#include <normal_pars_fragment>
#include <lights_phong_pars_fragment>
#include <shadowmap_pars_fragment>
#include <bumpmap_pars_fragment>
#include <normalmap_pars_fragment>
#include <specularmap_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
	#include <clipping_planes_fragment>
	vec4 diffuseColor = vec4( diffuse, opacity );
	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
	vec3 totalEmissiveRadiance = emissive;
	#include <logdepthbuf_fragment>
	#include <map_fragment>
	#include <color_fragment>
	#include <alphamap_fragment>
	#include <alphatest_fragment>
	#include <specularmap_fragment>
	#include <normal_fragment_begin>
	#include <normal_fragment_maps>
	#include <emissivemap_fragment>
	#include <lights_phong_fragment>
	#include <lights_fragment_begin>
	#include <lights_fragment_maps>
	#include <lights_fragment_end>
	#include <aomap_fragment>
	vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;
	#include <envmap_fragment>
	#include <output_fragment>
	#include <tonemapping_fragment>
	#include <encodings_fragment>
	#include <fog_fragment>
	#include <premultiplied_alpha_fragment>
	#include <dithering_fragment>
}`,meshphysical_vert:`#define STANDARD
varying vec3 vViewPosition;
#ifdef USE_TRANSMISSION
	varying vec3 vWorldPosition;
#endif
#include <common>
#include <uv_pars_vertex>
#include <uv2_pars_vertex>
#include <displacementmap_pars_vertex>
#include <color_pars_vertex>
#include <fog_pars_vertex>
#include <normal_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <shadowmap_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
	#include <uv_vertex>
	#include <uv2_vertex>
	#include <color_vertex>
	#include <morphcolor_vertex>
	#include <beginnormal_vertex>
	#include <morphnormal_vertex>
	#include <skinbase_vertex>
	#include <skinnormal_vertex>
	#include <defaultnormal_vertex>
	#include <normal_vertex>
	#include <begin_vertex>
	#include <morphtarget_vertex>
	#include <skinning_vertex>
	#include <displacementmap_vertex>
	#include <project_vertex>
	#include <logdepthbuf_vertex>
	#include <clipping_planes_vertex>
	vViewPosition = - mvPosition.xyz;
	#include <worldpos_vertex>
	#include <shadowmap_vertex>
	#include <fog_vertex>
#ifdef USE_TRANSMISSION
	vWorldPosition = worldPosition.xyz;
#endif
}`,meshphysical_frag:`#define STANDARD
#ifdef PHYSICAL
	#define IOR
	#define SPECULAR
#endif
uniform vec3 diffuse;
uniform vec3 emissive;
uniform float roughness;
uniform float metalness;
uniform float opacity;
#ifdef IOR
	uniform float ior;
#endif
#ifdef SPECULAR
	uniform float specularIntensity;
	uniform vec3 specularColor;
	#ifdef USE_SPECULARINTENSITYMAP
		uniform sampler2D specularIntensityMap;
	#endif
	#ifdef USE_SPECULARCOLORMAP
		uniform sampler2D specularColorMap;
	#endif
#endif
#ifdef USE_CLEARCOAT
	uniform float clearcoat;
	uniform float clearcoatRoughness;
#endif
#ifdef USE_IRIDESCENCE
	uniform float iridescence;
	uniform float iridescenceIOR;
	uniform float iridescenceThicknessMinimum;
	uniform float iridescenceThicknessMaximum;
#endif
#ifdef USE_SHEEN
	uniform vec3 sheenColor;
	uniform float sheenRoughness;
	#ifdef USE_SHEENCOLORMAP
		uniform sampler2D sheenColorMap;
	#endif
	#ifdef USE_SHEENROUGHNESSMAP
		uniform sampler2D sheenRoughnessMap;
	#endif
#endif
varying vec3 vViewPosition;
#include <common>
#include <packing>
#include <dithering_pars_fragment>
#include <color_pars_fragment>
#include <uv_pars_fragment>
#include <uv2_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <alphatest_pars_fragment>
#include <aomap_pars_fragment>
#include <lightmap_pars_fragment>
#include <emissivemap_pars_fragment>
#include <bsdfs>
#include <iridescence_fragment>
#include <cube_uv_reflection_fragment>
#include <envmap_common_pars_fragment>
#include <envmap_physical_pars_fragment>
#include <fog_pars_fragment>
#include <lights_pars_begin>
#include <normal_pars_fragment>
#include <lights_physical_pars_fragment>
#include <transmission_pars_fragment>
#include <shadowmap_pars_fragment>
#include <bumpmap_pars_fragment>
#include <normalmap_pars_fragment>
#include <clearcoat_pars_fragment>
#include <iridescence_pars_fragment>
#include <roughnessmap_pars_fragment>
#include <metalnessmap_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
	#include <clipping_planes_fragment>
	vec4 diffuseColor = vec4( diffuse, opacity );
	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
	vec3 totalEmissiveRadiance = emissive;
	#include <logdepthbuf_fragment>
	#include <map_fragment>
	#include <color_fragment>
	#include <alphamap_fragment>
	#include <alphatest_fragment>
	#include <roughnessmap_fragment>
	#include <metalnessmap_fragment>
	#include <normal_fragment_begin>
	#include <normal_fragment_maps>
	#include <clearcoat_normal_fragment_begin>
	#include <clearcoat_normal_fragment_maps>
	#include <emissivemap_fragment>
	#include <lights_physical_fragment>
	#include <lights_fragment_begin>
	#include <lights_fragment_maps>
	#include <lights_fragment_end>
	#include <aomap_fragment>
	vec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;
	vec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;
	#include <transmission_fragment>
	vec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;
	#ifdef USE_SHEEN
		float sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor );
		outgoingLight = outgoingLight * sheenEnergyComp + sheenSpecular;
	#endif
	#ifdef USE_CLEARCOAT
		float dotNVcc = saturate( dot( geometry.clearcoatNormal, geometry.viewDir ) );
		vec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );
		outgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + clearcoatSpecular * material.clearcoat;
	#endif
	#include <output_fragment>
	#include <tonemapping_fragment>
	#include <encodings_fragment>
	#include <fog_fragment>
	#include <premultiplied_alpha_fragment>
	#include <dithering_fragment>
}`,meshtoon_vert:`#define TOON
varying vec3 vViewPosition;
#include <common>
#include <uv_pars_vertex>
#include <uv2_pars_vertex>
#include <displacementmap_pars_vertex>
#include <color_pars_vertex>
#include <fog_pars_vertex>
#include <normal_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <shadowmap_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
	#include <uv_vertex>
	#include <uv2_vertex>
	#include <color_vertex>
	#include <morphcolor_vertex>
	#include <beginnormal_vertex>
	#include <morphnormal_vertex>
	#include <skinbase_vertex>
	#include <skinnormal_vertex>
	#include <defaultnormal_vertex>
	#include <normal_vertex>
	#include <begin_vertex>
	#include <morphtarget_vertex>
	#include <skinning_vertex>
	#include <displacementmap_vertex>
	#include <project_vertex>
	#include <logdepthbuf_vertex>
	#include <clipping_planes_vertex>
	vViewPosition = - mvPosition.xyz;
	#include <worldpos_vertex>
	#include <shadowmap_vertex>
	#include <fog_vertex>
}`,meshtoon_frag:`#define TOON
uniform vec3 diffuse;
uniform vec3 emissive;
uniform float opacity;
#include <common>
#include <packing>
#include <dithering_pars_fragment>
#include <color_pars_fragment>
#include <uv_pars_fragment>
#include <uv2_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <alphatest_pars_fragment>
#include <aomap_pars_fragment>
#include <lightmap_pars_fragment>
#include <emissivemap_pars_fragment>
#include <gradientmap_pars_fragment>
#include <fog_pars_fragment>
#include <bsdfs>
#include <lights_pars_begin>
#include <normal_pars_fragment>
#include <lights_toon_pars_fragment>
#include <shadowmap_pars_fragment>
#include <bumpmap_pars_fragment>
#include <normalmap_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
	#include <clipping_planes_fragment>
	vec4 diffuseColor = vec4( diffuse, opacity );
	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
	vec3 totalEmissiveRadiance = emissive;
	#include <logdepthbuf_fragment>
	#include <map_fragment>
	#include <color_fragment>
	#include <alphamap_fragment>
	#include <alphatest_fragment>
	#include <normal_fragment_begin>
	#include <normal_fragment_maps>
	#include <emissivemap_fragment>
	#include <lights_toon_fragment>
	#include <lights_fragment_begin>
	#include <lights_fragment_maps>
	#include <lights_fragment_end>
	#include <aomap_fragment>
	vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;
	#include <output_fragment>
	#include <tonemapping_fragment>
	#include <encodings_fragment>
	#include <fog_fragment>
	#include <premultiplied_alpha_fragment>
	#include <dithering_fragment>
}`,points_vert:`uniform float size;
uniform float scale;
#include <common>
#include <color_pars_vertex>
#include <fog_pars_vertex>
#include <morphtarget_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
	#include <color_vertex>
	#include <morphcolor_vertex>
	#include <begin_vertex>
	#include <morphtarget_vertex>
	#include <project_vertex>
	gl_PointSize = size;
	#ifdef USE_SIZEATTENUATION
		bool isPerspective = isPerspectiveMatrix( projectionMatrix );
		if ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );
	#endif
	#include <logdepthbuf_vertex>
	#include <clipping_planes_vertex>
	#include <worldpos_vertex>
	#include <fog_vertex>
}`,points_frag:`uniform vec3 diffuse;
uniform float opacity;
#include <common>
#include <color_pars_fragment>
#include <map_particle_pars_fragment>
#include <alphatest_pars_fragment>
#include <fog_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
	#include <clipping_planes_fragment>
	vec3 outgoingLight = vec3( 0.0 );
	vec4 diffuseColor = vec4( diffuse, opacity );
	#include <logdepthbuf_fragment>
	#include <map_particle_fragment>
	#include <color_fragment>
	#include <alphatest_fragment>
	outgoingLight = diffuseColor.rgb;
	#include <output_fragment>
	#include <tonemapping_fragment>
	#include <encodings_fragment>
	#include <fog_fragment>
	#include <premultiplied_alpha_fragment>
}`,shadow_vert:`#include <common>
#include <fog_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <shadowmap_pars_vertex>
void main() {
	#include <beginnormal_vertex>
	#include <morphnormal_vertex>
	#include <skinbase_vertex>
	#include <skinnormal_vertex>
	#include <defaultnormal_vertex>
	#include <begin_vertex>
	#include <morphtarget_vertex>
	#include <skinning_vertex>
	#include <project_vertex>
	#include <worldpos_vertex>
	#include <shadowmap_vertex>
	#include <fog_vertex>
}`,shadow_frag:`uniform vec3 color;
uniform float opacity;
#include <common>
#include <packing>
#include <fog_pars_fragment>
#include <bsdfs>
#include <lights_pars_begin>
#include <shadowmap_pars_fragment>
#include <shadowmask_pars_fragment>
void main() {
	gl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );
	#include <tonemapping_fragment>
	#include <encodings_fragment>
	#include <fog_fragment>
}`,sprite_vert:`uniform float rotation;
uniform vec2 center;
#include <common>
#include <uv_pars_vertex>
#include <fog_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
	#include <uv_vertex>
	vec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );
	vec2 scale;
	scale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) );
	scale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) );
	#ifndef USE_SIZEATTENUATION
		bool isPerspective = isPerspectiveMatrix( projectionMatrix );
		if ( isPerspective ) scale *= - mvPosition.z;
	#endif
	vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;
	vec2 rotatedPosition;
	rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;
	rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;
	mvPosition.xy += rotatedPosition;
	gl_Position = projectionMatrix * mvPosition;
	#include <logdepthbuf_vertex>
	#include <clipping_planes_vertex>
	#include <fog_vertex>
}`,sprite_frag:`uniform vec3 diffuse;
uniform float opacity;
#include <common>
#include <uv_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <alphatest_pars_fragment>
#include <fog_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
	#include <clipping_planes_fragment>
	vec3 outgoingLight = vec3( 0.0 );
	vec4 diffuseColor = vec4( diffuse, opacity );
	#include <logdepthbuf_fragment>
	#include <map_fragment>
	#include <alphamap_fragment>
	#include <alphatest_fragment>
	outgoingLight = diffuseColor.rgb;
	#include <output_fragment>
	#include <tonemapping_fragment>
	#include <encodings_fragment>
	#include <fog_fragment>
}`},Se={common:{diffuse:{value:new De(16777215)},opacity:{value:1},map:{value:null},uvTransform:{value:new ui},uv2Transform:{value:new ui},alphaMap:{value:null},alphaTest:{value:0}},specularmap:{specularMap:{value:null}},envmap:{envMap:{value:null},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},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 fe(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 De(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotShadowMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new De(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaTest:{value:0},uvTransform:{value:new ui}},sprite:{diffuse:{value:new De(16777215)},opacity:{value:1},center:{value:new fe(.5,.5)},rotation:{value:0},map:{value:null},alphaMap:{value:null},alphaTest:{value:0},uvTransform:{value:new ui}}},Jn={basic:{uniforms:Un([Se.common,Se.specularmap,Se.envmap,Se.aomap,Se.lightmap,Se.fog]),vertexShader:dt.meshbasic_vert,fragmentShader:dt.meshbasic_frag},lambert:{uniforms:Un([Se.common,Se.specularmap,Se.envmap,Se.aomap,Se.lightmap,Se.emissivemap,Se.bumpmap,Se.normalmap,Se.displacementmap,Se.fog,Se.lights,{emissive:{value:new De(0)}}]),vertexShader:dt.meshlambert_vert,fragmentShader:dt.meshlambert_frag},phong:{uniforms:Un([Se.common,Se.specularmap,Se.envmap,Se.aomap,Se.lightmap,Se.emissivemap,Se.bumpmap,Se.normalmap,Se.displacementmap,Se.fog,Se.lights,{emissive:{value:new De(0)},specular:{value:new De(1118481)},shininess:{value:30}}]),vertexShader:dt.meshphong_vert,fragmentShader:dt.meshphong_frag},standard:{uniforms:Un([Se.common,Se.envmap,Se.aomap,Se.lightmap,Se.emissivemap,Se.bumpmap,Se.normalmap,Se.displacementmap,Se.roughnessmap,Se.metalnessmap,Se.fog,Se.lights,{emissive:{value:new De(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:dt.meshphysical_vert,fragmentShader:dt.meshphysical_frag},toon:{uniforms:Un([Se.common,Se.aomap,Se.lightmap,Se.emissivemap,Se.bumpmap,Se.normalmap,Se.displacementmap,Se.gradientmap,Se.fog,Se.lights,{emissive:{value:new De(0)}}]),vertexShader:dt.meshtoon_vert,fragmentShader:dt.meshtoon_frag},matcap:{uniforms:Un([Se.common,Se.bumpmap,Se.normalmap,Se.displacementmap,Se.fog,{matcap:{value:null}}]),vertexShader:dt.meshmatcap_vert,fragmentShader:dt.meshmatcap_frag},points:{uniforms:Un([Se.points,Se.fog]),vertexShader:dt.points_vert,fragmentShader:dt.points_frag},dashed:{uniforms:Un([Se.common,Se.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:dt.linedashed_vert,fragmentShader:dt.linedashed_frag},depth:{uniforms:Un([Se.common,Se.displacementmap]),vertexShader:dt.depth_vert,fragmentShader:dt.depth_frag},normal:{uniforms:Un([Se.common,Se.bumpmap,Se.normalmap,Se.displacementmap,{opacity:{value:1}}]),vertexShader:dt.meshnormal_vert,fragmentShader:dt.meshnormal_frag},sprite:{uniforms:Un([Se.sprite,Se.fog]),vertexShader:dt.sprite_vert,fragmentShader:dt.sprite_frag},background:{uniforms:{uvTransform:{value:new ui},t2D:{value:null}},vertexShader:dt.background_vert,fragmentShader:dt.background_frag},cube:{uniforms:Un([Se.envmap,{opacity:{value:1}}]),vertexShader:dt.cube_vert,fragmentShader:dt.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:dt.equirect_vert,fragmentShader:dt.equirect_frag},distanceRGBA:{uniforms:Un([Se.common,Se.displacementmap,{referencePosition:{value:new R},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:dt.distanceRGBA_vert,fragmentShader:dt.distanceRGBA_frag},shadow:{uniforms:Un([Se.lights,Se.fog,{color:{value:new De(0)},opacity:{value:1}}]),vertexShader:dt.shadow_vert,fragmentShader:dt.shadow_frag}};Jn.physical={uniforms:Un([Jn.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatNormalScale:{value:new fe(1,1)},clearcoatNormalMap:{value:null},iridescence:{value:0},iridescenceMap:{value:null},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},sheen:{value:0},sheenColor:{value:new De(0)},sheenColorMap:{value:null},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},transmission:{value:0},transmissionMap:{value:null},transmissionSamplerSize:{value:new fe},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},attenuationDistance:{value:0},attenuationColor:{value:new De(0)},specularIntensity:{value:1},specularIntensityMap:{value:null},specularColor:{value:new De(1,1,1)},specularColorMap:{value:null}}]),vertexShader:dt.meshphysical_vert,fragmentShader:dt.meshphysical_frag};function fR(n,e,t,i,r,s){const o=new De(0);let l=r===!0?0:1,c,f,d=null,h=0,m=null;function g(y,w){let _=!1,S=w.isScene===!0?w.background:null;S&&S.isTexture&&(S=e.get(S));const E=n.xr,T=E.getSession&&E.getSession();T&&T.environmentBlendMode==="additive"&&(S=null),S===null?x(o,l):S&&S.isColor&&(x(S,1),_=!0),(n.autoClear||_)&&n.clear(n.autoClearColor,n.autoClearDepth,n.autoClearStencil),S&&(S.isCubeTexture||S.mapping===il)?(f===void 0&&(f=new wn(new ro(1,1,1),new pr({name:"BackgroundCubeMaterial",uniforms:vl(Jn.cube.uniforms),vertexShader:Jn.cube.vertexShader,fragmentShader:Jn.cube.fragmentShader,side:Si,depthTest:!1,depthWrite:!1,fog:!1})),f.geometry.deleteAttribute("normal"),f.geometry.deleteAttribute("uv"),f.onBeforeRender=function(C,P,I){this.matrixWorld.copyPosition(I.matrixWorld)},Object.defineProperty(f.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),i.update(f)),f.material.uniforms.envMap.value=S,f.material.uniforms.flipEnvMap.value=S.isCubeTexture&&S.isRenderTargetTexture===!1?-1:1,(d!==S||h!==S.version||m!==n.toneMapping)&&(f.material.needsUpdate=!0,d=S,h=S.version,m=n.toneMapping),f.layers.enableAll(),y.unshift(f,f.geometry,f.material,0,0,null)):S&&S.isTexture&&(c===void 0&&(c=new wn(new wl(2,2),new pr({name:"BackgroundMaterial",uniforms:vl(Jn.background.uniforms),vertexShader:Jn.background.vertexShader,fragmentShader:Jn.background.fragmentShader,side:Bo,depthTest:!1,depthWrite:!1,fog:!1})),c.geometry.deleteAttribute("normal"),Object.defineProperty(c.material,"map",{get:function(){return this.uniforms.t2D.value}}),i.update(c)),c.material.uniforms.t2D.value=S,S.matrixAutoUpdate===!0&&S.updateMatrix(),c.material.uniforms.uvTransform.value.copy(S.matrix),(d!==S||h!==S.version||m!==n.toneMapping)&&(c.material.needsUpdate=!0,d=S,h=S.version,m=n.toneMapping),c.layers.enableAll(),y.unshift(c,c.geometry,c.material,0,0,null))}function x(y,w){t.buffers.color.setClear(y.r,y.g,y.b,w,s)}return{getClearColor:function(){return o},setClearColor:function(y,w=1){o.set(y),l=w,x(o,l)},getClearAlpha:function(){return l},setClearAlpha:function(y){l=y,x(o,l)},render:g}}function dR(n,e,t,i){const r=n.getParameter(34921),s=i.isWebGL2?null:e.get("OES_vertex_array_object"),o=i.isWebGL2||s!==null,l={},c=w(null);let f=c,d=!1;function h(G,ie,ee,pe,k){let B=!1;if(o){const F=y(pe,ee,ie);f!==F&&(f=F,g(f.object)),B=_(G,pe,ee,k),B&&S(G,pe,ee,k)}else{const F=ie.wireframe===!0;(f.geometry!==pe.id||f.program!==ee.id||f.wireframe!==F)&&(f.geometry=pe.id,f.program=ee.id,f.wireframe=F,B=!0)}k!==null&&t.update(k,34963),(B||d)&&(d=!1,A(G,ie,ee,pe),k!==null&&n.bindBuffer(34963,t.get(k).buffer))}function m(){return i.isWebGL2?n.createVertexArray():s.createVertexArrayOES()}function g(G){return i.isWebGL2?n.bindVertexArray(G):s.bindVertexArrayOES(G)}function x(G){return i.isWebGL2?n.deleteVertexArray(G):s.deleteVertexArrayOES(G)}function y(G,ie,ee){const pe=ee.wireframe===!0;let k=l[G.id];k===void 0&&(k={},l[G.id]=k);let B=k[ie.id];B===void 0&&(B={},k[ie.id]=B);let F=B[pe];return F===void 0&&(F=w(m()),B[pe]=F),F}function w(G){const ie=[],ee=[],pe=[];for(let k=0;k<r;k++)ie[k]=0,ee[k]=0,pe[k]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:ie,enabledAttributes:ee,attributeDivisors:pe,object:G,attributes:{},index:null}}function _(G,ie,ee,pe){const k=f.attributes,B=ie.attributes;let F=0;const $=ee.getAttributes();for(const J in $)if($[J].location>=0){const Me=k[J];let Ve=B[J];if(Ve===void 0&&(J==="instanceMatrix"&&G.instanceMatrix&&(Ve=G.instanceMatrix),J==="instanceColor"&&G.instanceColor&&(Ve=G.instanceColor)),Me===void 0||Me.attribute!==Ve||Ve&&Me.data!==Ve.data)return!0;F++}return f.attributesNum!==F||f.index!==pe}function S(G,ie,ee,pe){const k={},B=ie.attributes;let F=0;const $=ee.getAttributes();for(const J in $)if($[J].location>=0){let Me=B[J];Me===void 0&&(J==="instanceMatrix"&&G.instanceMatrix&&(Me=G.instanceMatrix),J==="instanceColor"&&G.instanceColor&&(Me=G.instanceColor));const Ve={};Ve.attribute=Me,Me&&Me.data&&(Ve.data=Me.data),k[J]=Ve,F++}f.attributes=k,f.attributesNum=F,f.index=pe}function E(){const G=f.newAttributes;for(let ie=0,ee=G.length;ie<ee;ie++)G[ie]=0}function T(G){C(G,0)}function C(G,ie){const ee=f.newAttributes,pe=f.enabledAttributes,k=f.attributeDivisors;ee[G]=1,pe[G]===0&&(n.enableVertexAttribArray(G),pe[G]=1),k[G]!==ie&&((i.isWebGL2?n:e.get("ANGLE_instanced_arrays"))[i.isWebGL2?"vertexAttribDivisor":"vertexAttribDivisorANGLE"](G,ie),k[G]=ie)}function P(){const G=f.newAttributes,ie=f.enabledAttributes;for(let ee=0,pe=ie.length;ee<pe;ee++)ie[ee]!==G[ee]&&(n.disableVertexAttribArray(ee),ie[ee]=0)}function I(G,ie,ee,pe,k,B){i.isWebGL2===!0&&(ee===5124||ee===5125)?n.vertexAttribIPointer(G,ie,ee,k,B):n.vertexAttribPointer(G,ie,ee,pe,k,B)}function A(G,ie,ee,pe){if(i.isWebGL2===!1&&(G.isInstancedMesh||pe.isInstancedBufferGeometry)&&e.get("ANGLE_instanced_arrays")===null)return;E();const k=pe.attributes,B=ee.getAttributes(),F=ie.defaultAttributeValues;for(const $ in B){const J=B[$];if(J.location>=0){let me=k[$];if(me===void 0&&($==="instanceMatrix"&&G.instanceMatrix&&(me=G.instanceMatrix),$==="instanceColor"&&G.instanceColor&&(me=G.instanceColor)),me!==void 0){const Me=me.normalized,Ve=me.itemSize,re=t.get(me);if(re===void 0)continue;const Xe=re.buffer,je=re.type,Je=re.bytesPerElement;if(me.isInterleavedBufferAttribute){const be=me.data,Qe=be.stride,he=me.offset;if(be.isInstancedInterleavedBuffer){for(let oe=0;oe<J.locationSize;oe++)C(J.location+oe,be.meshPerAttribute);G.isInstancedMesh!==!0&&pe._maxInstanceCount===void 0&&(pe._maxInstanceCount=be.meshPerAttribute*be.count)}else for(let oe=0;oe<J.locationSize;oe++)T(J.location+oe);n.bindBuffer(34962,Xe);for(let oe=0;oe<J.locationSize;oe++)I(J.location+oe,Ve/J.locationSize,je,Me,Qe*Je,(he+Ve/J.locationSize*oe)*Je)}else{if(me.isInstancedBufferAttribute){for(let be=0;be<J.locationSize;be++)C(J.location+be,me.meshPerAttribute);G.isInstancedMesh!==!0&&pe._maxInstanceCount===void 0&&(pe._maxInstanceCount=me.meshPerAttribute*me.count)}else for(let be=0;be<J.locationSize;be++)T(J.location+be);n.bindBuffer(34962,Xe);for(let be=0;be<J.locationSize;be++)I(J.location+be,Ve/J.locationSize,je,Me,Ve*Je,Ve/J.locationSize*be*Je)}}else if(F!==void 0){const Me=F[$];if(Me!==void 0)switch(Me.length){case 2:n.vertexAttrib2fv(J.location,Me);break;case 3:n.vertexAttrib3fv(J.location,Me);break;case 4:n.vertexAttrib4fv(J.location,Me);break;default:n.vertexAttrib1fv(J.location,Me)}}}}P()}function L(){ue();for(const G in l){const ie=l[G];for(const ee in ie){const pe=ie[ee];for(const k in pe)x(pe[k].object),delete pe[k];delete ie[ee]}delete l[G]}}function z(G){if(l[G.id]===void 0)return;const ie=l[G.id];for(const ee in ie){const pe=ie[ee];for(const k in pe)x(pe[k].object),delete pe[k];delete ie[ee]}delete l[G.id]}function j(G){for(const ie in l){const ee=l[ie];if(ee[G.id]===void 0)continue;const pe=ee[G.id];for(const k in pe)x(pe[k].object),delete pe[k];delete ee[G.id]}}function ue(){Z(),d=!0,f!==c&&(f=c,g(f.object))}function Z(){c.geometry=null,c.program=null,c.wireframe=!1}return{setup:h,reset:ue,resetDefaultState:Z,dispose:L,releaseStatesOfGeometry:z,releaseStatesOfProgram:j,initAttributes:E,enableAttribute:T,disableUnusedAttributes:P}}function hR(n,e,t,i){const r=i.isWebGL2;let s;function o(f){s=f}function l(f,d){n.drawArrays(s,f,d),t.update(d,s,1)}function c(f,d,h){if(h===0)return;let m,g;if(r)m=n,g="drawArraysInstanced";else if(m=e.get("ANGLE_instanced_arrays"),g="drawArraysInstancedANGLE",m===null){console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");return}m[g](s,f,d,h),t.update(d,s,h)}this.setMode=o,this.render=l,this.renderInstances=c}function pR(n,e,t){let i;function r(){if(i!==void 0)return i;if(e.has("EXT_texture_filter_anisotropic")===!0){const I=e.get("EXT_texture_filter_anisotropic");i=n.getParameter(I.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else i=0;return i}function s(I){if(I==="highp"){if(n.getShaderPrecisionFormat(35633,36338).precision>0&&n.getShaderPrecisionFormat(35632,36338).precision>0)return"highp";I="mediump"}return I==="mediump"&&n.getShaderPrecisionFormat(35633,36337).precision>0&&n.getShaderPrecisionFormat(35632,36337).precision>0?"mediump":"lowp"}const o=typeof WebGL2RenderingContext<"u"&&n instanceof WebGL2RenderingContext||typeof WebGL2ComputeRenderingContext<"u"&&n instanceof WebGL2ComputeRenderingContext;let l=t.precision!==void 0?t.precision:"highp";const c=s(l);c!==l&&(console.warn("THREE.WebGLRenderer:",l,"not supported, using",c,"instead."),l=c);const f=o||e.has("WEBGL_draw_buffers"),d=t.logarithmicDepthBuffer===!0,h=n.getParameter(34930),m=n.getParameter(35660),g=n.getParameter(3379),x=n.getParameter(34076),y=n.getParameter(34921),w=n.getParameter(36347),_=n.getParameter(36348),S=n.getParameter(36349),E=m>0,T=o||e.has("OES_texture_float"),C=E&&T,P=o?n.getParameter(36183):0;return{isWebGL2:o,drawBuffers:f,getMaxAnisotropy:r,getMaxPrecision:s,precision:l,logarithmicDepthBuffer:d,maxTextures:h,maxVertexTextures:m,maxTextureSize:g,maxCubemapSize:x,maxAttributes:y,maxVertexUniforms:w,maxVaryings:_,maxFragmentUniforms:S,vertexTextures:E,floatFragmentTextures:T,floatVertexTextures:C,maxSamples:P}}function mR(n){const e=this;let t=null,i=0,r=!1,s=!1;const o=new so,l=new ui,c={value:null,needsUpdate:!1};this.uniform=c,this.numPlanes=0,this.numIntersection=0,this.init=function(h,m,g){const x=h.length!==0||m||i!==0||r;return r=m,t=d(h,g,0),i=h.length,x},this.beginShadows=function(){s=!0,d(null)},this.endShadows=function(){s=!1,f()},this.setState=function(h,m,g){const x=h.clippingPlanes,y=h.clipIntersection,w=h.clipShadows,_=n.get(h);if(!r||x===null||x.length===0||s&&!w)s?d(null):f();else{const S=s?0:i,E=S*4;let T=_.clippingState||null;c.value=T,T=d(x,m,E,g);for(let C=0;C!==E;++C)T[C]=t[C];_.clippingState=T,this.numIntersection=y?this.numPlanes:0,this.numPlanes+=S}};function f(){c.value!==t&&(c.value=t,c.needsUpdate=i>0),e.numPlanes=i,e.numIntersection=0}function d(h,m,g,x){const y=h!==null?h.length:0;let w=null;if(y!==0){if(w=c.value,x!==!0||w===null){const _=g+y*4,S=m.matrixWorldInverse;l.getNormalMatrix(S),(w===null||w.length<_)&&(w=new Float32Array(_));for(let E=0,T=g;E!==y;++E,T+=4)o.copy(h[E]).applyMatrix4(S,l),o.normal.toArray(w,T),w[T+3]=o.constant}c.value=w,c.needsUpdate=!0}return e.numPlanes=y,e.numIntersection=0,w}}function gR(n){let e=new WeakMap;function t(o,l){return l===Gu?o.mapping=Ws:l===Xu&&(o.mapping=Gs),o}function i(o){if(o&&o.isTexture&&o.isRenderTargetTexture===!1){const l=o.mapping;if(l===Gu||l===Xu)if(e.has(o)){const c=e.get(o).texture;return t(c,o.mapping)}else{const c=o.image;if(c&&c.height>0){const f=new uM(c.height/2);return f.fromEquirectangularTexture(n,o),e.set(o,f),o.addEventListener("dispose",r),t(f.texture,o.mapping)}else return null}}return o}function r(o){const l=o.target;l.removeEventListener("dispose",r);const c=e.get(l);c!==void 0&&(e.delete(l),c.dispose())}function s(){e=new WeakMap}return{get:i,dispose:s}}class oo extends oc{constructor(e=-1,t=1,i=1,r=-1,s=.1,o=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=i,this.bottom=r,this.near=s,this.far=o,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=e.view===null?null:Object.assign({},e.view),this}setViewOffset(e,t,i,r,s,o){this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=i,this.view.offsetY=r,this.view.width=s,this.view.height=o,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),i=(this.right+this.left)/2,r=(this.top+this.bottom)/2;let s=i-e,o=i+e,l=r+t,c=r-t;if(this.view!==null&&this.view.enabled){const f=(this.right-this.left)/this.view.fullWidth/this.zoom,d=(this.top-this.bottom)/this.view.fullHeight/this.zoom;s+=f*this.view.offsetX,o=s+f*this.view.width,l-=d*this.view.offsetY,c=l-d*this.view.height}this.projectionMatrix.makeOrthographic(s,o,l,c,this.near,this.far),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.zoom=this.zoom,t.object.left=this.left,t.object.right=this.right,t.object.top=this.top,t.object.bottom=this.bottom,t.object.near=this.near,t.object.far=this.far,this.view!==null&&(t.object.view=Object.assign({},this.view)),t}}const Sl=4,fM=[.125,.215,.35,.446,.526,.582],ta=20,hv=new oo,dM=new De;let pv=null;const na=(1+Math.sqrt(5))/2,Ml=1/na,hM=[new R(1,1,1),new R(-1,1,1),new R(1,1,-1),new R(-1,1,-1),new R(0,na,Ml),new R(0,na,-Ml),new R(Ml,0,na),new R(-Ml,0,na),new R(na,Ml,0),new R(-na,Ml,0)];class mv{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._lodPlanes=[],this._sizeLods=[],this._sigmas=[],this._blurMaterial=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._compileMaterial(this._blurMaterial)}fromScene(e,t=0,i=.1,r=100){pv=this._renderer.getRenderTarget(),this._setSize(256);const s=this._allocateTargets();return s.depthBuffer=!0,this._sceneToCubeUV(e,i,r,s),t>0&&this._blur(s,0,0,t),this._applyPMREM(s),this._cleanup(s),s}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=gM(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=mM(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose()}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){this._blurMaterial!==null&&this._blurMaterial.dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let e=0;e<this._lodPlanes.length;e++)this._lodPlanes[e].dispose()}_cleanup(e){this._renderer.setRenderTarget(pv),e.scissorTest=!1,sh(e,0,0,e.width,e.height)}_fromTexture(e,t){e.mapping===Ws||e.mapping===Gs?this._setSize(e.image.length===0?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4),pv=this._renderer.getRenderTarget();const i=t||this._allocateTargets();return this._textureToCubeUV(e,i),this._applyPMREM(i),this._cleanup(i),i}_allocateTargets(){const e=3*Math.max(this._cubeSize,112),t=4*this._cubeSize,i={magFilter:tn,minFilter:tn,generateMipmaps:!1,type:rl,format:Fi,encoding:ts,depthBuffer:!1},r=pM(e,t,i);if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==e){this._pingPongRenderTarget!==null&&this._dispose(),this._pingPongRenderTarget=pM(e,t,i);const{_lodMax:s}=this;({sizeLods:this._sizeLods,lodPlanes:this._lodPlanes,sigmas:this._sigmas}=vR(s)),this._blurMaterial=yR(s,e,t)}return r}_compileMaterial(e){const t=new wn(this._lodPlanes[0],e);this._renderer.compile(t,hv)}_sceneToCubeUV(e,t,i,r){const l=new Bt(90,1,t,i),c=[1,-1,1,1,1,1],f=[1,1,1,-1,-1,-1],d=this._renderer,h=d.autoClear,m=d.toneMapping;d.getClearColor(dM),d.toneMapping=cr,d.autoClear=!1;const g=new eo({name:"PMREM.Background",side:Si,depthWrite:!1,depthTest:!1}),x=new wn(new ro,g);let y=!1;const w=e.background;w?w.isColor&&(g.color.copy(w),e.background=null,y=!0):(g.color.copy(dM),y=!0);for(let _=0;_<6;_++){const S=_%3;S===0?(l.up.set(0,c[_],0),l.lookAt(f[_],0,0)):S===1?(l.up.set(0,0,c[_]),l.lookAt(0,f[_],0)):(l.up.set(0,c[_],0),l.lookAt(0,0,f[_]));const E=this._cubeSize;sh(r,S*E,_>2?E:0,E,E),d.setRenderTarget(r),y&&d.render(x,l),d.render(e,l)}x.geometry.dispose(),x.material.dispose(),d.toneMapping=m,d.autoClear=h,e.background=w}_textureToCubeUV(e,t){const i=this._renderer,r=e.mapping===Ws||e.mapping===Gs;r?(this._cubemapMaterial===null&&(this._cubemapMaterial=gM()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=mM());const s=r?this._cubemapMaterial:this._equirectMaterial,o=new wn(this._lodPlanes[0],s),l=s.uniforms;l.envMap.value=e;const c=this._cubeSize;sh(t,0,0,3*c,2*c),i.setRenderTarget(t),i.render(o,hv)}_applyPMREM(e){const t=this._renderer,i=t.autoClear;t.autoClear=!1;for(let r=1;r<this._lodPlanes.length;r++){const s=Math.sqrt(this._sigmas[r]*this._sigmas[r]-this._sigmas[r-1]*this._sigmas[r-1]),o=hM[(r-1)%hM.length];this._blur(e,r-1,r,s,o)}t.autoClear=i}_blur(e,t,i,r,s){const o=this._pingPongRenderTarget;this._halfBlur(e,o,t,i,r,"latitudinal",s),this._halfBlur(o,e,i,i,r,"longitudinal",s)}_halfBlur(e,t,i,r,s,o,l){const c=this._renderer,f=this._blurMaterial;o!=="latitudinal"&&o!=="longitudinal"&&console.error("blur direction must be either latitudinal or longitudinal!");const d=3,h=new wn(this._lodPlanes[r],f),m=f.uniforms,g=this._sizeLods[i]-1,x=isFinite(s)?Math.PI/(2*g):2*Math.PI/(2*ta-1),y=s/x,w=isFinite(s)?1+Math.floor(d*y):ta;w>ta&&console.warn(`sigmaRadians, ${s}, is too large and will clip, as it requested ${w} samples when the maximum is set to ${ta}`);const _=[];let S=0;for(let I=0;I<ta;++I){const A=I/y,L=Math.exp(-A*A/2);_.push(L),I===0?S+=L:I<w&&(S+=2*L)}for(let I=0;I<_.length;I++)_[I]=_[I]/S;m.envMap.value=e.texture,m.samples.value=w,m.weights.value=_,m.latitudinal.value=o==="latitudinal",l&&(m.poleAxis.value=l);const{_lodMax:E}=this;m.dTheta.value=x,m.mipInt.value=E-i;const T=this._sizeLods[r],C=3*T*(r>E-Sl?r-E+Sl:0),P=4*(this._cubeSize-T);sh(t,C,P,3*T,2*T),c.setRenderTarget(t),c.render(h,hv)}}function vR(n){const e=[],t=[],i=[];let r=n;const s=n-Sl+1+fM.length;for(let o=0;o<s;o++){const l=Math.pow(2,r);t.push(l);let c=1/l;o>n-Sl?c=fM[o-n+Sl-1]:o===0&&(c=0),i.push(c);const f=1/(l-2),d=-f,h=1+f,m=[d,d,h,d,h,h,d,d,h,h,d,h],g=6,x=6,y=3,w=2,_=1,S=new Float32Array(y*x*g),E=new Float32Array(w*x*g),T=new Float32Array(_*x*g);for(let P=0;P<g;P++){const I=P%3*2/3-1,A=P>2?0:-1,L=[I,A,0,I+2/3,A,0,I+2/3,A+1,0,I,A,0,I+2/3,A+1,0,I,A+1,0];S.set(L,y*x*P),E.set(m,w*x*P);const z=[P,P,P,P,P,P];T.set(z,_*x*P)}const C=new lt;C.setAttribute("position",new It(S,y)),C.setAttribute("uv",new It(E,w)),C.setAttribute("faceIndex",new It(T,_)),e.push(C),r>Sl&&r--}return{lodPlanes:e,sizeLods:t,sigmas:i}}function pM(n,e,t){const i=new Bi(n,e,t);return i.texture.mapping=il,i.texture.name="PMREM.cubeUv",i.scissorTest=!0,i}function sh(n,e,t,i,r){n.viewport.set(e,t,i,r),n.scissor.set(e,t,i,r)}function yR(n,e,t){const i=new Float32Array(ta),r=new R(0,1,0);return new pr({name:"SphericalGaussianBlur",defines:{n:ta,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${n}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:i},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:r}},vertexShader:gv(),fragmentShader:`

			precision mediump float;
			precision mediump int;

			varying vec3 vOutputDirection;

			uniform sampler2D envMap;
			uniform int samples;
			uniform float weights[ n ];
			uniform bool latitudinal;
			uniform float dTheta;
			uniform float mipInt;
			uniform vec3 poleAxis;

			#define ENVMAP_TYPE_CUBE_UV
			#include <cube_uv_reflection_fragment>

			vec3 getSample( float theta, vec3 axis ) {

				float cosTheta = cos( theta );
				// Rodrigues' axis-angle rotation
				vec3 sampleDirection = vOutputDirection * cosTheta
					+ cross( axis, vOutputDirection ) * sin( theta )
					+ axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta );

				return bilinearCubeUV( envMap, sampleDirection, mipInt );

			}

			void main() {

				vec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection );

				if ( all( equal( axis, vec3( 0.0 ) ) ) ) {

					axis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x );

				}

				axis = normalize( axis );

				gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );
				gl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis );

				for ( int i = 1; i < n; i++ ) {

					if ( i >= samples ) {

						break;

					}

					float theta = dTheta * float( i );
					gl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis );
					gl_FragColor.rgb += weights[ i ] * getSample( theta, axis );

				}

			}
		`,blending:$r,depthTest:!1,depthWrite:!1})}function mM(){return new pr({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:gv(),fragmentShader:`

			precision mediump float;
			precision mediump int;

			varying vec3 vOutputDirection;

			uniform sampler2D envMap;

			#include <common>

			void main() {

				vec3 outputDirection = normalize( vOutputDirection );
				vec2 uv = equirectUv( outputDirection );

				gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 );

			}
		`,blending:$r,depthTest:!1,depthWrite:!1})}function gM(){return new pr({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:gv(),fragmentShader:`

			precision mediump float;
			precision mediump int;

			uniform float flipEnvMap;

			varying vec3 vOutputDirection;

			uniform samplerCube envMap;

			void main() {

				gl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) );

			}
		`,blending:$r,depthTest:!1,depthWrite:!1})}function gv(){return`

		precision mediump float;
		precision mediump int;

		attribute float faceIndex;

		varying vec3 vOutputDirection;

		// RH coordinate system; PMREM face-indexing convention
		vec3 getDirection( vec2 uv, float face ) {

			uv = 2.0 * uv - 1.0;

			vec3 direction = vec3( uv, 1.0 );

			if ( face == 0.0 ) {

				direction = direction.zyx; // ( 1, v, u ) pos x

			} else if ( face == 1.0 ) {

				direction = direction.xzy;
				direction.xz *= -1.0; // ( -u, 1, -v ) pos y

			} else if ( face == 2.0 ) {

				direction.x *= -1.0; // ( -u, v, 1 ) pos z

			} else if ( face == 3.0 ) {

				direction = direction.zyx;
				direction.xz *= -1.0; // ( -1, v, -u ) neg x

			} else if ( face == 4.0 ) {

				direction = direction.xzy;
				direction.xy *= -1.0; // ( -u, -1, v ) neg y

			} else if ( face == 5.0 ) {

				direction.z *= -1.0; // ( u, v, -1 ) neg z

			}

			return direction;

		}

		void main() {

			vOutputDirection = getDirection( uv, faceIndex );
			gl_Position = vec4( position, 1.0 );

		}
	`}function xR(n){let e=new WeakMap,t=null;function i(l){if(l&&l.isTexture){const c=l.mapping,f=c===Gu||c===Xu,d=c===Ws||c===Gs;if(f||d)if(l.isRenderTargetTexture&&l.needsPMREMUpdate===!0){l.needsPMREMUpdate=!1;let h=e.get(l);return t===null&&(t=new mv(n)),h=f?t.fromEquirectangular(l,h):t.fromCubemap(l,h),e.set(l,h),h.texture}else{if(e.has(l))return e.get(l).texture;{const h=l.image;if(f&&h&&h.height>0||d&&h&&r(h)){t===null&&(t=new mv(n));const m=f?t.fromEquirectangular(l):t.fromCubemap(l);return e.set(l,m),l.addEventListener("dispose",s),m.texture}else return null}}}return l}function r(l){let c=0;const f=6;for(let d=0;d<f;d++)l[d]!==void 0&&c++;return c===f}function s(l){const c=l.target;c.removeEventListener("dispose",s);const f=e.get(c);f!==void 0&&(e.delete(c),f.dispose())}function o(){e=new WeakMap,t!==null&&(t.dispose(),t=null)}return{get:i,dispose:o}}function _R(n){const e={};function t(i){if(e[i]!==void 0)return e[i];let r;switch(i){case"WEBGL_depth_texture":r=n.getExtension("WEBGL_depth_texture")||n.getExtension("MOZ_WEBGL_depth_texture")||n.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":r=n.getExtension("EXT_texture_filter_anisotropic")||n.getExtension("MOZ_EXT_texture_filter_anisotropic")||n.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":r=n.getExtension("WEBGL_compressed_texture_s3tc")||n.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||n.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":r=n.getExtension("WEBGL_compressed_texture_pvrtc")||n.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:r=n.getExtension(i)}return e[i]=r,r}return{has:function(i){return t(i)!==null},init:function(i){i.isWebGL2?t("EXT_color_buffer_float"):(t("WEBGL_depth_texture"),t("OES_texture_float"),t("OES_texture_half_float"),t("OES_texture_half_float_linear"),t("OES_standard_derivatives"),t("OES_element_index_uint"),t("OES_vertex_array_object"),t("ANGLE_instanced_arrays")),t("OES_texture_float_linear"),t("EXT_color_buffer_half_float"),t("WEBGL_multisampled_render_to_texture")},get:function(i){const r=t(i);return r===null&&console.warn("THREE.WebGLRenderer: "+i+" extension not supported."),r}}}function wR(n,e,t,i){const r={},s=new WeakMap;function o(h){const m=h.target;m.index!==null&&e.remove(m.index);for(const x in m.attributes)e.remove(m.attributes[x]);m.removeEventListener("dispose",o),delete r[m.id];const g=s.get(m);g&&(e.remove(g),s.delete(m)),i.releaseStatesOfGeometry(m),m.isInstancedBufferGeometry===!0&&delete m._maxInstanceCount,t.memory.geometries--}function l(h,m){return r[m.id]===!0||(m.addEventListener("dispose",o),r[m.id]=!0,t.memory.geometries++),m}function c(h){const m=h.attributes;for(const x in m)e.update(m[x],34962);const g=h.morphAttributes;for(const x in g){const y=g[x];for(let w=0,_=y.length;w<_;w++)e.update(y[w],34962)}}function f(h){const m=[],g=h.index,x=h.attributes.position;let y=0;if(g!==null){const S=g.array;y=g.version;for(let E=0,T=S.length;E<T;E+=3){const C=S[E+0],P=S[E+1],I=S[E+2];m.push(C,P,P,I,I,C)}}else{const S=x.array;y=x.version;for(let E=0,T=S.length/3-1;E<T;E+=3){const C=E+0,P=E+1,I=E+2;m.push(C,P,P,I,I,C)}}const w=new(ZS(m)?sv:rv)(m,1);w.version=y;const _=s.get(h);_&&e.remove(_),s.set(h,w)}function d(h){const m=s.get(h);if(m){const g=h.index;g!==null&&m.version<g.version&&f(h)}else f(h);return s.get(h)}return{get:l,update:c,getWireframeAttribute:d}}function SR(n,e,t,i){const r=i.isWebGL2;let s;function o(m){s=m}let l,c;function f(m){l=m.type,c=m.bytesPerElement}function d(m,g){n.drawElements(s,g,l,m*c),t.update(g,s,1)}function h(m,g,x){if(x===0)return;let y,w;if(r)y=n,w="drawElementsInstanced";else if(y=e.get("ANGLE_instanced_arrays"),w="drawElementsInstancedANGLE",y===null){console.error("THREE.WebGLIndexedBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");return}y[w](s,g,l,m*c,x),t.update(g,s,x)}this.setMode=o,this.setIndex=f,this.render=d,this.renderInstances=h}function MR(n){const e={geometries:0,textures:0},t={frame:0,calls:0,triangles:0,points:0,lines:0};function i(s,o,l){switch(t.calls++,o){case 4:t.triangles+=l*(s/3);break;case 1:t.lines+=l*(s/2);break;case 3:t.lines+=l*(s-1);break;case 2:t.lines+=l*s;break;case 0:t.points+=l*s;break;default:console.error("THREE.WebGLInfo: Unknown draw mode:",o);break}}function r(){t.frame++,t.calls=0,t.triangles=0,t.points=0,t.lines=0}return{memory:e,render:t,programs:null,autoReset:!0,reset:r,update:i}}function ER(n,e){return n[0]-e[0]}function TR(n,e){return Math.abs(e[1])-Math.abs(n[1])}function bR(n,e,t){const i={},r=new Float32Array(8),s=new WeakMap,o=new wt,l=[];for(let f=0;f<8;f++)l[f]=[f,0];function c(f,d,h,m){const g=f.morphTargetInfluences;if(e.isWebGL2===!0){const x=d.morphAttributes.position||d.morphAttributes.normal||d.morphAttributes.color,y=x!==void 0?x.length:0;let w=s.get(d);if(w===void 0||w.count!==y){let ie=function(){Z.dispose(),s.delete(d),d.removeEventListener("dispose",ie)};w!==void 0&&w.texture.dispose();const E=d.morphAttributes.position!==void 0,T=d.morphAttributes.normal!==void 0,C=d.morphAttributes.color!==void 0,P=d.morphAttributes.position||[],I=d.morphAttributes.normal||[],A=d.morphAttributes.color||[];let L=0;E===!0&&(L=1),T===!0&&(L=2),C===!0&&(L=3);let z=d.attributes.position.count*L,j=1;z>e.maxTextureSize&&(j=Math.ceil(z/e.maxTextureSize),z=e.maxTextureSize);const ue=new Float32Array(z*j*4*y),Z=new tc(ue,z,j,y);Z.type=es,Z.needsUpdate=!0;const G=L*4;for(let ee=0;ee<y;ee++){const pe=P[ee],k=I[ee],B=A[ee],F=z*j*4*ee;for(let $=0;$<pe.count;$++){const J=$*G;E===!0&&(o.fromBufferAttribute(pe,$),ue[F+J+0]=o.x,ue[F+J+1]=o.y,ue[F+J+2]=o.z,ue[F+J+3]=0),T===!0&&(o.fromBufferAttribute(k,$),ue[F+J+4]=o.x,ue[F+J+5]=o.y,ue[F+J+6]=o.z,ue[F+J+7]=0),C===!0&&(o.fromBufferAttribute(B,$),ue[F+J+8]=o.x,ue[F+J+9]=o.y,ue[F+J+10]=o.z,ue[F+J+11]=B.itemSize===4?o.w:1)}}w={count:y,texture:Z,size:new fe(z,j)},s.set(d,w),d.addEventListener("dispose",ie)}let _=0;for(let E=0;E<g.length;E++)_+=g[E];const S=d.morphTargetsRelative?1:1-_;m.getUniforms().setValue(n,"morphTargetBaseInfluence",S),m.getUniforms().setValue(n,"morphTargetInfluences",g),m.getUniforms().setValue(n,"morphTargetsTexture",w.texture,t),m.getUniforms().setValue(n,"morphTargetsTextureSize",w.size)}else{const x=g===void 0?0:g.length;let y=i[d.id];if(y===void 0||y.length!==x){y=[];for(let T=0;T<x;T++)y[T]=[T,0];i[d.id]=y}for(let T=0;T<x;T++){const C=y[T];C[0]=T,C[1]=g[T]}y.sort(TR);for(let T=0;T<8;T++)T<x&&y[T][1]?(l[T][0]=y[T][0],l[T][1]=y[T][1]):(l[T][0]=Number.MAX_SAFE_INTEGER,l[T][1]=0);l.sort(ER);const w=d.morphAttributes.position,_=d.morphAttributes.normal;let S=0;for(let T=0;T<8;T++){const C=l[T],P=C[0],I=C[1];P!==Number.MAX_SAFE_INTEGER&&I?(w&&d.getAttribute("morphTarget"+T)!==w[P]&&d.setAttribute("morphTarget"+T,w[P]),_&&d.getAttribute("morphNormal"+T)!==_[P]&&d.setAttribute("morphNormal"+T,_[P]),r[T]=I,S+=I):(w&&d.hasAttribute("morphTarget"+T)===!0&&d.deleteAttribute("morphTarget"+T),_&&d.hasAttribute("morphNormal"+T)===!0&&d.deleteAttribute("morphNormal"+T),r[T]=0)}const E=d.morphTargetsRelative?1:1-S;m.getUniforms().setValue(n,"morphTargetBaseInfluence",E),m.getUniforms().setValue(n,"morphTargetInfluences",r)}}return{update:c}}function AR(n,e,t,i){let r=new WeakMap;function s(c){const f=i.render.frame,d=c.geometry,h=e.get(c,d);return r.get(h)!==f&&(e.update(h),r.set(h,f)),c.isInstancedMesh&&(c.hasEventListener("dispose",l)===!1&&c.addEventListener("dispose",l),t.update(c.instanceMatrix,34962),c.instanceColor!==null&&t.update(c.instanceColor,34962)),h}function o(){r=new WeakMap}function l(c){const f=c.target;f.removeEventListener("dispose",l),t.remove(f.instanceMatrix),f.instanceColor!==null&&t.remove(f.instanceColor)}return{update:s,dispose:o}}const vM=new un,yM=new tc,xM=new Ud,_M=new ac,wM=[],SM=[],MM=new Float32Array(16),EM=new Float32Array(9),TM=new Float32Array(4);function El(n,e,t){const i=n[0];if(i<=0||i>0)return n;const r=e*t;let s=wM[r];if(s===void 0&&(s=new Float32Array(r),wM[r]=s),e!==0){i.toArray(s,0);for(let o=1,l=0;o!==e;++o)l+=t,n[o].toArray(s,l)}return s}function Qn(n,e){if(n.length!==e.length)return!1;for(let t=0,i=n.length;t<i;t++)if(n[t]!==e[t])return!1;return!0}function Kn(n,e){for(let t=0,i=e.length;t<i;t++)n[t]=e[t]}function oh(n,e){let t=SM[e];t===void 0&&(t=new Int32Array(e),SM[e]=t);for(let i=0;i!==e;++i)t[i]=n.allocateTextureUnit();return t}function CR(n,e){const t=this.cache;t[0]!==e&&(n.uniform1f(this.addr,e),t[0]=e)}function PR(n,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(n.uniform2f(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(Qn(t,e))return;n.uniform2fv(this.addr,e),Kn(t,e)}}function LR(n,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(n.uniform3f(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else if(e.r!==void 0)(t[0]!==e.r||t[1]!==e.g||t[2]!==e.b)&&(n.uniform3f(this.addr,e.r,e.g,e.b),t[0]=e.r,t[1]=e.g,t[2]=e.b);else{if(Qn(t,e))return;n.uniform3fv(this.addr,e),Kn(t,e)}}function RR(n,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(n.uniform4f(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(Qn(t,e))return;n.uniform4fv(this.addr,e),Kn(t,e)}}function IR(n,e){const t=this.cache,i=e.elements;if(i===void 0){if(Qn(t,e))return;n.uniformMatrix2fv(this.addr,!1,e),Kn(t,e)}else{if(Qn(t,i))return;TM.set(i),n.uniformMatrix2fv(this.addr,!1,TM),Kn(t,i)}}function DR(n,e){const t=this.cache,i=e.elements;if(i===void 0){if(Qn(t,e))return;n.uniformMatrix3fv(this.addr,!1,e),Kn(t,e)}else{if(Qn(t,i))return;EM.set(i),n.uniformMatrix3fv(this.addr,!1,EM),Kn(t,i)}}function zR(n,e){const t=this.cache,i=e.elements;if(i===void 0){if(Qn(t,e))return;n.uniformMatrix4fv(this.addr,!1,e),Kn(t,e)}else{if(Qn(t,i))return;MM.set(i),n.uniformMatrix4fv(this.addr,!1,MM),Kn(t,i)}}function NR(n,e){const t=this.cache;t[0]!==e&&(n.uniform1i(this.addr,e),t[0]=e)}function kR(n,e){const t=this.cache;Qn(t,e)||(n.uniform2iv(this.addr,e),Kn(t,e))}function OR(n,e){const t=this.cache;Qn(t,e)||(n.uniform3iv(this.addr,e),Kn(t,e))}function FR(n,e){const t=this.cache;Qn(t,e)||(n.uniform4iv(this.addr,e),Kn(t,e))}function UR(n,e){const t=this.cache;t[0]!==e&&(n.uniform1ui(this.addr,e),t[0]=e)}function BR(n,e){const t=this.cache;Qn(t,e)||(n.uniform2uiv(this.addr,e),Kn(t,e))}function VR(n,e){const t=this.cache;Qn(t,e)||(n.uniform3uiv(this.addr,e),Kn(t,e))}function HR(n,e){const t=this.cache;Qn(t,e)||(n.uniform4uiv(this.addr,e),Kn(t,e))}function WR(n,e,t){const i=this.cache,r=t.allocateTextureUnit();i[0]!==r&&(n.uniform1i(this.addr,r),i[0]=r),t.setTexture2D(e||vM,r)}function GR(n,e,t){const i=this.cache,r=t.allocateTextureUnit();i[0]!==r&&(n.uniform1i(this.addr,r),i[0]=r),t.setTexture3D(e||xM,r)}function XR(n,e,t){const i=this.cache,r=t.allocateTextureUnit();i[0]!==r&&(n.uniform1i(this.addr,r),i[0]=r),t.setTextureCube(e||_M,r)}function jR(n,e,t){const i=this.cache,r=t.allocateTextureUnit();i[0]!==r&&(n.uniform1i(this.addr,r),i[0]=r),t.setTexture2DArray(e||yM,r)}function YR(n){switch(n){case 5126:return CR;case 35664:return PR;case 35665:return LR;case 35666:return RR;case 35674:return IR;case 35675:return DR;case 35676:return zR;case 5124:case 35670:return NR;case 35667:case 35671:return kR;case 35668:case 35672:return OR;case 35669:case 35673:return FR;case 5125:return UR;case 36294:return BR;case 36295:return VR;case 36296:return HR;case 35678:case 36198:case 36298:case 36306:case 35682:return WR;case 35679:case 36299:case 36307:return GR;case 35680:case 36300:case 36308:case 36293:return XR;case 36289:case 36303:case 36311:case 36292:return jR}}function qR(n,e){n.uniform1fv(this.addr,e)}function ZR(n,e){const t=El(e,this.size,2);n.uniform2fv(this.addr,t)}function JR(n,e){const t=El(e,this.size,3);n.uniform3fv(this.addr,t)}function QR(n,e){const t=El(e,this.size,4);n.uniform4fv(this.addr,t)}function KR(n,e){const t=El(e,this.size,4);n.uniformMatrix2fv(this.addr,!1,t)}function $R(n,e){const t=El(e,this.size,9);n.uniformMatrix3fv(this.addr,!1,t)}function eI(n,e){const t=El(e,this.size,16);n.uniformMatrix4fv(this.addr,!1,t)}function tI(n,e){n.uniform1iv(this.addr,e)}function nI(n,e){n.uniform2iv(this.addr,e)}function iI(n,e){n.uniform3iv(this.addr,e)}function rI(n,e){n.uniform4iv(this.addr,e)}function sI(n,e){n.uniform1uiv(this.addr,e)}function oI(n,e){n.uniform2uiv(this.addr,e)}function aI(n,e){n.uniform3uiv(this.addr,e)}function lI(n,e){n.uniform4uiv(this.addr,e)}function uI(n,e,t){const i=e.length,r=oh(t,i);n.uniform1iv(this.addr,r);for(let s=0;s!==i;++s)t.setTexture2D(e[s]||vM,r[s])}function cI(n,e,t){const i=e.length,r=oh(t,i);n.uniform1iv(this.addr,r);for(let s=0;s!==i;++s)t.setTexture3D(e[s]||xM,r[s])}function fI(n,e,t){const i=e.length,r=oh(t,i);n.uniform1iv(this.addr,r);for(let s=0;s!==i;++s)t.setTextureCube(e[s]||_M,r[s])}function dI(n,e,t){const i=e.length,r=oh(t,i);n.uniform1iv(this.addr,r);for(let s=0;s!==i;++s)t.setTexture2DArray(e[s]||yM,r[s])}function hI(n){switch(n){case 5126:return qR;case 35664:return ZR;case 35665:return JR;case 35666:return QR;case 35674:return KR;case 35675:return $R;case 35676:return eI;case 5124:case 35670:return tI;case 35667:case 35671:return nI;case 35668:case 35672:return iI;case 35669:case 35673:return rI;case 5125:return sI;case 36294:return oI;case 36295:return aI;case 36296:return lI;case 35678:case 36198:case 36298:case 36306:case 35682:return uI;case 35679:case 36299:case 36307:return cI;case 35680:case 36300:case 36308:case 36293:return fI;case 36289:case 36303:case 36311:case 36292:return dI}}class pI{constructor(e,t,i){this.id=e,this.addr=i,this.cache=[],this.setValue=YR(t.type)}}class mI{constructor(e,t,i){this.id=e,this.addr=i,this.cache=[],this.size=t.size,this.setValue=hI(t.type)}}class gI{constructor(e){this.id=e,this.seq=[],this.map={}}setValue(e,t,i){const r=this.seq;for(let s=0,o=r.length;s!==o;++s){const l=r[s];l.setValue(e,t[l.id],i)}}}const vv=/(\w+)(\])?(\[|\.)?/g;function bM(n,e){n.seq.push(e),n.map[e.id]=e}function vI(n,e,t){const i=n.name,r=i.length;for(vv.lastIndex=0;;){const s=vv.exec(i),o=vv.lastIndex;let l=s[1];const c=s[2]==="]",f=s[3];if(c&&(l=l|0),f===void 0||f==="["&&o+2===r){bM(t,f===void 0?new pI(l,n,e):new mI(l,n,e));break}else{let h=t.map[l];h===void 0&&(h=new gI(l),bM(t,h)),t=h}}}class ah{constructor(e,t){this.seq=[],this.map={};const i=e.getProgramParameter(t,35718);for(let r=0;r<i;++r){const s=e.getActiveUniform(t,r),o=e.getUniformLocation(t,s.name);vI(s,o,this)}}setValue(e,t,i,r){const s=this.map[t];s!==void 0&&s.setValue(e,i,r)}setOptional(e,t,i){const r=t[i];r!==void 0&&this.setValue(e,i,r)}static upload(e,t,i,r){for(let s=0,o=t.length;s!==o;++s){const l=t[s],c=i[l.id];c.needsUpdate!==!1&&l.setValue(e,c.value,r)}}static seqWithValue(e,t){const i=[];for(let r=0,s=e.length;r!==s;++r){const o=e[r];o.id in t&&i.push(o)}return i}}function AM(n,e,t){const i=n.createShader(e);return n.shaderSource(i,t),n.compileShader(i),i}let yI=0;function xI(n,e){const t=n.split(`
`),i=[],r=Math.max(e-6,0),s=Math.min(e+6,t.length);for(let o=r;o<s;o++){const l=o+1;i.push(`${l===e?">":" "} ${l}: ${t[o]}`)}return i.join(`
`)}function _I(n){switch(n){case ts:return["Linear","( value )"];case Ft:return["sRGB","( value )"];default:return console.warn("THREE.WebGLProgram: Unsupported encoding:",n),["Linear","( value )"]}}function CM(n,e,t){const i=n.getShaderParameter(e,35713),r=n.getShaderInfoLog(e).trim();if(i&&r==="")return"";const s=/ERROR: 0:(\d+)/.exec(r);if(s){const o=parseInt(s[1]);return t.toUpperCase()+`

`+r+`

`+xI(n.getShaderSource(e),o)}else return r}function wI(n,e){const t=_I(e);return"vec4 "+n+"( vec4 value ) { return LinearTo"+t[0]+t[1]+"; }"}function SI(n,e){let t;switch(e){case _S:t="Linear";break;case wS:t="Reinhard";break;case SS:t="OptimizedCineon";break;case m0:t="ACESFilmic";break;case MS:t="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",e),t="Linear"}return"vec3 "+n+"( vec3 color ) { return "+t+"ToneMapping( color ); }"}function MI(n){return[n.extensionDerivatives||!!n.envMapCubeUVHeight||n.bumpMap||n.tangentSpaceNormalMap||n.clearcoatNormalMap||n.flatShading||n.shaderID==="physical"?"#extension GL_OES_standard_derivatives : enable":"",(n.extensionFragDepth||n.logarithmicDepthBuffer)&&n.rendererExtensionFragDepth?"#extension GL_EXT_frag_depth : enable":"",n.extensionDrawBuffers&&n.rendererExtensionDrawBuffers?"#extension GL_EXT_draw_buffers : require":"",(n.extensionShaderTextureLOD||n.envMap||n.transmission)&&n.rendererExtensionShaderTextureLod?"#extension GL_EXT_shader_texture_lod : enable":""].filter(lc).join(`
`)}function EI(n){const e=[];for(const t in n){const i=n[t];i!==!1&&e.push("#define "+t+" "+i)}return e.join(`
`)}function TI(n,e){const t={},i=n.getProgramParameter(e,35721);for(let r=0;r<i;r++){const s=n.getActiveAttrib(e,r),o=s.name;let l=1;s.type===35674&&(l=2),s.type===35675&&(l=3),s.type===35676&&(l=4),t[o]={type:s.type,location:n.getAttribLocation(e,o),locationSize:l}}return t}function lc(n){return n!==""}function PM(n,e){const t=e.numSpotLightShadows+e.numSpotLightMaps-e.numSpotLightShadowsWithMaps;return n.replace(/NUM_DIR_LIGHTS/g,e.numDirLights).replace(/NUM_SPOT_LIGHTS/g,e.numSpotLights).replace(/NUM_SPOT_LIGHT_MAPS/g,e.numSpotLightMaps).replace(/NUM_SPOT_LIGHT_COORDS/g,t).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_WITH_MAPS/g,e.numSpotLightShadowsWithMaps).replace(/NUM_SPOT_LIGHT_SHADOWS/g,e.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,e.numPointLightShadows)}function LM(n,e){return n.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)}const bI=/^[ \t]*#include +<([\w\d./]+)>/gm;function yv(n){return n.replace(bI,AI)}function AI(n,e){const t=dt[e];if(t===void 0)throw new Error("Can not resolve #include <"+e+">");return yv(t)}const CI=/#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 RM(n){return n.replace(CI,PI)}function PI(n,e,t,i){let r="";for(let s=parseInt(e);s<parseInt(t);s++)r+=i.replace(/\[\s*i\s*\]/g,"[ "+s+" ]").replace(/UNROLLED_LOOP_INDEX/g,s);return r}function IM(n){let e="precision "+n.precision+` float;
precision `+n.precision+" int;";return n.precision==="highp"?e+=`
#define HIGH_PRECISION`:n.precision==="mediump"?e+=`
#define MEDIUM_PRECISION`:n.precision==="lowp"&&(e+=`
#define LOW_PRECISION`),e}function LI(n){let e="SHADOWMAP_TYPE_BASIC";return n.shadowMapType===o0?e="SHADOWMAP_TYPE_PCF":n.shadowMapType===a0?e="SHADOWMAP_TYPE_PCF_SOFT":n.shadowMapType===nl&&(e="SHADOWMAP_TYPE_VSM"),e}function RI(n){let e="ENVMAP_TYPE_CUBE";if(n.envMap)switch(n.envMapMode){case Ws:case Gs:e="ENVMAP_TYPE_CUBE";break;case il:e="ENVMAP_TYPE_CUBE_UV";break}return e}function II(n){let e="ENVMAP_MODE_REFLECTION";if(n.envMap)switch(n.envMapMode){case Gs:e="ENVMAP_MODE_REFRACTION";break}return e}function DI(n){let e="ENVMAP_BLENDING_NONE";if(n.envMap)switch(n.combine){case Wu:e="ENVMAP_BLENDING_MULTIPLY";break;case yS:e="ENVMAP_BLENDING_MIX";break;case xS:e="ENVMAP_BLENDING_ADD";break}return e}function zI(n){const e=n.envMapCubeUVHeight;if(e===null)return null;const t=Math.log2(e)-2,i=1/e;return{texelWidth:1/(3*Math.max(Math.pow(2,t),7*16)),texelHeight:i,maxMip:t}}function NI(n,e,t,i){const r=n.getContext(),s=t.defines;let o=t.vertexShader,l=t.fragmentShader;const c=LI(t),f=RI(t),d=II(t),h=DI(t),m=zI(t),g=t.isWebGL2?"":MI(t),x=EI(s),y=r.createProgram();let w,_,S=t.glslVersion?"#version "+t.glslVersion+`
`:"";t.isRawShaderMaterial?(w=[x].filter(lc).join(`
`),w.length>0&&(w+=`
`),_=[g,x].filter(lc).join(`
`),_.length>0&&(_+=`
`)):(w=[IM(t),"#define SHADER_NAME "+t.shaderName,x,t.instancing?"#define USE_INSTANCING":"",t.instancingColor?"#define USE_INSTANCING_COLOR":"",t.supportsVertexTextures?"#define VERTEX_TEXTURES":"",t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.map?"#define USE_MAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+d:"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMap&&t.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",t.normalMap&&t.tangentSpaceNormalMap?"#define TANGENTSPACE_NORMALMAP":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.displacementMap&&t.supportsVertexTextures?"#define USE_DISPLACEMENTMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularIntensityMap?"#define USE_SPECULARINTENSITYMAP":"",t.specularColorMap?"#define USE_SPECULARCOLORMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.sheenColorMap?"#define USE_SHEENCOLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEENROUGHNESSMAP":"",t.vertexTangents?"#define USE_TANGENT":"",t.vertexColors?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUvs?"#define USE_UV":"",t.uvsVertexOnly?"#define UVS_VERTEX_ONLY":"",t.flatShading?"#define FLAT_SHADED":"",t.skinning?"#define USE_SKINNING":"",t.morphTargets?"#define USE_MORPHTARGETS":"",t.morphNormals&&t.flatShading===!1?"#define USE_MORPHNORMALS":"",t.morphColors&&t.isWebGL2?"#define USE_MORPHCOLORS":"",t.morphTargetsCount>0&&t.isWebGL2?"#define MORPHTARGETS_TEXTURE":"",t.morphTargetsCount>0&&t.isWebGL2?"#define MORPHTARGETS_TEXTURE_STRIDE "+t.morphTextureStride:"",t.morphTargetsCount>0&&t.isWebGL2?"#define MORPHTARGETS_COUNT "+t.morphTargetsCount:"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+c:"",t.sizeAttenuation?"#define USE_SIZEATTENUATION":"",t.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",t.logarithmicDepthBuffer&&t.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","	attribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR","	attribute vec3 instanceColor;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_TANGENT","	attribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )","	attribute vec4 color;","#elif defined( USE_COLOR )","	attribute vec3 color;","#endif","#if ( defined( USE_MORPHTARGETS ) && ! defined( MORPHTARGETS_TEXTURE ) )","	attribute vec3 morphTarget0;","	attribute vec3 morphTarget1;","	attribute vec3 morphTarget2;","	attribute vec3 morphTarget3;","	#ifdef USE_MORPHNORMALS","		attribute vec3 morphNormal0;","		attribute vec3 morphNormal1;","		attribute vec3 morphNormal2;","		attribute vec3 morphNormal3;","	#else","		attribute vec3 morphTarget4;","		attribute vec3 morphTarget5;","		attribute vec3 morphTarget6;","		attribute vec3 morphTarget7;","	#endif","#endif","#ifdef USE_SKINNING","	attribute vec4 skinIndex;","	attribute vec4 skinWeight;","#endif",`
`].filter(lc).join(`
`),_=[g,IM(t),"#define SHADER_NAME "+t.shaderName,x,t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.map?"#define USE_MAP":"",t.matcap?"#define USE_MATCAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+f:"",t.envMap?"#define "+d:"",t.envMap?"#define "+h:"",m?"#define CUBEUV_TEXEL_WIDTH "+m.texelWidth:"",m?"#define CUBEUV_TEXEL_HEIGHT "+m.texelHeight:"",m?"#define CUBEUV_MAX_MIP "+m.maxMip+".0":"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMap&&t.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",t.normalMap&&t.tangentSpaceNormalMap?"#define TANGENTSPACE_NORMALMAP":"",t.clearcoat?"#define USE_CLEARCOAT":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.iridescence?"#define USE_IRIDESCENCE":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularIntensityMap?"#define USE_SPECULARINTENSITYMAP":"",t.specularColorMap?"#define USE_SPECULARCOLORMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaTest?"#define USE_ALPHATEST":"",t.sheen?"#define USE_SHEEN":"",t.sheenColorMap?"#define USE_SHEENCOLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEENROUGHNESSMAP":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",t.vertexTangents?"#define USE_TANGENT":"",t.vertexColors||t.instancingColor?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUvs?"#define USE_UV":"",t.uvsVertexOnly?"#define UVS_VERTEX_ONLY":"",t.gradientMap?"#define USE_GRADIENTMAP":"",t.flatShading?"#define FLAT_SHADED":"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+c:"",t.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",t.physicallyCorrectLights?"#define PHYSICALLY_CORRECT_LIGHTS":"",t.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",t.logarithmicDepthBuffer&&t.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",t.toneMapping!==cr?"#define TONE_MAPPING":"",t.toneMapping!==cr?dt.tonemapping_pars_fragment:"",t.toneMapping!==cr?SI("toneMapping",t.toneMapping):"",t.dithering?"#define DITHERING":"",t.opaque?"#define OPAQUE":"",dt.encodings_pars_fragment,wI("linearToOutputTexel",t.outputEncoding),t.useDepthPacking?"#define DEPTH_PACKING "+t.depthPacking:"",`
`].filter(lc).join(`
`)),o=yv(o),o=PM(o,t),o=LM(o,t),l=yv(l),l=PM(l,t),l=LM(l,t),o=RM(o),l=RM(l),t.isWebGL2&&t.isRawShaderMaterial!==!0&&(S=`#version 300 es
`,w=["precision mediump sampler2DArray;","#define attribute in","#define varying out","#define texture2D texture"].join(`
`)+`
`+w,_=["#define varying in",t.glslVersion===B0?"":"layout(location = 0) out highp vec4 pc_fragColor;",t.glslVersion===B0?"":"#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(`
`)+`
`+_);const E=S+w+o,T=S+_+l,C=AM(r,35633,E),P=AM(r,35632,T);if(r.attachShader(y,C),r.attachShader(y,P),t.index0AttributeName!==void 0?r.bindAttribLocation(y,0,t.index0AttributeName):t.morphTargets===!0&&r.bindAttribLocation(y,0,"position"),r.linkProgram(y),n.debug.checkShaderErrors){const L=r.getProgramInfoLog(y).trim(),z=r.getShaderInfoLog(C).trim(),j=r.getShaderInfoLog(P).trim();let ue=!0,Z=!0;if(r.getProgramParameter(y,35714)===!1){ue=!1;const G=CM(r,C,"vertex"),ie=CM(r,P,"fragment");console.error("THREE.WebGLProgram: Shader Error "+r.getError()+" - VALIDATE_STATUS "+r.getProgramParameter(y,35715)+`

Program Info Log: `+L+`
`+G+`
`+ie)}else L!==""?console.warn("THREE.WebGLProgram: Program Info Log:",L):(z===""||j==="")&&(Z=!1);Z&&(this.diagnostics={runnable:ue,programLog:L,vertexShader:{log:z,prefix:w},fragmentShader:{log:j,prefix:_}})}r.deleteShader(C),r.deleteShader(P);let I;this.getUniforms=function(){return I===void 0&&(I=new ah(r,y)),I};let A;return this.getAttributes=function(){return A===void 0&&(A=TI(r,y)),A},this.destroy=function(){i.releaseStatesOfProgram(this),r.deleteProgram(y),this.program=void 0},this.name=t.shaderName,this.id=yI++,this.cacheKey=e,this.usedTimes=1,this.program=y,this.vertexShader=C,this.fragmentShader=P,this}let kI=0;class OI{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){const t=e.vertexShader,i=e.fragmentShader,r=this._getShaderStage(t),s=this._getShaderStage(i),o=this._getShaderCacheForMaterial(e);return o.has(r)===!1&&(o.add(r),r.usedTimes++),o.has(s)===!1&&(o.add(s),s.usedTimes++),this}remove(e){const t=this.materialCache.get(e);for(const i of t)i.usedTimes--,i.usedTimes===0&&this.shaderCache.delete(i.code);return this.materialCache.delete(e),this}getVertexShaderID(e){return this._getShaderStage(e.vertexShader).id}getFragmentShaderID(e){return this._getShaderStage(e.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(e){const t=this.materialCache;let i=t.get(e);return i===void 0&&(i=new Set,t.set(e,i)),i}_getShaderStage(e){const t=this.shaderCache;let i=t.get(e);return i===void 0&&(i=new FI(e),t.set(e,i)),i}}class FI{constructor(e){this.id=kI++,this.code=e,this.usedTimes=0}}function UI(n,e,t,i,r,s,o){const l=new ea,c=new OI,f=[],d=r.isWebGL2,h=r.logarithmicDepthBuffer,m=r.vertexTextures;let g=r.precision;const x={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distanceRGBA",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"};function y(A,L,z,j,ue){const Z=j.fog,G=ue.geometry,ie=A.isMeshStandardMaterial?j.environment:null,ee=(A.isMeshStandardMaterial?t:e).get(A.envMap||ie),pe=!!ee&&ee.mapping===il?ee.image.height:null,k=x[A.type];A.precision!==null&&(g=r.getMaxPrecision(A.precision),g!==A.precision&&console.warn("THREE.WebGLProgram.getParameters:",A.precision,"not supported, using",g,"instead."));const B=G.morphAttributes.position||G.morphAttributes.normal||G.morphAttributes.color,F=B!==void 0?B.length:0;let $=0;G.morphAttributes.position!==void 0&&($=1),G.morphAttributes.normal!==void 0&&($=2),G.morphAttributes.color!==void 0&&($=3);let J,me,Me,Ve;if(k){const Qe=Jn[k];J=Qe.vertexShader,me=Qe.fragmentShader}else J=A.vertexShader,me=A.fragmentShader,c.update(A),Me=c.getVertexShaderID(A),Ve=c.getFragmentShaderID(A);const re=n.getRenderTarget(),Xe=A.alphaTest>0,je=A.clearcoat>0,Je=A.iridescence>0;return{isWebGL2:d,shaderID:k,shaderName:A.type,vertexShader:J,fragmentShader:me,defines:A.defines,customVertexShaderID:Me,customFragmentShaderID:Ve,isRawShaderMaterial:A.isRawShaderMaterial===!0,glslVersion:A.glslVersion,precision:g,instancing:ue.isInstancedMesh===!0,instancingColor:ue.isInstancedMesh===!0&&ue.instanceColor!==null,supportsVertexTextures:m,outputEncoding:re===null?n.outputEncoding:re.isXRRenderTarget===!0?re.texture.encoding:ts,map:!!A.map,matcap:!!A.matcap,envMap:!!ee,envMapMode:ee&&ee.mapping,envMapCubeUVHeight:pe,lightMap:!!A.lightMap,aoMap:!!A.aoMap,emissiveMap:!!A.emissiveMap,bumpMap:!!A.bumpMap,normalMap:!!A.normalMap,objectSpaceNormalMap:A.normalMapType===GS,tangentSpaceNormalMap:A.normalMapType===qs,decodeVideoTexture:!!A.map&&A.map.isVideoTexture===!0&&A.map.encoding===Ft,clearcoat:je,clearcoatMap:je&&!!A.clearcoatMap,clearcoatRoughnessMap:je&&!!A.clearcoatRoughnessMap,clearcoatNormalMap:je&&!!A.clearcoatNormalMap,iridescence:Je,iridescenceMap:Je&&!!A.iridescenceMap,iridescenceThicknessMap:Je&&!!A.iridescenceThicknessMap,displacementMap:!!A.displacementMap,roughnessMap:!!A.roughnessMap,metalnessMap:!!A.metalnessMap,specularMap:!!A.specularMap,specularIntensityMap:!!A.specularIntensityMap,specularColorMap:!!A.specularColorMap,opaque:A.transparent===!1&&A.blending===Vo,alphaMap:!!A.alphaMap,alphaTest:Xe,gradientMap:!!A.gradientMap,sheen:A.sheen>0,sheenColorMap:!!A.sheenColorMap,sheenRoughnessMap:!!A.sheenRoughnessMap,transmission:A.transmission>0,transmissionMap:!!A.transmissionMap,thicknessMap:!!A.thicknessMap,combine:A.combine,vertexTangents:!!A.normalMap&&!!G.attributes.tangent,vertexColors:A.vertexColors,vertexAlphas:A.vertexColors===!0&&!!G.attributes.color&&G.attributes.color.itemSize===4,vertexUvs:!!A.map||!!A.bumpMap||!!A.normalMap||!!A.specularMap||!!A.alphaMap||!!A.emissiveMap||!!A.roughnessMap||!!A.metalnessMap||!!A.clearcoatMap||!!A.clearcoatRoughnessMap||!!A.clearcoatNormalMap||!!A.iridescenceMap||!!A.iridescenceThicknessMap||!!A.displacementMap||!!A.transmissionMap||!!A.thicknessMap||!!A.specularIntensityMap||!!A.specularColorMap||!!A.sheenColorMap||!!A.sheenRoughnessMap,uvsVertexOnly:!(!!A.map||!!A.bumpMap||!!A.normalMap||!!A.specularMap||!!A.alphaMap||!!A.emissiveMap||!!A.roughnessMap||!!A.metalnessMap||!!A.clearcoatNormalMap||!!A.iridescenceMap||!!A.iridescenceThicknessMap||A.transmission>0||!!A.transmissionMap||!!A.thicknessMap||!!A.specularIntensityMap||!!A.specularColorMap||A.sheen>0||!!A.sheenColorMap||!!A.sheenRoughnessMap)&&!!A.displacementMap,fog:!!Z,useFog:A.fog===!0,fogExp2:Z&&Z.isFogExp2,flatShading:!!A.flatShading,sizeAttenuation:A.sizeAttenuation,logarithmicDepthBuffer:h,skinning:ue.isSkinnedMesh===!0,morphTargets:G.morphAttributes.position!==void 0,morphNormals:G.morphAttributes.normal!==void 0,morphColors:G.morphAttributes.color!==void 0,morphTargetsCount:F,morphTextureStride:$,numDirLights:L.directional.length,numPointLights:L.point.length,numSpotLights:L.spot.length,numSpotLightMaps:L.spotLightMap.length,numRectAreaLights:L.rectArea.length,numHemiLights:L.hemi.length,numDirLightShadows:L.directionalShadowMap.length,numPointLightShadows:L.pointShadowMap.length,numSpotLightShadows:L.spotShadowMap.length,numSpotLightShadowsWithMaps:L.numSpotLightShadowsWithMaps,numClippingPlanes:o.numPlanes,numClipIntersection:o.numIntersection,dithering:A.dithering,shadowMapEnabled:n.shadowMap.enabled&&z.length>0,shadowMapType:n.shadowMap.type,toneMapping:A.toneMapped?n.toneMapping:cr,physicallyCorrectLights:n.physicallyCorrectLights,premultipliedAlpha:A.premultipliedAlpha,doubleSided:A.side===Kr,flipSided:A.side===Si,useDepthPacking:!!A.depthPacking,depthPacking:A.depthPacking||0,index0AttributeName:A.index0AttributeName,extensionDerivatives:A.extensions&&A.extensions.derivatives,extensionFragDepth:A.extensions&&A.extensions.fragDepth,extensionDrawBuffers:A.extensions&&A.extensions.drawBuffers,extensionShaderTextureLOD:A.extensions&&A.extensions.shaderTextureLOD,rendererExtensionFragDepth:d||i.has("EXT_frag_depth"),rendererExtensionDrawBuffers:d||i.has("WEBGL_draw_buffers"),rendererExtensionShaderTextureLod:d||i.has("EXT_shader_texture_lod"),customProgramCacheKey:A.customProgramCacheKey()}}function w(A){const L=[];if(A.shaderID?L.push(A.shaderID):(L.push(A.customVertexShaderID),L.push(A.customFragmentShaderID)),A.defines!==void 0)for(const z in A.defines)L.push(z),L.push(A.defines[z]);return A.isRawShaderMaterial===!1&&(_(L,A),S(L,A),L.push(n.outputEncoding)),L.push(A.customProgramCacheKey),L.join()}function _(A,L){A.push(L.precision),A.push(L.outputEncoding),A.push(L.envMapMode),A.push(L.envMapCubeUVHeight),A.push(L.combine),A.push(L.vertexUvs),A.push(L.fogExp2),A.push(L.sizeAttenuation),A.push(L.morphTargetsCount),A.push(L.morphAttributeCount),A.push(L.numDirLights),A.push(L.numPointLights),A.push(L.numSpotLights),A.push(L.numSpotLightMaps),A.push(L.numHemiLights),A.push(L.numRectAreaLights),A.push(L.numDirLightShadows),A.push(L.numPointLightShadows),A.push(L.numSpotLightShadows),A.push(L.numSpotLightShadowsWithMaps),A.push(L.shadowMapType),A.push(L.toneMapping),A.push(L.numClippingPlanes),A.push(L.numClipIntersection),A.push(L.depthPacking)}function S(A,L){l.disableAll(),L.isWebGL2&&l.enable(0),L.supportsVertexTextures&&l.enable(1),L.instancing&&l.enable(2),L.instancingColor&&l.enable(3),L.map&&l.enable(4),L.matcap&&l.enable(5),L.envMap&&l.enable(6),L.lightMap&&l.enable(7),L.aoMap&&l.enable(8),L.emissiveMap&&l.enable(9),L.bumpMap&&l.enable(10),L.normalMap&&l.enable(11),L.objectSpaceNormalMap&&l.enable(12),L.tangentSpaceNormalMap&&l.enable(13),L.clearcoat&&l.enable(14),L.clearcoatMap&&l.enable(15),L.clearcoatRoughnessMap&&l.enable(16),L.clearcoatNormalMap&&l.enable(17),L.iridescence&&l.enable(18),L.iridescenceMap&&l.enable(19),L.iridescenceThicknessMap&&l.enable(20),L.displacementMap&&l.enable(21),L.specularMap&&l.enable(22),L.roughnessMap&&l.enable(23),L.metalnessMap&&l.enable(24),L.gradientMap&&l.enable(25),L.alphaMap&&l.enable(26),L.alphaTest&&l.enable(27),L.vertexColors&&l.enable(28),L.vertexAlphas&&l.enable(29),L.vertexUvs&&l.enable(30),L.vertexTangents&&l.enable(31),L.uvsVertexOnly&&l.enable(32),A.push(l.mask),l.disableAll(),L.fog&&l.enable(0),L.useFog&&l.enable(1),L.flatShading&&l.enable(2),L.logarithmicDepthBuffer&&l.enable(3),L.skinning&&l.enable(4),L.morphTargets&&l.enable(5),L.morphNormals&&l.enable(6),L.morphColors&&l.enable(7),L.premultipliedAlpha&&l.enable(8),L.shadowMapEnabled&&l.enable(9),L.physicallyCorrectLights&&l.enable(10),L.doubleSided&&l.enable(11),L.flipSided&&l.enable(12),L.useDepthPacking&&l.enable(13),L.dithering&&l.enable(14),L.specularIntensityMap&&l.enable(15),L.specularColorMap&&l.enable(16),L.transmission&&l.enable(17),L.transmissionMap&&l.enable(18),L.thicknessMap&&l.enable(19),L.sheen&&l.enable(20),L.sheenColorMap&&l.enable(21),L.sheenRoughnessMap&&l.enable(22),L.decodeVideoTexture&&l.enable(23),L.opaque&&l.enable(24),A.push(l.mask)}function E(A){const L=x[A.type];let z;if(L){const j=Jn[L];z=nh.clone(j.uniforms)}else z=A.uniforms;return z}function T(A,L){let z;for(let j=0,ue=f.length;j<ue;j++){const Z=f[j];if(Z.cacheKey===L){z=Z,++z.usedTimes;break}}return z===void 0&&(z=new NI(n,L,A,s),f.push(z)),z}function C(A){if(--A.usedTimes===0){const L=f.indexOf(A);f[L]=f[f.length-1],f.pop(),A.destroy()}}function P(A){c.remove(A)}function I(){c.dispose()}return{getParameters:y,getProgramCacheKey:w,getUniforms:E,acquireProgram:T,releaseProgram:C,releaseShaderCache:P,programs:f,dispose:I}}function BI(){let n=new WeakMap;function e(s){let o=n.get(s);return o===void 0&&(o={},n.set(s,o)),o}function t(s){n.delete(s)}function i(s,o,l){n.get(s)[o]=l}function r(){n=new WeakMap}return{get:e,remove:t,update:i,dispose:r}}function VI(n,e){return n.groupOrder!==e.groupOrder?n.groupOrder-e.groupOrder:n.renderOrder!==e.renderOrder?n.renderOrder-e.renderOrder:n.material.id!==e.material.id?n.material.id-e.material.id:n.z!==e.z?n.z-e.z:n.id-e.id}function DM(n,e){return n.groupOrder!==e.groupOrder?n.groupOrder-e.groupOrder:n.renderOrder!==e.renderOrder?n.renderOrder-e.renderOrder:n.z!==e.z?e.z-n.z:n.id-e.id}function zM(){const n=[];let e=0;const t=[],i=[],r=[];function s(){e=0,t.length=0,i.length=0,r.length=0}function o(h,m,g,x,y,w){let _=n[e];return _===void 0?(_={id:h.id,object:h,geometry:m,material:g,groupOrder:x,renderOrder:h.renderOrder,z:y,group:w},n[e]=_):(_.id=h.id,_.object=h,_.geometry=m,_.material=g,_.groupOrder=x,_.renderOrder=h.renderOrder,_.z=y,_.group=w),e++,_}function l(h,m,g,x,y,w){const _=o(h,m,g,x,y,w);g.transmission>0?i.push(_):g.transparent===!0?r.push(_):t.push(_)}function c(h,m,g,x,y,w){const _=o(h,m,g,x,y,w);g.transmission>0?i.unshift(_):g.transparent===!0?r.unshift(_):t.unshift(_)}function f(h,m){t.length>1&&t.sort(h||VI),i.length>1&&i.sort(m||DM),r.length>1&&r.sort(m||DM)}function d(){for(let h=e,m=n.length;h<m;h++){const g=n[h];if(g.id===null)break;g.id=null,g.object=null,g.geometry=null,g.material=null,g.group=null}}return{opaque:t,transmissive:i,transparent:r,init:s,push:l,unshift:c,finish:d,sort:f}}function HI(){let n=new WeakMap;function e(i,r){const s=n.get(i);let o;return s===void 0?(o=new zM,n.set(i,[o])):r>=s.length?(o=new zM,s.push(o)):o=s[r],o}function t(){n=new WeakMap}return{get:e,dispose:t}}function WI(){const n={};return{get:function(e){if(n[e.id]!==void 0)return n[e.id];let t;switch(e.type){case"DirectionalLight":t={direction:new R,color:new De};break;case"SpotLight":t={position:new R,direction:new R,color:new De,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new R,color:new De,distance:0,decay:0};break;case"HemisphereLight":t={direction:new R,skyColor:new De,groundColor:new De};break;case"RectAreaLight":t={color:new De,position:new R,halfWidth:new R,halfHeight:new R};break}return n[e.id]=t,t}}}function GI(){const n={};return{get:function(e){if(n[e.id]!==void 0)return n[e.id];let t;switch(e.type){case"DirectionalLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new fe};break;case"SpotLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new fe};break;case"PointLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new fe,shadowCameraNear:1,shadowCameraFar:1e3};break}return n[e.id]=t,t}}}let XI=0;function jI(n,e){return(e.castShadow?2:0)-(n.castShadow?2:0)+(e.map?1:0)-(n.map?1:0)}function YI(n,e){const t=new WI,i=GI(),r={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0};for(let d=0;d<9;d++)r.probe.push(new R);const s=new R,o=new st,l=new st;function c(d,h){let m=0,g=0,x=0;for(let j=0;j<9;j++)r.probe[j].set(0,0,0);let y=0,w=0,_=0,S=0,E=0,T=0,C=0,P=0,I=0,A=0;d.sort(jI);const L=h!==!0?Math.PI:1;for(let j=0,ue=d.length;j<ue;j++){const Z=d[j],G=Z.color,ie=Z.intensity,ee=Z.distance,pe=Z.shadow&&Z.shadow.map?Z.shadow.map.texture:null;if(Z.isAmbientLight)m+=G.r*ie*L,g+=G.g*ie*L,x+=G.b*ie*L;else if(Z.isLightProbe)for(let k=0;k<9;k++)r.probe[k].addScaledVector(Z.sh.coefficients[k],ie);else if(Z.isDirectionalLight){const k=t.get(Z);if(k.color.copy(Z.color).multiplyScalar(Z.intensity*L),Z.castShadow){const B=Z.shadow,F=i.get(Z);F.shadowBias=B.bias,F.shadowNormalBias=B.normalBias,F.shadowRadius=B.radius,F.shadowMapSize=B.mapSize,r.directionalShadow[y]=F,r.directionalShadowMap[y]=pe,r.directionalShadowMatrix[y]=Z.shadow.matrix,T++}r.directional[y]=k,y++}else if(Z.isSpotLight){const k=t.get(Z);k.position.setFromMatrixPosition(Z.matrixWorld),k.color.copy(G).multiplyScalar(ie*L),k.distance=ee,k.coneCos=Math.cos(Z.angle),k.penumbraCos=Math.cos(Z.angle*(1-Z.penumbra)),k.decay=Z.decay,r.spot[_]=k;const B=Z.shadow;if(Z.map&&(r.spotLightMap[I]=Z.map,I++,B.updateMatrices(Z),Z.castShadow&&A++),r.spotLightMatrix[_]=B.matrix,Z.castShadow){const F=i.get(Z);F.shadowBias=B.bias,F.shadowNormalBias=B.normalBias,F.shadowRadius=B.radius,F.shadowMapSize=B.mapSize,r.spotShadow[_]=F,r.spotShadowMap[_]=pe,P++}_++}else if(Z.isRectAreaLight){const k=t.get(Z);k.color.copy(G).multiplyScalar(ie),k.halfWidth.set(Z.width*.5,0,0),k.halfHeight.set(0,Z.height*.5,0),r.rectArea[S]=k,S++}else if(Z.isPointLight){const k=t.get(Z);if(k.color.copy(Z.color).multiplyScalar(Z.intensity*L),k.distance=Z.distance,k.decay=Z.decay,Z.castShadow){const B=Z.shadow,F=i.get(Z);F.shadowBias=B.bias,F.shadowNormalBias=B.normalBias,F.shadowRadius=B.radius,F.shadowMapSize=B.mapSize,F.shadowCameraNear=B.camera.near,F.shadowCameraFar=B.camera.far,r.pointShadow[w]=F,r.pointShadowMap[w]=pe,r.pointShadowMatrix[w]=Z.shadow.matrix,C++}r.point[w]=k,w++}else if(Z.isHemisphereLight){const k=t.get(Z);k.skyColor.copy(Z.color).multiplyScalar(ie*L),k.groundColor.copy(Z.groundColor).multiplyScalar(ie*L),r.hemi[E]=k,E++}}S>0&&(e.isWebGL2||n.has("OES_texture_float_linear")===!0?(r.rectAreaLTC1=Se.LTC_FLOAT_1,r.rectAreaLTC2=Se.LTC_FLOAT_2):n.has("OES_texture_half_float_linear")===!0?(r.rectAreaLTC1=Se.LTC_HALF_1,r.rectAreaLTC2=Se.LTC_HALF_2):console.error("THREE.WebGLRenderer: Unable to use RectAreaLight. Missing WebGL extensions.")),r.ambient[0]=m,r.ambient[1]=g,r.ambient[2]=x;const z=r.hash;(z.directionalLength!==y||z.pointLength!==w||z.spotLength!==_||z.rectAreaLength!==S||z.hemiLength!==E||z.numDirectionalShadows!==T||z.numPointShadows!==C||z.numSpotShadows!==P||z.numSpotMaps!==I)&&(r.directional.length=y,r.spot.length=_,r.rectArea.length=S,r.point.length=w,r.hemi.length=E,r.directionalShadow.length=T,r.directionalShadowMap.length=T,r.pointShadow.length=C,r.pointShadowMap.length=C,r.spotShadow.length=P,r.spotShadowMap.length=P,r.directionalShadowMatrix.length=T,r.pointShadowMatrix.length=C,r.spotLightMatrix.length=P+I-A,r.spotLightMap.length=I,r.numSpotLightShadowsWithMaps=A,z.directionalLength=y,z.pointLength=w,z.spotLength=_,z.rectAreaLength=S,z.hemiLength=E,z.numDirectionalShadows=T,z.numPointShadows=C,z.numSpotShadows=P,z.numSpotMaps=I,r.version=XI++)}function f(d,h){let m=0,g=0,x=0,y=0,w=0;const _=h.matrixWorldInverse;for(let S=0,E=d.length;S<E;S++){const T=d[S];if(T.isDirectionalLight){const C=r.directional[m];C.direction.setFromMatrixPosition(T.matrixWorld),s.setFromMatrixPosition(T.target.matrixWorld),C.direction.sub(s),C.direction.transformDirection(_),m++}else if(T.isSpotLight){const C=r.spot[x];C.position.setFromMatrixPosition(T.matrixWorld),C.position.applyMatrix4(_),C.direction.setFromMatrixPosition(T.matrixWorld),s.setFromMatrixPosition(T.target.matrixWorld),C.direction.sub(s),C.direction.transformDirection(_),x++}else if(T.isRectAreaLight){const C=r.rectArea[y];C.position.setFromMatrixPosition(T.matrixWorld),C.position.applyMatrix4(_),l.identity(),o.copy(T.matrixWorld),o.premultiply(_),l.extractRotation(o),C.halfWidth.set(T.width*.5,0,0),C.halfHeight.set(0,T.height*.5,0),C.halfWidth.applyMatrix4(l),C.halfHeight.applyMatrix4(l),y++}else if(T.isPointLight){const C=r.point[g];C.position.setFromMatrixPosition(T.matrixWorld),C.position.applyMatrix4(_),g++}else if(T.isHemisphereLight){const C=r.hemi[w];C.direction.setFromMatrixPosition(T.matrixWorld),C.direction.transformDirection(_),w++}}}return{setup:c,setupView:f,state:r}}function NM(n,e){const t=new YI(n,e),i=[],r=[];function s(){i.length=0,r.length=0}function o(h){i.push(h)}function l(h){r.push(h)}function c(h){t.setup(i,h)}function f(h){t.setupView(i,h)}return{init:s,state:{lightsArray:i,shadowsArray:r,lights:t},setupLights:c,setupLightsView:f,pushLight:o,pushShadow:l}}function qI(n,e){let t=new WeakMap;function i(s,o=0){const l=t.get(s);let c;return l===void 0?(c=new NM(n,e),t.set(s,[c])):o>=l.length?(c=new NM(n,e),l.push(c)):c=l[o],c}function r(){t=new WeakMap}return{get:i,dispose:r}}class xv extends Pn{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=HS,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(e)}copy(e){return super.copy(e),this.depthPacking=e.depthPacking,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this}}class _v extends Pn{constructor(e){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.referencePosition=new R,this.nearDistance=1,this.farDistance=1e3,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(e)}copy(e){return super.copy(e),this.referencePosition.copy(e.referencePosition),this.nearDistance=e.nearDistance,this.farDistance=e.farDistance,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}}const ZI=`void main() {
	gl_Position = vec4( position, 1.0 );
}`,JI=`uniform sampler2D shadow_pass;
uniform vec2 resolution;
uniform float radius;
#include <packing>
void main() {
	const float samples = float( VSM_SAMPLES );
	float mean = 0.0;
	float squared_mean = 0.0;
	float uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 );
	float uvStart = samples <= 1.0 ? 0.0 : - 1.0;
	for ( float i = 0.0; i < samples; i ++ ) {
		float uvOffset = uvStart + i * uvStride;
		#ifdef HORIZONTAL_PASS
			vec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ) );
			mean += distribution.x;
			squared_mean += distribution.y * distribution.y + distribution.x * distribution.x;
		#else
			float depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ) );
			mean += depth;
			squared_mean += depth * depth;
		#endif
	}
	mean = mean / samples;
	squared_mean = squared_mean / samples;
	float std_dev = sqrt( squared_mean - mean * mean );
	gl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );
}`;function QI(n,e,t){let i=new rh;const r=new fe,s=new fe,o=new wt,l=new xv({depthPacking:WS}),c=new _v,f={},d=t.maxTextureSize,h={0:Si,1:Bo,2:Kr},m=new pr({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new fe},radius:{value:4}},vertexShader:ZI,fragmentShader:JI}),g=m.clone();g.defines.HORIZONTAL_PASS=1;const x=new lt;x.setAttribute("position",new It(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const y=new wn(x,m),w=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=o0,this.render=function(T,C,P){if(w.enabled===!1||w.autoUpdate===!1&&w.needsUpdate===!1||T.length===0)return;const I=n.getRenderTarget(),A=n.getActiveCubeFace(),L=n.getActiveMipmapLevel(),z=n.state;z.setBlending($r),z.buffers.color.setClear(1,1,1,1),z.buffers.depth.setTest(!0),z.setScissorTest(!1);for(let j=0,ue=T.length;j<ue;j++){const Z=T[j],G=Z.shadow;if(G===void 0){console.warn("THREE.WebGLShadowMap:",Z,"has no shadow.");continue}if(G.autoUpdate===!1&&G.needsUpdate===!1)continue;r.copy(G.mapSize);const ie=G.getFrameExtents();if(r.multiply(ie),s.copy(G.mapSize),(r.x>d||r.y>d)&&(r.x>d&&(s.x=Math.floor(d/ie.x),r.x=s.x*ie.x,G.mapSize.x=s.x),r.y>d&&(s.y=Math.floor(d/ie.y),r.y=s.y*ie.y,G.mapSize.y=s.y)),G.map===null){const pe=this.type!==nl?{minFilter:ln,magFilter:ln}:{};G.map=new Bi(r.x,r.y,pe),G.map.texture.name=Z.name+".shadowMap",G.camera.updateProjectionMatrix()}n.setRenderTarget(G.map),n.clear();const ee=G.getViewportCount();for(let pe=0;pe<ee;pe++){const k=G.getViewport(pe);o.set(s.x*k.x,s.y*k.y,s.x*k.z,s.y*k.w),z.viewport(o),G.updateMatrices(Z,pe),i=G.getFrustum(),E(C,P,G.camera,Z,this.type)}G.isPointLightShadow!==!0&&this.type===nl&&_(G,P),G.needsUpdate=!1}w.needsUpdate=!1,n.setRenderTarget(I,A,L)};function _(T,C){const P=e.update(y);m.defines.VSM_SAMPLES!==T.blurSamples&&(m.defines.VSM_SAMPLES=T.blurSamples,g.defines.VSM_SAMPLES=T.blurSamples,m.needsUpdate=!0,g.needsUpdate=!0),T.mapPass===null&&(T.mapPass=new Bi(r.x,r.y)),m.uniforms.shadow_pass.value=T.map.texture,m.uniforms.resolution.value=T.mapSize,m.uniforms.radius.value=T.radius,n.setRenderTarget(T.mapPass),n.clear(),n.renderBufferDirect(C,null,P,m,y,null),g.uniforms.shadow_pass.value=T.mapPass.texture,g.uniforms.resolution.value=T.mapSize,g.uniforms.radius.value=T.radius,n.setRenderTarget(T.map),n.clear(),n.renderBufferDirect(C,null,P,g,y,null)}function S(T,C,P,I,A,L){let z=null;const j=P.isPointLight===!0?T.customDistanceMaterial:T.customDepthMaterial;if(j!==void 0?z=j:z=P.isPointLight===!0?c:l,n.localClippingEnabled&&C.clipShadows===!0&&Array.isArray(C.clippingPlanes)&&C.clippingPlanes.length!==0||C.displacementMap&&C.displacementScale!==0||C.alphaMap&&C.alphaTest>0){const ue=z.uuid,Z=C.uuid;let G=f[ue];G===void 0&&(G={},f[ue]=G);let ie=G[Z];ie===void 0&&(ie=z.clone(),G[Z]=ie),z=ie}return z.visible=C.visible,z.wireframe=C.wireframe,L===nl?z.side=C.shadowSide!==null?C.shadowSide:C.side:z.side=C.shadowSide!==null?C.shadowSide:h[C.side],z.alphaMap=C.alphaMap,z.alphaTest=C.alphaTest,z.clipShadows=C.clipShadows,z.clippingPlanes=C.clippingPlanes,z.clipIntersection=C.clipIntersection,z.displacementMap=C.displacementMap,z.displacementScale=C.displacementScale,z.displacementBias=C.displacementBias,z.wireframeLinewidth=C.wireframeLinewidth,z.linewidth=C.linewidth,P.isPointLight===!0&&z.isMeshDistanceMaterial===!0&&(z.referencePosition.setFromMatrixPosition(P.matrixWorld),z.nearDistance=I,z.farDistance=A),z}function E(T,C,P,I,A){if(T.visible===!1)return;if(T.layers.test(C.layers)&&(T.isMesh||T.isLine||T.isPoints)&&(T.castShadow||T.receiveShadow&&A===nl)&&(!T.frustumCulled||i.intersectsObject(T))){T.modelViewMatrix.multiplyMatrices(P.matrixWorldInverse,T.matrixWorld);const j=e.update(T),ue=T.material;if(Array.isArray(ue)){const Z=j.groups;for(let G=0,ie=Z.length;G<ie;G++){const ee=Z[G],pe=ue[ee.materialIndex];if(pe&&pe.visible){const k=S(T,pe,I,P.near,P.far,A);n.renderBufferDirect(P,null,j,k,T,ee)}}}else if(ue.visible){const Z=S(T,ue,I,P.near,P.far,A);n.renderBufferDirect(P,null,j,Z,T,null)}}const z=T.children;for(let j=0,ue=z.length;j<ue;j++)E(z[j],C,P,I,A)}}function KI(n,e,t){const i=t.isWebGL2;function r(){let W=!1;const Le=new wt;let le=null;const Te=new wt(0,0,0,0);return{setMask:function(Ee){le!==Ee&&!W&&(n.colorMask(Ee,Ee,Ee,Ee),le=Ee)},setLocked:function(Ee){W=Ee},setClear:function(Ee,yt,fn,Vt,vr){vr===!0&&(Ee*=Vt,yt*=Vt,fn*=Vt),Le.set(Ee,yt,fn,Vt),Te.equals(Le)===!1&&(n.clearColor(Ee,yt,fn,Vt),Te.copy(Le))},reset:function(){W=!1,le=null,Te.set(-1,0,0,0)}}}function s(){let W=!1,Le=null,le=null,Te=null;return{setTest:function(Ee){Ee?Xe(2929):je(2929)},setMask:function(Ee){Le!==Ee&&!W&&(n.depthMask(Ee),Le=Ee)},setFunc:function(Ee){if(le!==Ee){if(Ee)switch(Ee){case fS:n.depthFunc(512);break;case dS:n.depthFunc(519);break;case hS:n.depthFunc(513);break;case Md:n.depthFunc(515);break;case pS:n.depthFunc(514);break;case mS:n.depthFunc(518);break;case gS:n.depthFunc(516);break;case vS:n.depthFunc(517);break;default:n.depthFunc(515)}else n.depthFunc(515);le=Ee}},setLocked:function(Ee){W=Ee},setClear:function(Ee){Te!==Ee&&(n.clearDepth(Ee),Te=Ee)},reset:function(){W=!1,Le=null,le=null,Te=null}}}function o(){let W=!1,Le=null,le=null,Te=null,Ee=null,yt=null,fn=null,Vt=null,vr=null;return{setTest:function(Ht){W||(Ht?Xe(2960):je(2960))},setMask:function(Ht){Le!==Ht&&!W&&(n.stencilMask(Ht),Le=Ht)},setFunc:function(Ht,Gi,ti){(le!==Ht||Te!==Gi||Ee!==ti)&&(n.stencilFunc(Ht,Gi,ti),le=Ht,Te=Gi,Ee=ti)},setOp:function(Ht,Gi,ti){(yt!==Ht||fn!==Gi||Vt!==ti)&&(n.stencilOp(Ht,Gi,ti),yt=Ht,fn=Gi,Vt=ti)},setLocked:function(Ht){W=Ht},setClear:function(Ht){vr!==Ht&&(n.clearStencil(Ht),vr=Ht)},reset:function(){W=!1,Le=null,le=null,Te=null,Ee=null,yt=null,fn=null,Vt=null,vr=null}}}const l=new r,c=new s,f=new o,d=new WeakMap,h=new WeakMap;let m={},g={},x=new WeakMap,y=[],w=null,_=!1,S=null,E=null,T=null,C=null,P=null,I=null,A=null,L=!1,z=null,j=null,ue=null,Z=null,G=null;const ie=n.getParameter(35661);let ee=!1,pe=0;const k=n.getParameter(7938);k.indexOf("WebGL")!==-1?(pe=parseFloat(/^WebGL (\d)/.exec(k)[1]),ee=pe>=1):k.indexOf("OpenGL ES")!==-1&&(pe=parseFloat(/^OpenGL ES (\d)/.exec(k)[1]),ee=pe>=2);let B=null,F={};const $=n.getParameter(3088),J=n.getParameter(2978),me=new wt().fromArray($),Me=new wt().fromArray(J);function Ve(W,Le,le){const Te=new Uint8Array(4),Ee=n.createTexture();n.bindTexture(W,Ee),n.texParameteri(W,10241,9728),n.texParameteri(W,10240,9728);for(let yt=0;yt<le;yt++)n.texImage2D(Le+yt,0,6408,1,1,0,6408,5121,Te);return Ee}const re={};re[3553]=Ve(3553,3553,1),re[34067]=Ve(34067,34069,6),l.setClear(0,0,0,1),c.setClear(1),f.setClear(0),Xe(2929),c.setFunc(Md),Ae(!1),$e(s0),Xe(2884),xe($r);function Xe(W){m[W]!==!0&&(n.enable(W),m[W]=!0)}function je(W){m[W]!==!1&&(n.disable(W),m[W]=!1)}function Je(W,Le){return g[W]!==Le?(n.bindFramebuffer(W,Le),g[W]=Le,i&&(W===36009&&(g[36160]=Le),W===36160&&(g[36009]=Le)),!0):!1}function be(W,Le){let le=y,Te=!1;if(W)if(le=x.get(Le),le===void 0&&(le=[],x.set(Le,le)),W.isWebGLMultipleRenderTargets){const Ee=W.texture;if(le.length!==Ee.length||le[0]!==36064){for(let yt=0,fn=Ee.length;yt<fn;yt++)le[yt]=36064+yt;le.length=Ee.length,Te=!0}}else le[0]!==36064&&(le[0]=36064,Te=!0);else le[0]!==1029&&(le[0]=1029,Te=!0);Te&&(t.isWebGL2?n.drawBuffers(le):e.get("WEBGL_draw_buffers").drawBuffersWEBGL(le))}function Qe(W){return w!==W?(n.useProgram(W),w=W,!0):!1}const he={[Ho]:32774,[eS]:32778,[tS]:32779};if(i)he[f0]=32775,he[d0]=32776;else{const W=e.get("EXT_blend_minmax");W!==null&&(he[f0]=W.MIN_EXT,he[d0]=W.MAX_EXT)}const oe={[nS]:0,[iS]:1,[rS]:768,[h0]:770,[cS]:776,[lS]:774,[oS]:772,[sS]:769,[p0]:771,[uS]:775,[aS]:773};function xe(W,Le,le,Te,Ee,yt,fn,Vt){if(W===$r){_===!0&&(je(3042),_=!1);return}if(_===!1&&(Xe(3042),_=!0),W!==$w){if(W!==S||Vt!==L){if((E!==Ho||P!==Ho)&&(n.blendEquation(32774),E=Ho,P=Ho),Vt)switch(W){case Vo:n.blendFuncSeparate(1,771,1,771);break;case l0:n.blendFunc(1,1);break;case u0:n.blendFuncSeparate(0,769,0,1);break;case c0:n.blendFuncSeparate(0,768,0,770);break;default:console.error("THREE.WebGLState: Invalid blending: ",W);break}else switch(W){case Vo:n.blendFuncSeparate(770,771,1,771);break;case l0:n.blendFunc(770,1);break;case u0:n.blendFuncSeparate(0,769,0,1);break;case c0:n.blendFunc(0,768);break;default:console.error("THREE.WebGLState: Invalid blending: ",W);break}T=null,C=null,I=null,A=null,S=W,L=Vt}return}Ee=Ee||Le,yt=yt||le,fn=fn||Te,(Le!==E||Ee!==P)&&(n.blendEquationSeparate(he[Le],he[Ee]),E=Le,P=Ee),(le!==T||Te!==C||yt!==I||fn!==A)&&(n.blendFuncSeparate(oe[le],oe[Te],oe[yt],oe[fn]),T=le,C=Te,I=yt,A=fn),S=W,L=null}function Ue(W,Le){W.side===Kr?je(2884):Xe(2884);let le=W.side===Si;Le&&(le=!le),Ae(le),W.blending===Vo&&W.transparent===!1?xe($r):xe(W.blending,W.blendEquation,W.blendSrc,W.blendDst,W.blendEquationAlpha,W.blendSrcAlpha,W.blendDstAlpha,W.premultipliedAlpha),c.setFunc(W.depthFunc),c.setTest(W.depthTest),c.setMask(W.depthWrite),l.setMask(W.colorWrite);const Te=W.stencilWrite;f.setTest(Te),Te&&(f.setMask(W.stencilWriteMask),f.setFunc(W.stencilFunc,W.stencilRef,W.stencilFuncMask),f.setOp(W.stencilFail,W.stencilZFail,W.stencilZPass)),Ge(W.polygonOffset,W.polygonOffsetFactor,W.polygonOffsetUnits),W.alphaToCoverage===!0?Xe(32926):je(32926)}function Ae(W){z!==W&&(W?n.frontFace(2304):n.frontFace(2305),z=W)}function $e(W){W!==Qw?(Xe(2884),W!==j&&(W===s0?n.cullFace(1029):W===Kw?n.cullFace(1028):n.cullFace(1032))):je(2884),j=W}function Ye(W){W!==ue&&(ee&&n.lineWidth(W),ue=W)}function Ge(W,Le,le){W?(Xe(32823),(Z!==Le||G!==le)&&(n.polygonOffset(Le,le),Z=Le,G=le)):je(32823)}function vt(W){W?Xe(3089):je(3089)}function Et(W){W===void 0&&(W=33984+ie-1),B!==W&&(n.activeTexture(W),B=W)}function U(W,Le){B===null&&Et();let le=F[B];le===void 0&&(le={type:void 0,texture:void 0},F[B]=le),(le.type!==W||le.texture!==Le)&&(n.bindTexture(W,Le||re[W]),le.type=W,le.texture=Le)}function D(){const W=F[B];W!==void 0&&W.type!==void 0&&(n.bindTexture(W.type,null),W.type=void 0,W.texture=void 0)}function te(){try{n.compressedTexImage2D.apply(n,arguments)}catch(W){console.error("THREE.WebGLState:",W)}}function ve(){try{n.texSubImage2D.apply(n,arguments)}catch(W){console.error("THREE.WebGLState:",W)}}function we(){try{n.texSubImage3D.apply(n,arguments)}catch(W){console.error("THREE.WebGLState:",W)}}function Ce(){try{n.compressedTexSubImage2D.apply(n,arguments)}catch(W){console.error("THREE.WebGLState:",W)}}function Ke(){try{n.texStorage2D.apply(n,arguments)}catch(W){console.error("THREE.WebGLState:",W)}}function se(){try{n.texStorage3D.apply(n,arguments)}catch(W){console.error("THREE.WebGLState:",W)}}function Be(){try{n.texImage2D.apply(n,arguments)}catch(W){console.error("THREE.WebGLState:",W)}}function Ie(){try{n.texImage3D.apply(n,arguments)}catch(W){console.error("THREE.WebGLState:",W)}}function V(W){me.equals(W)===!1&&(n.scissor(W.x,W.y,W.z,W.w),me.copy(W))}function K(W){Me.equals(W)===!1&&(n.viewport(W.x,W.y,W.z,W.w),Me.copy(W))}function _e(W,Le){let le=h.get(Le);le===void 0&&(le=new WeakMap,h.set(Le,le));let Te=le.get(W);Te===void 0&&(Te=n.getUniformBlockIndex(Le,W.name),le.set(W,Te))}function Oe(W,Le){const Te=h.get(Le).get(W);d.get(W)!==Te&&(n.uniformBlockBinding(Le,Te,W.__bindingPointIndex),d.set(W,Te))}function ot(){n.disable(3042),n.disable(2884),n.disable(2929),n.disable(32823),n.disable(3089),n.disable(2960),n.disable(32926),n.blendEquation(32774),n.blendFunc(1,0),n.blendFuncSeparate(1,0,1,0),n.colorMask(!0,!0,!0,!0),n.clearColor(0,0,0,0),n.depthMask(!0),n.depthFunc(513),n.clearDepth(1),n.stencilMask(4294967295),n.stencilFunc(519,0,4294967295),n.stencilOp(7680,7680,7680),n.clearStencil(0),n.cullFace(1029),n.frontFace(2305),n.polygonOffset(0,0),n.activeTexture(33984),n.bindFramebuffer(36160,null),i===!0&&(n.bindFramebuffer(36009,null),n.bindFramebuffer(36008,null)),n.useProgram(null),n.lineWidth(1),n.scissor(0,0,n.canvas.width,n.canvas.height),n.viewport(0,0,n.canvas.width,n.canvas.height),m={},B=null,F={},g={},x=new WeakMap,y=[],w=null,_=!1,S=null,E=null,T=null,C=null,P=null,I=null,A=null,L=!1,z=null,j=null,ue=null,Z=null,G=null,me.set(0,0,n.canvas.width,n.canvas.height),Me.set(0,0,n.canvas.width,n.canvas.height),l.reset(),c.reset(),f.reset()}return{buffers:{color:l,depth:c,stencil:f},enable:Xe,disable:je,bindFramebuffer:Je,drawBuffers:be,useProgram:Qe,setBlending:xe,setMaterial:Ue,setFlipSided:Ae,setCullFace:$e,setLineWidth:Ye,setPolygonOffset:Ge,setScissorTest:vt,activeTexture:Et,bindTexture:U,unbindTexture:D,compressedTexImage2D:te,texImage2D:Be,texImage3D:Ie,updateUBOMapping:_e,uniformBlockBinding:Oe,texStorage2D:Ke,texStorage3D:se,texSubImage2D:ve,texSubImage3D:we,compressedTexSubImage2D:Ce,scissor:V,viewport:K,reset:ot}}function $I(n,e,t,i,r,s,o){const l=r.isWebGL2,c=r.maxTextures,f=r.maxCubemapSize,d=r.maxTextureSize,h=r.maxSamples,m=e.has("WEBGL_multisampled_render_to_texture")?e.get("WEBGL_multisampled_render_to_texture"):null,g=/OculusBrowser/g.test(navigator.userAgent),x=new WeakMap;let y;const w=new WeakMap;let _=!1;try{_=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function S(U,D){return _?new OffscreenCanvas(U,D):ec("canvas")}function E(U,D,te,ve){let we=1;if((U.width>ve||U.height>ve)&&(we=ve/Math.max(U.width,U.height)),we<1||D===!0)if(typeof HTMLImageElement<"u"&&U instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&U instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&U instanceof ImageBitmap){const Ce=D?Nd:Math.floor,Ke=Ce(we*U.width),se=Ce(we*U.height);y===void 0&&(y=S(Ke,se));const Be=te?S(Ke,se):y;return Be.width=Ke,Be.height=se,Be.getContext("2d").drawImage(U,0,0,Ke,se),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+U.width+"x"+U.height+") to ("+Ke+"x"+se+")."),Be}else return"data"in U&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+U.width+"x"+U.height+")."),U;return U}function T(U){return H0(U.width)&&H0(U.height)}function C(U){return l?!1:U.wrapS!==Zn||U.wrapT!==Zn||U.minFilter!==ln&&U.minFilter!==tn}function P(U,D){return U.generateMipmaps&&D&&U.minFilter!==ln&&U.minFilter!==tn}function I(U){n.generateMipmap(U)}function A(U,D,te,ve,we=!1){if(l===!1)return D;if(U!==null){if(n[U]!==void 0)return n[U];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+U+"'")}let Ce=D;return D===6403&&(te===5126&&(Ce=33326),te===5131&&(Ce=33325),te===5121&&(Ce=33321)),D===33319&&(te===5126&&(Ce=33328),te===5131&&(Ce=33327),te===5121&&(Ce=33323)),D===6408&&(te===5126&&(Ce=34836),te===5131&&(Ce=34842),te===5121&&(Ce=ve===Ft&&we===!1?35907:32856),te===32819&&(Ce=32854),te===32820&&(Ce=32855)),(Ce===33325||Ce===33326||Ce===33327||Ce===33328||Ce===34842||Ce===34836)&&e.get("EXT_color_buffer_float"),Ce}function L(U,D,te){return P(U,te)===!0||U.isFramebufferTexture&&U.minFilter!==ln&&U.minFilter!==tn?Math.log2(Math.max(D.width,D.height))+1:U.mipmaps!==void 0&&U.mipmaps.length>0?U.mipmaps.length:U.isCompressedTexture&&Array.isArray(U.image)?D.mipmaps.length:1}function z(U){return U===ln||U===Td||U===bd?9728:9729}function j(U){const D=U.target;D.removeEventListener("dispose",j),Z(D),D.isVideoTexture&&x.delete(D)}function ue(U){const D=U.target;D.removeEventListener("dispose",ue),ie(D)}function Z(U){const D=i.get(U);if(D.__webglInit===void 0)return;const te=U.source,ve=w.get(te);if(ve){const we=ve[D.__cacheKey];we.usedTimes--,we.usedTimes===0&&G(U),Object.keys(ve).length===0&&w.delete(te)}i.remove(U)}function G(U){const D=i.get(U);n.deleteTexture(D.__webglTexture);const te=U.source,ve=w.get(te);delete ve[D.__cacheKey],o.memory.textures--}function ie(U){const D=U.texture,te=i.get(U),ve=i.get(D);if(ve.__webglTexture!==void 0&&(n.deleteTexture(ve.__webglTexture),o.memory.textures--),U.depthTexture&&U.depthTexture.dispose(),U.isWebGLCubeRenderTarget)for(let we=0;we<6;we++)n.deleteFramebuffer(te.__webglFramebuffer[we]),te.__webglDepthbuffer&&n.deleteRenderbuffer(te.__webglDepthbuffer[we]);else{if(n.deleteFramebuffer(te.__webglFramebuffer),te.__webglDepthbuffer&&n.deleteRenderbuffer(te.__webglDepthbuffer),te.__webglMultisampledFramebuffer&&n.deleteFramebuffer(te.__webglMultisampledFramebuffer),te.__webglColorRenderbuffer)for(let we=0;we<te.__webglColorRenderbuffer.length;we++)te.__webglColorRenderbuffer[we]&&n.deleteRenderbuffer(te.__webglColorRenderbuffer[we]);te.__webglDepthRenderbuffer&&n.deleteRenderbuffer(te.__webglDepthRenderbuffer)}if(U.isWebGLMultipleRenderTargets)for(let we=0,Ce=D.length;we<Ce;we++){const Ke=i.get(D[we]);Ke.__webglTexture&&(n.deleteTexture(Ke.__webglTexture),o.memory.textures--),i.remove(D[we])}i.remove(D),i.remove(U)}let ee=0;function pe(){ee=0}function k(){const U=ee;return U>=c&&console.warn("THREE.WebGLTextures: Trying to use "+U+" texture units while this GPU supports only "+c),ee+=1,U}function B(U){const D=[];return D.push(U.wrapS),D.push(U.wrapT),D.push(U.magFilter),D.push(U.minFilter),D.push(U.anisotropy),D.push(U.internalFormat),D.push(U.format),D.push(U.type),D.push(U.generateMipmaps),D.push(U.premultiplyAlpha),D.push(U.flipY),D.push(U.unpackAlignment),D.push(U.encoding),D.join()}function F(U,D){const te=i.get(U);if(U.isVideoTexture&&vt(U),U.isRenderTargetTexture===!1&&U.version>0&&te.__version!==U.version){const ve=U.image;if(ve===null)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else if(ve.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{je(te,U,D);return}}t.activeTexture(33984+D),t.bindTexture(3553,te.__webglTexture)}function $(U,D){const te=i.get(U);if(U.version>0&&te.__version!==U.version){je(te,U,D);return}t.activeTexture(33984+D),t.bindTexture(35866,te.__webglTexture)}function J(U,D){const te=i.get(U);if(U.version>0&&te.__version!==U.version){je(te,U,D);return}t.activeTexture(33984+D),t.bindTexture(32879,te.__webglTexture)}function me(U,D){const te=i.get(U);if(U.version>0&&te.__version!==U.version){Je(te,U,D);return}t.activeTexture(33984+D),t.bindTexture(34067,te.__webglTexture)}const Me={[ju]:10497,[Zn]:33071,[Yu]:33648},Ve={[ln]:9728,[Td]:9984,[bd]:9986,[tn]:9729,[g0]:9985,[Wo]:9987};function re(U,D,te){if(te?(n.texParameteri(U,10242,Me[D.wrapS]),n.texParameteri(U,10243,Me[D.wrapT]),(U===32879||U===35866)&&n.texParameteri(U,32882,Me[D.wrapR]),n.texParameteri(U,10240,Ve[D.magFilter]),n.texParameteri(U,10241,Ve[D.minFilter])):(n.texParameteri(U,10242,33071),n.texParameteri(U,10243,33071),(U===32879||U===35866)&&n.texParameteri(U,32882,33071),(D.wrapS!==Zn||D.wrapT!==Zn)&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."),n.texParameteri(U,10240,z(D.magFilter)),n.texParameteri(U,10241,z(D.minFilter)),D.minFilter!==ln&&D.minFilter!==tn&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.")),e.has("EXT_texture_filter_anisotropic")===!0){const ve=e.get("EXT_texture_filter_anisotropic");if(D.type===es&&e.has("OES_texture_float_linear")===!1||l===!1&&D.type===rl&&e.has("OES_texture_half_float_linear")===!1)return;(D.anisotropy>1||i.get(D).__currentAnisotropy)&&(n.texParameterf(U,ve.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(D.anisotropy,r.getMaxAnisotropy())),i.get(D).__currentAnisotropy=D.anisotropy)}}function Xe(U,D){let te=!1;U.__webglInit===void 0&&(U.__webglInit=!0,D.addEventListener("dispose",j));const ve=D.source;let we=w.get(ve);we===void 0&&(we={},w.set(ve,we));const Ce=B(D);if(Ce!==U.__cacheKey){we[Ce]===void 0&&(we[Ce]={texture:n.createTexture(),usedTimes:0},o.memory.textures++,te=!0),we[Ce].usedTimes++;const Ke=we[U.__cacheKey];Ke!==void 0&&(we[U.__cacheKey].usedTimes--,Ke.usedTimes===0&&G(D)),U.__cacheKey=Ce,U.__webglTexture=we[Ce].texture}return te}function je(U,D,te){let ve=3553;D.isDataArrayTexture&&(ve=35866),D.isData3DTexture&&(ve=32879);const we=Xe(U,D),Ce=D.source;if(t.activeTexture(33984+te),t.bindTexture(ve,U.__webglTexture),Ce.version!==Ce.__currentVersion||we===!0){n.pixelStorei(37440,D.flipY),n.pixelStorei(37441,D.premultiplyAlpha),n.pixelStorei(3317,D.unpackAlignment),n.pixelStorei(37443,0);const Ke=C(D)&&T(D.image)===!1;let se=E(D.image,Ke,!1,d);se=Et(D,se);const Be=T(se)||l,Ie=s.convert(D.format,D.encoding);let V=s.convert(D.type),K=A(D.internalFormat,Ie,V,D.encoding,D.isVideoTexture);re(ve,D,Be);let _e;const Oe=D.mipmaps,ot=l&&D.isVideoTexture!==!0,W=Ce.__currentVersion===void 0||we===!0,Le=L(D,se,Be);if(D.isDepthTexture)K=6402,l?D.type===es?K=36012:D.type===js?K=33190:D.type===Go?K=35056:K=33189:D.type===es&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),D.format===Ys&&K===6402&&D.type!==v0&&D.type!==js&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),D.type=js,V=s.convert(D.type)),D.format===Xo&&K===6402&&(K=34041,D.type!==Go&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),D.type=Go,V=s.convert(D.type))),W&&(ot?t.texStorage2D(3553,1,K,se.width,se.height):t.texImage2D(3553,0,K,se.width,se.height,0,Ie,V,null));else if(D.isDataTexture)if(Oe.length>0&&Be){ot&&W&&t.texStorage2D(3553,Le,K,Oe[0].width,Oe[0].height);for(let le=0,Te=Oe.length;le<Te;le++)_e=Oe[le],ot?t.texSubImage2D(3553,le,0,0,_e.width,_e.height,Ie,V,_e.data):t.texImage2D(3553,le,K,_e.width,_e.height,0,Ie,V,_e.data);D.generateMipmaps=!1}else ot?(W&&t.texStorage2D(3553,Le,K,se.width,se.height),t.texSubImage2D(3553,0,0,0,se.width,se.height,Ie,V,se.data)):t.texImage2D(3553,0,K,se.width,se.height,0,Ie,V,se.data);else if(D.isCompressedTexture){ot&&W&&t.texStorage2D(3553,Le,K,Oe[0].width,Oe[0].height);for(let le=0,Te=Oe.length;le<Te;le++)_e=Oe[le],D.format!==Fi?Ie!==null?ot?t.compressedTexSubImage2D(3553,le,0,0,_e.width,_e.height,Ie,_e.data):t.compressedTexImage2D(3553,le,K,_e.width,_e.height,0,_e.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):ot?t.texSubImage2D(3553,le,0,0,_e.width,_e.height,Ie,V,_e.data):t.texImage2D(3553,le,K,_e.width,_e.height,0,Ie,V,_e.data)}else if(D.isDataArrayTexture)ot?(W&&t.texStorage3D(35866,Le,K,se.width,se.height,se.depth),t.texSubImage3D(35866,0,0,0,0,se.width,se.height,se.depth,Ie,V,se.data)):t.texImage3D(35866,0,K,se.width,se.height,se.depth,0,Ie,V,se.data);else if(D.isData3DTexture)ot?(W&&t.texStorage3D(32879,Le,K,se.width,se.height,se.depth),t.texSubImage3D(32879,0,0,0,0,se.width,se.height,se.depth,Ie,V,se.data)):t.texImage3D(32879,0,K,se.width,se.height,se.depth,0,Ie,V,se.data);else if(D.isFramebufferTexture){if(W)if(ot)t.texStorage2D(3553,Le,K,se.width,se.height);else{let le=se.width,Te=se.height;for(let Ee=0;Ee<Le;Ee++)t.texImage2D(3553,Ee,K,le,Te,0,Ie,V,null),le>>=1,Te>>=1}}else if(Oe.length>0&&Be){ot&&W&&t.texStorage2D(3553,Le,K,Oe[0].width,Oe[0].height);for(let le=0,Te=Oe.length;le<Te;le++)_e=Oe[le],ot?t.texSubImage2D(3553,le,0,0,Ie,V,_e):t.texImage2D(3553,le,K,Ie,V,_e);D.generateMipmaps=!1}else ot?(W&&t.texStorage2D(3553,Le,K,se.width,se.height),t.texSubImage2D(3553,0,0,0,Ie,V,se)):t.texImage2D(3553,0,K,Ie,V,se);P(D,Be)&&I(ve),Ce.__currentVersion=Ce.version,D.onUpdate&&D.onUpdate(D)}U.__version=D.version}function Je(U,D,te){if(D.image.length!==6)return;const ve=Xe(U,D),we=D.source;if(t.activeTexture(33984+te),t.bindTexture(34067,U.__webglTexture),we.version!==we.__currentVersion||ve===!0){n.pixelStorei(37440,D.flipY),n.pixelStorei(37441,D.premultiplyAlpha),n.pixelStorei(3317,D.unpackAlignment),n.pixelStorei(37443,0);const Ce=D.isCompressedTexture||D.image[0].isCompressedTexture,Ke=D.image[0]&&D.image[0].isDataTexture,se=[];for(let le=0;le<6;le++)!Ce&&!Ke?se[le]=E(D.image[le],!1,!0,f):se[le]=Ke?D.image[le].image:D.image[le],se[le]=Et(D,se[le]);const Be=se[0],Ie=T(Be)||l,V=s.convert(D.format,D.encoding),K=s.convert(D.type),_e=A(D.internalFormat,V,K,D.encoding),Oe=l&&D.isVideoTexture!==!0,ot=we.__currentVersion===void 0||ve===!0;let W=L(D,Be,Ie);re(34067,D,Ie);let Le;if(Ce){Oe&&ot&&t.texStorage2D(34067,W,_e,Be.width,Be.height);for(let le=0;le<6;le++){Le=se[le].mipmaps;for(let Te=0;Te<Le.length;Te++){const Ee=Le[Te];D.format!==Fi?V!==null?Oe?t.compressedTexSubImage2D(34069+le,Te,0,0,Ee.width,Ee.height,V,Ee.data):t.compressedTexImage2D(34069+le,Te,_e,Ee.width,Ee.height,0,Ee.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):Oe?t.texSubImage2D(34069+le,Te,0,0,Ee.width,Ee.height,V,K,Ee.data):t.texImage2D(34069+le,Te,_e,Ee.width,Ee.height,0,V,K,Ee.data)}}}else{Le=D.mipmaps,Oe&&ot&&(Le.length>0&&W++,t.texStorage2D(34067,W,_e,se[0].width,se[0].height));for(let le=0;le<6;le++)if(Ke){Oe?t.texSubImage2D(34069+le,0,0,0,se[le].width,se[le].height,V,K,se[le].data):t.texImage2D(34069+le,0,_e,se[le].width,se[le].height,0,V,K,se[le].data);for(let Te=0;Te<Le.length;Te++){const yt=Le[Te].image[le].image;Oe?t.texSubImage2D(34069+le,Te+1,0,0,yt.width,yt.height,V,K,yt.data):t.texImage2D(34069+le,Te+1,_e,yt.width,yt.height,0,V,K,yt.data)}}else{Oe?t.texSubImage2D(34069+le,0,0,0,V,K,se[le]):t.texImage2D(34069+le,0,_e,V,K,se[le]);for(let Te=0;Te<Le.length;Te++){const Ee=Le[Te];Oe?t.texSubImage2D(34069+le,Te+1,0,0,V,K,Ee.image[le]):t.texImage2D(34069+le,Te+1,_e,V,K,Ee.image[le])}}}P(D,Ie)&&I(34067),we.__currentVersion=we.version,D.onUpdate&&D.onUpdate(D)}U.__version=D.version}function be(U,D,te,ve,we){const Ce=s.convert(te.format,te.encoding),Ke=s.convert(te.type),se=A(te.internalFormat,Ce,Ke,te.encoding);i.get(D).__hasExternalTextures||(we===32879||we===35866?t.texImage3D(we,0,se,D.width,D.height,D.depth,0,Ce,Ke,null):t.texImage2D(we,0,se,D.width,D.height,0,Ce,Ke,null)),t.bindFramebuffer(36160,U),Ge(D)?m.framebufferTexture2DMultisampleEXT(36160,ve,we,i.get(te).__webglTexture,0,Ye(D)):n.framebufferTexture2D(36160,ve,we,i.get(te).__webglTexture,0),t.bindFramebuffer(36160,null)}function Qe(U,D,te){if(n.bindRenderbuffer(36161,U),D.depthBuffer&&!D.stencilBuffer){let ve=33189;if(te||Ge(D)){const we=D.depthTexture;we&&we.isDepthTexture&&(we.type===es?ve=36012:we.type===js&&(ve=33190));const Ce=Ye(D);Ge(D)?m.renderbufferStorageMultisampleEXT(36161,Ce,ve,D.width,D.height):n.renderbufferStorageMultisample(36161,Ce,ve,D.width,D.height)}else n.renderbufferStorage(36161,ve,D.width,D.height);n.framebufferRenderbuffer(36160,36096,36161,U)}else if(D.depthBuffer&&D.stencilBuffer){const ve=Ye(D);te&&Ge(D)===!1?n.renderbufferStorageMultisample(36161,ve,35056,D.width,D.height):Ge(D)?m.renderbufferStorageMultisampleEXT(36161,ve,35056,D.width,D.height):n.renderbufferStorage(36161,34041,D.width,D.height),n.framebufferRenderbuffer(36160,33306,36161,U)}else{const ve=D.isWebGLMultipleRenderTargets===!0?D.texture:[D.texture];for(let we=0;we<ve.length;we++){const Ce=ve[we],Ke=s.convert(Ce.format,Ce.encoding),se=s.convert(Ce.type),Be=A(Ce.internalFormat,Ke,se,Ce.encoding),Ie=Ye(D);te&&Ge(D)===!1?n.renderbufferStorageMultisample(36161,Ie,Be,D.width,D.height):Ge(D)?m.renderbufferStorageMultisampleEXT(36161,Ie,Be,D.width,D.height):n.renderbufferStorage(36161,Be,D.width,D.height)}}n.bindRenderbuffer(36161,null)}function he(U,D){if(D&&D.isWebGLCubeRenderTarget)throw new Error("Depth Texture with cube render targets is not supported");if(t.bindFramebuffer(36160,U),!(D.depthTexture&&D.depthTexture.isDepthTexture))throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");(!i.get(D.depthTexture).__webglTexture||D.depthTexture.image.width!==D.width||D.depthTexture.image.height!==D.height)&&(D.depthTexture.image.width=D.width,D.depthTexture.image.height=D.height,D.depthTexture.needsUpdate=!0),F(D.depthTexture,0);const ve=i.get(D.depthTexture).__webglTexture,we=Ye(D);if(D.depthTexture.format===Ys)Ge(D)?m.framebufferTexture2DMultisampleEXT(36160,36096,3553,ve,0,we):n.framebufferTexture2D(36160,36096,3553,ve,0);else if(D.depthTexture.format===Xo)Ge(D)?m.framebufferTexture2DMultisampleEXT(36160,33306,3553,ve,0,we):n.framebufferTexture2D(36160,33306,3553,ve,0);else throw new Error("Unknown depthTexture format")}function oe(U){const D=i.get(U),te=U.isWebGLCubeRenderTarget===!0;if(U.depthTexture&&!D.__autoAllocateDepthBuffer){if(te)throw new Error("target.depthTexture not supported in Cube render targets");he(D.__webglFramebuffer,U)}else if(te){D.__webglDepthbuffer=[];for(let ve=0;ve<6;ve++)t.bindFramebuffer(36160,D.__webglFramebuffer[ve]),D.__webglDepthbuffer[ve]=n.createRenderbuffer(),Qe(D.__webglDepthbuffer[ve],U,!1)}else t.bindFramebuffer(36160,D.__webglFramebuffer),D.__webglDepthbuffer=n.createRenderbuffer(),Qe(D.__webglDepthbuffer,U,!1);t.bindFramebuffer(36160,null)}function xe(U,D,te){const ve=i.get(U);D!==void 0&&be(ve.__webglFramebuffer,U,U.texture,36064,3553),te!==void 0&&oe(U)}function Ue(U){const D=U.texture,te=i.get(U),ve=i.get(D);U.addEventListener("dispose",ue),U.isWebGLMultipleRenderTargets!==!0&&(ve.__webglTexture===void 0&&(ve.__webglTexture=n.createTexture()),ve.__version=D.version,o.memory.textures++);const we=U.isWebGLCubeRenderTarget===!0,Ce=U.isWebGLMultipleRenderTargets===!0,Ke=T(U)||l;if(we){te.__webglFramebuffer=[];for(let se=0;se<6;se++)te.__webglFramebuffer[se]=n.createFramebuffer()}else{if(te.__webglFramebuffer=n.createFramebuffer(),Ce)if(r.drawBuffers){const se=U.texture;for(let Be=0,Ie=se.length;Be<Ie;Be++){const V=i.get(se[Be]);V.__webglTexture===void 0&&(V.__webglTexture=n.createTexture(),o.memory.textures++)}}else console.warn("THREE.WebGLRenderer: WebGLMultipleRenderTargets can only be used with WebGL2 or WEBGL_draw_buffers extension.");if(l&&U.samples>0&&Ge(U)===!1){const se=Ce?D:[D];te.__webglMultisampledFramebuffer=n.createFramebuffer(),te.__webglColorRenderbuffer=[],t.bindFramebuffer(36160,te.__webglMultisampledFramebuffer);for(let Be=0;Be<se.length;Be++){const Ie=se[Be];te.__webglColorRenderbuffer[Be]=n.createRenderbuffer(),n.bindRenderbuffer(36161,te.__webglColorRenderbuffer[Be]);const V=s.convert(Ie.format,Ie.encoding),K=s.convert(Ie.type),_e=A(Ie.internalFormat,V,K,Ie.encoding),Oe=Ye(U);n.renderbufferStorageMultisample(36161,Oe,_e,U.width,U.height),n.framebufferRenderbuffer(36160,36064+Be,36161,te.__webglColorRenderbuffer[Be])}n.bindRenderbuffer(36161,null),U.depthBuffer&&(te.__webglDepthRenderbuffer=n.createRenderbuffer(),Qe(te.__webglDepthRenderbuffer,U,!0)),t.bindFramebuffer(36160,null)}}if(we){t.bindTexture(34067,ve.__webglTexture),re(34067,D,Ke);for(let se=0;se<6;se++)be(te.__webglFramebuffer[se],U,D,36064,34069+se);P(D,Ke)&&I(34067),t.unbindTexture()}else if(Ce){const se=U.texture;for(let Be=0,Ie=se.length;Be<Ie;Be++){const V=se[Be],K=i.get(V);t.bindTexture(3553,K.__webglTexture),re(3553,V,Ke),be(te.__webglFramebuffer,U,V,36064+Be,3553),P(V,Ke)&&I(3553)}t.unbindTexture()}else{let se=3553;(U.isWebGL3DRenderTarget||U.isWebGLArrayRenderTarget)&&(l?se=U.isWebGL3DRenderTarget?32879:35866:console.error("THREE.WebGLTextures: THREE.Data3DTexture and THREE.DataArrayTexture only supported with WebGL2.")),t.bindTexture(se,ve.__webglTexture),re(se,D,Ke),be(te.__webglFramebuffer,U,D,36064,se),P(D,Ke)&&I(se),t.unbindTexture()}U.depthBuffer&&oe(U)}function Ae(U){const D=T(U)||l,te=U.isWebGLMultipleRenderTargets===!0?U.texture:[U.texture];for(let ve=0,we=te.length;ve<we;ve++){const Ce=te[ve];if(P(Ce,D)){const Ke=U.isWebGLCubeRenderTarget?34067:3553,se=i.get(Ce).__webglTexture;t.bindTexture(Ke,se),I(Ke),t.unbindTexture()}}}function $e(U){if(l&&U.samples>0&&Ge(U)===!1){const D=U.isWebGLMultipleRenderTargets?U.texture:[U.texture],te=U.width,ve=U.height;let we=16384;const Ce=[],Ke=U.stencilBuffer?33306:36096,se=i.get(U),Be=U.isWebGLMultipleRenderTargets===!0;if(Be)for(let Ie=0;Ie<D.length;Ie++)t.bindFramebuffer(36160,se.__webglMultisampledFramebuffer),n.framebufferRenderbuffer(36160,36064+Ie,36161,null),t.bindFramebuffer(36160,se.__webglFramebuffer),n.framebufferTexture2D(36009,36064+Ie,3553,null,0);t.bindFramebuffer(36008,se.__webglMultisampledFramebuffer),t.bindFramebuffer(36009,se.__webglFramebuffer);for(let Ie=0;Ie<D.length;Ie++){Ce.push(36064+Ie),U.depthBuffer&&Ce.push(Ke);const V=se.__ignoreDepthValues!==void 0?se.__ignoreDepthValues:!1;if(V===!1&&(U.depthBuffer&&(we|=256),U.stencilBuffer&&(we|=1024)),Be&&n.framebufferRenderbuffer(36008,36064,36161,se.__webglColorRenderbuffer[Ie]),V===!0&&(n.invalidateFramebuffer(36008,[Ke]),n.invalidateFramebuffer(36009,[Ke])),Be){const K=i.get(D[Ie]).__webglTexture;n.framebufferTexture2D(36009,36064,3553,K,0)}n.blitFramebuffer(0,0,te,ve,0,0,te,ve,we,9728),g&&n.invalidateFramebuffer(36008,Ce)}if(t.bindFramebuffer(36008,null),t.bindFramebuffer(36009,null),Be)for(let Ie=0;Ie<D.length;Ie++){t.bindFramebuffer(36160,se.__webglMultisampledFramebuffer),n.framebufferRenderbuffer(36160,36064+Ie,36161,se.__webglColorRenderbuffer[Ie]);const V=i.get(D[Ie]).__webglTexture;t.bindFramebuffer(36160,se.__webglFramebuffer),n.framebufferTexture2D(36009,36064+Ie,3553,V,0)}t.bindFramebuffer(36009,se.__webglMultisampledFramebuffer)}}function Ye(U){return Math.min(h,U.samples)}function Ge(U){const D=i.get(U);return l&&U.samples>0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&D.__useRenderToTexture!==!1}function vt(U){const D=o.render.frame;x.get(U)!==D&&(x.set(U,D),U.update())}function Et(U,D){const te=U.encoding,ve=U.format,we=U.type;return U.isCompressedTexture===!0||U.isVideoTexture===!0||U.format===zd||te!==ts&&(te===Ft?l===!1?e.has("EXT_sRGB")===!0&&ve===Fi?(U.format=zd,U.minFilter=tn,U.generateMipmaps=!1):D=X0.sRGBToLinear(D):(ve!==Fi||we!==Xs)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture encoding:",te)),D}this.allocateTextureUnit=k,this.resetTextureUnits=pe,this.setTexture2D=F,this.setTexture2DArray=$,this.setTexture3D=J,this.setTextureCube=me,this.rebindTextures=xe,this.setupRenderTarget=Ue,this.updateRenderTargetMipmap=Ae,this.updateMultisampleRenderTarget=$e,this.setupDepthRenderbuffer=oe,this.setupFrameBufferTexture=be,this.useMultisampledRTT=Ge}function kM(n,e,t){const i=t.isWebGL2;function r(s,o=null){let l;if(s===Xs)return 5121;if(s===AS)return 32819;if(s===CS)return 32820;if(s===ES)return 5120;if(s===TS)return 5122;if(s===v0)return 5123;if(s===bS)return 5124;if(s===js)return 5125;if(s===es)return 5126;if(s===rl)return i?5131:(l=e.get("OES_texture_half_float"),l!==null?l.HALF_FLOAT_OES:null);if(s===PS)return 6406;if(s===Fi)return 6408;if(s===RS)return 6409;if(s===IS)return 6410;if(s===Ys)return 6402;if(s===Xo)return 34041;if(s===DS)return 6403;if(s===LS)return console.warn("THREE.WebGLRenderer: THREE.RGBFormat has been removed. Use THREE.RGBAFormat instead. https://github.com/mrdoob/three.js/pull/23228"),6408;if(s===zd)return l=e.get("EXT_sRGB"),l!==null?l.SRGB_ALPHA_EXT:null;if(s===zS)return 36244;if(s===NS)return 33319;if(s===kS)return 33320;if(s===OS)return 36249;if(s===Ad||s===Cd||s===Pd||s===Ld)if(o===Ft)if(l=e.get("WEBGL_compressed_texture_s3tc_srgb"),l!==null){if(s===Ad)return l.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(s===Cd)return l.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(s===Pd)return l.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(s===Ld)return l.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(l=e.get("WEBGL_compressed_texture_s3tc"),l!==null){if(s===Ad)return l.COMPRESSED_RGB_S3TC_DXT1_EXT;if(s===Cd)return l.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(s===Pd)return l.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(s===Ld)return l.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(s===y0||s===x0||s===_0||s===w0)if(l=e.get("WEBGL_compressed_texture_pvrtc"),l!==null){if(s===y0)return l.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(s===x0)return l.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(s===_0)return l.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(s===w0)return l.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(s===FS)return l=e.get("WEBGL_compressed_texture_etc1"),l!==null?l.COMPRESSED_RGB_ETC1_WEBGL:null;if(s===S0||s===M0)if(l=e.get("WEBGL_compressed_texture_etc"),l!==null){if(s===S0)return o===Ft?l.COMPRESSED_SRGB8_ETC2:l.COMPRESSED_RGB8_ETC2;if(s===M0)return o===Ft?l.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:l.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(s===E0||s===T0||s===b0||s===A0||s===C0||s===P0||s===L0||s===R0||s===I0||s===D0||s===z0||s===N0||s===k0||s===O0)if(l=e.get("WEBGL_compressed_texture_astc"),l!==null){if(s===E0)return o===Ft?l.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:l.COMPRESSED_RGBA_ASTC_4x4_KHR;if(s===T0)return o===Ft?l.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:l.COMPRESSED_RGBA_ASTC_5x4_KHR;if(s===b0)return o===Ft?l.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:l.COMPRESSED_RGBA_ASTC_5x5_KHR;if(s===A0)return o===Ft?l.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:l.COMPRESSED_RGBA_ASTC_6x5_KHR;if(s===C0)return o===Ft?l.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:l.COMPRESSED_RGBA_ASTC_6x6_KHR;if(s===P0)return o===Ft?l.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:l.COMPRESSED_RGBA_ASTC_8x5_KHR;if(s===L0)return o===Ft?l.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:l.COMPRESSED_RGBA_ASTC_8x6_KHR;if(s===R0)return o===Ft?l.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:l.COMPRESSED_RGBA_ASTC_8x8_KHR;if(s===I0)return o===Ft?l.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:l.COMPRESSED_RGBA_ASTC_10x5_KHR;if(s===D0)return o===Ft?l.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:l.COMPRESSED_RGBA_ASTC_10x6_KHR;if(s===z0)return o===Ft?l.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:l.COMPRESSED_RGBA_ASTC_10x8_KHR;if(s===N0)return o===Ft?l.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:l.COMPRESSED_RGBA_ASTC_10x10_KHR;if(s===k0)return o===Ft?l.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:l.COMPRESSED_RGBA_ASTC_12x10_KHR;if(s===O0)return o===Ft?l.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:l.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(s===F0)if(l=e.get("EXT_texture_compression_bptc"),l!==null){if(s===F0)return o===Ft?l.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:l.COMPRESSED_RGBA_BPTC_UNORM_EXT}else return null;return s===Go?i?34042:(l=e.get("WEBGL_depth_texture"),l!==null?l.UNSIGNED_INT_24_8_WEBGL:null):n[s]!==void 0?n[s]:null}return{convert:r}}class OM extends Bt{constructor(e=[]){super(),this.isArrayCamera=!0,this.cameras=e}}class Tl extends Mt{constructor(){super(),this.isGroup=!0,this.type="Group"}}const eD={type:"move"};class wv{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new Tl,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return this._targetRay===null&&(this._targetRay=new Tl,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new R,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new R),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new Tl,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new R,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new R),this._grip}dispatchEvent(e){return this._targetRay!==null&&this._targetRay.dispatchEvent(e),this._grip!==null&&this._grip.dispatchEvent(e),this._hand!==null&&this._hand.dispatchEvent(e),this}disconnect(e){return this.dispatchEvent({type:"disconnected",data:e}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(e,t,i){let r=null,s=null,o=null;const l=this._targetRay,c=this._grip,f=this._hand;if(e&&t.session.visibilityState!=="visible-blurred"){if(f&&e.hand){o=!0;for(const y of e.hand.values()){const w=t.getJointPose(y,i);if(f.joints[y.jointName]===void 0){const S=new Tl;S.matrixAutoUpdate=!1,S.visible=!1,f.joints[y.jointName]=S,f.add(S)}const _=f.joints[y.jointName];w!==null&&(_.matrix.fromArray(w.transform.matrix),_.matrix.decompose(_.position,_.rotation,_.scale),_.jointRadius=w.radius),_.visible=w!==null}const d=f.joints["index-finger-tip"],h=f.joints["thumb-tip"],m=d.position.distanceTo(h.position),g=.02,x=.005;f.inputState.pinching&&m>g+x?(f.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!f.inputState.pinching&&m<=g-x&&(f.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else c!==null&&e.gripSpace&&(s=t.getPose(e.gripSpace,i),s!==null&&(c.matrix.fromArray(s.transform.matrix),c.matrix.decompose(c.position,c.rotation,c.scale),s.linearVelocity?(c.hasLinearVelocity=!0,c.linearVelocity.copy(s.linearVelocity)):c.hasLinearVelocity=!1,s.angularVelocity?(c.hasAngularVelocity=!0,c.angularVelocity.copy(s.angularVelocity)):c.hasAngularVelocity=!1));l!==null&&(r=t.getPose(e.targetRaySpace,i),r===null&&s!==null&&(r=s),r!==null&&(l.matrix.fromArray(r.transform.matrix),l.matrix.decompose(l.position,l.rotation,l.scale),r.linearVelocity?(l.hasLinearVelocity=!0,l.linearVelocity.copy(r.linearVelocity)):l.hasLinearVelocity=!1,r.angularVelocity?(l.hasAngularVelocity=!0,l.angularVelocity.copy(r.angularVelocity)):l.hasAngularVelocity=!1,this.dispatchEvent(eD)))}return l!==null&&(l.visible=r!==null),c!==null&&(c.visible=s!==null),f!==null&&(f.visible=o!==null),this}}class FM extends un{constructor(e,t,i,r,s,o,l,c,f,d){if(d=d!==void 0?d:Ys,d!==Ys&&d!==Xo)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");i===void 0&&d===Ys&&(i=js),i===void 0&&d===Xo&&(i=Go),super(null,r,s,o,l,c,d,i,f),this.isDepthTexture=!0,this.image={width:e,height:t},this.magFilter=l!==void 0?l:ln,this.minFilter=c!==void 0?c:ln,this.flipY=!1,this.generateMipmaps=!1}}class tD extends Ar{constructor(e,t){super();const i=this;let r=null,s=1,o=null,l="local-floor",c=null,f=null,d=null,h=null,m=null,g=null;const x=t.getContextAttributes();let y=null,w=null;const _=[],S=[],E=new Bt;E.layers.enable(1),E.viewport=new wt;const T=new Bt;T.layers.enable(2),T.viewport=new wt;const C=[E,T],P=new OM;P.layers.enable(1),P.layers.enable(2);let I=null,A=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(B){let F=_[B];return F===void 0&&(F=new wv,_[B]=F),F.getTargetRaySpace()},this.getControllerGrip=function(B){let F=_[B];return F===void 0&&(F=new wv,_[B]=F),F.getGripSpace()},this.getHand=function(B){let F=_[B];return F===void 0&&(F=new wv,_[B]=F),F.getHandSpace()};function L(B){const F=S.indexOf(B.inputSource);if(F===-1)return;const $=_[F];$!==void 0&&$.dispatchEvent({type:B.type,data:B.inputSource})}function z(){r.removeEventListener("select",L),r.removeEventListener("selectstart",L),r.removeEventListener("selectend",L),r.removeEventListener("squeeze",L),r.removeEventListener("squeezestart",L),r.removeEventListener("squeezeend",L),r.removeEventListener("end",z),r.removeEventListener("inputsourceschange",j);for(let B=0;B<_.length;B++){const F=S[B];F!==null&&(S[B]=null,_[B].disconnect(F))}I=null,A=null,e.setRenderTarget(y),m=null,h=null,d=null,r=null,w=null,k.stop(),i.isPresenting=!1,i.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(B){s=B,i.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(B){l=B,i.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return c||o},this.setReferenceSpace=function(B){c=B},this.getBaseLayer=function(){return h!==null?h:m},this.getBinding=function(){return d},this.getFrame=function(){return g},this.getSession=function(){return r},this.setSession=async function(B){if(r=B,r!==null){if(y=e.getRenderTarget(),r.addEventListener("select",L),r.addEventListener("selectstart",L),r.addEventListener("selectend",L),r.addEventListener("squeeze",L),r.addEventListener("squeezestart",L),r.addEventListener("squeezeend",L),r.addEventListener("end",z),r.addEventListener("inputsourceschange",j),x.xrCompatible!==!0&&await t.makeXRCompatible(),r.renderState.layers===void 0||e.capabilities.isWebGL2===!1){const F={antialias:r.renderState.layers===void 0?x.antialias:!0,alpha:x.alpha,depth:x.depth,stencil:x.stencil,framebufferScaleFactor:s};m=new XRWebGLLayer(r,t,F),r.updateRenderState({baseLayer:m}),w=new Bi(m.framebufferWidth,m.framebufferHeight,{format:Fi,type:Xs,encoding:e.outputEncoding,stencilBuffer:x.stencil})}else{let F=null,$=null,J=null;x.depth&&(J=x.stencil?35056:33190,F=x.stencil?Xo:Ys,$=x.stencil?Go:js);const me={colorFormat:32856,depthFormat:J,scaleFactor:s};d=new XRWebGLBinding(r,t),h=d.createProjectionLayer(me),r.updateRenderState({layers:[h]}),w=new Bi(h.textureWidth,h.textureHeight,{format:Fi,type:Xs,depthTexture:new FM(h.textureWidth,h.textureHeight,$,void 0,void 0,void 0,void 0,void 0,void 0,F),stencilBuffer:x.stencil,encoding:e.outputEncoding,samples:x.antialias?4:0});const Me=e.properties.get(w);Me.__ignoreDepthValues=h.ignoreDepthValues}w.isXRRenderTarget=!0,this.setFoveation(1),c=null,o=await r.requestReferenceSpace(l),k.setContext(r),k.start(),i.isPresenting=!0,i.dispatchEvent({type:"sessionstart"})}};function j(B){for(let F=0;F<B.removed.length;F++){const $=B.removed[F],J=S.indexOf($);J>=0&&(S[J]=null,_[J].dispatchEvent({type:"disconnected",data:$}))}for(let F=0;F<B.added.length;F++){const $=B.added[F];let J=S.indexOf($);if(J===-1){for(let Me=0;Me<_.length;Me++)if(Me>=S.length){S.push($),J=Me;break}else if(S[Me]===null){S[Me]=$,J=Me;break}if(J===-1)break}const me=_[J];me&&me.dispatchEvent({type:"connected",data:$})}}const ue=new R,Z=new R;function G(B,F,$){ue.setFromMatrixPosition(F.matrixWorld),Z.setFromMatrixPosition($.matrixWorld);const J=ue.distanceTo(Z),me=F.projectionMatrix.elements,Me=$.projectionMatrix.elements,Ve=me[14]/(me[10]-1),re=me[14]/(me[10]+1),Xe=(me[9]+1)/me[5],je=(me[9]-1)/me[5],Je=(me[8]-1)/me[0],be=(Me[8]+1)/Me[0],Qe=Ve*Je,he=Ve*be,oe=J/(-Je+be),xe=oe*-Je;F.matrixWorld.decompose(B.position,B.quaternion,B.scale),B.translateX(xe),B.translateZ(oe),B.matrixWorld.compose(B.position,B.quaternion,B.scale),B.matrixWorldInverse.copy(B.matrixWorld).invert();const Ue=Ve+oe,Ae=re+oe,$e=Qe-xe,Ye=he+(J-xe),Ge=Xe*re/Ae*Ue,vt=je*re/Ae*Ue;B.projectionMatrix.makePerspective($e,Ye,Ge,vt,Ue,Ae)}function ie(B,F){F===null?B.matrixWorld.copy(B.matrix):B.matrixWorld.multiplyMatrices(F.matrixWorld,B.matrix),B.matrixWorldInverse.copy(B.matrixWorld).invert()}this.updateCamera=function(B){if(r===null)return;P.near=T.near=E.near=B.near,P.far=T.far=E.far=B.far,(I!==P.near||A!==P.far)&&(r.updateRenderState({depthNear:P.near,depthFar:P.far}),I=P.near,A=P.far);const F=B.parent,$=P.cameras;ie(P,F);for(let me=0;me<$.length;me++)ie($[me],F);P.matrixWorld.decompose(P.position,P.quaternion,P.scale),B.matrix.copy(P.matrix),B.matrix.decompose(B.position,B.quaternion,B.scale);const J=B.children;for(let me=0,Me=J.length;me<Me;me++)J[me].updateMatrixWorld(!0);$.length===2?G(P,E,T):P.projectionMatrix.copy(E.projectionMatrix)},this.getCamera=function(){return P},this.getFoveation=function(){if(h!==null)return h.fixedFoveation;if(m!==null)return m.fixedFoveation},this.setFoveation=function(B){h!==null&&(h.fixedFoveation=B),m!==null&&m.fixedFoveation!==void 0&&(m.fixedFoveation=B)};let ee=null;function pe(B,F){if(f=F.getViewerPose(c||o),g=F,f!==null){const $=f.views;m!==null&&(e.setRenderTargetFramebuffer(w,m.framebuffer),e.setRenderTarget(w));let J=!1;$.length!==P.cameras.length&&(P.cameras.length=0,J=!0);for(let me=0;me<$.length;me++){const Me=$[me];let Ve=null;if(m!==null)Ve=m.getViewport(Me);else{const Xe=d.getViewSubImage(h,Me);Ve=Xe.viewport,me===0&&(e.setRenderTargetTextures(w,Xe.colorTexture,h.ignoreDepthValues?void 0:Xe.depthStencilTexture),e.setRenderTarget(w))}let re=C[me];re===void 0&&(re=new Bt,re.layers.enable(me),re.viewport=new wt,C[me]=re),re.matrix.fromArray(Me.transform.matrix),re.projectionMatrix.fromArray(Me.projectionMatrix),re.viewport.set(Ve.x,Ve.y,Ve.width,Ve.height),me===0&&P.matrix.copy(re.matrix),J===!0&&P.cameras.push(re)}}for(let $=0;$<_.length;$++){const J=S[$],me=_[$];J!==null&&me!==void 0&&me.update(J,F,c||o)}ee&&ee(B,F),g=null}const k=new cM;k.setAnimationLoop(pe),this.setAnimationLoop=function(B){ee=B},this.dispose=function(){}}}function nD(n,e){function t(y,w){y.fogColor.value.copy(w.color),w.isFog?(y.fogNear.value=w.near,y.fogFar.value=w.far):w.isFogExp2&&(y.fogDensity.value=w.density)}function i(y,w,_,S,E){w.isMeshBasicMaterial||w.isMeshLambertMaterial?r(y,w):w.isMeshToonMaterial?(r(y,w),d(y,w)):w.isMeshPhongMaterial?(r(y,w),f(y,w)):w.isMeshStandardMaterial?(r(y,w),h(y,w),w.isMeshPhysicalMaterial&&m(y,w,E)):w.isMeshMatcapMaterial?(r(y,w),g(y,w)):w.isMeshDepthMaterial?r(y,w):w.isMeshDistanceMaterial?(r(y,w),x(y,w)):w.isMeshNormalMaterial?r(y,w):w.isLineBasicMaterial?(s(y,w),w.isLineDashedMaterial&&o(y,w)):w.isPointsMaterial?l(y,w,_,S):w.isSpriteMaterial?c(y,w):w.isShadowMaterial?(y.color.value.copy(w.color),y.opacity.value=w.opacity):w.isShaderMaterial&&(w.uniformsNeedUpdate=!1)}function r(y,w){y.opacity.value=w.opacity,w.color&&y.diffuse.value.copy(w.color),w.emissive&&y.emissive.value.copy(w.emissive).multiplyScalar(w.emissiveIntensity),w.map&&(y.map.value=w.map),w.alphaMap&&(y.alphaMap.value=w.alphaMap),w.bumpMap&&(y.bumpMap.value=w.bumpMap,y.bumpScale.value=w.bumpScale,w.side===Si&&(y.bumpScale.value*=-1)),w.displacementMap&&(y.displacementMap.value=w.displacementMap,y.displacementScale.value=w.displacementScale,y.displacementBias.value=w.displacementBias),w.emissiveMap&&(y.emissiveMap.value=w.emissiveMap),w.normalMap&&(y.normalMap.value=w.normalMap,y.normalScale.value.copy(w.normalScale),w.side===Si&&y.normalScale.value.negate()),w.specularMap&&(y.specularMap.value=w.specularMap),w.alphaTest>0&&(y.alphaTest.value=w.alphaTest);const _=e.get(w).envMap;if(_&&(y.envMap.value=_,y.flipEnvMap.value=_.isCubeTexture&&_.isRenderTargetTexture===!1?-1:1,y.reflectivity.value=w.reflectivity,y.ior.value=w.ior,y.refractionRatio.value=w.refractionRatio),w.lightMap){y.lightMap.value=w.lightMap;const T=n.physicallyCorrectLights!==!0?Math.PI:1;y.lightMapIntensity.value=w.lightMapIntensity*T}w.aoMap&&(y.aoMap.value=w.aoMap,y.aoMapIntensity.value=w.aoMapIntensity);let S;w.map?S=w.map:w.specularMap?S=w.specularMap:w.displacementMap?S=w.displacementMap:w.normalMap?S=w.normalMap:w.bumpMap?S=w.bumpMap:w.roughnessMap?S=w.roughnessMap:w.metalnessMap?S=w.metalnessMap:w.alphaMap?S=w.alphaMap:w.emissiveMap?S=w.emissiveMap:w.clearcoatMap?S=w.clearcoatMap:w.clearcoatNormalMap?S=w.clearcoatNormalMap:w.clearcoatRoughnessMap?S=w.clearcoatRoughnessMap:w.iridescenceMap?S=w.iridescenceMap:w.iridescenceThicknessMap?S=w.iridescenceThicknessMap:w.specularIntensityMap?S=w.specularIntensityMap:w.specularColorMap?S=w.specularColorMap:w.transmissionMap?S=w.transmissionMap:w.thicknessMap?S=w.thicknessMap:w.sheenColorMap?S=w.sheenColorMap:w.sheenRoughnessMap&&(S=w.sheenRoughnessMap),S!==void 0&&(S.isWebGLRenderTarget&&(S=S.texture),S.matrixAutoUpdate===!0&&S.updateMatrix(),y.uvTransform.value.copy(S.matrix));let E;w.aoMap?E=w.aoMap:w.lightMap&&(E=w.lightMap),E!==void 0&&(E.isWebGLRenderTarget&&(E=E.texture),E.matrixAutoUpdate===!0&&E.updateMatrix(),y.uv2Transform.value.copy(E.matrix))}function s(y,w){y.diffuse.value.copy(w.color),y.opacity.value=w.opacity}function o(y,w){y.dashSize.value=w.dashSize,y.totalSize.value=w.dashSize+w.gapSize,y.scale.value=w.scale}function l(y,w,_,S){y.diffuse.value.copy(w.color),y.opacity.value=w.opacity,y.size.value=w.size*_,y.scale.value=S*.5,w.map&&(y.map.value=w.map),w.alphaMap&&(y.alphaMap.value=w.alphaMap),w.alphaTest>0&&(y.alphaTest.value=w.alphaTest);let E;w.map?E=w.map:w.alphaMap&&(E=w.alphaMap),E!==void 0&&(E.matrixAutoUpdate===!0&&E.updateMatrix(),y.uvTransform.value.copy(E.matrix))}function c(y,w){y.diffuse.value.copy(w.color),y.opacity.value=w.opacity,y.rotation.value=w.rotation,w.map&&(y.map.value=w.map),w.alphaMap&&(y.alphaMap.value=w.alphaMap),w.alphaTest>0&&(y.alphaTest.value=w.alphaTest);let _;w.map?_=w.map:w.alphaMap&&(_=w.alphaMap),_!==void 0&&(_.matrixAutoUpdate===!0&&_.updateMatrix(),y.uvTransform.value.copy(_.matrix))}function f(y,w){y.specular.value.copy(w.specular),y.shininess.value=Math.max(w.shininess,1e-4)}function d(y,w){w.gradientMap&&(y.gradientMap.value=w.gradientMap)}function h(y,w){y.roughness.value=w.roughness,y.metalness.value=w.metalness,w.roughnessMap&&(y.roughnessMap.value=w.roughnessMap),w.metalnessMap&&(y.metalnessMap.value=w.metalnessMap),e.get(w).envMap&&(y.envMapIntensity.value=w.envMapIntensity)}function m(y,w,_){y.ior.value=w.ior,w.sheen>0&&(y.sheenColor.value.copy(w.sheenColor).multiplyScalar(w.sheen),y.sheenRoughness.value=w.sheenRoughness,w.sheenColorMap&&(y.sheenColorMap.value=w.sheenColorMap),w.sheenRoughnessMap&&(y.sheenRoughnessMap.value=w.sheenRoughnessMap)),w.clearcoat>0&&(y.clearcoat.value=w.clearcoat,y.clearcoatRoughness.value=w.clearcoatRoughness,w.clearcoatMap&&(y.clearcoatMap.value=w.clearcoatMap),w.clearcoatRoughnessMap&&(y.clearcoatRoughnessMap.value=w.clearcoatRoughnessMap),w.clearcoatNormalMap&&(y.clearcoatNormalScale.value.copy(w.clearcoatNormalScale),y.clearcoatNormalMap.value=w.clearcoatNormalMap,w.side===Si&&y.clearcoatNormalScale.value.negate())),w.iridescence>0&&(y.iridescence.value=w.iridescence,y.iridescenceIOR.value=w.iridescenceIOR,y.iridescenceThicknessMinimum.value=w.iridescenceThicknessRange[0],y.iridescenceThicknessMaximum.value=w.iridescenceThicknessRange[1],w.iridescenceMap&&(y.iridescenceMap.value=w.iridescenceMap),w.iridescenceThicknessMap&&(y.iridescenceThicknessMap.value=w.iridescenceThicknessMap)),w.transmission>0&&(y.transmission.value=w.transmission,y.transmissionSamplerMap.value=_.texture,y.transmissionSamplerSize.value.set(_.width,_.height),w.transmissionMap&&(y.transmissionMap.value=w.transmissionMap),y.thickness.value=w.thickness,w.thicknessMap&&(y.thicknessMap.value=w.thicknessMap),y.attenuationDistance.value=w.attenuationDistance,y.attenuationColor.value.copy(w.attenuationColor)),y.specularIntensity.value=w.specularIntensity,y.specularColor.value.copy(w.specularColor),w.specularIntensityMap&&(y.specularIntensityMap.value=w.specularIntensityMap),w.specularColorMap&&(y.specularColorMap.value=w.specularColorMap)}function g(y,w){w.matcap&&(y.matcap.value=w.matcap)}function x(y,w){y.referencePosition.value.copy(w.referencePosition),y.nearDistance.value=w.nearDistance,y.farDistance.value=w.farDistance}return{refreshFogUniforms:t,refreshMaterialUniforms:i}}function iD(n,e,t,i){let r={},s={},o=[];const l=t.isWebGL2?n.getParameter(35375):0;function c(S,E){const T=E.program;i.uniformBlockBinding(S,T)}function f(S,E){let T=r[S.id];T===void 0&&(x(S),T=d(S),r[S.id]=T,S.addEventListener("dispose",w));const C=E.program;i.updateUBOMapping(S,C);const P=e.render.frame;s[S.id]!==P&&(m(S),s[S.id]=P)}function d(S){const E=h();S.__bindingPointIndex=E;const T=n.createBuffer(),C=S.__size,P=S.usage;return n.bindBuffer(35345,T),n.bufferData(35345,C,P),n.bindBuffer(35345,null),n.bindBufferBase(35345,E,T),T}function h(){for(let S=0;S<l;S++)if(o.indexOf(S)===-1)return o.push(S),S;return console.error("THREE.WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function m(S){const E=r[S.id],T=S.uniforms,C=S.__cache;n.bindBuffer(35345,E);for(let P=0,I=T.length;P<I;P++){const A=T[P];if(g(A,P,C)===!0){const L=A.value,z=A.__offset;typeof L=="number"?(A.__data[0]=L,n.bufferSubData(35345,z,A.__data)):(A.value.isMatrix3?(A.__data[0]=A.value.elements[0],A.__data[1]=A.value.elements[1],A.__data[2]=A.value.elements[2],A.__data[3]=A.value.elements[0],A.__data[4]=A.value.elements[3],A.__data[5]=A.value.elements[4],A.__data[6]=A.value.elements[5],A.__data[7]=A.value.elements[0],A.__data[8]=A.value.elements[6],A.__data[9]=A.value.elements[7],A.__data[10]=A.value.elements[8],A.__data[11]=A.value.elements[0]):L.toArray(A.__data),n.bufferSubData(35345,z,A.__data))}}n.bindBuffer(35345,null)}function g(S,E,T){const C=S.value;if(T[E]===void 0)return typeof C=="number"?T[E]=C:T[E]=C.clone(),!0;if(typeof C=="number"){if(T[E]!==C)return T[E]=C,!0}else{const P=T[E];if(P.equals(C)===!1)return P.copy(C),!0}return!1}function x(S){const E=S.uniforms;let T=0;const C=16;let P=0;for(let I=0,A=E.length;I<A;I++){const L=E[I],z=y(L);if(L.__data=new Float32Array(z.storage/Float32Array.BYTES_PER_ELEMENT),L.__offset=T,I>0){P=T%C;const j=C-P;P!==0&&j-z.boundary<0&&(T+=C-P,L.__offset=T)}T+=z.storage}return P=T%C,P>0&&(T+=C-P),S.__size=T,S.__cache={},this}function y(S){const E=S.value,T={boundary:0,storage:0};return typeof E=="number"?(T.boundary=4,T.storage=4):E.isVector2?(T.boundary=8,T.storage=8):E.isVector3||E.isColor?(T.boundary=16,T.storage=12):E.isVector4?(T.boundary=16,T.storage=16):E.isMatrix3?(T.boundary=48,T.storage=48):E.isMatrix4?(T.boundary=64,T.storage=64):E.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",E),T}function w(S){const E=S.target;E.removeEventListener("dispose",w);const T=o.indexOf(E.__bindingPointIndex);o.splice(T,1),n.deleteBuffer(r[E.id]),delete r[E.id],delete s[E.id]}function _(){for(const S in r)n.deleteBuffer(r[S]);o=[],r={},s={}}return{bind:c,update:f,dispose:_}}function rD(){const n=ec("canvas");return n.style.display="block",n}function Sv(n={}){this.isWebGLRenderer=!0;const e=n.canvas!==void 0?n.canvas:rD(),t=n.context!==void 0?n.context:null,i=n.depth!==void 0?n.depth:!0,r=n.stencil!==void 0?n.stencil:!0,s=n.antialias!==void 0?n.antialias:!1,o=n.premultipliedAlpha!==void 0?n.premultipliedAlpha:!0,l=n.preserveDrawingBuffer!==void 0?n.preserveDrawingBuffer:!1,c=n.powerPreference!==void 0?n.powerPreference:"default",f=n.failIfMajorPerformanceCaveat!==void 0?n.failIfMajorPerformanceCaveat:!1;let d;t!==null?d=t.getContextAttributes().alpha:d=n.alpha!==void 0?n.alpha:!1;let h=null,m=null;const g=[],x=[];this.domElement=e,this.debug={checkShaderErrors:!0},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.outputEncoding=ts,this.physicallyCorrectLights=!1,this.toneMapping=cr,this.toneMappingExposure=1,Object.defineProperties(this,{gammaFactor:{get:function(){return console.warn("THREE.WebGLRenderer: .gammaFactor has been removed."),2},set:function(){console.warn("THREE.WebGLRenderer: .gammaFactor has been removed.")}}});const y=this;let w=!1,_=0,S=0,E=null,T=-1,C=null;const P=new wt,I=new wt;let A=null,L=e.width,z=e.height,j=1,ue=null,Z=null;const G=new wt(0,0,L,z),ie=new wt(0,0,L,z);let ee=!1;const pe=new rh;let k=!1,B=!1,F=null;const $=new st,J=new fe,me=new R,Me={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function Ve(){return E===null?j:1}let re=t;function Xe(N,q){for(let ce=0;ce<N.length;ce++){const Y=N[ce],de=e.getContext(Y,q);if(de!==null)return de}return null}try{const N={alpha:!0,depth:i,stencil:r,antialias:s,premultipliedAlpha:o,preserveDrawingBuffer:l,powerPreference:c,failIfMajorPerformanceCaveat:f};if("setAttribute"in e&&e.setAttribute("data-engine",`three.js r${Sd}`),e.addEventListener("webglcontextlost",_e,!1),e.addEventListener("webglcontextrestored",Oe,!1),e.addEventListener("webglcontextcreationerror",ot,!1),re===null){const q=["webgl2","webgl","experimental-webgl"];if(y.isWebGL1Renderer===!0&&q.shift(),re=Xe(q,N),re===null)throw Xe(q)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}re.getShaderPrecisionFormat===void 0&&(re.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}})}catch(N){throw console.error("THREE.WebGLRenderer: "+N.message),N}let je,Je,be,Qe,he,oe,xe,Ue,Ae,$e,Ye,Ge,vt,Et,U,D,te,ve,we,Ce,Ke,se,Be,Ie;function V(){je=new _R(re),Je=new pR(re,je,n),je.init(Je),se=new kM(re,je,Je),be=new KI(re,je,Je),Qe=new MR,he=new BI,oe=new $I(re,je,be,he,Je,se,Qe),xe=new gR(y),Ue=new xR(y),Ae=new dP(re,Je),Be=new dR(re,je,Ae,Je),$e=new wR(re,Ae,Qe,Be),Ye=new AR(re,$e,Ae,Qe),we=new bR(re,Je,oe),D=new mR(he),Ge=new UI(y,xe,Ue,je,Je,Be,D),vt=new nD(y,he),Et=new HI,U=new qI(je,Je),ve=new fR(y,xe,be,Ye,d,o),te=new QI(y,Ye,Je),Ie=new iD(re,Qe,Je,be),Ce=new hR(re,je,Qe,Je),Ke=new SR(re,je,Qe,Je),Qe.programs=Ge.programs,y.capabilities=Je,y.extensions=je,y.properties=he,y.renderLists=Et,y.shadowMap=te,y.state=be,y.info=Qe}V();const K=new tD(y,re);this.xr=K,this.getContext=function(){return re},this.getContextAttributes=function(){return re.getContextAttributes()},this.forceContextLoss=function(){const N=je.get("WEBGL_lose_context");N&&N.loseContext()},this.forceContextRestore=function(){const N=je.get("WEBGL_lose_context");N&&N.restoreContext()},this.getPixelRatio=function(){return j},this.setPixelRatio=function(N){N!==void 0&&(j=N,this.setSize(L,z,!1))},this.getSize=function(N){return N.set(L,z)},this.setSize=function(N,q,ce){if(K.isPresenting){console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.");return}L=N,z=q,e.width=Math.floor(N*j),e.height=Math.floor(q*j),ce!==!1&&(e.style.width=N+"px",e.style.height=q+"px"),this.setViewport(0,0,N,q)},this.getDrawingBufferSize=function(N){return N.set(L*j,z*j).floor()},this.setDrawingBufferSize=function(N,q,ce){L=N,z=q,j=ce,e.width=Math.floor(N*ce),e.height=Math.floor(q*ce),this.setViewport(0,0,N,q)},this.getCurrentViewport=function(N){return N.copy(P)},this.getViewport=function(N){return N.copy(G)},this.setViewport=function(N,q,ce,Y){N.isVector4?G.set(N.x,N.y,N.z,N.w):G.set(N,q,ce,Y),be.viewport(P.copy(G).multiplyScalar(j).floor())},this.getScissor=function(N){return N.copy(ie)},this.setScissor=function(N,q,ce,Y){N.isVector4?ie.set(N.x,N.y,N.z,N.w):ie.set(N,q,ce,Y),be.scissor(I.copy(ie).multiplyScalar(j).floor())},this.getScissorTest=function(){return ee},this.setScissorTest=function(N){be.setScissorTest(ee=N)},this.setOpaqueSort=function(N){ue=N},this.setTransparentSort=function(N){Z=N},this.getClearColor=function(N){return N.copy(ve.getClearColor())},this.setClearColor=function(){ve.setClearColor.apply(ve,arguments)},this.getClearAlpha=function(){return ve.getClearAlpha()},this.setClearAlpha=function(){ve.setClearAlpha.apply(ve,arguments)},this.clear=function(N=!0,q=!0,ce=!0){let Y=0;N&&(Y|=16384),q&&(Y|=256),ce&&(Y|=1024),re.clear(Y)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.dispose=function(){e.removeEventListener("webglcontextlost",_e,!1),e.removeEventListener("webglcontextrestored",Oe,!1),e.removeEventListener("webglcontextcreationerror",ot,!1),Et.dispose(),U.dispose(),he.dispose(),xe.dispose(),Ue.dispose(),Ye.dispose(),Be.dispose(),Ie.dispose(),Ge.dispose(),K.dispose(),K.removeEventListener("sessionstart",yt),K.removeEventListener("sessionend",fn),F&&(F.dispose(),F=null),Vt.stop()};function _e(N){N.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),w=!0}function Oe(){console.log("THREE.WebGLRenderer: Context Restored."),w=!1;const N=Qe.autoReset,q=te.enabled,ce=te.autoUpdate,Y=te.needsUpdate,de=te.type;V(),Qe.autoReset=N,te.enabled=q,te.autoUpdate=ce,te.needsUpdate=Y,te.type=de}function ot(N){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",N.statusMessage)}function W(N){const q=N.target;q.removeEventListener("dispose",W),Le(q)}function Le(N){le(N),he.remove(N)}function le(N){const q=he.get(N).programs;q!==void 0&&(q.forEach(function(ce){Ge.releaseProgram(ce)}),N.isShaderMaterial&&Ge.releaseShaderCache(N))}this.renderBufferDirect=function(N,q,ce,Y,de,qe){q===null&&(q=Me);const et=de.isMesh&&de.matrixWorld.determinant()<0,ut=Ay(N,q,ce,Y,de);be.setMaterial(Y,et);let tt=ce.index;const Tt=ce.attributes.position;if(tt===null){if(Tt===void 0||Tt.count===0)return}else if(tt.count===0)return;let mt=1;Y.wireframe===!0&&(tt=$e.getWireframeAttribute(ce),mt=2),Be.setup(de,Y,ut,ce,tt);let gt,Wt=Ce;tt!==null&&(gt=Ae.get(tt),Wt=Ke,Wt.setIndex(gt));const ps=tt!==null?tt.count:Tt.count,ho=ce.drawRange.start*mt,po=ce.drawRange.count*mt,ci=qe!==null?qe.start*mt:0,pt=qe!==null?qe.count*mt:1/0,zr=Math.max(ho,ci),Gt=Math.min(ps,ho+po,ci+pt)-1,fi=Math.max(0,Gt-zr+1);if(fi!==0){if(de.isMesh)Y.wireframe===!0?(be.setLineWidth(Y.wireframeLinewidth*Ve()),Wt.setMode(1)):Wt.setMode(4);else if(de.isLine){let Xi=Y.linewidth;Xi===void 0&&(Xi=1),be.setLineWidth(Xi*Ve()),de.isLineSegments?Wt.setMode(1):de.isLineLoop?Wt.setMode(2):Wt.setMode(3)}else de.isPoints?Wt.setMode(0):de.isSprite&&Wt.setMode(4);if(de.isInstancedMesh)Wt.renderInstances(zr,fi,de.count);else if(ce.isInstancedBufferGeometry){const Xi=Math.min(ce.instanceCount,ce._maxInstanceCount);Wt.renderInstances(zr,fi,Xi)}else Wt.render(zr,fi)}},this.compile=function(N,q){function ce(Y,de,qe){Y.transparent===!0&&Y.side===Kr?(Y.side=Si,Y.needsUpdate=!0,Vl(Y,de,qe),Y.side=Bo,Y.needsUpdate=!0,Vl(Y,de,qe),Y.side=Kr):Vl(Y,de,qe)}m=U.get(N),m.init(),x.push(m),N.traverseVisible(function(Y){Y.isLight&&Y.layers.test(q.layers)&&(m.pushLight(Y),Y.castShadow&&m.pushShadow(Y))}),m.setupLights(y.physicallyCorrectLights),N.traverse(function(Y){const de=Y.material;if(de)if(Array.isArray(de))for(let qe=0;qe<de.length;qe++){const et=de[qe];ce(et,N,Y)}else ce(de,N,Y)}),x.pop(),m=null};let Te=null;function Ee(N){Te&&Te(N)}function yt(){Vt.stop()}function fn(){Vt.start()}const Vt=new cM;Vt.setAnimationLoop(Ee),typeof self<"u"&&Vt.setContext(self),this.setAnimationLoop=function(N){Te=N,K.setAnimationLoop(N),N===null?Vt.stop():Vt.start()},K.addEventListener("sessionstart",yt),K.addEventListener("sessionend",fn),this.render=function(N,q){if(q!==void 0&&q.isCamera!==!0){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(w===!0)return;N.matrixWorldAutoUpdate===!0&&N.updateMatrixWorld(),q.parent===null&&q.matrixWorldAutoUpdate===!0&&q.updateMatrixWorld(),K.enabled===!0&&K.isPresenting===!0&&(K.cameraAutoUpdate===!0&&K.updateCamera(q),q=K.getCamera()),N.isScene===!0&&N.onBeforeRender(y,N,q,E),m=U.get(N,x.length),m.init(),x.push(m),$.multiplyMatrices(q.projectionMatrix,q.matrixWorldInverse),pe.setFromProjectionMatrix($),B=this.localClippingEnabled,k=D.init(this.clippingPlanes,B,q),h=Et.get(N,g.length),h.init(),g.push(h),vr(N,q,0,y.sortObjects),h.finish(),y.sortObjects===!0&&h.sort(ue,Z),k===!0&&D.beginShadows();const ce=m.state.shadowsArray;if(te.render(ce,N,q),k===!0&&D.endShadows(),this.info.autoReset===!0&&this.info.reset(),ve.render(h,N),m.setupLights(y.physicallyCorrectLights),q.isArrayCamera){const Y=q.cameras;for(let de=0,qe=Y.length;de<qe;de++){const et=Y[de];Ht(h,N,et,et.viewport)}}else Ht(h,N,q);E!==null&&(oe.updateMultisampleRenderTarget(E),oe.updateRenderTargetMipmap(E)),N.isScene===!0&&N.onAfterRender(y,N,q),Be.resetDefaultState(),T=-1,C=null,x.pop(),x.length>0?m=x[x.length-1]:m=null,g.pop(),g.length>0?h=g[g.length-1]:h=null};function vr(N,q,ce,Y){if(N.visible===!1)return;if(N.layers.test(q.layers)){if(N.isGroup)ce=N.renderOrder;else if(N.isLOD)N.autoUpdate===!0&&N.update(q);else if(N.isLight)m.pushLight(N),N.castShadow&&m.pushShadow(N);else if(N.isSprite){if(!N.frustumCulled||pe.intersectsSprite(N)){Y&&me.setFromMatrixPosition(N.matrixWorld).applyMatrix4($);const et=Ye.update(N),ut=N.material;ut.visible&&h.push(N,et,ut,ce,me.z,null)}}else if((N.isMesh||N.isLine||N.isPoints)&&(N.isSkinnedMesh&&N.skeleton.frame!==Qe.render.frame&&(N.skeleton.update(),N.skeleton.frame=Qe.render.frame),!N.frustumCulled||pe.intersectsObject(N))){Y&&me.setFromMatrixPosition(N.matrixWorld).applyMatrix4($);const et=Ye.update(N),ut=N.material;if(Array.isArray(ut)){const tt=et.groups;for(let Tt=0,mt=tt.length;Tt<mt;Tt++){const gt=tt[Tt],Wt=ut[gt.materialIndex];Wt&&Wt.visible&&h.push(N,et,Wt,ce,me.z,gt)}}else ut.visible&&h.push(N,et,ut,ce,me.z,null)}}const qe=N.children;for(let et=0,ut=qe.length;et<ut;et++)vr(qe[et],q,ce,Y)}function Ht(N,q,ce,Y){const de=N.opaque,qe=N.transmissive,et=N.transparent;m.setupLightsView(ce),qe.length>0&&Gi(de,q,ce),Y&&be.viewport(P.copy(Y)),de.length>0&&ti(de,q,ce),qe.length>0&&ti(qe,q,ce),et.length>0&&ti(et,q,ce),be.buffers.depth.setTest(!0),be.buffers.depth.setMask(!0),be.buffers.color.setMask(!0),be.setPolygonOffset(!1)}function Gi(N,q,ce){const Y=Je.isWebGL2;F===null&&(F=new Bi(1,1,{generateMipmaps:!0,type:je.has("EXT_color_buffer_half_float")?rl:Xs,minFilter:Wo,samples:Y&&s===!0?4:0})),y.getDrawingBufferSize(J),Y?F.setSize(J.x,J.y):F.setSize(Nd(J.x),Nd(J.y));const de=y.getRenderTarget();y.setRenderTarget(F),y.clear();const qe=y.toneMapping;y.toneMapping=cr,ti(N,q,ce),y.toneMapping=qe,oe.updateMultisampleRenderTarget(F),oe.updateRenderTargetMipmap(F),y.setRenderTarget(de)}function ti(N,q,ce){const Y=q.isScene===!0?q.overrideMaterial:null;for(let de=0,qe=N.length;de<qe;de++){const et=N[de],ut=et.object,tt=et.geometry,Tt=Y===null?et.material:Y,mt=et.group;ut.layers.test(ce.layers)&&Zh(ut,q,ce,tt,Tt,mt)}}function Zh(N,q,ce,Y,de,qe){N.onBeforeRender(y,q,ce,Y,de,qe),N.modelViewMatrix.multiplyMatrices(ce.matrixWorldInverse,N.matrixWorld),N.normalMatrix.getNormalMatrix(N.modelViewMatrix),de.onBeforeRender(y,q,ce,Y,N,qe),de.transparent===!0&&de.side===Kr?(de.side=Si,de.needsUpdate=!0,y.renderBufferDirect(ce,q,Y,de,N,qe),de.side=Bo,de.needsUpdate=!0,y.renderBufferDirect(ce,q,Y,de,N,qe),de.side=Kr):y.renderBufferDirect(ce,q,Y,de,N,qe),N.onAfterRender(y,q,ce,Y,de,qe)}function Vl(N,q,ce){q.isScene!==!0&&(q=Me);const Y=he.get(N),de=m.state.lights,qe=m.state.shadowsArray,et=de.state.version,ut=Ge.getParameters(N,de.state,qe,q,ce),tt=Ge.getProgramCacheKey(ut);let Tt=Y.programs;Y.environment=N.isMeshStandardMaterial?q.environment:null,Y.fog=q.fog,Y.envMap=(N.isMeshStandardMaterial?Ue:xe).get(N.envMap||Y.environment),Tt===void 0&&(N.addEventListener("dispose",W),Tt=new Map,Y.programs=Tt);let mt=Tt.get(tt);if(mt!==void 0){if(Y.currentProgram===mt&&Y.lightsStateVersion===et)return Jh(N,ut),mt}else ut.uniforms=Ge.getUniforms(N),N.onBuild(ce,ut,y),N.onBeforeCompile(ut,y),mt=Ge.acquireProgram(ut,tt),Tt.set(tt,mt),Y.uniforms=ut.uniforms;const gt=Y.uniforms;(!N.isShaderMaterial&&!N.isRawShaderMaterial||N.clipping===!0)&&(gt.clippingPlanes=D.uniform),Jh(N,ut),Y.needsLights=Vc(N),Y.lightsStateVersion=et,Y.needsLights&&(gt.ambientLightColor.value=de.state.ambient,gt.lightProbe.value=de.state.probe,gt.directionalLights.value=de.state.directional,gt.directionalLightShadows.value=de.state.directionalShadow,gt.spotLights.value=de.state.spot,gt.spotLightShadows.value=de.state.spotShadow,gt.rectAreaLights.value=de.state.rectArea,gt.ltc_1.value=de.state.rectAreaLTC1,gt.ltc_2.value=de.state.rectAreaLTC2,gt.pointLights.value=de.state.point,gt.pointLightShadows.value=de.state.pointShadow,gt.hemisphereLights.value=de.state.hemi,gt.directionalShadowMap.value=de.state.directionalShadowMap,gt.directionalShadowMatrix.value=de.state.directionalShadowMatrix,gt.spotShadowMap.value=de.state.spotShadowMap,gt.spotLightMatrix.value=de.state.spotLightMatrix,gt.spotLightMap.value=de.state.spotLightMap,gt.pointShadowMap.value=de.state.pointShadowMap,gt.pointShadowMatrix.value=de.state.pointShadowMatrix);const Wt=mt.getUniforms(),ps=ah.seqWithValue(Wt.seq,gt);return Y.currentProgram=mt,Y.uniformsList=ps,mt}function Jh(N,q){const ce=he.get(N);ce.outputEncoding=q.outputEncoding,ce.instancing=q.instancing,ce.skinning=q.skinning,ce.morphTargets=q.morphTargets,ce.morphNormals=q.morphNormals,ce.morphColors=q.morphColors,ce.morphTargetsCount=q.morphTargetsCount,ce.numClippingPlanes=q.numClippingPlanes,ce.numIntersection=q.numClipIntersection,ce.vertexAlphas=q.vertexAlphas,ce.vertexTangents=q.vertexTangents,ce.toneMapping=q.toneMapping}function Ay(N,q,ce,Y,de){q.isScene!==!0&&(q=Me),oe.resetTextureUnits();const qe=q.fog,et=Y.isMeshStandardMaterial?q.environment:null,ut=E===null?y.outputEncoding:E.isXRRenderTarget===!0?E.texture.encoding:ts,tt=(Y.isMeshStandardMaterial?Ue:xe).get(Y.envMap||et),Tt=Y.vertexColors===!0&&!!ce.attributes.color&&ce.attributes.color.itemSize===4,mt=!!Y.normalMap&&!!ce.attributes.tangent,gt=!!ce.morphAttributes.position,Wt=!!ce.morphAttributes.normal,ps=!!ce.morphAttributes.color,ho=Y.toneMapped?y.toneMapping:cr,po=ce.morphAttributes.position||ce.morphAttributes.normal||ce.morphAttributes.color,ci=po!==void 0?po.length:0,pt=he.get(Y),zr=m.state.lights;if(k===!0&&(B===!0||N!==C)){const Pt=N===C&&Y.id===T;D.setState(Y,N,Pt)}let Gt=!1;Y.version===pt.__version?(pt.needsLights&&pt.lightsStateVersion!==zr.state.version||pt.outputEncoding!==ut||de.isInstancedMesh&&pt.instancing===!1||!de.isInstancedMesh&&pt.instancing===!0||de.isSkinnedMesh&&pt.skinning===!1||!de.isSkinnedMesh&&pt.skinning===!0||pt.envMap!==tt||Y.fog===!0&&pt.fog!==qe||pt.numClippingPlanes!==void 0&&(pt.numClippingPlanes!==D.numPlanes||pt.numIntersection!==D.numIntersection)||pt.vertexAlphas!==Tt||pt.vertexTangents!==mt||pt.morphTargets!==gt||pt.morphNormals!==Wt||pt.morphColors!==ps||pt.toneMapping!==ho||Je.isWebGL2===!0&&pt.morphTargetsCount!==ci)&&(Gt=!0):(Gt=!0,pt.__version=Y.version);let fi=pt.currentProgram;Gt===!0&&(fi=Vl(Y,q,de));let Xi=!1,ji=!1,Yi=!1;const at=fi.getUniforms(),xt=pt.uniforms;if(be.useProgram(fi.program)&&(Xi=!0,ji=!0,Yi=!0),Y.id!==T&&(T=Y.id,ji=!0),Xi||C!==N){if(at.setValue(re,"projectionMatrix",N.projectionMatrix),Je.logarithmicDepthBuffer&&at.setValue(re,"logDepthBufFC",2/(Math.log(N.far+1)/Math.LN2)),C!==N&&(C=N,ji=!0,Yi=!0),Y.isShaderMaterial||Y.isMeshPhongMaterial||Y.isMeshToonMaterial||Y.isMeshStandardMaterial||Y.envMap){const Pt=at.map.cameraPosition;Pt!==void 0&&Pt.setValue(re,me.setFromMatrixPosition(N.matrixWorld))}(Y.isMeshPhongMaterial||Y.isMeshToonMaterial||Y.isMeshLambertMaterial||Y.isMeshBasicMaterial||Y.isMeshStandardMaterial||Y.isShaderMaterial)&&at.setValue(re,"isOrthographic",N.isOrthographicCamera===!0),(Y.isMeshPhongMaterial||Y.isMeshToonMaterial||Y.isMeshLambertMaterial||Y.isMeshBasicMaterial||Y.isMeshStandardMaterial||Y.isShaderMaterial||Y.isShadowMaterial||de.isSkinnedMesh)&&at.setValue(re,"viewMatrix",N.matrixWorldInverse)}if(de.isSkinnedMesh){at.setOptional(re,de,"bindMatrix"),at.setOptional(re,de,"bindMatrixInverse");const Pt=de.skeleton;Pt&&(Je.floatVertexTextures?(Pt.boneTexture===null&&Pt.computeBoneTexture(),at.setValue(re,"boneTexture",Pt.boneTexture,oe),at.setValue(re,"boneTextureSize",Pt.boneTextureSize)):console.warn("THREE.WebGLRenderer: SkinnedMesh can only be used with WebGL 2. With WebGL 1 OES_texture_float and vertex textures support is required."))}const qi=ce.morphAttributes;if((qi.position!==void 0||qi.normal!==void 0||qi.color!==void 0&&Je.isWebGL2===!0)&&we.update(de,ce,Y,fi),(ji||pt.receiveShadow!==de.receiveShadow)&&(pt.receiveShadow=de.receiveShadow,at.setValue(re,"receiveShadow",de.receiveShadow)),Y.isMeshGouraudMaterial&&Y.envMap!==null&&(xt.envMap.value=tt,xt.flipEnvMap.value=tt.isCubeTexture&&tt.isRenderTargetTexture===!1?-1:1),ji&&(at.setValue(re,"toneMappingExposure",y.toneMappingExposure),pt.needsLights&&Qh(xt,Yi),qe&&Y.fog===!0&&vt.refreshFogUniforms(xt,qe),vt.refreshMaterialUniforms(xt,Y,j,z,F),ah.upload(re,pt.uniformsList,xt,oe)),Y.isShaderMaterial&&Y.uniformsNeedUpdate===!0&&(ah.upload(re,pt.uniformsList,xt,oe),Y.uniformsNeedUpdate=!1),Y.isSpriteMaterial&&at.setValue(re,"center",de.center),at.setValue(re,"modelViewMatrix",de.modelViewMatrix),at.setValue(re,"normalMatrix",de.normalMatrix),at.setValue(re,"modelMatrix",de.matrixWorld),Y.isShaderMaterial||Y.isRawShaderMaterial){const Pt=Y.uniformsGroups;for(let Sn=0,ms=Pt.length;Sn<ms;Sn++)if(Je.isWebGL2){const gs=Pt[Sn];Ie.update(gs,fi),Ie.bind(gs,fi)}else console.warn("THREE.WebGLRenderer: Uniform Buffer Objects can only be used with WebGL 2.")}return fi}function Qh(N,q){N.ambientLightColor.needsUpdate=q,N.lightProbe.needsUpdate=q,N.directionalLights.needsUpdate=q,N.directionalLightShadows.needsUpdate=q,N.pointLights.needsUpdate=q,N.pointLightShadows.needsUpdate=q,N.spotLights.needsUpdate=q,N.spotLightShadows.needsUpdate=q,N.rectAreaLights.needsUpdate=q,N.hemisphereLights.needsUpdate=q}function Vc(N){return N.isMeshLambertMaterial||N.isMeshToonMaterial||N.isMeshPhongMaterial||N.isMeshStandardMaterial||N.isShadowMaterial||N.isShaderMaterial&&N.lights===!0}this.getActiveCubeFace=function(){return _},this.getActiveMipmapLevel=function(){return S},this.getRenderTarget=function(){return E},this.setRenderTargetTextures=function(N,q,ce){he.get(N.texture).__webglTexture=q,he.get(N.depthTexture).__webglTexture=ce;const Y=he.get(N);Y.__hasExternalTextures=!0,Y.__hasExternalTextures&&(Y.__autoAllocateDepthBuffer=ce===void 0,Y.__autoAllocateDepthBuffer||je.has("WEBGL_multisampled_render_to_texture")===!0&&(console.warn("THREE.WebGLRenderer: Render-to-texture extension was disabled because an external texture was provided"),Y.__useRenderToTexture=!1))},this.setRenderTargetFramebuffer=function(N,q){const ce=he.get(N);ce.__webglFramebuffer=q,ce.__useDefaultFramebuffer=q===void 0},this.setRenderTarget=function(N,q=0,ce=0){E=N,_=q,S=ce;let Y=!0;if(N){const tt=he.get(N);tt.__useDefaultFramebuffer!==void 0?(be.bindFramebuffer(36160,null),Y=!1):tt.__webglFramebuffer===void 0?oe.setupRenderTarget(N):tt.__hasExternalTextures&&oe.rebindTextures(N,he.get(N.texture).__webglTexture,he.get(N.depthTexture).__webglTexture)}let de=null,qe=!1,et=!1;if(N){const tt=N.texture;(tt.isData3DTexture||tt.isDataArrayTexture)&&(et=!0);const Tt=he.get(N).__webglFramebuffer;N.isWebGLCubeRenderTarget?(de=Tt[q],qe=!0):Je.isWebGL2&&N.samples>0&&oe.useMultisampledRTT(N)===!1?de=he.get(N).__webglMultisampledFramebuffer:de=Tt,P.copy(N.viewport),I.copy(N.scissor),A=N.scissorTest}else P.copy(G).multiplyScalar(j).floor(),I.copy(ie).multiplyScalar(j).floor(),A=ee;if(be.bindFramebuffer(36160,de)&&Je.drawBuffers&&Y&&be.drawBuffers(N,de),be.viewport(P),be.scissor(I),be.setScissorTest(A),qe){const tt=he.get(N.texture);re.framebufferTexture2D(36160,36064,34069+q,tt.__webglTexture,ce)}else if(et){const tt=he.get(N.texture),Tt=q||0;re.framebufferTextureLayer(36160,36064,tt.__webglTexture,ce||0,Tt)}T=-1},this.readRenderTargetPixels=function(N,q,ce,Y,de,qe,et){if(!(N&&N.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let ut=he.get(N).__webglFramebuffer;if(N.isWebGLCubeRenderTarget&&et!==void 0&&(ut=ut[et]),ut){be.bindFramebuffer(36160,ut);try{const tt=N.texture,Tt=tt.format,mt=tt.type;if(Tt!==Fi&&se.convert(Tt)!==re.getParameter(35739)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}const gt=mt===rl&&(je.has("EXT_color_buffer_half_float")||Je.isWebGL2&&je.has("EXT_color_buffer_float"));if(mt!==Xs&&se.convert(mt)!==re.getParameter(35738)&&!(mt===es&&(Je.isWebGL2||je.has("OES_texture_float")||je.has("WEBGL_color_buffer_float")))&&!gt){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}q>=0&&q<=N.width-Y&&ce>=0&&ce<=N.height-de&&re.readPixels(q,ce,Y,de,se.convert(Tt),se.convert(mt),qe)}finally{const tt=E!==null?he.get(E).__webglFramebuffer:null;be.bindFramebuffer(36160,tt)}}},this.copyFramebufferToTexture=function(N,q,ce=0){const Y=Math.pow(2,-ce),de=Math.floor(q.image.width*Y),qe=Math.floor(q.image.height*Y);oe.setTexture2D(q,0),re.copyTexSubImage2D(3553,ce,0,0,N.x,N.y,de,qe),be.unbindTexture()},this.copyTextureToTexture=function(N,q,ce,Y=0){const de=q.image.width,qe=q.image.height,et=se.convert(ce.format),ut=se.convert(ce.type);oe.setTexture2D(ce,0),re.pixelStorei(37440,ce.flipY),re.pixelStorei(37441,ce.premultiplyAlpha),re.pixelStorei(3317,ce.unpackAlignment),q.isDataTexture?re.texSubImage2D(3553,Y,N.x,N.y,de,qe,et,ut,q.image.data):q.isCompressedTexture?re.compressedTexSubImage2D(3553,Y,N.x,N.y,q.mipmaps[0].width,q.mipmaps[0].height,et,q.mipmaps[0].data):re.texSubImage2D(3553,Y,N.x,N.y,et,ut,q.image),Y===0&&ce.generateMipmaps&&re.generateMipmap(3553),be.unbindTexture()},this.copyTextureToTexture3D=function(N,q,ce,Y,de=0){if(y.isWebGL1Renderer){console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.");return}const qe=N.max.x-N.min.x+1,et=N.max.y-N.min.y+1,ut=N.max.z-N.min.z+1,tt=se.convert(Y.format),Tt=se.convert(Y.type);let mt;if(Y.isData3DTexture)oe.setTexture3D(Y,0),mt=32879;else if(Y.isDataArrayTexture)oe.setTexture2DArray(Y,0),mt=35866;else{console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");return}re.pixelStorei(37440,Y.flipY),re.pixelStorei(37441,Y.premultiplyAlpha),re.pixelStorei(3317,Y.unpackAlignment);const gt=re.getParameter(3314),Wt=re.getParameter(32878),ps=re.getParameter(3316),ho=re.getParameter(3315),po=re.getParameter(32877),ci=ce.isCompressedTexture?ce.mipmaps[0]:ce.image;re.pixelStorei(3314,ci.width),re.pixelStorei(32878,ci.height),re.pixelStorei(3316,N.min.x),re.pixelStorei(3315,N.min.y),re.pixelStorei(32877,N.min.z),ce.isDataTexture||ce.isData3DTexture?re.texSubImage3D(mt,de,q.x,q.y,q.z,qe,et,ut,tt,Tt,ci.data):ce.isCompressedTexture?(console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: untested support for compressed srcTexture."),re.compressedTexSubImage3D(mt,de,q.x,q.y,q.z,qe,et,ut,tt,ci.data)):re.texSubImage3D(mt,de,q.x,q.y,q.z,qe,et,ut,tt,Tt,ci),re.pixelStorei(3314,gt),re.pixelStorei(32878,Wt),re.pixelStorei(3316,ps),re.pixelStorei(3315,ho),re.pixelStorei(32877,po),de===0&&Y.generateMipmaps&&re.generateMipmap(mt),be.unbindTexture()},this.initTexture=function(N){N.isCubeTexture?oe.setTextureCube(N,0):N.isData3DTexture?oe.setTexture3D(N,0):N.isDataArrayTexture?oe.setTexture2DArray(N,0):oe.setTexture2D(N,0),be.unbindTexture()},this.resetState=function(){_=0,S=0,E=null,be.reset(),Be.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}class UM extends Sv{}UM.prototype.isWebGL1Renderer=!0;class lh{constructor(e,t=25e-5){this.isFogExp2=!0,this.name="",this.color=new De(e),this.density=t}clone(){return new lh(this.color,this.density)}toJSON(){return{type:"FogExp2",color:this.color.getHex(),density:this.density}}}class uh{constructor(e,t=1,i=1e3){this.isFog=!0,this.name="",this.color=new De(e),this.near=t,this.far=i}clone(){return new uh(this.color,this.near,this.far)}toJSON(){return{type:"Fog",color:this.color.getHex(),near:this.near,far:this.far}}}class Mv extends Mt{constructor(){super(),this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,t){return super.copy(e,t),e.background!==null&&(this.background=e.background.clone()),e.environment!==null&&(this.environment=e.environment.clone()),e.fog!==null&&(this.fog=e.fog.clone()),e.overrideMaterial!==null&&(this.overrideMaterial=e.overrideMaterial.clone()),this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){const t=super.toJSON(e);return this.fog!==null&&(t.object.fog=this.fog.toJSON()),t}get autoUpdate(){return console.warn("THREE.Scene: autoUpdate was renamed to matrixWorldAutoUpdate in r144."),this.matrixWorldAutoUpdate}set autoUpdate(e){console.warn("THREE.Scene: autoUpdate was renamed to matrixWorldAutoUpdate in r144."),this.matrixWorldAutoUpdate=e}}class ch{constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=e!==void 0?e.length/t:0,this.usage=Qu,this.updateRange={offset:0,count:-1},this.version=0,this.uuid=Mi()}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}copy(e){return this.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.usage=e.usage,this}copyAt(e,t,i){e*=this.stride,i*=t.stride;for(let r=0,s=this.stride;r<s;r++)this.array[e+r]=t.array[i+r];return this}set(e,t=0){return this.array.set(e,t),this}clone(e){e.arrayBuffers===void 0&&(e.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=Mi()),e.arrayBuffers[this.array.buffer._uuid]===void 0&&(e.arrayBuffers[this.array.buffer._uuid]=this.array.slice(0).buffer);const t=new this.array.constructor(e.arrayBuffers[this.array.buffer._uuid]),i=new this.constructor(t,this.stride);return i.setUsage(this.usage),i}onUpload(e){return this.onUploadCallback=e,this}toJSON(e){return e.arrayBuffers===void 0&&(e.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=Mi()),e.arrayBuffers[this.array.buffer._uuid]===void 0&&(e.arrayBuffers[this.array.buffer._uuid]=Array.from(new Uint32Array(this.array.buffer))),{uuid:this.uuid,buffer:this.array.buffer._uuid,type:this.array.constructor.name,stride:this.stride}}}const $n=new R;class bi{constructor(e,t,i,r=!1){this.isInterleavedBufferAttribute=!0,this.name="",this.data=e,this.itemSize=t,this.offset=i,this.normalized=r===!0}get count(){return this.data.count}get array(){return this.data.array}set needsUpdate(e){this.data.needsUpdate=e}applyMatrix4(e){for(let t=0,i=this.data.count;t<i;t++)$n.fromBufferAttribute(this,t),$n.applyMatrix4(e),this.setXYZ(t,$n.x,$n.y,$n.z);return this}applyNormalMatrix(e){for(let t=0,i=this.count;t<i;t++)$n.fromBufferAttribute(this,t),$n.applyNormalMatrix(e),this.setXYZ(t,$n.x,$n.y,$n.z);return this}transformDirection(e){for(let t=0,i=this.count;t<i;t++)$n.fromBufferAttribute(this,t),$n.transformDirection(e),this.setXYZ(t,$n.x,$n.y,$n.z);return this}setX(e,t){return this.normalized&&(t=Rt(t,this.array)),this.data.array[e*this.data.stride+this.offset]=t,this}setY(e,t){return this.normalized&&(t=Rt(t,this.array)),this.data.array[e*this.data.stride+this.offset+1]=t,this}setZ(e,t){return this.normalized&&(t=Rt(t,this.array)),this.data.array[e*this.data.stride+this.offset+2]=t,this}setW(e,t){return this.normalized&&(t=Rt(t,this.array)),this.data.array[e*this.data.stride+this.offset+3]=t,this}getX(e){let t=this.data.array[e*this.data.stride+this.offset];return this.normalized&&(t=ns(t,this.array)),t}getY(e){let t=this.data.array[e*this.data.stride+this.offset+1];return this.normalized&&(t=ns(t,this.array)),t}getZ(e){let t=this.data.array[e*this.data.stride+this.offset+2];return this.normalized&&(t=ns(t,this.array)),t}getW(e){let t=this.data.array[e*this.data.stride+this.offset+3];return this.normalized&&(t=ns(t,this.array)),t}setXY(e,t,i){return e=e*this.data.stride+this.offset,this.normalized&&(t=Rt(t,this.array),i=Rt(i,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=i,this}setXYZ(e,t,i,r){return e=e*this.data.stride+this.offset,this.normalized&&(t=Rt(t,this.array),i=Rt(i,this.array),r=Rt(r,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=i,this.data.array[e+2]=r,this}setXYZW(e,t,i,r,s){return e=e*this.data.stride+this.offset,this.normalized&&(t=Rt(t,this.array),i=Rt(i,this.array),r=Rt(r,this.array),s=Rt(s,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=i,this.data.array[e+2]=r,this.data.array[e+3]=s,this}clone(e){if(e===void 0){console.log("THREE.InterleavedBufferAttribute.clone(): Cloning an interleaved buffer attribute will deinterleave buffer data.");const t=[];for(let i=0;i<this.count;i++){const r=i*this.data.stride+this.offset;for(let s=0;s<this.itemSize;s++)t.push(this.data.array[r+s])}return new It(new this.array.constructor(t),this.itemSize,this.normalized)}else return e.interleavedBuffers===void 0&&(e.interleavedBuffers={}),e.interleavedBuffers[this.data.uuid]===void 0&&(e.interleavedBuffers[this.data.uuid]=this.data.clone(e)),new bi(e.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)}toJSON(e){if(e===void 0){console.log("THREE.InterleavedBufferAttribute.toJSON(): Serializing an interleaved buffer attribute will deinterleave buffer data.");const t=[];for(let i=0;i<this.count;i++){const r=i*this.data.stride+this.offset;for(let s=0;s<this.itemSize;s++)t.push(this.data.array[r+s])}return{itemSize:this.itemSize,type:this.array.constructor.name,array:t,normalized:this.normalized}}else return e.interleavedBuffers===void 0&&(e.interleavedBuffers={}),e.interleavedBuffers[this.data.uuid]===void 0&&(e.interleavedBuffers[this.data.uuid]=this.data.toJSON(e)),{isInterleavedBufferAttribute:!0,itemSize:this.itemSize,data:this.data.uuid,offset:this.offset,normalized:this.normalized}}}class Ev extends Pn{constructor(e){super(),this.isSpriteMaterial=!0,this.type="SpriteMaterial",this.color=new De(16777215),this.map=null,this.alphaMap=null,this.rotation=0,this.sizeAttenuation=!0,this.transparent=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.rotation=e.rotation,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this}}let bl;const uc=new R,Al=new R,Cl=new R,Pl=new fe,cc=new fe,BM=new st,fh=new R,fc=new R,dh=new R,VM=new fe,Tv=new fe,HM=new fe;class WM extends Mt{constructor(e){if(super(),this.isSprite=!0,this.type="Sprite",bl===void 0){bl=new lt;const t=new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),i=new ch(t,5);bl.setIndex([0,1,2,0,2,3]),bl.setAttribute("position",new bi(i,3,0,!1)),bl.setAttribute("uv",new bi(i,2,3,!1))}this.geometry=bl,this.material=e!==void 0?e:new Ev,this.center=new fe(.5,.5)}raycast(e,t){e.camera===null&&console.error('THREE.Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),Al.setFromMatrixScale(this.matrixWorld),BM.copy(e.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(e.camera.matrixWorldInverse,this.matrixWorld),Cl.setFromMatrixPosition(this.modelViewMatrix),e.camera.isPerspectiveCamera&&this.material.sizeAttenuation===!1&&Al.multiplyScalar(-Cl.z);const i=this.material.rotation;let r,s;i!==0&&(s=Math.cos(i),r=Math.sin(i));const o=this.center;hh(fh.set(-.5,-.5,0),Cl,o,Al,r,s),hh(fc.set(.5,-.5,0),Cl,o,Al,r,s),hh(dh.set(.5,.5,0),Cl,o,Al,r,s),VM.set(0,0),Tv.set(1,0),HM.set(1,1);let l=e.ray.intersectTriangle(fh,fc,dh,!1,uc);if(l===null&&(hh(fc.set(-.5,.5,0),Cl,o,Al,r,s),Tv.set(0,1),l=e.ray.intersectTriangle(fh,dh,fc,!1,uc),l===null))return;const c=e.ray.origin.distanceTo(uc);c<e.near||c>e.far||t.push({distance:c,point:uc.clone(),uv:Vi.getUV(uc,fh,fc,dh,VM,Tv,HM,new fe),face:null,object:this})}copy(e,t){return super.copy(e,t),e.center!==void 0&&this.center.copy(e.center),this.material=e.material,this}}function hh(n,e,t,i,r,s){Pl.subVectors(n,t).addScalar(.5).multiply(i),r!==void 0?(cc.x=s*Pl.x-r*Pl.y,cc.y=r*Pl.x+s*Pl.y):cc.copy(Pl),n.copy(e),n.x+=cc.x,n.y+=cc.y,n.applyMatrix4(BM)}const ph=new R,GM=new R;class XM extends Mt{constructor(){super(),this._currentLevel=0,this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]},isLOD:{value:!0}}),this.autoUpdate=!0}copy(e){super.copy(e,!1);const t=e.levels;for(let i=0,r=t.length;i<r;i++){const s=t[i];this.addLevel(s.object.clone(),s.distance)}return this.autoUpdate=e.autoUpdate,this}addLevel(e,t=0){t=Math.abs(t);const i=this.levels;let r;for(r=0;r<i.length&&!(t<i[r].distance);r++);return i.splice(r,0,{distance:t,object:e}),this.add(e),this}getCurrentLevel(){return this._currentLevel}getObjectForDistance(e){const t=this.levels;if(t.length>0){let i,r;for(i=1,r=t.length;i<r&&!(e<t[i].distance);i++);return t[i-1].object}return null}raycast(e,t){if(this.levels.length>0){ph.setFromMatrixPosition(this.matrixWorld);const r=e.ray.origin.distanceTo(ph);this.getObjectForDistance(r).raycast(e,t)}}update(e){const t=this.levels;if(t.length>1){ph.setFromMatrixPosition(e.matrixWorld),GM.setFromMatrixPosition(this.matrixWorld);const i=ph.distanceTo(GM)/e.zoom;t[0].object.visible=!0;let r,s;for(r=1,s=t.length;r<s&&i>=t[r].distance;r++)t[r-1].object.visible=!1,t[r].object.visible=!0;for(this._currentLevel=r-1;r<s;r++)t[r].object.visible=!1}}toJSON(e){const t=super.toJSON(e);this.autoUpdate===!1&&(t.object.autoUpdate=!1),t.object.levels=[];const i=this.levels;for(let r=0,s=i.length;r<s;r++){const o=i[r];t.object.levels.push({object:o.object.uuid,distance:o.distance})}return t}}const jM=new R,YM=new wt,qM=new wt,sD=new R,ZM=new st;class JM extends wn{constructor(e,t){super(e,t),this.isSkinnedMesh=!0,this.type="SkinnedMesh",this.bindMode="attached",this.bindMatrix=new st,this.bindMatrixInverse=new st}copy(e,t){return super.copy(e,t),this.bindMode=e.bindMode,this.bindMatrix.copy(e.bindMatrix),this.bindMatrixInverse.copy(e.bindMatrixInverse),this.skeleton=e.skeleton,this}bind(e,t){this.skeleton=e,t===void 0&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),t=this.matrixWorld),this.bindMatrix.copy(t),this.bindMatrixInverse.copy(t).invert()}pose(){this.skeleton.pose()}normalizeSkinWeights(){const e=new wt,t=this.geometry.attributes.skinWeight;for(let i=0,r=t.count;i<r;i++){e.fromBufferAttribute(t,i);const s=1/e.manhattanLength();s!==1/0?e.multiplyScalar(s):e.set(1,0,0,0),t.setXYZW(i,e.x,e.y,e.z,e.w)}}updateMatrixWorld(e){super.updateMatrixWorld(e),this.bindMode==="attached"?this.bindMatrixInverse.copy(this.matrixWorld).invert():this.bindMode==="detached"?this.bindMatrixInverse.copy(this.bindMatrix).invert():console.warn("THREE.SkinnedMesh: Unrecognized bindMode: "+this.bindMode)}boneTransform(e,t){const i=this.skeleton,r=this.geometry;YM.fromBufferAttribute(r.attributes.skinIndex,e),qM.fromBufferAttribute(r.attributes.skinWeight,e),jM.copy(t).applyMatrix4(this.bindMatrix),t.set(0,0,0);for(let s=0;s<4;s++){const o=qM.getComponent(s);if(o!==0){const l=YM.getComponent(s);ZM.multiplyMatrices(i.bones[l].matrixWorld,i.boneInverses[l]),t.addScaledVector(sD.copy(jM).applyMatrix4(ZM),o)}}return t.applyMatrix4(this.bindMatrixInverse)}}class bv extends Mt{constructor(){super(),this.isBone=!0,this.type="Bone"}}class Ll extends un{constructor(e=null,t=1,i=1,r,s,o,l,c,f=ln,d=ln,h,m){super(null,o,l,c,f,d,r,s,h,m),this.isDataTexture=!0,this.image={data:e,width:t,height:i},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}const QM=new st,oD=new st;class mh{constructor(e=[],t=[]){this.uuid=Mi(),this.bones=e.slice(0),this.boneInverses=t,this.boneMatrices=null,this.boneTexture=null,this.boneTextureSize=0,this.frame=-1,this.init()}init(){const e=this.bones,t=this.boneInverses;if(this.boneMatrices=new Float32Array(e.length*16),t.length===0)this.calculateInverses();else if(e.length!==t.length){console.warn("THREE.Skeleton: Number of inverse bone matrices does not match amount of bones."),this.boneInverses=[];for(let i=0,r=this.bones.length;i<r;i++)this.boneInverses.push(new st)}}calculateInverses(){this.boneInverses.length=0;for(let e=0,t=this.bones.length;e<t;e++){const i=new st;this.bones[e]&&i.copy(this.bones[e].matrixWorld).invert(),this.boneInverses.push(i)}}pose(){for(let e=0,t=this.bones.length;e<t;e++){const i=this.bones[e];i&&i.matrixWorld.copy(this.boneInverses[e]).invert()}for(let e=0,t=this.bones.length;e<t;e++){const i=this.bones[e];i&&(i.parent&&i.parent.isBone?(i.matrix.copy(i.parent.matrixWorld).invert(),i.matrix.multiply(i.matrixWorld)):i.matrix.copy(i.matrixWorld),i.matrix.decompose(i.position,i.quaternion,i.scale))}}update(){const e=this.bones,t=this.boneInverses,i=this.boneMatrices,r=this.boneTexture;for(let s=0,o=e.length;s<o;s++){const l=e[s]?e[s].matrixWorld:oD;QM.multiplyMatrices(l,t[s]),QM.toArray(i,s*16)}r!==null&&(r.needsUpdate=!0)}clone(){return new mh(this.bones,this.boneInverses)}computeBoneTexture(){let e=Math.sqrt(this.bones.length*4);e=YS(e),e=Math.max(e,4);const t=new Float32Array(e*e*4);t.set(this.boneMatrices);const i=new Ll(t,e,e,Fi,es);return i.needsUpdate=!0,this.boneMatrices=t,this.boneTexture=i,this.boneTextureSize=e,this}getBoneByName(e){for(let t=0,i=this.bones.length;t<i;t++){const r=this.bones[t];if(r.name===e)return r}}dispose(){this.boneTexture!==null&&(this.boneTexture.dispose(),this.boneTexture=null)}fromJSON(e,t){this.uuid=e.uuid;for(let i=0,r=e.bones.length;i<r;i++){const s=e.bones[i];let o=t[s];o===void 0&&(console.warn("THREE.Skeleton: No bone found with UUID:",s),o=new bv),this.bones.push(o),this.boneInverses.push(new st().fromArray(e.boneInverses[i]))}return this.init(),this}toJSON(){const e={metadata:{version:4.5,type:"Skeleton",generator:"Skeleton.toJSON"},bones:[],boneInverses:[]};e.uuid=this.uuid;const t=this.bones,i=this.boneInverses;for(let r=0,s=t.length;r<s;r++){const o=t[r];e.bones.push(o.uuid);const l=i[r];e.boneInverses.push(l.toArray())}return e}}class Rl extends It{constructor(e,t,i,r=1){super(e,t,i),this.isInstancedBufferAttribute=!0,this.meshPerAttribute=r}copy(e){return super.copy(e),this.meshPerAttribute=e.meshPerAttribute,this}toJSON(){const e=super.toJSON();return e.meshPerAttribute=this.meshPerAttribute,e.isInstancedBufferAttribute=!0,e}}const KM=new st,$M=new st,gh=[],dc=new wn;class e2 extends wn{constructor(e,t,i){super(e,t),this.isInstancedMesh=!0,this.instanceMatrix=new Rl(new Float32Array(i*16),16),this.instanceColor=null,this.count=i,this.frustumCulled=!1}copy(e,t){return super.copy(e,t),this.instanceMatrix.copy(e.instanceMatrix),e.instanceColor!==null&&(this.instanceColor=e.instanceColor.clone()),this.count=e.count,this}getColorAt(e,t){t.fromArray(this.instanceColor.array,e*3)}getMatrixAt(e,t){t.fromArray(this.instanceMatrix.array,e*16)}raycast(e,t){const i=this.matrixWorld,r=this.count;if(dc.geometry=this.geometry,dc.material=this.material,dc.material!==void 0)for(let s=0;s<r;s++){this.getMatrixAt(s,KM),$M.multiplyMatrices(i,KM),dc.matrixWorld=$M,dc.raycast(e,gh);for(let o=0,l=gh.length;o<l;o++){const c=gh[o];c.instanceId=s,c.object=this,t.push(c)}gh.length=0}}setColorAt(e,t){this.instanceColor===null&&(this.instanceColor=new Rl(new Float32Array(this.instanceMatrix.count*3),3)),t.toArray(this.instanceColor.array,e*3)}setMatrixAt(e,t){t.toArray(this.instanceMatrix.array,e*16)}updateMorphTargets(){}dispose(){this.dispatchEvent({type:"dispose"})}}class ei extends Pn{constructor(e){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new De(16777215),this.linewidth=1,this.linecap="round",this.linejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.linewidth=e.linewidth,this.linecap=e.linecap,this.linejoin=e.linejoin,this.fog=e.fog,this}}const t2=new R,n2=new R,i2=new st,Av=new ic,vh=new rs;class ao extends Mt{constructor(e=new lt,t=new ei){super(),this.isLine=!0,this.type="Line",this.geometry=e,this.material=t,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=e.material,this.geometry=e.geometry,this}computeLineDistances(){const e=this.geometry;if(e.index===null){const t=e.attributes.position,i=[0];for(let r=1,s=t.count;r<s;r++)t2.fromBufferAttribute(t,r-1),n2.fromBufferAttribute(t,r),i[r]=i[r-1],i[r]+=t2.distanceTo(n2);e.setAttribute("lineDistance",new Fe(i,1))}else console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}raycast(e,t){const i=this.geometry,r=this.matrixWorld,s=e.params.Line.threshold,o=i.drawRange;if(i.boundingSphere===null&&i.computeBoundingSphere(),vh.copy(i.boundingSphere),vh.applyMatrix4(r),vh.radius+=s,e.ray.intersectsSphere(vh)===!1)return;i2.copy(r).invert(),Av.copy(e.ray).applyMatrix4(i2);const l=s/((this.scale.x+this.scale.y+this.scale.z)/3),c=l*l,f=new R,d=new R,h=new R,m=new R,g=this.isLineSegments?2:1,x=i.index,w=i.attributes.position;if(x!==null){const _=Math.max(0,o.start),S=Math.min(x.count,o.start+o.count);for(let E=_,T=S-1;E<T;E+=g){const C=x.getX(E),P=x.getX(E+1);if(f.fromBufferAttribute(w,C),d.fromBufferAttribute(w,P),Av.distanceSqToSegment(f,d,m,h)>c)continue;m.applyMatrix4(this.matrixWorld);const A=e.ray.origin.distanceTo(m);A<e.near||A>e.far||t.push({distance:A,point:h.clone().applyMatrix4(this.matrixWorld),index:E,face:null,faceIndex:null,object:this})}}else{const _=Math.max(0,o.start),S=Math.min(w.count,o.start+o.count);for(let E=_,T=S-1;E<T;E+=g){if(f.fromBufferAttribute(w,E),d.fromBufferAttribute(w,E+1),Av.distanceSqToSegment(f,d,m,h)>c)continue;m.applyMatrix4(this.matrixWorld);const P=e.ray.origin.distanceTo(m);P<e.near||P>e.far||t.push({distance:P,point:h.clone().applyMatrix4(this.matrixWorld),index:E,face:null,faceIndex:null,object:this})}}}updateMorphTargets(){const t=this.geometry.morphAttributes,i=Object.keys(t);if(i.length>0){const r=t[i[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=r.length;s<o;s++){const l=r[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[l]=s}}}}}const r2=new R,s2=new R;class Pr extends ao{constructor(e,t){super(e,t),this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){const e=this.geometry;if(e.index===null){const t=e.attributes.position,i=[];for(let r=0,s=t.count;r<s;r+=2)r2.fromBufferAttribute(t,r),s2.fromBufferAttribute(t,r+1),i[r]=r===0?0:i[r-1],i[r+1]=i[r]+r2.distanceTo(s2);e.setAttribute("lineDistance",new Fe(i,1))}else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}}class o2 extends ao{constructor(e,t){super(e,t),this.isLineLoop=!0,this.type="LineLoop"}}class Cv extends Pn{constructor(e){super(),this.isPointsMaterial=!0,this.type="PointsMaterial",this.color=new De(16777215),this.map=null,this.alphaMap=null,this.size=1,this.sizeAttenuation=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.size=e.size,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this}}const a2=new st,Pv=new ic,yh=new rs,xh=new R;class l2 extends Mt{constructor(e=new lt,t=new Cv){super(),this.isPoints=!0,this.type="Points",this.geometry=e,this.material=t,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=e.material,this.geometry=e.geometry,this}raycast(e,t){const i=this.geometry,r=this.matrixWorld,s=e.params.Points.threshold,o=i.drawRange;if(i.boundingSphere===null&&i.computeBoundingSphere(),yh.copy(i.boundingSphere),yh.applyMatrix4(r),yh.radius+=s,e.ray.intersectsSphere(yh)===!1)return;a2.copy(r).invert(),Pv.copy(e.ray).applyMatrix4(a2);const l=s/((this.scale.x+this.scale.y+this.scale.z)/3),c=l*l,f=i.index,h=i.attributes.position;if(f!==null){const m=Math.max(0,o.start),g=Math.min(f.count,o.start+o.count);for(let x=m,y=g;x<y;x++){const w=f.getX(x);xh.fromBufferAttribute(h,w),u2(xh,w,c,r,e,t,this)}}else{const m=Math.max(0,o.start),g=Math.min(h.count,o.start+o.count);for(let x=m,y=g;x<y;x++)xh.fromBufferAttribute(h,x),u2(xh,x,c,r,e,t,this)}}updateMorphTargets(){const t=this.geometry.morphAttributes,i=Object.keys(t);if(i.length>0){const r=t[i[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=r.length;s<o;s++){const l=r[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[l]=s}}}}}function u2(n,e,t,i,r,s,o){const l=Pv.distanceSqToPoint(n);if(l<t){const c=new R;Pv.closestPointToPoint(n,c),c.applyMatrix4(i);const f=r.ray.origin.distanceTo(c);if(f<r.near||f>r.far)return;s.push({distance:f,distanceToRay:Math.sqrt(l),point:c,index:e,face:null,object:o})}}class aD extends un{constructor(e,t,i,r,s,o,l,c,f){super(e,t,i,r,s,o,l,c,f),this.isVideoTexture=!0,this.minFilter=o!==void 0?o:tn,this.magFilter=s!==void 0?s:tn,this.generateMipmaps=!1;const d=this;function h(){d.needsUpdate=!0,e.requestVideoFrameCallback(h)}"requestVideoFrameCallback"in e&&e.requestVideoFrameCallback(h)}clone(){return new this.constructor(this.image).copy(this)}update(){const e=this.image;"requestVideoFrameCallback"in e===!1&&e.readyState>=e.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}}class lD extends un{constructor(e,t,i){super({width:e,height:t}),this.isFramebufferTexture=!0,this.format=i,this.magFilter=ln,this.minFilter=ln,this.generateMipmaps=!1,this.needsUpdate=!0}}class c2 extends un{constructor(e,t,i,r,s,o,l,c,f,d,h,m){super(null,o,l,c,f,d,r,s,h,m),this.isCompressedTexture=!0,this.image={width:t,height:i},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1}}class uD extends un{constructor(e,t,i,r,s,o,l,c,f){super(e,t,i,r,s,o,l,c,f),this.isCanvasTexture=!0,this.needsUpdate=!0}}class mr{constructor(){this.type="Curve",this.arcLengthDivisions=200}getPoint(){return console.warn("THREE.Curve: .getPoint() not implemented."),null}getPointAt(e,t){const i=this.getUtoTmapping(e);return this.getPoint(i,t)}getPoints(e=5){const t=[];for(let i=0;i<=e;i++)t.push(this.getPoint(i/e));return t}getSpacedPoints(e=5){const t=[];for(let i=0;i<=e;i++)t.push(this.getPointAt(i/e));return t}getLength(){const e=this.getLengths();return e[e.length-1]}getLengths(e=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;const t=[];let i,r=this.getPoint(0),s=0;t.push(0);for(let o=1;o<=e;o++)i=this.getPoint(o/e),s+=i.distanceTo(r),t.push(s),r=i;return this.cacheArcLengths=t,t}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(e,t){const i=this.getLengths();let r=0;const s=i.length;let o;t?o=t:o=e*i[s-1];let l=0,c=s-1,f;for(;l<=c;)if(r=Math.floor(l+(c-l)/2),f=i[r]-o,f<0)l=r+1;else if(f>0)c=r-1;else{c=r;break}if(r=c,i[r]===o)return r/(s-1);const d=i[r],m=i[r+1]-d,g=(o-d)/m;return(r+g)/(s-1)}getTangent(e,t){let r=e-1e-4,s=e+1e-4;r<0&&(r=0),s>1&&(s=1);const o=this.getPoint(r),l=this.getPoint(s),c=t||(o.isVector2?new fe:new R);return c.copy(l).sub(o).normalize(),c}getTangentAt(e,t){const i=this.getUtoTmapping(e);return this.getTangent(i,t)}computeFrenetFrames(e,t){const i=new R,r=[],s=[],o=[],l=new R,c=new st;for(let g=0;g<=e;g++){const x=g/e;r[g]=this.getTangentAt(x,new R)}s[0]=new R,o[0]=new R;let f=Number.MAX_VALUE;const d=Math.abs(r[0].x),h=Math.abs(r[0].y),m=Math.abs(r[0].z);d<=f&&(f=d,i.set(1,0,0)),h<=f&&(f=h,i.set(0,1,0)),m<=f&&i.set(0,0,1),l.crossVectors(r[0],i).normalize(),s[0].crossVectors(r[0],l),o[0].crossVectors(r[0],s[0]);for(let g=1;g<=e;g++){if(s[g]=s[g-1].clone(),o[g]=o[g-1].clone(),l.crossVectors(r[g-1],r[g]),l.length()>Number.EPSILON){l.normalize();const x=Math.acos(nn(r[g-1].dot(r[g]),-1,1));s[g].applyMatrix4(c.makeRotationAxis(l,x))}o[g].crossVectors(r[g],s[g])}if(t===!0){let g=Math.acos(nn(s[0].dot(s[e]),-1,1));g/=e,r[0].dot(l.crossVectors(s[0],s[e]))>0&&(g=-g);for(let x=1;x<=e;x++)s[x].applyMatrix4(c.makeRotationAxis(r[x],g*x)),o[x].crossVectors(r[x],s[x])}return{tangents:r,normals:s,binormals:o}}clone(){return new this.constructor().copy(this)}copy(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}toJSON(){const e={metadata:{version:4.5,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e}fromJSON(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}}class _h extends mr{constructor(e=0,t=0,i=1,r=1,s=0,o=Math.PI*2,l=!1,c=0){super(),this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=e,this.aY=t,this.xRadius=i,this.yRadius=r,this.aStartAngle=s,this.aEndAngle=o,this.aClockwise=l,this.aRotation=c}getPoint(e,t){const i=t||new fe,r=Math.PI*2;let s=this.aEndAngle-this.aStartAngle;const o=Math.abs(s)<Number.EPSILON;for(;s<0;)s+=r;for(;s>r;)s-=r;s<Number.EPSILON&&(o?s=0:s=r),this.aClockwise===!0&&!o&&(s===r?s=-r:s=s-r);const l=this.aStartAngle+e*s;let c=this.aX+this.xRadius*Math.cos(l),f=this.aY+this.yRadius*Math.sin(l);if(this.aRotation!==0){const d=Math.cos(this.aRotation),h=Math.sin(this.aRotation),m=c-this.aX,g=f-this.aY;c=m*d-g*h+this.aX,f=m*h+g*d+this.aY}return i.set(c,f)}copy(e){return super.copy(e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this}toJSON(){const e=super.toJSON();return e.aX=this.aX,e.aY=this.aY,e.xRadius=this.xRadius,e.yRadius=this.yRadius,e.aStartAngle=this.aStartAngle,e.aEndAngle=this.aEndAngle,e.aClockwise=this.aClockwise,e.aRotation=this.aRotation,e}fromJSON(e){return super.fromJSON(e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this}}class f2 extends _h{constructor(e,t,i,r,s,o){super(e,t,i,i,r,s,o),this.isArcCurve=!0,this.type="ArcCurve"}}function Lv(){let n=0,e=0,t=0,i=0;function r(s,o,l,c){n=s,e=l,t=-3*s+3*o-2*l-c,i=2*s-2*o+l+c}return{initCatmullRom:function(s,o,l,c,f){r(o,l,f*(l-s),f*(c-o))},initNonuniformCatmullRom:function(s,o,l,c,f,d,h){let m=(o-s)/f-(l-s)/(f+d)+(l-o)/d,g=(l-o)/d-(c-o)/(d+h)+(c-l)/h;m*=d,g*=d,r(o,l,m,g)},calc:function(s){const o=s*s,l=o*s;return n+e*s+t*o+i*l}}}const wh=new R,Rv=new Lv,Iv=new Lv,Dv=new Lv;class d2 extends mr{constructor(e=[],t=!1,i="centripetal",r=.5){super(),this.isCatmullRomCurve3=!0,this.type="CatmullRomCurve3",this.points=e,this.closed=t,this.curveType=i,this.tension=r}getPoint(e,t=new R){const i=t,r=this.points,s=r.length,o=(s-(this.closed?0:1))*e;let l=Math.floor(o),c=o-l;this.closed?l+=l>0?0:(Math.floor(Math.abs(l)/s)+1)*s:c===0&&l===s-1&&(l=s-2,c=1);let f,d;this.closed||l>0?f=r[(l-1)%s]:(wh.subVectors(r[0],r[1]).add(r[0]),f=wh);const h=r[l%s],m=r[(l+1)%s];if(this.closed||l+2<s?d=r[(l+2)%s]:(wh.subVectors(r[s-1],r[s-2]).add(r[s-1]),d=wh),this.curveType==="centripetal"||this.curveType==="chordal"){const g=this.curveType==="chordal"?.5:.25;let x=Math.pow(f.distanceToSquared(h),g),y=Math.pow(h.distanceToSquared(m),g),w=Math.pow(m.distanceToSquared(d),g);y<1e-4&&(y=1),x<1e-4&&(x=y),w<1e-4&&(w=y),Rv.initNonuniformCatmullRom(f.x,h.x,m.x,d.x,x,y,w),Iv.initNonuniformCatmullRom(f.y,h.y,m.y,d.y,x,y,w),Dv.initNonuniformCatmullRom(f.z,h.z,m.z,d.z,x,y,w)}else this.curveType==="catmullrom"&&(Rv.initCatmullRom(f.x,h.x,m.x,d.x,this.tension),Iv.initCatmullRom(f.y,h.y,m.y,d.y,this.tension),Dv.initCatmullRom(f.z,h.z,m.z,d.z,this.tension));return i.set(Rv.calc(c),Iv.calc(c),Dv.calc(c)),i}copy(e){super.copy(e),this.points=[];for(let t=0,i=e.points.length;t<i;t++){const r=e.points[t];this.points.push(r.clone())}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}toJSON(){const e=super.toJSON();e.points=[];for(let t=0,i=this.points.length;t<i;t++){const r=this.points[t];e.points.push(r.toArray())}return e.closed=this.closed,e.curveType=this.curveType,e.tension=this.tension,e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,i=e.points.length;t<i;t++){const r=e.points[t];this.points.push(new R().fromArray(r))}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}}function h2(n,e,t,i,r){const s=(i-e)*.5,o=(r-t)*.5,l=n*n,c=n*l;return(2*t-2*i+s+o)*c+(-3*t+3*i-2*s-o)*l+s*n+t}function cD(n,e){const t=1-n;return t*t*e}function fD(n,e){return 2*(1-n)*n*e}function dD(n,e){return n*n*e}function hc(n,e,t,i){return cD(n,e)+fD(n,t)+dD(n,i)}function hD(n,e){const t=1-n;return t*t*t*e}function pD(n,e){const t=1-n;return 3*t*t*n*e}function mD(n,e){return 3*(1-n)*n*n*e}function gD(n,e){return n*n*n*e}function pc(n,e,t,i,r){return hD(n,e)+pD(n,t)+mD(n,i)+gD(n,r)}class zv extends mr{constructor(e=new fe,t=new fe,i=new fe,r=new fe){super(),this.isCubicBezierCurve=!0,this.type="CubicBezierCurve",this.v0=e,this.v1=t,this.v2=i,this.v3=r}getPoint(e,t=new fe){const i=t,r=this.v0,s=this.v1,o=this.v2,l=this.v3;return i.set(pc(e,r.x,s.x,o.x,l.x),pc(e,r.y,s.y,o.y,l.y)),i}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}}class p2 extends mr{constructor(e=new R,t=new R,i=new R,r=new R){super(),this.isCubicBezierCurve3=!0,this.type="CubicBezierCurve3",this.v0=e,this.v1=t,this.v2=i,this.v3=r}getPoint(e,t=new R){const i=t,r=this.v0,s=this.v1,o=this.v2,l=this.v3;return i.set(pc(e,r.x,s.x,o.x,l.x),pc(e,r.y,s.y,o.y,l.y),pc(e,r.z,s.z,o.z,l.z)),i}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}}class Sh extends mr{constructor(e=new fe,t=new fe){super(),this.isLineCurve=!0,this.type="LineCurve",this.v1=e,this.v2=t}getPoint(e,t=new fe){const i=t;return e===1?i.copy(this.v2):(i.copy(this.v2).sub(this.v1),i.multiplyScalar(e).add(this.v1)),i}getPointAt(e,t){return this.getPoint(e,t)}getTangent(e,t){const i=t||new fe;return i.copy(this.v2).sub(this.v1).normalize(),i}copy(e){return super.copy(e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class m2 extends mr{constructor(e=new R,t=new R){super(),this.isLineCurve3=!0,this.type="LineCurve3",this.v1=e,this.v2=t}getPoint(e,t=new R){const i=t;return e===1?i.copy(this.v2):(i.copy(this.v2).sub(this.v1),i.multiplyScalar(e).add(this.v1)),i}getPointAt(e,t){return this.getPoint(e,t)}copy(e){return super.copy(e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class Nv extends mr{constructor(e=new fe,t=new fe,i=new fe){super(),this.isQuadraticBezierCurve=!0,this.type="QuadraticBezierCurve",this.v0=e,this.v1=t,this.v2=i}getPoint(e,t=new fe){const i=t,r=this.v0,s=this.v1,o=this.v2;return i.set(hc(e,r.x,s.x,o.x),hc(e,r.y,s.y,o.y)),i}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class kv extends mr{constructor(e=new R,t=new R,i=new R){super(),this.isQuadraticBezierCurve3=!0,this.type="QuadraticBezierCurve3",this.v0=e,this.v1=t,this.v2=i}getPoint(e,t=new R){const i=t,r=this.v0,s=this.v1,o=this.v2;return i.set(hc(e,r.x,s.x,o.x),hc(e,r.y,s.y,o.y),hc(e,r.z,s.z,o.z)),i}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class Ov extends mr{constructor(e=[]){super(),this.isSplineCurve=!0,this.type="SplineCurve",this.points=e}getPoint(e,t=new fe){const i=t,r=this.points,s=(r.length-1)*e,o=Math.floor(s),l=s-o,c=r[o===0?o:o-1],f=r[o],d=r[o>r.length-2?r.length-1:o+1],h=r[o>r.length-3?r.length-1:o+2];return i.set(h2(l,c.x,f.x,d.x,h.x),h2(l,c.y,f.y,d.y,h.y)),i}copy(e){super.copy(e),this.points=[];for(let t=0,i=e.points.length;t<i;t++){const r=e.points[t];this.points.push(r.clone())}return this}toJSON(){const e=super.toJSON();e.points=[];for(let t=0,i=this.points.length;t<i;t++){const r=this.points[t];e.points.push(r.toArray())}return e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,i=e.points.length;t<i;t++){const r=e.points[t];this.points.push(new fe().fromArray(r))}return this}}var Fv=Object.freeze({__proto__:null,ArcCurve:f2,CatmullRomCurve3:d2,CubicBezierCurve:zv,CubicBezierCurve3:p2,EllipseCurve:_h,LineCurve:Sh,LineCurve3:m2,QuadraticBezierCurve:Nv,QuadraticBezierCurve3:kv,SplineCurve:Ov});class g2 extends mr{constructor(){super(),this.type="CurvePath",this.curves=[],this.autoClose=!1}add(e){this.curves.push(e)}closePath(){const e=this.curves[0].getPoint(0),t=this.curves[this.curves.length-1].getPoint(1);e.equals(t)||this.curves.push(new Sh(t,e))}getPoint(e,t){const i=e*this.getLength(),r=this.getCurveLengths();let s=0;for(;s<r.length;){if(r[s]>=i){const o=r[s]-i,l=this.curves[s],c=l.getLength(),f=c===0?0:1-o/c;return l.getPointAt(f,t)}s++}return null}getLength(){const e=this.getCurveLengths();return e[e.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;const e=[];let t=0;for(let i=0,r=this.curves.length;i<r;i++)t+=this.curves[i].getLength(),e.push(t);return this.cacheLengths=e,e}getSpacedPoints(e=40){const t=[];for(let i=0;i<=e;i++)t.push(this.getPoint(i/e));return this.autoClose&&t.push(t[0]),t}getPoints(e=12){const t=[];let i;for(let r=0,s=this.curves;r<s.length;r++){const o=s[r],l=o.isEllipseCurve?e*2:o.isLineCurve||o.isLineCurve3?1:o.isSplineCurve?e*o.points.length:e,c=o.getPoints(l);for(let f=0;f<c.length;f++){const d=c[f];i&&i.equals(d)||(t.push(d),i=d)}}return this.autoClose&&t.length>1&&!t[t.length-1].equals(t[0])&&t.push(t[0]),t}copy(e){super.copy(e),this.curves=[];for(let t=0,i=e.curves.length;t<i;t++){const r=e.curves[t];this.curves.push(r.clone())}return this.autoClose=e.autoClose,this}toJSON(){const e=super.toJSON();e.autoClose=this.autoClose,e.curves=[];for(let t=0,i=this.curves.length;t<i;t++){const r=this.curves[t];e.curves.push(r.toJSON())}return e}fromJSON(e){super.fromJSON(e),this.autoClose=e.autoClose,this.curves=[];for(let t=0,i=e.curves.length;t<i;t++){const r=e.curves[t];this.curves.push(new Fv[r.type]().fromJSON(r))}return this}}class mc extends g2{constructor(e){super(),this.type="Path",this.currentPoint=new fe,e&&this.setFromPoints(e)}setFromPoints(e){this.moveTo(e[0].x,e[0].y);for(let t=1,i=e.length;t<i;t++)this.lineTo(e[t].x,e[t].y);return this}moveTo(e,t){return this.currentPoint.set(e,t),this}lineTo(e,t){const i=new Sh(this.currentPoint.clone(),new fe(e,t));return this.curves.push(i),this.currentPoint.set(e,t),this}quadraticCurveTo(e,t,i,r){const s=new Nv(this.currentPoint.clone(),new fe(e,t),new fe(i,r));return this.curves.push(s),this.currentPoint.set(i,r),this}bezierCurveTo(e,t,i,r,s,o){const l=new zv(this.currentPoint.clone(),new fe(e,t),new fe(i,r),new fe(s,o));return this.curves.push(l),this.currentPoint.set(s,o),this}splineThru(e){const t=[this.currentPoint.clone()].concat(e),i=new Ov(t);return this.curves.push(i),this.currentPoint.copy(e[e.length-1]),this}arc(e,t,i,r,s,o){const l=this.currentPoint.x,c=this.currentPoint.y;return this.absarc(e+l,t+c,i,r,s,o),this}absarc(e,t,i,r,s,o){return this.absellipse(e,t,i,i,r,s,o),this}ellipse(e,t,i,r,s,o,l,c){const f=this.currentPoint.x,d=this.currentPoint.y;return this.absellipse(e+f,t+d,i,r,s,o,l,c),this}absellipse(e,t,i,r,s,o,l,c){const f=new _h(e,t,i,r,s,o,l,c);if(this.curves.length>0){const h=f.getPoint(0);h.equals(this.currentPoint)||this.lineTo(h.x,h.y)}this.curves.push(f);const d=f.getPoint(1);return this.currentPoint.copy(d),this}copy(e){return super.copy(e),this.currentPoint.copy(e.currentPoint),this}toJSON(){const e=super.toJSON();return e.currentPoint=this.currentPoint.toArray(),e}fromJSON(e){return super.fromJSON(e),this.currentPoint.fromArray(e.currentPoint),this}}class Il extends lt{constructor(e=[new fe(0,-.5),new fe(.5,0),new fe(0,.5)],t=12,i=0,r=Math.PI*2){super(),this.type="LatheGeometry",this.parameters={points:e,segments:t,phiStart:i,phiLength:r},t=Math.floor(t),r=nn(r,0,Math.PI*2);const s=[],o=[],l=[],c=[],f=[],d=1/t,h=new R,m=new fe,g=new R,x=new R,y=new R;let w=0,_=0;for(let S=0;S<=e.length-1;S++)switch(S){case 0:w=e[S+1].x-e[S].x,_=e[S+1].y-e[S].y,g.x=_*1,g.y=-w,g.z=_*0,y.copy(g),g.normalize(),c.push(g.x,g.y,g.z);break;case e.length-1:c.push(y.x,y.y,y.z);break;default:w=e[S+1].x-e[S].x,_=e[S+1].y-e[S].y,g.x=_*1,g.y=-w,g.z=_*0,x.copy(g),g.x+=y.x,g.y+=y.y,g.z+=y.z,g.normalize(),c.push(g.x,g.y,g.z),y.copy(x)}for(let S=0;S<=t;S++){const E=i+S*d*r,T=Math.sin(E),C=Math.cos(E);for(let P=0;P<=e.length-1;P++){h.x=e[P].x*T,h.y=e[P].y,h.z=e[P].x*C,o.push(h.x,h.y,h.z),m.x=S/t,m.y=P/(e.length-1),l.push(m.x,m.y);const I=c[3*P+0]*T,A=c[3*P+1],L=c[3*P+0]*C;f.push(I,A,L)}}for(let S=0;S<t;S++)for(let E=0;E<e.length-1;E++){const T=E+S*e.length,C=T,P=T+e.length,I=T+e.length+1,A=T+1;s.push(C,P,A),s.push(I,A,P)}this.setIndex(s),this.setAttribute("position",new Fe(o,3)),this.setAttribute("uv",new Fe(l,2)),this.setAttribute("normal",new Fe(f,3))}static fromJSON(e){return new Il(e.points,e.segments,e.phiStart,e.phiLength)}}class gc extends Il{constructor(e=1,t=1,i=4,r=8){const s=new mc;s.absarc(0,-t/2,e,Math.PI*1.5,0),s.absarc(0,t/2,e,0,Math.PI*.5),super(s.getPoints(i),r),this.type="CapsuleGeometry",this.parameters={radius:e,height:t,capSegments:i,radialSegments:r}}static fromJSON(e){return new gc(e.radius,e.length,e.capSegments,e.radialSegments)}}class vc extends lt{constructor(e=1,t=8,i=0,r=Math.PI*2){super(),this.type="CircleGeometry",this.parameters={radius:e,segments:t,thetaStart:i,thetaLength:r},t=Math.max(3,t);const s=[],o=[],l=[],c=[],f=new R,d=new fe;o.push(0,0,0),l.push(0,0,1),c.push(.5,.5);for(let h=0,m=3;h<=t;h++,m+=3){const g=i+h/t*r;f.x=e*Math.cos(g),f.y=e*Math.sin(g),o.push(f.x,f.y,f.z),l.push(0,0,1),d.x=(o[m]/e+1)/2,d.y=(o[m+1]/e+1)/2,c.push(d.x,d.y)}for(let h=1;h<=t;h++)s.push(h,h+1,0);this.setIndex(s),this.setAttribute("position",new Fe(o,3)),this.setAttribute("normal",new Fe(l,3)),this.setAttribute("uv",new Fe(c,2))}static fromJSON(e){return new vc(e.radius,e.segments,e.thetaStart,e.thetaLength)}}class ia extends lt{constructor(e=1,t=1,i=1,r=8,s=1,o=!1,l=0,c=Math.PI*2){super(),this.type="CylinderGeometry",this.parameters={radiusTop:e,radiusBottom:t,height:i,radialSegments:r,heightSegments:s,openEnded:o,thetaStart:l,thetaLength:c};const f=this;r=Math.floor(r),s=Math.floor(s);const d=[],h=[],m=[],g=[];let x=0;const y=[],w=i/2;let _=0;S(),o===!1&&(e>0&&E(!0),t>0&&E(!1)),this.setIndex(d),this.setAttribute("position",new Fe(h,3)),this.setAttribute("normal",new Fe(m,3)),this.setAttribute("uv",new Fe(g,2));function S(){const T=new R,C=new R;let P=0;const I=(t-e)/i;for(let A=0;A<=s;A++){const L=[],z=A/s,j=z*(t-e)+e;for(let ue=0;ue<=r;ue++){const Z=ue/r,G=Z*c+l,ie=Math.sin(G),ee=Math.cos(G);C.x=j*ie,C.y=-z*i+w,C.z=j*ee,h.push(C.x,C.y,C.z),T.set(ie,I,ee).normalize(),m.push(T.x,T.y,T.z),g.push(Z,1-z),L.push(x++)}y.push(L)}for(let A=0;A<r;A++)for(let L=0;L<s;L++){const z=y[L][A],j=y[L+1][A],ue=y[L+1][A+1],Z=y[L][A+1];d.push(z,j,Z),d.push(j,ue,Z),P+=6}f.addGroup(_,P,0),_+=P}function E(T){const C=x,P=new fe,I=new R;let A=0;const L=T===!0?e:t,z=T===!0?1:-1;for(let ue=1;ue<=r;ue++)h.push(0,w*z,0),m.push(0,z,0),g.push(.5,.5),x++;const j=x;for(let ue=0;ue<=r;ue++){const G=ue/r*c+l,ie=Math.cos(G),ee=Math.sin(G);I.x=L*ee,I.y=w*z,I.z=L*ie,h.push(I.x,I.y,I.z),m.push(0,z,0),P.x=ie*.5+.5,P.y=ee*.5*z+.5,g.push(P.x,P.y),x++}for(let ue=0;ue<r;ue++){const Z=C+ue,G=j+ue;T===!0?d.push(G,G+1,Z):d.push(G+1,G,Z),A+=3}f.addGroup(_,A,T===!0?1:2),_+=A}}static fromJSON(e){return new ia(e.radiusTop,e.radiusBottom,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}class yc extends ia{constructor(e=1,t=1,i=8,r=1,s=!1,o=0,l=Math.PI*2){super(0,e,t,i,r,s,o,l),this.type="ConeGeometry",this.parameters={radius:e,height:t,radialSegments:i,heightSegments:r,openEnded:s,thetaStart:o,thetaLength:l}}static fromJSON(e){return new yc(e.radius,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}class us extends lt{constructor(e=[],t=[],i=1,r=0){super(),this.type="PolyhedronGeometry",this.parameters={vertices:e,indices:t,radius:i,detail:r};const s=[],o=[];l(r),f(i),d(),this.setAttribute("position",new Fe(s,3)),this.setAttribute("normal",new Fe(s.slice(),3)),this.setAttribute("uv",new Fe(o,2)),r===0?this.computeVertexNormals():this.normalizeNormals();function l(S){const E=new R,T=new R,C=new R;for(let P=0;P<t.length;P+=3)g(t[P+0],E),g(t[P+1],T),g(t[P+2],C),c(E,T,C,S)}function c(S,E,T,C){const P=C+1,I=[];for(let A=0;A<=P;A++){I[A]=[];const L=S.clone().lerp(T,A/P),z=E.clone().lerp(T,A/P),j=P-A;for(let ue=0;ue<=j;ue++)ue===0&&A===P?I[A][ue]=L:I[A][ue]=L.clone().lerp(z,ue/j)}for(let A=0;A<P;A++)for(let L=0;L<2*(P-A)-1;L++){const z=Math.floor(L/2);L%2===0?(m(I[A][z+1]),m(I[A+1][z]),m(I[A][z])):(m(I[A][z+1]),m(I[A+1][z+1]),m(I[A+1][z]))}}function f(S){const E=new R;for(let T=0;T<s.length;T+=3)E.x=s[T+0],E.y=s[T+1],E.z=s[T+2],E.normalize().multiplyScalar(S),s[T+0]=E.x,s[T+1]=E.y,s[T+2]=E.z}function d(){const S=new R;for(let E=0;E<s.length;E+=3){S.x=s[E+0],S.y=s[E+1],S.z=s[E+2];const T=w(S)/2/Math.PI+.5,C=_(S)/Math.PI+.5;o.push(T,1-C)}x(),h()}function h(){for(let S=0;S<o.length;S+=6){const E=o[S+0],T=o[S+2],C=o[S+4],P=Math.max(E,T,C),I=Math.min(E,T,C);P>.9&&I<.1&&(E<.2&&(o[S+0]+=1),T<.2&&(o[S+2]+=1),C<.2&&(o[S+4]+=1))}}function m(S){s.push(S.x,S.y,S.z)}function g(S,E){const T=S*3;E.x=e[T+0],E.y=e[T+1],E.z=e[T+2]}function x(){const S=new R,E=new R,T=new R,C=new R,P=new fe,I=new fe,A=new fe;for(let L=0,z=0;L<s.length;L+=9,z+=6){S.set(s[L+0],s[L+1],s[L+2]),E.set(s[L+3],s[L+4],s[L+5]),T.set(s[L+6],s[L+7],s[L+8]),P.set(o[z+0],o[z+1]),I.set(o[z+2],o[z+3]),A.set(o[z+4],o[z+5]),C.copy(S).add(E).add(T).divideScalar(3);const j=w(C);y(P,z+0,S,j),y(I,z+2,E,j),y(A,z+4,T,j)}}function y(S,E,T,C){C<0&&S.x===1&&(o[E]=S.x-1),T.x===0&&T.z===0&&(o[E]=C/2/Math.PI+.5)}function w(S){return Math.atan2(S.z,-S.x)}function _(S){return Math.atan2(-S.y,Math.sqrt(S.x*S.x+S.z*S.z))}}static fromJSON(e){return new us(e.vertices,e.indices,e.radius,e.details)}}class xc extends us{constructor(e=1,t=0){const i=(1+Math.sqrt(5))/2,r=1/i,s=[-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,-r,-i,0,-r,i,0,r,-i,0,r,i,-r,-i,0,-r,i,0,r,-i,0,r,i,0,-i,0,-r,i,0,-r,-i,0,r,i,0,r],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];super(s,o,e,t),this.type="DodecahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new xc(e.radius,e.detail)}}const Mh=new R,Eh=new R,Uv=new R,Th=new Vi;class v2 extends lt{constructor(e=null,t=1){if(super(),this.type="EdgesGeometry",this.parameters={geometry:e,thresholdAngle:t},e!==null){const r=Math.pow(10,4),s=Math.cos(qo*t),o=e.getIndex(),l=e.getAttribute("position"),c=o?o.count:l.count,f=[0,0,0],d=["a","b","c"],h=new Array(3),m={},g=[];for(let x=0;x<c;x+=3){o?(f[0]=o.getX(x),f[1]=o.getX(x+1),f[2]=o.getX(x+2)):(f[0]=x,f[1]=x+1,f[2]=x+2);const{a:y,b:w,c:_}=Th;if(y.fromBufferAttribute(l,f[0]),w.fromBufferAttribute(l,f[1]),_.fromBufferAttribute(l,f[2]),Th.getNormal(Uv),h[0]=`${Math.round(y.x*r)},${Math.round(y.y*r)},${Math.round(y.z*r)}`,h[1]=`${Math.round(w.x*r)},${Math.round(w.y*r)},${Math.round(w.z*r)}`,h[2]=`${Math.round(_.x*r)},${Math.round(_.y*r)},${Math.round(_.z*r)}`,!(h[0]===h[1]||h[1]===h[2]||h[2]===h[0]))for(let S=0;S<3;S++){const E=(S+1)%3,T=h[S],C=h[E],P=Th[d[S]],I=Th[d[E]],A=`${T}_${C}`,L=`${C}_${T}`;L in m&&m[L]?(Uv.dot(m[L].normal)<=s&&(g.push(P.x,P.y,P.z),g.push(I.x,I.y,I.z)),m[L]=null):A in m||(m[A]={index0:f[S],index1:f[E],normal:Uv.clone()})}}for(const x in m)if(m[x]){const{index0:y,index1:w}=m[x];Mh.fromBufferAttribute(l,y),Eh.fromBufferAttribute(l,w),g.push(Mh.x,Mh.y,Mh.z),g.push(Eh.x,Eh.y,Eh.z)}this.setAttribute("position",new Fe(g,3))}}}class ra extends mc{constructor(e){super(e),this.uuid=Mi(),this.type="Shape",this.holes=[]}getPointsHoles(e){const t=[];for(let i=0,r=this.holes.length;i<r;i++)t[i]=this.holes[i].getPoints(e);return t}extractPoints(e){return{shape:this.getPoints(e),holes:this.getPointsHoles(e)}}copy(e){super.copy(e),this.holes=[];for(let t=0,i=e.holes.length;t<i;t++){const r=e.holes[t];this.holes.push(r.clone())}return this}toJSON(){const e=super.toJSON();e.uuid=this.uuid,e.holes=[];for(let t=0,i=this.holes.length;t<i;t++){const r=this.holes[t];e.holes.push(r.toJSON())}return e}fromJSON(e){super.fromJSON(e),this.uuid=e.uuid,this.holes=[];for(let t=0,i=e.holes.length;t<i;t++){const r=e.holes[t];this.holes.push(new mc().fromJSON(r))}return this}}const vD={triangulate:function(n,e,t=2){const i=e&&e.length,r=i?e[0]*t:n.length;let s=y2(n,0,r,t,!0);const o=[];if(!s||s.next===s.prev)return o;let l,c,f,d,h,m,g;if(i&&(s=SD(n,e,s,t)),n.length>80*t){l=f=n[0],c=d=n[1];for(let x=t;x<r;x+=t)h=n[x],m=n[x+1],h<l&&(l=h),m<c&&(c=m),h>f&&(f=h),m>d&&(d=m);g=Math.max(f-l,d-c),g=g!==0?1/g:0}return _c(s,o,t,l,c,g),o}};function y2(n,e,t,i,r){let s,o;if(r===DD(n,e,t,i)>0)for(s=e;s<t;s+=i)o=w2(s,n[s],n[s+1],o);else for(s=t-i;s>=e;s-=i)o=w2(s,n[s],n[s+1],o);return o&&bh(o,o.next)&&(Sc(o),o=o.next),o}function lo(n,e){if(!n)return n;e||(e=n);let t=n,i;do if(i=!1,!t.steiner&&(bh(t,t.next)||Zt(t.prev,t,t.next)===0)){if(Sc(t),t=e=t.prev,t===t.next)break;i=!0}else t=t.next;while(i||t!==e);return e}function _c(n,e,t,i,r,s,o){if(!n)return;!o&&s&&AD(n,i,r,s);let l=n,c,f;for(;n.prev!==n.next;){if(c=n.prev,f=n.next,s?xD(n,i,r,s):yD(n)){e.push(c.i/t),e.push(n.i/t),e.push(f.i/t),Sc(n),n=f.next,l=f.next;continue}if(n=f,n===l){o?o===1?(n=_D(lo(n),e,t),_c(n,e,t,i,r,s,2)):o===2&&wD(n,e,t,i,r,s):_c(lo(n),e,t,i,r,s,1);break}}}function yD(n){const e=n.prev,t=n,i=n.next;if(Zt(e,t,i)>=0)return!1;let r=n.next.next;for(;r!==n.prev;){if(Dl(e.x,e.y,t.x,t.y,i.x,i.y,r.x,r.y)&&Zt(r.prev,r,r.next)>=0)return!1;r=r.next}return!0}function xD(n,e,t,i){const r=n.prev,s=n,o=n.next;if(Zt(r,s,o)>=0)return!1;const l=r.x<s.x?r.x<o.x?r.x:o.x:s.x<o.x?s.x:o.x,c=r.y<s.y?r.y<o.y?r.y:o.y:s.y<o.y?s.y:o.y,f=r.x>s.x?r.x>o.x?r.x:o.x:s.x>o.x?s.x:o.x,d=r.y>s.y?r.y>o.y?r.y:o.y:s.y>o.y?s.y:o.y,h=Bv(l,c,e,t,i),m=Bv(f,d,e,t,i);let g=n.prevZ,x=n.nextZ;for(;g&&g.z>=h&&x&&x.z<=m;){if(g!==n.prev&&g!==n.next&&Dl(r.x,r.y,s.x,s.y,o.x,o.y,g.x,g.y)&&Zt(g.prev,g,g.next)>=0||(g=g.prevZ,x!==n.prev&&x!==n.next&&Dl(r.x,r.y,s.x,s.y,o.x,o.y,x.x,x.y)&&Zt(x.prev,x,x.next)>=0))return!1;x=x.nextZ}for(;g&&g.z>=h;){if(g!==n.prev&&g!==n.next&&Dl(r.x,r.y,s.x,s.y,o.x,o.y,g.x,g.y)&&Zt(g.prev,g,g.next)>=0)return!1;g=g.prevZ}for(;x&&x.z<=m;){if(x!==n.prev&&x!==n.next&&Dl(r.x,r.y,s.x,s.y,o.x,o.y,x.x,x.y)&&Zt(x.prev,x,x.next)>=0)return!1;x=x.nextZ}return!0}function _D(n,e,t){let i=n;do{const r=i.prev,s=i.next.next;!bh(r,s)&&x2(r,i,i.next,s)&&wc(r,s)&&wc(s,r)&&(e.push(r.i/t),e.push(i.i/t),e.push(s.i/t),Sc(i),Sc(i.next),i=n=s),i=i.next}while(i!==n);return lo(i)}function wD(n,e,t,i,r,s){let o=n;do{let l=o.next.next;for(;l!==o.prev;){if(o.i!==l.i&&LD(o,l)){let c=_2(o,l);o=lo(o,o.next),c=lo(c,c.next),_c(o,e,t,i,r,s),_c(c,e,t,i,r,s);return}l=l.next}o=o.next}while(o!==n)}function SD(n,e,t,i){const r=[];let s,o,l,c,f;for(s=0,o=e.length;s<o;s++)l=e[s]*i,c=s<o-1?e[s+1]*i:n.length,f=y2(n,l,c,i,!1),f===f.next&&(f.steiner=!0),r.push(PD(f));for(r.sort(MD),s=0;s<r.length;s++)ED(r[s],t),t=lo(t,t.next);return t}function MD(n,e){return n.x-e.x}function ED(n,e){if(e=TD(n,e),e){const t=_2(e,n);lo(e,e.next),lo(t,t.next)}}function TD(n,e){let t=e;const i=n.x,r=n.y;let s=-1/0,o;do{if(r<=t.y&&r>=t.next.y&&t.next.y!==t.y){const m=t.x+(r-t.y)*(t.next.x-t.x)/(t.next.y-t.y);if(m<=i&&m>s){if(s=m,m===i){if(r===t.y)return t;if(r===t.next.y)return t.next}o=t.x<t.next.x?t:t.next}}t=t.next}while(t!==e);if(!o)return null;if(i===s)return o;const l=o,c=o.x,f=o.y;let d=1/0,h;t=o;do i>=t.x&&t.x>=c&&i!==t.x&&Dl(r<f?i:s,r,c,f,r<f?s:i,r,t.x,t.y)&&(h=Math.abs(r-t.y)/(i-t.x),wc(t,n)&&(h<d||h===d&&(t.x>o.x||t.x===o.x&&bD(o,t)))&&(o=t,d=h)),t=t.next;while(t!==l);return o}function bD(n,e){return Zt(n.prev,n,e.prev)<0&&Zt(e.next,n,n.next)<0}function AD(n,e,t,i){let r=n;do r.z===null&&(r.z=Bv(r.x,r.y,e,t,i)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next;while(r!==n);r.prevZ.nextZ=null,r.prevZ=null,CD(r)}function CD(n){let e,t,i,r,s,o,l,c,f=1;do{for(t=n,n=null,s=null,o=0;t;){for(o++,i=t,l=0,e=0;e<f&&(l++,i=i.nextZ,!!i);e++);for(c=f;l>0||c>0&&i;)l!==0&&(c===0||!i||t.z<=i.z)?(r=t,t=t.nextZ,l--):(r=i,i=i.nextZ,c--),s?s.nextZ=r:n=r,r.prevZ=s,s=r;t=i}s.nextZ=null,f*=2}while(o>1);return n}function Bv(n,e,t,i,r){return n=32767*(n-t)*r,e=32767*(e-i)*r,n=(n|n<<8)&16711935,n=(n|n<<4)&252645135,n=(n|n<<2)&858993459,n=(n|n<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,n|e<<1}function PD(n){let e=n,t=n;do(e.x<t.x||e.x===t.x&&e.y<t.y)&&(t=e),e=e.next;while(e!==n);return t}function Dl(n,e,t,i,r,s,o,l){return(r-o)*(e-l)-(n-o)*(s-l)>=0&&(n-o)*(i-l)-(t-o)*(e-l)>=0&&(t-o)*(s-l)-(r-o)*(i-l)>=0}function LD(n,e){return n.next.i!==e.i&&n.prev.i!==e.i&&!RD(n,e)&&(wc(n,e)&&wc(e,n)&&ID(n,e)&&(Zt(n.prev,n,e.prev)||Zt(n,e.prev,e))||bh(n,e)&&Zt(n.prev,n,n.next)>0&&Zt(e.prev,e,e.next)>0)}function Zt(n,e,t){return(e.y-n.y)*(t.x-e.x)-(e.x-n.x)*(t.y-e.y)}function bh(n,e){return n.x===e.x&&n.y===e.y}function x2(n,e,t,i){const r=Ch(Zt(n,e,t)),s=Ch(Zt(n,e,i)),o=Ch(Zt(t,i,n)),l=Ch(Zt(t,i,e));return!!(r!==s&&o!==l||r===0&&Ah(n,t,e)||s===0&&Ah(n,i,e)||o===0&&Ah(t,n,i)||l===0&&Ah(t,e,i))}function Ah(n,e,t){return e.x<=Math.max(n.x,t.x)&&e.x>=Math.min(n.x,t.x)&&e.y<=Math.max(n.y,t.y)&&e.y>=Math.min(n.y,t.y)}function Ch(n){return n>0?1:n<0?-1:0}function RD(n,e){let t=n;do{if(t.i!==n.i&&t.next.i!==n.i&&t.i!==e.i&&t.next.i!==e.i&&x2(t,t.next,n,e))return!0;t=t.next}while(t!==n);return!1}function wc(n,e){return Zt(n.prev,n,n.next)<0?Zt(n,e,n.next)>=0&&Zt(n,n.prev,e)>=0:Zt(n,e,n.prev)<0||Zt(n,n.next,e)<0}function ID(n,e){let t=n,i=!1;const r=(n.x+e.x)/2,s=(n.y+e.y)/2;do t.y>s!=t.next.y>s&&t.next.y!==t.y&&r<(t.next.x-t.x)*(s-t.y)/(t.next.y-t.y)+t.x&&(i=!i),t=t.next;while(t!==n);return i}function _2(n,e){const t=new Vv(n.i,n.x,n.y),i=new Vv(e.i,e.x,e.y),r=n.next,s=e.prev;return n.next=e,e.prev=n,t.next=r,r.prev=t,i.next=t,t.prev=i,s.next=i,i.prev=s,i}function w2(n,e,t,i){const r=new Vv(n,e,t);return i?(r.next=i.next,r.prev=i,i.next.prev=r,i.next=r):(r.prev=r,r.next=r),r}function Sc(n){n.next.prev=n.prev,n.prev.next=n.next,n.prevZ&&(n.prevZ.nextZ=n.nextZ),n.nextZ&&(n.nextZ.prevZ=n.prevZ)}function Vv(n,e,t){this.i=n,this.x=e,this.y=t,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}function DD(n,e,t,i){let r=0;for(let s=e,o=t-i;s<t;s+=i)r+=(n[o]-n[s])*(n[s+1]+n[o+1]),o=s;return r}class Lr{static area(e){const t=e.length;let i=0;for(let r=t-1,s=0;s<t;r=s++)i+=e[r].x*e[s].y-e[s].x*e[r].y;return i*.5}static isClockWise(e){return Lr.area(e)<0}static triangulateShape(e,t){const i=[],r=[],s=[];S2(e),M2(i,e);let o=e.length;t.forEach(S2);for(let c=0;c<t.length;c++)r.push(o),o+=t[c].length,M2(i,t[c]);const l=vD.triangulate(i,r);for(let c=0;c<l.length;c+=3)s.push(l.slice(c,c+3));return s}}function S2(n){const e=n.length;e>2&&n[e-1].equals(n[0])&&n.pop()}function M2(n,e){for(let t=0;t<e.length;t++)n.push(e[t].x),n.push(e[t].y)}class Mc extends lt{constructor(e=new ra([new fe(.5,.5),new fe(-.5,.5),new fe(-.5,-.5),new fe(.5,-.5)]),t={}){super(),this.type="ExtrudeGeometry",this.parameters={shapes:e,options:t},e=Array.isArray(e)?e:[e];const i=this,r=[],s=[];for(let l=0,c=e.length;l<c;l++){const f=e[l];o(f)}this.setAttribute("position",new Fe(r,3)),this.setAttribute("uv",new Fe(s,2)),this.computeVertexNormals();function o(l){const c=[],f=t.curveSegments!==void 0?t.curveSegments:12,d=t.steps!==void 0?t.steps:1,h=t.depth!==void 0?t.depth:1;let m=t.bevelEnabled!==void 0?t.bevelEnabled:!0,g=t.bevelThickness!==void 0?t.bevelThickness:.2,x=t.bevelSize!==void 0?t.bevelSize:g-.1,y=t.bevelOffset!==void 0?t.bevelOffset:0,w=t.bevelSegments!==void 0?t.bevelSegments:3;const _=t.extrudePath,S=t.UVGenerator!==void 0?t.UVGenerator:zD;let E,T=!1,C,P,I,A;_&&(E=_.getSpacedPoints(d),T=!0,m=!1,C=_.computeFrenetFrames(d,!1),P=new R,I=new R,A=new R),m||(w=0,g=0,x=0,y=0);const L=l.extractPoints(f);let z=L.shape;const j=L.holes;if(!Lr.isClockWise(z)){z=z.reverse();for(let he=0,oe=j.length;he<oe;he++){const xe=j[he];Lr.isClockWise(xe)&&(j[he]=xe.reverse())}}const Z=Lr.triangulateShape(z,j),G=z;for(let he=0,oe=j.length;he<oe;he++){const xe=j[he];z=z.concat(xe)}function ie(he,oe,xe){return oe||console.error("THREE.ExtrudeGeometry: vec does not exist"),oe.clone().multiplyScalar(xe).add(he)}const ee=z.length,pe=Z.length;function k(he,oe,xe){let Ue,Ae,$e;const Ye=he.x-oe.x,Ge=he.y-oe.y,vt=xe.x-he.x,Et=xe.y-he.y,U=Ye*Ye+Ge*Ge,D=Ye*Et-Ge*vt;if(Math.abs(D)>Number.EPSILON){const te=Math.sqrt(U),ve=Math.sqrt(vt*vt+Et*Et),we=oe.x-Ge/te,Ce=oe.y+Ye/te,Ke=xe.x-Et/ve,se=xe.y+vt/ve,Be=((Ke-we)*Et-(se-Ce)*vt)/(Ye*Et-Ge*vt);Ue=we+Ye*Be-he.x,Ae=Ce+Ge*Be-he.y;const Ie=Ue*Ue+Ae*Ae;if(Ie<=2)return new fe(Ue,Ae);$e=Math.sqrt(Ie/2)}else{let te=!1;Ye>Number.EPSILON?vt>Number.EPSILON&&(te=!0):Ye<-Number.EPSILON?vt<-Number.EPSILON&&(te=!0):Math.sign(Ge)===Math.sign(Et)&&(te=!0),te?(Ue=-Ge,Ae=Ye,$e=Math.sqrt(U)):(Ue=Ye,Ae=Ge,$e=Math.sqrt(U/2))}return new fe(Ue/$e,Ae/$e)}const B=[];for(let he=0,oe=G.length,xe=oe-1,Ue=he+1;he<oe;he++,xe++,Ue++)xe===oe&&(xe=0),Ue===oe&&(Ue=0),B[he]=k(G[he],G[xe],G[Ue]);const F=[];let $,J=B.concat();for(let he=0,oe=j.length;he<oe;he++){const xe=j[he];$=[];for(let Ue=0,Ae=xe.length,$e=Ae-1,Ye=Ue+1;Ue<Ae;Ue++,$e++,Ye++)$e===Ae&&($e=0),Ye===Ae&&(Ye=0),$[Ue]=k(xe[Ue],xe[$e],xe[Ye]);F.push($),J=J.concat($)}for(let he=0;he<w;he++){const oe=he/w,xe=g*Math.cos(oe*Math.PI/2),Ue=x*Math.sin(oe*Math.PI/2)+y;for(let Ae=0,$e=G.length;Ae<$e;Ae++){const Ye=ie(G[Ae],B[Ae],Ue);Xe(Ye.x,Ye.y,-xe)}for(let Ae=0,$e=j.length;Ae<$e;Ae++){const Ye=j[Ae];$=F[Ae];for(let Ge=0,vt=Ye.length;Ge<vt;Ge++){const Et=ie(Ye[Ge],$[Ge],Ue);Xe(Et.x,Et.y,-xe)}}}const me=x+y;for(let he=0;he<ee;he++){const oe=m?ie(z[he],J[he],me):z[he];T?(I.copy(C.normals[0]).multiplyScalar(oe.x),P.copy(C.binormals[0]).multiplyScalar(oe.y),A.copy(E[0]).add(I).add(P),Xe(A.x,A.y,A.z)):Xe(oe.x,oe.y,0)}for(let he=1;he<=d;he++)for(let oe=0;oe<ee;oe++){const xe=m?ie(z[oe],J[oe],me):z[oe];T?(I.copy(C.normals[he]).multiplyScalar(xe.x),P.copy(C.binormals[he]).multiplyScalar(xe.y),A.copy(E[he]).add(I).add(P),Xe(A.x,A.y,A.z)):Xe(xe.x,xe.y,h/d*he)}for(let he=w-1;he>=0;he--){const oe=he/w,xe=g*Math.cos(oe*Math.PI/2),Ue=x*Math.sin(oe*Math.PI/2)+y;for(let Ae=0,$e=G.length;Ae<$e;Ae++){const Ye=ie(G[Ae],B[Ae],Ue);Xe(Ye.x,Ye.y,h+xe)}for(let Ae=0,$e=j.length;Ae<$e;Ae++){const Ye=j[Ae];$=F[Ae];for(let Ge=0,vt=Ye.length;Ge<vt;Ge++){const Et=ie(Ye[Ge],$[Ge],Ue);T?Xe(Et.x,Et.y+E[d-1].y,E[d-1].x+xe):Xe(Et.x,Et.y,h+xe)}}}Me(),Ve();function Me(){const he=r.length/3;if(m){let oe=0,xe=ee*oe;for(let Ue=0;Ue<pe;Ue++){const Ae=Z[Ue];je(Ae[2]+xe,Ae[1]+xe,Ae[0]+xe)}oe=d+w*2,xe=ee*oe;for(let Ue=0;Ue<pe;Ue++){const Ae=Z[Ue];je(Ae[0]+xe,Ae[1]+xe,Ae[2]+xe)}}else{for(let oe=0;oe<pe;oe++){const xe=Z[oe];je(xe[2],xe[1],xe[0])}for(let oe=0;oe<pe;oe++){const xe=Z[oe];je(xe[0]+ee*d,xe[1]+ee*d,xe[2]+ee*d)}}i.addGroup(he,r.length/3-he,0)}function Ve(){const he=r.length/3;let oe=0;re(G,oe),oe+=G.length;for(let xe=0,Ue=j.length;xe<Ue;xe++){const Ae=j[xe];re(Ae,oe),oe+=Ae.length}i.addGroup(he,r.length/3-he,1)}function re(he,oe){let xe=he.length;for(;--xe>=0;){const Ue=xe;let Ae=xe-1;Ae<0&&(Ae=he.length-1);for(let $e=0,Ye=d+w*2;$e<Ye;$e++){const Ge=ee*$e,vt=ee*($e+1),Et=oe+Ue+Ge,U=oe+Ae+Ge,D=oe+Ae+vt,te=oe+Ue+vt;Je(Et,U,D,te)}}}function Xe(he,oe,xe){c.push(he),c.push(oe),c.push(xe)}function je(he,oe,xe){be(he),be(oe),be(xe);const Ue=r.length/3,Ae=S.generateTopUV(i,r,Ue-3,Ue-2,Ue-1);Qe(Ae[0]),Qe(Ae[1]),Qe(Ae[2])}function Je(he,oe,xe,Ue){be(he),be(oe),be(Ue),be(oe),be(xe),be(Ue);const Ae=r.length/3,$e=S.generateSideWallUV(i,r,Ae-6,Ae-3,Ae-2,Ae-1);Qe($e[0]),Qe($e[1]),Qe($e[3]),Qe($e[1]),Qe($e[2]),Qe($e[3])}function be(he){r.push(c[he*3+0]),r.push(c[he*3+1]),r.push(c[he*3+2])}function Qe(he){s.push(he.x),s.push(he.y)}}}toJSON(){const e=super.toJSON(),t=this.parameters.shapes,i=this.parameters.options;return ND(t,i,e)}static fromJSON(e,t){const i=[];for(let s=0,o=e.shapes.length;s<o;s++){const l=t[e.shapes[s]];i.push(l)}const r=e.options.extrudePath;return r!==void 0&&(e.options.extrudePath=new Fv[r.type]().fromJSON(r)),new Mc(i,e.options)}}const zD={generateTopUV:function(n,e,t,i,r){const s=e[t*3],o=e[t*3+1],l=e[i*3],c=e[i*3+1],f=e[r*3],d=e[r*3+1];return[new fe(s,o),new fe(l,c),new fe(f,d)]},generateSideWallUV:function(n,e,t,i,r,s){const o=e[t*3],l=e[t*3+1],c=e[t*3+2],f=e[i*3],d=e[i*3+1],h=e[i*3+2],m=e[r*3],g=e[r*3+1],x=e[r*3+2],y=e[s*3],w=e[s*3+1],_=e[s*3+2];return Math.abs(l-d)<Math.abs(o-f)?[new fe(o,1-c),new fe(f,1-h),new fe(m,1-x),new fe(y,1-_)]:[new fe(l,1-c),new fe(d,1-h),new fe(g,1-x),new fe(w,1-_)]}};function ND(n,e,t){if(t.shapes=[],Array.isArray(n))for(let i=0,r=n.length;i<r;i++){const s=n[i];t.shapes.push(s.uuid)}else t.shapes.push(n.uuid);return t.options=Object.assign({},e),e.extrudePath!==void 0&&(t.options.extrudePath=e.extrudePath.toJSON()),t}class Ec extends us{constructor(e=1,t=0){const i=(1+Math.sqrt(5))/2,r=[-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],s=[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];super(r,s,e,t),this.type="IcosahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new Ec(e.radius,e.detail)}}class zl extends us{constructor(e=1,t=0){const i=[1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],r=[0,2,4,0,4,3,0,3,5,0,5,2,1,2,5,1,5,3,1,3,4,1,4,2];super(i,r,e,t),this.type="OctahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new zl(e.radius,e.detail)}}class Tc extends lt{constructor(e=.5,t=1,i=8,r=1,s=0,o=Math.PI*2){super(),this.type="RingGeometry",this.parameters={innerRadius:e,outerRadius:t,thetaSegments:i,phiSegments:r,thetaStart:s,thetaLength:o},i=Math.max(3,i),r=Math.max(1,r);const l=[],c=[],f=[],d=[];let h=e;const m=(t-e)/r,g=new R,x=new fe;for(let y=0;y<=r;y++){for(let w=0;w<=i;w++){const _=s+w/i*o;g.x=h*Math.cos(_),g.y=h*Math.sin(_),c.push(g.x,g.y,g.z),f.push(0,0,1),x.x=(g.x/t+1)/2,x.y=(g.y/t+1)/2,d.push(x.x,x.y)}h+=m}for(let y=0;y<r;y++){const w=y*(i+1);for(let _=0;_<i;_++){const S=_+w,E=S,T=S+i+1,C=S+i+2,P=S+1;l.push(E,T,P),l.push(T,C,P)}}this.setIndex(l),this.setAttribute("position",new Fe(c,3)),this.setAttribute("normal",new Fe(f,3)),this.setAttribute("uv",new Fe(d,2))}static fromJSON(e){return new Tc(e.innerRadius,e.outerRadius,e.thetaSegments,e.phiSegments,e.thetaStart,e.thetaLength)}}class bc extends lt{constructor(e=new ra([new fe(0,.5),new fe(-.5,-.5),new fe(.5,-.5)]),t=12){super(),this.type="ShapeGeometry",this.parameters={shapes:e,curveSegments:t};const i=[],r=[],s=[],o=[];let l=0,c=0;if(Array.isArray(e)===!1)f(e);else for(let d=0;d<e.length;d++)f(e[d]),this.addGroup(l,c,d),l+=c,c=0;this.setIndex(i),this.setAttribute("position",new Fe(r,3)),this.setAttribute("normal",new Fe(s,3)),this.setAttribute("uv",new Fe(o,2));function f(d){const h=r.length/3,m=d.extractPoints(t);let g=m.shape;const x=m.holes;Lr.isClockWise(g)===!1&&(g=g.reverse());for(let w=0,_=x.length;w<_;w++){const S=x[w];Lr.isClockWise(S)===!0&&(x[w]=S.reverse())}const y=Lr.triangulateShape(g,x);for(let w=0,_=x.length;w<_;w++){const S=x[w];g=g.concat(S)}for(let w=0,_=g.length;w<_;w++){const S=g[w];r.push(S.x,S.y,0),s.push(0,0,1),o.push(S.x,S.y)}for(let w=0,_=y.length;w<_;w++){const S=y[w],E=S[0]+h,T=S[1]+h,C=S[2]+h;i.push(E,T,C),c+=3}}}toJSON(){const e=super.toJSON(),t=this.parameters.shapes;return kD(t,e)}static fromJSON(e,t){const i=[];for(let r=0,s=e.shapes.length;r<s;r++){const o=t[e.shapes[r]];i.push(o)}return new bc(i,e.curveSegments)}}function kD(n,e){if(e.shapes=[],Array.isArray(n))for(let t=0,i=n.length;t<i;t++){const r=n[t];e.shapes.push(r.uuid)}else e.shapes.push(n.uuid);return e}class Nl extends lt{constructor(e=1,t=32,i=16,r=0,s=Math.PI*2,o=0,l=Math.PI){super(),this.type="SphereGeometry",this.parameters={radius:e,widthSegments:t,heightSegments:i,phiStart:r,phiLength:s,thetaStart:o,thetaLength:l},t=Math.max(3,Math.floor(t)),i=Math.max(2,Math.floor(i));const c=Math.min(o+l,Math.PI);let f=0;const d=[],h=new R,m=new R,g=[],x=[],y=[],w=[];for(let _=0;_<=i;_++){const S=[],E=_/i;let T=0;_==0&&o==0?T=.5/t:_==i&&c==Math.PI&&(T=-.5/t);for(let C=0;C<=t;C++){const P=C/t;h.x=-e*Math.cos(r+P*s)*Math.sin(o+E*l),h.y=e*Math.cos(o+E*l),h.z=e*Math.sin(r+P*s)*Math.sin(o+E*l),x.push(h.x,h.y,h.z),m.copy(h).normalize(),y.push(m.x,m.y,m.z),w.push(P+T,1-E),S.push(f++)}d.push(S)}for(let _=0;_<i;_++)for(let S=0;S<t;S++){const E=d[_][S+1],T=d[_][S],C=d[_+1][S],P=d[_+1][S+1];(_!==0||o>0)&&g.push(E,T,P),(_!==i-1||c<Math.PI)&&g.push(T,C,P)}this.setIndex(g),this.setAttribute("position",new Fe(x,3)),this.setAttribute("normal",new Fe(y,3)),this.setAttribute("uv",new Fe(w,2))}static fromJSON(e){return new Nl(e.radius,e.widthSegments,e.heightSegments,e.phiStart,e.phiLength,e.thetaStart,e.thetaLength)}}class Ac extends us{constructor(e=1,t=0){const i=[1,1,1,-1,-1,1,-1,1,-1,1,-1,-1],r=[2,1,0,0,3,2,1,3,0,2,3,1];super(i,r,e,t),this.type="TetrahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new Ac(e.radius,e.detail)}}class Cc extends lt{constructor(e=1,t=.4,i=8,r=6,s=Math.PI*2){super(),this.type="TorusGeometry",this.parameters={radius:e,tube:t,radialSegments:i,tubularSegments:r,arc:s},i=Math.floor(i),r=Math.floor(r);const o=[],l=[],c=[],f=[],d=new R,h=new R,m=new R;for(let g=0;g<=i;g++)for(let x=0;x<=r;x++){const y=x/r*s,w=g/i*Math.PI*2;h.x=(e+t*Math.cos(w))*Math.cos(y),h.y=(e+t*Math.cos(w))*Math.sin(y),h.z=t*Math.sin(w),l.push(h.x,h.y,h.z),d.x=e*Math.cos(y),d.y=e*Math.sin(y),m.subVectors(h,d).normalize(),c.push(m.x,m.y,m.z),f.push(x/r),f.push(g/i)}for(let g=1;g<=i;g++)for(let x=1;x<=r;x++){const y=(r+1)*g+x-1,w=(r+1)*(g-1)+x-1,_=(r+1)*(g-1)+x,S=(r+1)*g+x;o.push(y,w,S),o.push(w,_,S)}this.setIndex(o),this.setAttribute("position",new Fe(l,3)),this.setAttribute("normal",new Fe(c,3)),this.setAttribute("uv",new Fe(f,2))}static fromJSON(e){return new Cc(e.radius,e.tube,e.radialSegments,e.tubularSegments,e.arc)}}class Pc extends lt{constructor(e=1,t=.4,i=64,r=8,s=2,o=3){super(),this.type="TorusKnotGeometry",this.parameters={radius:e,tube:t,tubularSegments:i,radialSegments:r,p:s,q:o},i=Math.floor(i),r=Math.floor(r);const l=[],c=[],f=[],d=[],h=new R,m=new R,g=new R,x=new R,y=new R,w=new R,_=new R;for(let E=0;E<=i;++E){const T=E/i*s*Math.PI*2;S(T,s,o,e,g),S(T+.01,s,o,e,x),w.subVectors(x,g),_.addVectors(x,g),y.crossVectors(w,_),_.crossVectors(y,w),y.normalize(),_.normalize();for(let C=0;C<=r;++C){const P=C/r*Math.PI*2,I=-t*Math.cos(P),A=t*Math.sin(P);h.x=g.x+(I*_.x+A*y.x),h.y=g.y+(I*_.y+A*y.y),h.z=g.z+(I*_.z+A*y.z),c.push(h.x,h.y,h.z),m.subVectors(h,g).normalize(),f.push(m.x,m.y,m.z),d.push(E/i),d.push(C/r)}}for(let E=1;E<=i;E++)for(let T=1;T<=r;T++){const C=(r+1)*(E-1)+(T-1),P=(r+1)*E+(T-1),I=(r+1)*E+T,A=(r+1)*(E-1)+T;l.push(C,P,A),l.push(P,I,A)}this.setIndex(l),this.setAttribute("position",new Fe(c,3)),this.setAttribute("normal",new Fe(f,3)),this.setAttribute("uv",new Fe(d,2));function S(E,T,C,P,I){const A=Math.cos(E),L=Math.sin(E),z=C/T*E,j=Math.cos(z);I.x=P*(2+j)*.5*A,I.y=P*(2+j)*L*.5,I.z=P*Math.sin(z)*.5}}static fromJSON(e){return new Pc(e.radius,e.tube,e.tubularSegments,e.radialSegments,e.p,e.q)}}class Lc extends lt{constructor(e=new kv(new R(-1,-1,0),new R(-1,1,0),new R(1,1,0)),t=64,i=1,r=8,s=!1){super(),this.type="TubeGeometry",this.parameters={path:e,tubularSegments:t,radius:i,radialSegments:r,closed:s};const o=e.computeFrenetFrames(t,s);this.tangents=o.tangents,this.normals=o.normals,this.binormals=o.binormals;const l=new R,c=new R,f=new fe;let d=new R;const h=[],m=[],g=[],x=[];y(),this.setIndex(x),this.setAttribute("position",new Fe(h,3)),this.setAttribute("normal",new Fe(m,3)),this.setAttribute("uv",new Fe(g,2));function y(){for(let E=0;E<t;E++)w(E);w(s===!1?t:0),S(),_()}function w(E){d=e.getPointAt(E/t,d);const T=o.normals[E],C=o.binormals[E];for(let P=0;P<=r;P++){const I=P/r*Math.PI*2,A=Math.sin(I),L=-Math.cos(I);c.x=L*T.x+A*C.x,c.y=L*T.y+A*C.y,c.z=L*T.z+A*C.z,c.normalize(),m.push(c.x,c.y,c.z),l.x=d.x+i*c.x,l.y=d.y+i*c.y,l.z=d.z+i*c.z,h.push(l.x,l.y,l.z)}}function _(){for(let E=1;E<=t;E++)for(let T=1;T<=r;T++){const C=(r+1)*(E-1)+(T-1),P=(r+1)*E+(T-1),I=(r+1)*E+T,A=(r+1)*(E-1)+T;x.push(C,P,A),x.push(P,I,A)}}function S(){for(let E=0;E<=t;E++)for(let T=0;T<=r;T++)f.x=E/t,f.y=T/r,g.push(f.x,f.y)}}toJSON(){const e=super.toJSON();return e.path=this.parameters.path.toJSON(),e}static fromJSON(e){return new Lc(new Fv[e.path.type]().fromJSON(e.path),e.tubularSegments,e.radius,e.radialSegments,e.closed)}}class Hv extends lt{constructor(e=null){if(super(),this.type="WireframeGeometry",this.parameters={geometry:e},e!==null){const t=[],i=new Set,r=new R,s=new R;if(e.index!==null){const o=e.attributes.position,l=e.index;let c=e.groups;c.length===0&&(c=[{start:0,count:l.count,materialIndex:0}]);for(let f=0,d=c.length;f<d;++f){const h=c[f],m=h.start,g=h.count;for(let x=m,y=m+g;x<y;x+=3)for(let w=0;w<3;w++){const _=l.getX(x+w),S=l.getX(x+(w+1)%3);r.fromBufferAttribute(o,_),s.fromBufferAttribute(o,S),E2(r,s,i)===!0&&(t.push(r.x,r.y,r.z),t.push(s.x,s.y,s.z))}}}else{const o=e.attributes.position;for(let l=0,c=o.count/3;l<c;l++)for(let f=0;f<3;f++){const d=3*l+f,h=3*l+(f+1)%3;r.fromBufferAttribute(o,d),s.fromBufferAttribute(o,h),E2(r,s,i)===!0&&(t.push(r.x,r.y,r.z),t.push(s.x,s.y,s.z))}}this.setAttribute("position",new Fe(t,3))}}}function E2(n,e,t){const i=`${n.x},${n.y},${n.z}-${e.x},${e.y},${e.z}`,r=`${e.x},${e.y},${e.z}-${n.x},${n.y},${n.z}`;return t.has(i)===!0||t.has(r)===!0?!1:(t.add(i),t.add(r),!0)}var T2=Object.freeze({__proto__:null,BoxGeometry:ro,CapsuleGeometry:gc,CircleGeometry:vc,ConeGeometry:yc,CylinderGeometry:ia,DodecahedronGeometry:xc,EdgesGeometry:v2,ExtrudeGeometry:Mc,IcosahedronGeometry:Ec,LatheGeometry:Il,OctahedronGeometry:zl,PlaneGeometry:wl,PolyhedronGeometry:us,RingGeometry:Tc,ShapeGeometry:bc,SphereGeometry:Nl,TetrahedronGeometry:Ac,TorusGeometry:Cc,TorusKnotGeometry:Pc,TubeGeometry:Lc,WireframeGeometry:Hv});class b2 extends Pn{constructor(e){super(),this.isShadowMaterial=!0,this.type="ShadowMaterial",this.color=new De(0),this.transparent=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.fog=e.fog,this}}class A2 extends pr{constructor(e){super(e),this.isRawShaderMaterial=!0,this.type="RawShaderMaterial"}}class Wv extends Pn{constructor(e){super(),this.isMeshStandardMaterial=!0,this.defines={STANDARD:""},this.type="MeshStandardMaterial",this.color=new De(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 De(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=qs,this.normalScale=new fe(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.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.defines={STANDARD:""},this.color.copy(e.color),this.roughness=e.roughness,this.metalness=e.metalness,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.roughnessMap=e.roughnessMap,this.metalnessMap=e.metalnessMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapIntensity=e.envMapIntensity,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class C2 extends Wv{constructor(e){super(),this.isMeshPhysicalMaterial=!0,this.defines={STANDARD:"",PHYSICAL:""},this.type="MeshPhysicalMaterial",this.clearcoatMap=null,this.clearcoatRoughness=0,this.clearcoatRoughnessMap=null,this.clearcoatNormalScale=new fe(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get:function(){return nn(2.5*(this.ior-1)/(this.ior+1),0,1)},set:function(t){this.ior=(1+.4*t)/(1-.4*t)}}),this.iridescenceMap=null,this.iridescenceIOR=1.3,this.iridescenceThicknessRange=[100,400],this.iridescenceThicknessMap=null,this.sheenColor=new De(0),this.sheenColorMap=null,this.sheenRoughness=1,this.sheenRoughnessMap=null,this.transmissionMap=null,this.thickness=0,this.thicknessMap=null,this.attenuationDistance=0,this.attenuationColor=new De(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new De(1,1,1),this.specularColorMap=null,this._sheen=0,this._clearcoat=0,this._iridescence=0,this._transmission=0,this.setValues(e)}get sheen(){return this._sheen}set sheen(e){this._sheen>0!=e>0&&this.version++,this._sheen=e}get clearcoat(){return this._clearcoat}set clearcoat(e){this._clearcoat>0!=e>0&&this.version++,this._clearcoat=e}get iridescence(){return this._iridescence}set iridescence(e){this._iridescence>0!=e>0&&this.version++,this._iridescence=e}get transmission(){return this._transmission}set transmission(e){this._transmission>0!=e>0&&this.version++,this._transmission=e}copy(e){return super.copy(e),this.defines={STANDARD:"",PHYSICAL:""},this.clearcoat=e.clearcoat,this.clearcoatMap=e.clearcoatMap,this.clearcoatRoughness=e.clearcoatRoughness,this.clearcoatRoughnessMap=e.clearcoatRoughnessMap,this.clearcoatNormalMap=e.clearcoatNormalMap,this.clearcoatNormalScale.copy(e.clearcoatNormalScale),this.ior=e.ior,this.iridescence=e.iridescence,this.iridescenceMap=e.iridescenceMap,this.iridescenceIOR=e.iridescenceIOR,this.iridescenceThicknessRange=[...e.iridescenceThicknessRange],this.iridescenceThicknessMap=e.iridescenceThicknessMap,this.sheen=e.sheen,this.sheenColor.copy(e.sheenColor),this.sheenColorMap=e.sheenColorMap,this.sheenRoughness=e.sheenRoughness,this.sheenRoughnessMap=e.sheenRoughnessMap,this.transmission=e.transmission,this.transmissionMap=e.transmissionMap,this.thickness=e.thickness,this.thicknessMap=e.thicknessMap,this.attenuationDistance=e.attenuationDistance,this.attenuationColor.copy(e.attenuationColor),this.specularIntensity=e.specularIntensity,this.specularIntensityMap=e.specularIntensityMap,this.specularColor.copy(e.specularColor),this.specularColorMap=e.specularColorMap,this}}class P2 extends Pn{constructor(e){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new De(16777215),this.specular=new De(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new De(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=qs,this.normalScale=new fe(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=Wu,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.specular.copy(e.specular),this.shininess=e.shininess,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class L2 extends Pn{constructor(e){super(),this.isMeshToonMaterial=!0,this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new De(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new De(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=qs,this.normalScale=new fe(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.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.fog=e.fog,this}}class R2 extends Pn{constructor(e){super(),this.isMeshNormalMaterial=!0,this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=qs,this.normalScale=new fe(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.flatShading=!1,this.setValues(e)}copy(e){return super.copy(e),this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.flatShading=e.flatShading,this}}class I2 extends Pn{constructor(e){super(),this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new De(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new De(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=qs,this.normalScale=new fe(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=Wu,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class D2 extends Pn{constructor(e){super(),this.isMeshMatcapMaterial=!0,this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new De(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=qs,this.normalScale=new fe(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(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.flatShading=e.flatShading,this.fog=e.fog,this}}class z2 extends ei{constructor(e){super(),this.isLineDashedMaterial=!0,this.type="LineDashedMaterial",this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(e)}copy(e){return super.copy(e),this.scale=e.scale,this.dashSize=e.dashSize,this.gapSize=e.gapSize,this}}function Wi(n,e,t){return Gv(n)?new n.constructor(n.subarray(e,t!==void 0?t:n.length)):n.slice(e,t)}function sa(n,e,t){return!n||!t&&n.constructor===e?n:typeof e.BYTES_PER_ELEMENT=="number"?new e(n):Array.prototype.slice.call(n)}function Gv(n){return ArrayBuffer.isView(n)&&!(n instanceof DataView)}function N2(n){function e(r,s){return n[r]-n[s]}const t=n.length,i=new Array(t);for(let r=0;r!==t;++r)i[r]=r;return i.sort(e),i}function Xv(n,e,t){const i=n.length,r=new n.constructor(i);for(let s=0,o=0;o!==i;++s){const l=t[s]*e;for(let c=0;c!==e;++c)r[o++]=n[l+c]}return r}function jv(n,e,t,i){let r=1,s=n[0];for(;s!==void 0&&s[i]===void 0;)s=n[r++];if(s===void 0)return;let o=s[i];if(o!==void 0)if(Array.isArray(o))do o=s[i],o!==void 0&&(e.push(s.time),t.push.apply(t,o)),s=n[r++];while(s!==void 0);else if(o.toArray!==void 0)do o=s[i],o!==void 0&&(e.push(s.time),o.toArray(t,t.length)),s=n[r++];while(s!==void 0);else do o=s[i],o!==void 0&&(e.push(s.time),t.push(o)),s=n[r++];while(s!==void 0)}function OD(n,e,t,i,r=30){const s=n.clone();s.name=e;const o=[];for(let c=0;c<s.tracks.length;++c){const f=s.tracks[c],d=f.getValueSize(),h=[],m=[];for(let g=0;g<f.times.length;++g){const x=f.times[g]*r;if(!(x<t||x>=i)){h.push(f.times[g]);for(let y=0;y<d;++y)m.push(f.values[g*d+y])}}h.length!==0&&(f.times=sa(h,f.times.constructor),f.values=sa(m,f.values.constructor),o.push(f))}s.tracks=o;let l=1/0;for(let c=0;c<s.tracks.length;++c)l>s.tracks[c].times[0]&&(l=s.tracks[c].times[0]);for(let c=0;c<s.tracks.length;++c)s.tracks[c].shift(-1*l);return s.resetDuration(),s}function FD(n,e=0,t=n,i=30){i<=0&&(i=30);const r=t.tracks.length,s=e/i;for(let o=0;o<r;++o){const l=t.tracks[o],c=l.ValueTypeName;if(c==="bool"||c==="string")continue;const f=n.tracks.find(function(_){return _.name===l.name&&_.ValueTypeName===c});if(f===void 0)continue;let d=0;const h=l.getValueSize();l.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(d=h/3);let m=0;const g=f.getValueSize();f.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(m=g/3);const x=l.times.length-1;let y;if(s<=l.times[0]){const _=d,S=h-d;y=Wi(l.values,_,S)}else if(s>=l.times[x]){const _=x*h+d,S=_+h-d;y=Wi(l.values,_,S)}else{const _=l.createInterpolant(),S=d,E=h-d;_.evaluate(s),y=Wi(_.resultBuffer,S,E)}c==="quaternion"&&new Fn().fromArray(y).normalize().conjugate().toArray(y);const w=f.times.length;for(let _=0;_<w;++_){const S=_*g+m;if(c==="quaternion")Fn.multiplyQuaternionsFlat(f.values,S,y,0,f.values,S);else{const E=g-m*2;for(let T=0;T<E;++T)f.values[S+T]-=y[T]}}}return n.blendMode=U0,n}var UD=Object.freeze({__proto__:null,arraySlice:Wi,convertArray:sa,isTypedArray:Gv,getKeyframeOrder:N2,sortedArray:Xv,flattenJSON:jv,subclip:OD,makeClipAdditive:FD});class Rc{constructor(e,t,i,r){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=r!==void 0?r:new t.constructor(i),this.sampleValues=t,this.valueSize=i,this.settings=null,this.DefaultSettings_={}}evaluate(e){const t=this.parameterPositions;let i=this._cachedIndex,r=t[i],s=t[i-1];e:{t:{let o;n:{i:if(!(e<r)){for(let l=i+2;;){if(r===void 0){if(e<s)break i;return i=t.length,this._cachedIndex=i,this.copySampleValue_(i-1)}if(i===l)break;if(s=r,r=t[++i],e<r)break t}o=t.length;break n}if(!(e>=s)){const l=t[1];e<l&&(i=2,s=l);for(let c=i-2;;){if(s===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(i===c)break;if(r=s,s=t[--i-1],e>=s)break t}o=i,i=0;break n}break e}for(;i<o;){const l=i+o>>>1;e<t[l]?o=l:i=l+1}if(r=t[i],s=t[i-1],s===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(r===void 0)return i=t.length,this._cachedIndex=i,this.copySampleValue_(i-1)}this._cachedIndex=i,this.intervalChanged_(i,s,r)}return this.interpolate_(i,s,e,r)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(e){const t=this.resultBuffer,i=this.sampleValues,r=this.valueSize,s=e*r;for(let o=0;o!==r;++o)t[o]=i[s+o];return t}interpolate_(){throw new Error("call to abstract method")}intervalChanged_(){}}class k2 extends Rc{constructor(e,t,i,r){super(e,t,i,r),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:jo,endingEnd:jo}}intervalChanged_(e,t,i){const r=this.parameterPositions;let s=e-2,o=e+1,l=r[s],c=r[o];if(l===void 0)switch(this.getSettings_().endingStart){case Yo:s=e,l=2*t-i;break;case Ju:s=r.length-2,l=t+r[s]-r[s+1];break;default:s=e,l=i}if(c===void 0)switch(this.getSettings_().endingEnd){case Yo:o=e,c=2*i-t;break;case Ju:o=1,c=i+r[1]-r[0];break;default:o=e-1,c=t}const f=(i-t)*.5,d=this.valueSize;this._weightPrev=f/(t-l),this._weightNext=f/(c-i),this._offsetPrev=s*d,this._offsetNext=o*d}interpolate_(e,t,i,r){const s=this.resultBuffer,o=this.sampleValues,l=this.valueSize,c=e*l,f=c-l,d=this._offsetPrev,h=this._offsetNext,m=this._weightPrev,g=this._weightNext,x=(i-t)/(r-t),y=x*x,w=y*x,_=-m*w+2*m*y-m*x,S=(1+m)*w+(-1.5-2*m)*y+(-.5+m)*x+1,E=(-1-g)*w+(1.5+g)*y+.5*x,T=g*w-g*y;for(let C=0;C!==l;++C)s[C]=_*o[d+C]+S*o[f+C]+E*o[c+C]+T*o[h+C];return s}}class Yv extends Rc{constructor(e,t,i,r){super(e,t,i,r)}interpolate_(e,t,i,r){const s=this.resultBuffer,o=this.sampleValues,l=this.valueSize,c=e*l,f=c-l,d=(i-t)/(r-t),h=1-d;for(let m=0;m!==l;++m)s[m]=o[f+m]*h+o[c+m]*d;return s}}class O2 extends Rc{constructor(e,t,i,r){super(e,t,i,r)}interpolate_(e){return this.copySampleValue_(e-1)}}class gr{constructor(e,t,i,r){if(e===void 0)throw new Error("THREE.KeyframeTrack: track name is undefined");if(t===void 0||t.length===0)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+e);this.name=e,this.times=sa(t,this.TimeBufferType),this.values=sa(i,this.ValueBufferType),this.setInterpolation(r||this.DefaultInterpolation)}static toJSON(e){const t=e.constructor;let i;if(t.toJSON!==this.toJSON)i=t.toJSON(e);else{i={name:e.name,times:sa(e.times,Array),values:sa(e.values,Array)};const r=e.getInterpolation();r!==e.DefaultInterpolation&&(i.interpolation=r)}return i.type=e.ValueTypeName,i}InterpolantFactoryMethodDiscrete(e){return new O2(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodLinear(e){return new Yv(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodSmooth(e){return new k2(this.times,this.values,this.getValueSize(),e)}setInterpolation(e){let t;switch(e){case qu:t=this.InterpolantFactoryMethodDiscrete;break;case Zu:t=this.InterpolantFactoryMethodLinear;break;case Rd:t=this.InterpolantFactoryMethodSmooth;break}if(t===void 0){const i="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(this.createInterpolant===void 0)if(e!==this.DefaultInterpolation)this.setInterpolation(this.DefaultInterpolation);else throw new Error(i);return console.warn("THREE.KeyframeTrack:",i),this}return this.createInterpolant=t,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return qu;case this.InterpolantFactoryMethodLinear:return Zu;case this.InterpolantFactoryMethodSmooth:return Rd}}getValueSize(){return this.values.length/this.times.length}shift(e){if(e!==0){const t=this.times;for(let i=0,r=t.length;i!==r;++i)t[i]+=e}return this}scale(e){if(e!==1){const t=this.times;for(let i=0,r=t.length;i!==r;++i)t[i]*=e}return this}trim(e,t){const i=this.times,r=i.length;let s=0,o=r-1;for(;s!==r&&i[s]<e;)++s;for(;o!==-1&&i[o]>t;)--o;if(++o,s!==0||o!==r){s>=o&&(o=Math.max(o,1),s=o-1);const l=this.getValueSize();this.times=Wi(i,s,o),this.values=Wi(this.values,s*l,o*l)}return this}validate(){let e=!0;const t=this.getValueSize();t-Math.floor(t)!==0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),e=!1);const i=this.times,r=this.values,s=i.length;s===0&&(console.error("THREE.KeyframeTrack: Track is empty.",this),e=!1);let o=null;for(let l=0;l!==s;l++){const c=i[l];if(typeof c=="number"&&isNaN(c)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,l,c),e=!1;break}if(o!==null&&o>c){console.error("THREE.KeyframeTrack: Out of order keys.",this,l,c,o),e=!1;break}o=c}if(r!==void 0&&Gv(r))for(let l=0,c=r.length;l!==c;++l){const f=r[l];if(isNaN(f)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,l,f),e=!1;break}}return e}optimize(){const e=Wi(this.times),t=Wi(this.values),i=this.getValueSize(),r=this.getInterpolation()===Rd,s=e.length-1;let o=1;for(let l=1;l<s;++l){let c=!1;const f=e[l],d=e[l+1];if(f!==d&&(l!==1||f!==e[0]))if(r)c=!0;else{const h=l*i,m=h-i,g=h+i;for(let x=0;x!==i;++x){const y=t[h+x];if(y!==t[m+x]||y!==t[g+x]){c=!0;break}}}if(c){if(l!==o){e[o]=e[l];const h=l*i,m=o*i;for(let g=0;g!==i;++g)t[m+g]=t[h+g]}++o}}if(s>0){e[o]=e[s];for(let l=s*i,c=o*i,f=0;f!==i;++f)t[c+f]=t[l+f];++o}return o!==e.length?(this.times=Wi(e,0,o),this.values=Wi(t,0,o*i)):(this.times=e,this.values=t),this}clone(){const e=Wi(this.times,0),t=Wi(this.values,0),i=this.constructor,r=new i(this.name,e,t);return r.createInterpolant=this.createInterpolant,r}}gr.prototype.TimeBufferType=Float32Array,gr.prototype.ValueBufferType=Float32Array,gr.prototype.DefaultInterpolation=Zu;class oa extends gr{}oa.prototype.ValueTypeName="bool",oa.prototype.ValueBufferType=Array,oa.prototype.DefaultInterpolation=qu,oa.prototype.InterpolantFactoryMethodLinear=void 0,oa.prototype.InterpolantFactoryMethodSmooth=void 0;class qv extends gr{}qv.prototype.ValueTypeName="color";class Ic extends gr{}Ic.prototype.ValueTypeName="number";class F2 extends Rc{constructor(e,t,i,r){super(e,t,i,r)}interpolate_(e,t,i,r){const s=this.resultBuffer,o=this.sampleValues,l=this.valueSize,c=(i-t)/(r-t);let f=e*l;for(let d=f+l;f!==d;f+=4)Fn.slerpFlat(s,0,o,f-l,o,f,c);return s}}class kl extends gr{InterpolantFactoryMethodLinear(e){return new F2(this.times,this.values,this.getValueSize(),e)}}kl.prototype.ValueTypeName="quaternion",kl.prototype.DefaultInterpolation=Zu,kl.prototype.InterpolantFactoryMethodSmooth=void 0;class aa extends gr{}aa.prototype.ValueTypeName="string",aa.prototype.ValueBufferType=Array,aa.prototype.DefaultInterpolation=qu,aa.prototype.InterpolantFactoryMethodLinear=void 0,aa.prototype.InterpolantFactoryMethodSmooth=void 0;class Dc extends gr{}Dc.prototype.ValueTypeName="vector";class zc{constructor(e,t=-1,i,r=Id){this.name=e,this.tracks=i,this.duration=t,this.blendMode=r,this.uuid=Mi(),this.duration<0&&this.resetDuration()}static parse(e){const t=[],i=e.tracks,r=1/(e.fps||1);for(let o=0,l=i.length;o!==l;++o)t.push(VD(i[o]).scale(r));const s=new this(e.name,e.duration,t,e.blendMode);return s.uuid=e.uuid,s}static toJSON(e){const t=[],i=e.tracks,r={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid,blendMode:e.blendMode};for(let s=0,o=i.length;s!==o;++s)t.push(gr.toJSON(i[s]));return r}static CreateFromMorphTargetSequence(e,t,i,r){const s=t.length,o=[];for(let l=0;l<s;l++){let c=[],f=[];c.push((l+s-1)%s,l,(l+1)%s),f.push(0,1,0);const d=N2(c);c=Xv(c,1,d),f=Xv(f,1,d),!r&&c[0]===0&&(c.push(s),f.push(f[0])),o.push(new Ic(".morphTargetInfluences["+t[l].name+"]",c,f).scale(1/i))}return new this(e,-1,o)}static findByName(e,t){let i=e;if(!Array.isArray(e)){const r=e;i=r.geometry&&r.geometry.animations||r.animations}for(let r=0;r<i.length;r++)if(i[r].name===t)return i[r];return null}static CreateClipsFromMorphTargetSequences(e,t,i){const r={},s=/^([\w-]*?)([\d]+)$/;for(let l=0,c=e.length;l<c;l++){const f=e[l],d=f.name.match(s);if(d&&d.length>1){const h=d[1];let m=r[h];m||(r[h]=m=[]),m.push(f)}}const o=[];for(const l in r)o.push(this.CreateFromMorphTargetSequence(l,r[l],t,i));return o}static parseAnimation(e,t){if(!e)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;const i=function(h,m,g,x,y){if(g.length!==0){const w=[],_=[];jv(g,w,_,x),w.length!==0&&y.push(new h(m,w,_))}},r=[],s=e.name||"default",o=e.fps||30,l=e.blendMode;let c=e.length||-1;const f=e.hierarchy||[];for(let h=0;h<f.length;h++){const m=f[h].keys;if(!(!m||m.length===0))if(m[0].morphTargets){const g={};let x;for(x=0;x<m.length;x++)if(m[x].morphTargets)for(let y=0;y<m[x].morphTargets.length;y++)g[m[x].morphTargets[y]]=-1;for(const y in g){const w=[],_=[];for(let S=0;S!==m[x].morphTargets.length;++S){const E=m[x];w.push(E.time),_.push(E.morphTarget===y?1:0)}r.push(new Ic(".morphTargetInfluence["+y+"]",w,_))}c=g.length*o}else{const g=".bones["+t[h].name+"]";i(Dc,g+".position",m,"pos",r),i(kl,g+".quaternion",m,"rot",r),i(Dc,g+".scale",m,"scl",r)}}return r.length===0?null:new this(s,c,r,l)}resetDuration(){const e=this.tracks;let t=0;for(let i=0,r=e.length;i!==r;++i){const s=this.tracks[i];t=Math.max(t,s.times[s.times.length-1])}return this.duration=t,this}trim(){for(let e=0;e<this.tracks.length;e++)this.tracks[e].trim(0,this.duration);return this}validate(){let e=!0;for(let t=0;t<this.tracks.length;t++)e=e&&this.tracks[t].validate();return e}optimize(){for(let e=0;e<this.tracks.length;e++)this.tracks[e].optimize();return this}clone(){const e=[];for(let t=0;t<this.tracks.length;t++)e.push(this.tracks[t].clone());return new this.constructor(this.name,this.duration,e,this.blendMode)}toJSON(){return this.constructor.toJSON(this)}}function BD(n){switch(n.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return Ic;case"vector":case"vector2":case"vector3":case"vector4":return Dc;case"color":return qv;case"quaternion":return kl;case"bool":case"boolean":return oa;case"string":return aa}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+n)}function VD(n){if(n.type===void 0)throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");const e=BD(n.type);if(n.times===void 0){const t=[],i=[];jv(n.keys,t,i,"value"),n.times=t,n.values=i}return e.parse!==void 0?e.parse(n):new e(n.name,n.times,n.values,n.interpolation)}const la={enabled:!1,files:{},add:function(n,e){this.enabled!==!1&&(this.files[n]=e)},get:function(n){if(this.enabled!==!1)return this.files[n]},remove:function(n){delete this.files[n]},clear:function(){this.files={}}};class Zv{constructor(e,t,i){const r=this;let s=!1,o=0,l=0,c;const f=[];this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=i,this.itemStart=function(d){l++,s===!1&&r.onStart!==void 0&&r.onStart(d,o,l),s=!0},this.itemEnd=function(d){o++,r.onProgress!==void 0&&r.onProgress(d,o,l),o===l&&(s=!1,r.onLoad!==void 0&&r.onLoad())},this.itemError=function(d){r.onError!==void 0&&r.onError(d)},this.resolveURL=function(d){return c?c(d):d},this.setURLModifier=function(d){return c=d,this},this.addHandler=function(d,h){return f.push(d,h),this},this.removeHandler=function(d){const h=f.indexOf(d);return h!==-1&&f.splice(h,2),this},this.getHandler=function(d){for(let h=0,m=f.length;h<m;h+=2){const g=f[h],x=f[h+1];if(g.global&&(g.lastIndex=0),g.test(d))return x}return null}}}const U2=new Zv;class Ai{constructor(e){this.manager=e!==void 0?e:U2,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}load(){}loadAsync(e,t){const i=this;return new Promise(function(r,s){i.load(e,r,t,s)})}parse(){}setCrossOrigin(e){return this.crossOrigin=e,this}setWithCredentials(e){return this.withCredentials=e,this}setPath(e){return this.path=e,this}setResourcePath(e){return this.resourcePath=e,this}setRequestHeader(e){return this.requestHeader=e,this}}const cs={};class HD extends Error{constructor(e,t){super(e),this.response=t}}class fs extends Ai{constructor(e){super(e)}load(e,t,i,r){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const s=la.get(e);if(s!==void 0)return this.manager.itemStart(e),setTimeout(()=>{t&&t(s),this.manager.itemEnd(e)},0),s;if(cs[e]!==void 0){cs[e].push({onLoad:t,onProgress:i,onError:r});return}cs[e]=[],cs[e].push({onLoad:t,onProgress:i,onError:r});const o=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin"}),l=this.mimeType,c=this.responseType;fetch(o).then(f=>{if(f.status===200||f.status===0){if(f.status===0&&console.warn("THREE.FileLoader: HTTP Status 0 received."),typeof ReadableStream>"u"||f.body===void 0||f.body.getReader===void 0)return f;const d=cs[e],h=f.body.getReader(),m=f.headers.get("Content-Length"),g=m?parseInt(m):0,x=g!==0;let y=0;const w=new ReadableStream({start(_){S();function S(){h.read().then(({done:E,value:T})=>{if(E)_.close();else{y+=T.byteLength;const C=new ProgressEvent("progress",{lengthComputable:x,loaded:y,total:g});for(let P=0,I=d.length;P<I;P++){const A=d[P];A.onProgress&&A.onProgress(C)}_.enqueue(T),S()}})}}});return new Response(w)}else throw new HD(`fetch for "${f.url}" responded with ${f.status}: ${f.statusText}`,f)}).then(f=>{switch(c){case"arraybuffer":return f.arrayBuffer();case"blob":return f.blob();case"document":return f.text().then(d=>new DOMParser().parseFromString(d,l));case"json":return f.json();default:if(l===void 0)return f.text();{const h=/charset="?([^;"\s]*)"?/i.exec(l),m=h&&h[1]?h[1].toLowerCase():void 0,g=new TextDecoder(m);return f.arrayBuffer().then(x=>g.decode(x))}}}).then(f=>{la.add(e,f);const d=cs[e];delete cs[e];for(let h=0,m=d.length;h<m;h++){const g=d[h];g.onLoad&&g.onLoad(f)}}).catch(f=>{const d=cs[e];if(d===void 0)throw this.manager.itemError(e),f;delete cs[e];for(let h=0,m=d.length;h<m;h++){const g=d[h];g.onError&&g.onError(f)}this.manager.itemError(e)}).finally(()=>{this.manager.itemEnd(e)}),this.manager.itemStart(e)}setResponseType(e){return this.responseType=e,this}setMimeType(e){return this.mimeType=e,this}}class WD extends Ai{constructor(e){super(e)}load(e,t,i,r){const s=this,o=new fs(this.manager);o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(e,function(l){try{t(s.parse(JSON.parse(l)))}catch(c){r?r(c):console.error(c),s.manager.itemError(e)}},i,r)}parse(e){const t=[];for(let i=0;i<e.length;i++){const r=zc.parse(e[i]);t.push(r)}return t}}class GD extends Ai{constructor(e){super(e)}load(e,t,i,r){const s=this,o=[],l=new c2,c=new fs(this.manager);c.setPath(this.path),c.setResponseType("arraybuffer"),c.setRequestHeader(this.requestHeader),c.setWithCredentials(s.withCredentials);let f=0;function d(h){c.load(e[h],function(m){const g=s.parse(m,!0);o[h]={width:g.width,height:g.height,format:g.format,mipmaps:g.mipmaps},f+=1,f===6&&(g.mipmapCount===1&&(l.minFilter=tn),l.image=o,l.format=g.format,l.needsUpdate=!0,t&&t(l))},i,r)}if(Array.isArray(e))for(let h=0,m=e.length;h<m;++h)d(h);else c.load(e,function(h){const m=s.parse(h,!0);if(m.isCubemap){const g=m.mipmaps.length/m.mipmapCount;for(let x=0;x<g;x++){o[x]={mipmaps:[]};for(let y=0;y<m.mipmapCount;y++)o[x].mipmaps.push(m.mipmaps[x*m.mipmapCount+y]),o[x].format=m.format,o[x].width=m.width,o[x].height=m.height}l.image=o}else l.image.width=m.width,l.image.height=m.height,l.mipmaps=m.mipmaps;m.mipmapCount===1&&(l.minFilter=tn),l.format=m.format,l.needsUpdate=!0,t&&t(l)},i,r);return l}}class Nc extends Ai{constructor(e){super(e)}load(e,t,i,r){this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const s=this,o=la.get(e);if(o!==void 0)return s.manager.itemStart(e),setTimeout(function(){t&&t(o),s.manager.itemEnd(e)},0),o;const l=ec("img");function c(){d(),la.add(e,this),t&&t(this),s.manager.itemEnd(e)}function f(h){d(),r&&r(h),s.manager.itemError(e),s.manager.itemEnd(e)}function d(){l.removeEventListener("load",c,!1),l.removeEventListener("error",f,!1)}return l.addEventListener("load",c,!1),l.addEventListener("error",f,!1),e.slice(0,5)!=="data:"&&this.crossOrigin!==void 0&&(l.crossOrigin=this.crossOrigin),s.manager.itemStart(e),l.src=e,l}}class XD extends Ai{constructor(e){super(e)}load(e,t,i,r){const s=new ac,o=new Nc(this.manager);o.setCrossOrigin(this.crossOrigin),o.setPath(this.path);let l=0;function c(f){o.load(e[f],function(d){s.images[f]=d,l++,l===6&&(s.needsUpdate=!0,t&&t(s))},void 0,r)}for(let f=0;f<e.length;++f)c(f);return s}}class jD extends Ai{constructor(e){super(e)}load(e,t,i,r){const s=this,o=new Ll,l=new fs(this.manager);return l.setResponseType("arraybuffer"),l.setRequestHeader(this.requestHeader),l.setPath(this.path),l.setWithCredentials(s.withCredentials),l.load(e,function(c){const f=s.parse(c);!f||(f.image!==void 0?o.image=f.image:f.data!==void 0&&(o.image.width=f.width,o.image.height=f.height,o.image.data=f.data),o.wrapS=f.wrapS!==void 0?f.wrapS:Zn,o.wrapT=f.wrapT!==void 0?f.wrapT:Zn,o.magFilter=f.magFilter!==void 0?f.magFilter:tn,o.minFilter=f.minFilter!==void 0?f.minFilter:tn,o.anisotropy=f.anisotropy!==void 0?f.anisotropy:1,f.encoding!==void 0&&(o.encoding=f.encoding),f.flipY!==void 0&&(o.flipY=f.flipY),f.format!==void 0&&(o.format=f.format),f.type!==void 0&&(o.type=f.type),f.mipmaps!==void 0&&(o.mipmaps=f.mipmaps,o.minFilter=Wo),f.mipmapCount===1&&(o.minFilter=tn),f.generateMipmaps!==void 0&&(o.generateMipmaps=f.generateMipmaps),o.needsUpdate=!0,t&&t(o,f))},i,r),o}}class YD extends Ai{constructor(e){super(e)}load(e,t,i,r){const s=new un,o=new Nc(this.manager);return o.setCrossOrigin(this.crossOrigin),o.setPath(this.path),o.load(e,function(l){s.image=l,s.needsUpdate=!0,t!==void 0&&t(s)},i,r),s}}class uo extends Mt{constructor(e,t=1){super(),this.isLight=!0,this.type="Light",this.color=new De(e),this.intensity=t}dispose(){}copy(e,t){return super.copy(e,t),this.color.copy(e.color),this.intensity=e.intensity,this}toJSON(e){const t=super.toJSON(e);return t.object.color=this.color.getHex(),t.object.intensity=this.intensity,this.groundColor!==void 0&&(t.object.groundColor=this.groundColor.getHex()),this.distance!==void 0&&(t.object.distance=this.distance),this.angle!==void 0&&(t.object.angle=this.angle),this.decay!==void 0&&(t.object.decay=this.decay),this.penumbra!==void 0&&(t.object.penumbra=this.penumbra),this.shadow!==void 0&&(t.object.shadow=this.shadow.toJSON()),t}}class B2 extends uo{constructor(e,t,i){super(e,i),this.isHemisphereLight=!0,this.type="HemisphereLight",this.position.copy(Mt.DefaultUp),this.updateMatrix(),this.groundColor=new De(t)}copy(e,t){return super.copy(e,t),this.groundColor.copy(e.groundColor),this}}const V2=new st,H2=new R,W2=new R;class Jv{constructor(e){this.camera=e,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new fe(512,512),this.map=null,this.mapPass=null,this.matrix=new st,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new rh,this._frameExtents=new fe(1,1),this._viewportCount=1,this._viewports=[new wt(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){const t=this.camera,i=this.matrix;H2.setFromMatrixPosition(e.matrixWorld),t.position.copy(H2),W2.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(W2),t.updateMatrixWorld(),V2.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(V2),i.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),i.multiply(t.projectionMatrix),i.multiply(t.matrixWorldInverse)}getViewport(e){return this._viewports[e]}getFrameExtents(){return this._frameExtents}dispose(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}copy(e){return this.camera=e.camera.clone(),this.bias=e.bias,this.radius=e.radius,this.mapSize.copy(e.mapSize),this}clone(){return new this.constructor().copy(this)}toJSON(){const e={};return this.bias!==0&&(e.bias=this.bias),this.normalBias!==0&&(e.normalBias=this.normalBias),this.radius!==1&&(e.radius=this.radius),(this.mapSize.x!==512||this.mapSize.y!==512)&&(e.mapSize=this.mapSize.toArray()),e.camera=this.camera.toJSON(!1).object,delete e.camera.matrix,e}}class qD extends Jv{constructor(){super(new Bt(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1}updateMatrices(e){const t=this.camera,i=Ku*2*e.angle*this.focus,r=this.mapSize.width/this.mapSize.height,s=e.distance||t.far;(i!==t.fov||r!==t.aspect||s!==t.far)&&(t.fov=i,t.aspect=r,t.far=s,t.updateProjectionMatrix()),super.updateMatrices(e)}copy(e){return super.copy(e),this.focus=e.focus,this}}class G2 extends uo{constructor(e,t,i=0,r=Math.PI/3,s=0,o=1){super(e,t),this.isSpotLight=!0,this.type="SpotLight",this.position.copy(Mt.DefaultUp),this.updateMatrix(),this.target=new Mt,this.distance=i,this.angle=r,this.penumbra=s,this.decay=o,this.map=null,this.shadow=new qD}get power(){return this.intensity*Math.PI}set power(e){this.intensity=e/Math.PI}dispose(){this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.angle=e.angle,this.penumbra=e.penumbra,this.decay=e.decay,this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}const X2=new st,kc=new R,Qv=new R;class ZD extends Jv{constructor(){super(new Bt(90,1,.5,500)),this.isPointLightShadow=!0,this._frameExtents=new fe(4,2),this._viewportCount=6,this._viewports=[new wt(2,1,1,1),new wt(0,1,1,1),new wt(3,1,1,1),new wt(1,1,1,1),new wt(3,0,1,1),new wt(1,0,1,1)],this._cubeDirections=[new R(1,0,0),new R(-1,0,0),new R(0,0,1),new R(0,0,-1),new R(0,1,0),new R(0,-1,0)],this._cubeUps=[new R(0,1,0),new R(0,1,0),new R(0,1,0),new R(0,1,0),new R(0,0,1),new R(0,0,-1)]}updateMatrices(e,t=0){const i=this.camera,r=this.matrix,s=e.distance||i.far;s!==i.far&&(i.far=s,i.updateProjectionMatrix()),kc.setFromMatrixPosition(e.matrixWorld),i.position.copy(kc),Qv.copy(i.position),Qv.add(this._cubeDirections[t]),i.up.copy(this._cubeUps[t]),i.lookAt(Qv),i.updateMatrixWorld(),r.makeTranslation(-kc.x,-kc.y,-kc.z),X2.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse),this._frustum.setFromProjectionMatrix(X2)}}class j2 extends uo{constructor(e,t,i=0,r=1){super(e,t),this.isPointLight=!0,this.type="PointLight",this.distance=i,this.decay=r,this.shadow=new ZD}get power(){return this.intensity*4*Math.PI}set power(e){this.intensity=e/(4*Math.PI)}dispose(){this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.decay=e.decay,this.shadow=e.shadow.clone(),this}}class JD extends Jv{constructor(){super(new oo(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}}class Y2 extends uo{constructor(e,t){super(e,t),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(Mt.DefaultUp),this.updateMatrix(),this.target=new Mt,this.shadow=new JD}dispose(){this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}class q2 extends uo{constructor(e,t){super(e,t),this.isAmbientLight=!0,this.type="AmbientLight"}}class Z2 extends uo{constructor(e,t,i=10,r=10){super(e,t),this.isRectAreaLight=!0,this.type="RectAreaLight",this.width=i,this.height=r}get power(){return this.intensity*this.width*this.height*Math.PI}set power(e){this.intensity=e/(this.width*this.height*Math.PI)}copy(e){return super.copy(e),this.width=e.width,this.height=e.height,this}toJSON(e){const t=super.toJSON(e);return t.object.width=this.width,t.object.height=this.height,t}}class J2{constructor(){this.isSphericalHarmonics3=!0,this.coefficients=[];for(let e=0;e<9;e++)this.coefficients.push(new R)}set(e){for(let t=0;t<9;t++)this.coefficients[t].copy(e[t]);return this}zero(){for(let e=0;e<9;e++)this.coefficients[e].set(0,0,0);return this}getAt(e,t){const i=e.x,r=e.y,s=e.z,o=this.coefficients;return t.copy(o[0]).multiplyScalar(.282095),t.addScaledVector(o[1],.488603*r),t.addScaledVector(o[2],.488603*s),t.addScaledVector(o[3],.488603*i),t.addScaledVector(o[4],1.092548*(i*r)),t.addScaledVector(o[5],1.092548*(r*s)),t.addScaledVector(o[6],.315392*(3*s*s-1)),t.addScaledVector(o[7],1.092548*(i*s)),t.addScaledVector(o[8],.546274*(i*i-r*r)),t}getIrradianceAt(e,t){const i=e.x,r=e.y,s=e.z,o=this.coefficients;return t.copy(o[0]).multiplyScalar(.886227),t.addScaledVector(o[1],2*.511664*r),t.addScaledVector(o[2],2*.511664*s),t.addScaledVector(o[3],2*.511664*i),t.addScaledVector(o[4],2*.429043*i*r),t.addScaledVector(o[5],2*.429043*r*s),t.addScaledVector(o[6],.743125*s*s-.247708),t.addScaledVector(o[7],2*.429043*i*s),t.addScaledVector(o[8],.429043*(i*i-r*r)),t}add(e){for(let t=0;t<9;t++)this.coefficients[t].add(e.coefficients[t]);return this}addScaledSH(e,t){for(let i=0;i<9;i++)this.coefficients[i].addScaledVector(e.coefficients[i],t);return this}scale(e){for(let t=0;t<9;t++)this.coefficients[t].multiplyScalar(e);return this}lerp(e,t){for(let i=0;i<9;i++)this.coefficients[i].lerp(e.coefficients[i],t);return this}equals(e){for(let t=0;t<9;t++)if(!this.coefficients[t].equals(e.coefficients[t]))return!1;return!0}copy(e){return this.set(e.coefficients)}clone(){return new this.constructor().copy(this)}fromArray(e,t=0){const i=this.coefficients;for(let r=0;r<9;r++)i[r].fromArray(e,t+r*3);return this}toArray(e=[],t=0){const i=this.coefficients;for(let r=0;r<9;r++)i[r].toArray(e,t+r*3);return e}static getBasisAt(e,t){const i=e.x,r=e.y,s=e.z;t[0]=.282095,t[1]=.488603*r,t[2]=.488603*s,t[3]=.488603*i,t[4]=1.092548*i*r,t[5]=1.092548*r*s,t[6]=.315392*(3*s*s-1),t[7]=1.092548*i*s,t[8]=.546274*(i*i-r*r)}}class Ph extends uo{constructor(e=new J2,t=1){super(void 0,t),this.isLightProbe=!0,this.sh=e}copy(e){return super.copy(e),this.sh.copy(e.sh),this}fromJSON(e){return this.intensity=e.intensity,this.sh.fromArray(e.sh),this}toJSON(e){const t=super.toJSON(e);return t.object.sh=this.sh.toArray(),t}}class Lh extends Ai{constructor(e){super(e),this.textures={}}load(e,t,i,r){const s=this,o=new fs(s.manager);o.setPath(s.path),o.setRequestHeader(s.requestHeader),o.setWithCredentials(s.withCredentials),o.load(e,function(l){try{t(s.parse(JSON.parse(l)))}catch(c){r?r(c):console.error(c),s.manager.itemError(e)}},i,r)}parse(e){const t=this.textures;function i(s){return t[s]===void 0&&console.warn("THREE.MaterialLoader: Undefined texture",s),t[s]}const r=Lh.createMaterialFromType(e.type);if(e.uuid!==void 0&&(r.uuid=e.uuid),e.name!==void 0&&(r.name=e.name),e.color!==void 0&&r.color!==void 0&&r.color.setHex(e.color),e.roughness!==void 0&&(r.roughness=e.roughness),e.metalness!==void 0&&(r.metalness=e.metalness),e.sheen!==void 0&&(r.sheen=e.sheen),e.sheenColor!==void 0&&(r.sheenColor=new De().setHex(e.sheenColor)),e.sheenRoughness!==void 0&&(r.sheenRoughness=e.sheenRoughness),e.emissive!==void 0&&r.emissive!==void 0&&r.emissive.setHex(e.emissive),e.specular!==void 0&&r.specular!==void 0&&r.specular.setHex(e.specular),e.specularIntensity!==void 0&&(r.specularIntensity=e.specularIntensity),e.specularColor!==void 0&&r.specularColor!==void 0&&r.specularColor.setHex(e.specularColor),e.shininess!==void 0&&(r.shininess=e.shininess),e.clearcoat!==void 0&&(r.clearcoat=e.clearcoat),e.clearcoatRoughness!==void 0&&(r.clearcoatRoughness=e.clearcoatRoughness),e.iridescence!==void 0&&(r.iridescence=e.iridescence),e.iridescenceIOR!==void 0&&(r.iridescenceIOR=e.iridescenceIOR),e.iridescenceThicknessRange!==void 0&&(r.iridescenceThicknessRange=e.iridescenceThicknessRange),e.transmission!==void 0&&(r.transmission=e.transmission),e.thickness!==void 0&&(r.thickness=e.thickness),e.attenuationDistance!==void 0&&(r.attenuationDistance=e.attenuationDistance),e.attenuationColor!==void 0&&r.attenuationColor!==void 0&&r.attenuationColor.setHex(e.attenuationColor),e.fog!==void 0&&(r.fog=e.fog),e.flatShading!==void 0&&(r.flatShading=e.flatShading),e.blending!==void 0&&(r.blending=e.blending),e.combine!==void 0&&(r.combine=e.combine),e.side!==void 0&&(r.side=e.side),e.shadowSide!==void 0&&(r.shadowSide=e.shadowSide),e.opacity!==void 0&&(r.opacity=e.opacity),e.transparent!==void 0&&(r.transparent=e.transparent),e.alphaTest!==void 0&&(r.alphaTest=e.alphaTest),e.depthTest!==void 0&&(r.depthTest=e.depthTest),e.depthWrite!==void 0&&(r.depthWrite=e.depthWrite),e.colorWrite!==void 0&&(r.colorWrite=e.colorWrite),e.stencilWrite!==void 0&&(r.stencilWrite=e.stencilWrite),e.stencilWriteMask!==void 0&&(r.stencilWriteMask=e.stencilWriteMask),e.stencilFunc!==void 0&&(r.stencilFunc=e.stencilFunc),e.stencilRef!==void 0&&(r.stencilRef=e.stencilRef),e.stencilFuncMask!==void 0&&(r.stencilFuncMask=e.stencilFuncMask),e.stencilFail!==void 0&&(r.stencilFail=e.stencilFail),e.stencilZFail!==void 0&&(r.stencilZFail=e.stencilZFail),e.stencilZPass!==void 0&&(r.stencilZPass=e.stencilZPass),e.wireframe!==void 0&&(r.wireframe=e.wireframe),e.wireframeLinewidth!==void 0&&(r.wireframeLinewidth=e.wireframeLinewidth),e.wireframeLinecap!==void 0&&(r.wireframeLinecap=e.wireframeLinecap),e.wireframeLinejoin!==void 0&&(r.wireframeLinejoin=e.wireframeLinejoin),e.rotation!==void 0&&(r.rotation=e.rotation),e.linewidth!==1&&(r.linewidth=e.linewidth),e.dashSize!==void 0&&(r.dashSize=e.dashSize),e.gapSize!==void 0&&(r.gapSize=e.gapSize),e.scale!==void 0&&(r.scale=e.scale),e.polygonOffset!==void 0&&(r.polygonOffset=e.polygonOffset),e.polygonOffsetFactor!==void 0&&(r.polygonOffsetFactor=e.polygonOffsetFactor),e.polygonOffsetUnits!==void 0&&(r.polygonOffsetUnits=e.polygonOffsetUnits),e.dithering!==void 0&&(r.dithering=e.dithering),e.alphaToCoverage!==void 0&&(r.alphaToCoverage=e.alphaToCoverage),e.premultipliedAlpha!==void 0&&(r.premultipliedAlpha=e.premultipliedAlpha),e.visible!==void 0&&(r.visible=e.visible),e.toneMapped!==void 0&&(r.toneMapped=e.toneMapped),e.userData!==void 0&&(r.userData=e.userData),e.vertexColors!==void 0&&(typeof e.vertexColors=="number"?r.vertexColors=e.vertexColors>0:r.vertexColors=e.vertexColors),e.uniforms!==void 0)for(const s in e.uniforms){const o=e.uniforms[s];switch(r.uniforms[s]={},o.type){case"t":r.uniforms[s].value=i(o.value);break;case"c":r.uniforms[s].value=new De().setHex(o.value);break;case"v2":r.uniforms[s].value=new fe().fromArray(o.value);break;case"v3":r.uniforms[s].value=new R().fromArray(o.value);break;case"v4":r.uniforms[s].value=new wt().fromArray(o.value);break;case"m3":r.uniforms[s].value=new ui().fromArray(o.value);break;case"m4":r.uniforms[s].value=new st().fromArray(o.value);break;default:r.uniforms[s].value=o.value}}if(e.defines!==void 0&&(r.defines=e.defines),e.vertexShader!==void 0&&(r.vertexShader=e.vertexShader),e.fragmentShader!==void 0&&(r.fragmentShader=e.fragmentShader),e.glslVersion!==void 0&&(r.glslVersion=e.glslVersion),e.extensions!==void 0)for(const s in e.extensions)r.extensions[s]=e.extensions[s];if(e.size!==void 0&&(r.size=e.size),e.sizeAttenuation!==void 0&&(r.sizeAttenuation=e.sizeAttenuation),e.map!==void 0&&(r.map=i(e.map)),e.matcap!==void 0&&(r.matcap=i(e.matcap)),e.alphaMap!==void 0&&(r.alphaMap=i(e.alphaMap)),e.bumpMap!==void 0&&(r.bumpMap=i(e.bumpMap)),e.bumpScale!==void 0&&(r.bumpScale=e.bumpScale),e.normalMap!==void 0&&(r.normalMap=i(e.normalMap)),e.normalMapType!==void 0&&(r.normalMapType=e.normalMapType),e.normalScale!==void 0){let s=e.normalScale;Array.isArray(s)===!1&&(s=[s,s]),r.normalScale=new fe().fromArray(s)}return e.displacementMap!==void 0&&(r.displacementMap=i(e.displacementMap)),e.displacementScale!==void 0&&(r.displacementScale=e.displacementScale),e.displacementBias!==void 0&&(r.displacementBias=e.displacementBias),e.roughnessMap!==void 0&&(r.roughnessMap=i(e.roughnessMap)),e.metalnessMap!==void 0&&(r.metalnessMap=i(e.metalnessMap)),e.emissiveMap!==void 0&&(r.emissiveMap=i(e.emissiveMap)),e.emissiveIntensity!==void 0&&(r.emissiveIntensity=e.emissiveIntensity),e.specularMap!==void 0&&(r.specularMap=i(e.specularMap)),e.specularIntensityMap!==void 0&&(r.specularIntensityMap=i(e.specularIntensityMap)),e.specularColorMap!==void 0&&(r.specularColorMap=i(e.specularColorMap)),e.envMap!==void 0&&(r.envMap=i(e.envMap)),e.envMapIntensity!==void 0&&(r.envMapIntensity=e.envMapIntensity),e.reflectivity!==void 0&&(r.reflectivity=e.reflectivity),e.refractionRatio!==void 0&&(r.refractionRatio=e.refractionRatio),e.lightMap!==void 0&&(r.lightMap=i(e.lightMap)),e.lightMapIntensity!==void 0&&(r.lightMapIntensity=e.lightMapIntensity),e.aoMap!==void 0&&(r.aoMap=i(e.aoMap)),e.aoMapIntensity!==void 0&&(r.aoMapIntensity=e.aoMapIntensity),e.gradientMap!==void 0&&(r.gradientMap=i(e.gradientMap)),e.clearcoatMap!==void 0&&(r.clearcoatMap=i(e.clearcoatMap)),e.clearcoatRoughnessMap!==void 0&&(r.clearcoatRoughnessMap=i(e.clearcoatRoughnessMap)),e.clearcoatNormalMap!==void 0&&(r.clearcoatNormalMap=i(e.clearcoatNormalMap)),e.clearcoatNormalScale!==void 0&&(r.clearcoatNormalScale=new fe().fromArray(e.clearcoatNormalScale)),e.iridescenceMap!==void 0&&(r.iridescenceMap=i(e.iridescenceMap)),e.iridescenceThicknessMap!==void 0&&(r.iridescenceThicknessMap=i(e.iridescenceThicknessMap)),e.transmissionMap!==void 0&&(r.transmissionMap=i(e.transmissionMap)),e.thicknessMap!==void 0&&(r.thicknessMap=i(e.thicknessMap)),e.sheenColorMap!==void 0&&(r.sheenColorMap=i(e.sheenColorMap)),e.sheenRoughnessMap!==void 0&&(r.sheenRoughnessMap=i(e.sheenRoughnessMap)),r}setTextures(e){return this.textures=e,this}static createMaterialFromType(e){const t={ShadowMaterial:b2,SpriteMaterial:Ev,RawShaderMaterial:A2,ShaderMaterial:pr,PointsMaterial:Cv,MeshPhysicalMaterial:C2,MeshStandardMaterial:Wv,MeshPhongMaterial:P2,MeshToonMaterial:L2,MeshNormalMaterial:R2,MeshLambertMaterial:I2,MeshDepthMaterial:xv,MeshDistanceMaterial:_v,MeshBasicMaterial:eo,MeshMatcapMaterial:D2,LineDashedMaterial:z2,LineBasicMaterial:ei,Material:Pn};return new t[e]}}class Kv{static decodeText(e){if(typeof TextDecoder<"u")return new TextDecoder().decode(e);let t="";for(let i=0,r=e.length;i<r;i++)t+=String.fromCharCode(e[i]);try{return decodeURIComponent(escape(t))}catch{return t}}static extractUrlBase(e){const t=e.lastIndexOf("/");return t===-1?"./":e.slice(0,t+1)}static resolveURL(e,t){return typeof e!="string"||e===""?"":(/^https?:\/\//i.test(t)&&/^\//.test(e)&&(t=t.replace(/(^https?:\/\/[^\/]+).*/i,"$1")),/^(https?:)?\/\//i.test(e)||/^data:.*,.*$/i.test(e)||/^blob:.*$/i.test(e)?e:t+e)}}class $v extends lt{constructor(){super(),this.isInstancedBufferGeometry=!0,this.type="InstancedBufferGeometry",this.instanceCount=1/0}copy(e){return super.copy(e),this.instanceCount=e.instanceCount,this}clone(){return new this.constructor().copy(this)}toJSON(){const e=super.toJSON(this);return e.instanceCount=this.instanceCount,e.isInstancedBufferGeometry=!0,e}}class ey extends Ai{constructor(e){super(e)}load(e,t,i,r){const s=this,o=new fs(s.manager);o.setPath(s.path),o.setRequestHeader(s.requestHeader),o.setWithCredentials(s.withCredentials),o.load(e,function(l){try{t(s.parse(JSON.parse(l)))}catch(c){r?r(c):console.error(c),s.manager.itemError(e)}},i,r)}parse(e){const t={},i={};function r(g,x){if(t[x]!==void 0)return t[x];const w=g.interleavedBuffers[x],_=s(g,w.buffer),S=sl(w.type,_),E=new ch(S,w.stride);return E.uuid=w.uuid,t[x]=E,E}function s(g,x){if(i[x]!==void 0)return i[x];const w=g.arrayBuffers[x],_=new Uint32Array(w).buffer;return i[x]=_,_}const o=e.isInstancedBufferGeometry?new $v:new lt,l=e.data.index;if(l!==void 0){const g=sl(l.type,l.array);o.setIndex(new It(g,1))}const c=e.data.attributes;for(const g in c){const x=c[g];let y;if(x.isInterleavedBufferAttribute){const w=r(e.data,x.data);y=new bi(w,x.itemSize,x.offset,x.normalized)}else{const w=sl(x.type,x.array),_=x.isInstancedBufferAttribute?Rl:It;y=new _(w,x.itemSize,x.normalized)}x.name!==void 0&&(y.name=x.name),x.usage!==void 0&&y.setUsage(x.usage),x.updateRange!==void 0&&(y.updateRange.offset=x.updateRange.offset,y.updateRange.count=x.updateRange.count),o.setAttribute(g,y)}const f=e.data.morphAttributes;if(f)for(const g in f){const x=f[g],y=[];for(let w=0,_=x.length;w<_;w++){const S=x[w];let E;if(S.isInterleavedBufferAttribute){const T=r(e.data,S.data);E=new bi(T,S.itemSize,S.offset,S.normalized)}else{const T=sl(S.type,S.array);E=new It(T,S.itemSize,S.normalized)}S.name!==void 0&&(E.name=S.name),y.push(E)}o.morphAttributes[g]=y}e.data.morphTargetsRelative&&(o.morphTargetsRelative=!0);const h=e.data.groups||e.data.drawcalls||e.data.offsets;if(h!==void 0)for(let g=0,x=h.length;g!==x;++g){const y=h[g];o.addGroup(y.start,y.count,y.materialIndex)}const m=e.data.boundingSphere;if(m!==void 0){const g=new R;m.center!==void 0&&g.fromArray(m.center),o.boundingSphere=new rs(g,m.radius)}return e.name&&(o.name=e.name),e.userData&&(o.userData=e.userData),o}}class QD extends Ai{constructor(e){super(e)}load(e,t,i,r){const s=this,o=this.path===""?Kv.extractUrlBase(e):this.path;this.resourcePath=this.resourcePath||o;const l=new fs(this.manager);l.setPath(this.path),l.setRequestHeader(this.requestHeader),l.setWithCredentials(this.withCredentials),l.load(e,function(c){let f=null;try{f=JSON.parse(c)}catch(h){r!==void 0&&r(h),console.error("THREE:ObjectLoader: Can't parse "+e+".",h.message);return}const d=f.metadata;if(d===void 0||d.type===void 0||d.type.toLowerCase()==="geometry"){console.error("THREE.ObjectLoader: Can't load "+e);return}s.parse(f,t)},i,r)}async loadAsync(e,t){const i=this,r=this.path===""?Kv.extractUrlBase(e):this.path;this.resourcePath=this.resourcePath||r;const s=new fs(this.manager);s.setPath(this.path),s.setRequestHeader(this.requestHeader),s.setWithCredentials(this.withCredentials);const o=await s.loadAsync(e,t),l=JSON.parse(o),c=l.metadata;if(c===void 0||c.type===void 0||c.type.toLowerCase()==="geometry")throw new Error("THREE.ObjectLoader: Can't load "+e);return await i.parseAsync(l)}parse(e,t){const i=this.parseAnimations(e.animations),r=this.parseShapes(e.shapes),s=this.parseGeometries(e.geometries,r),o=this.parseImages(e.images,function(){t!==void 0&&t(f)}),l=this.parseTextures(e.textures,o),c=this.parseMaterials(e.materials,l),f=this.parseObject(e.object,s,c,l,i),d=this.parseSkeletons(e.skeletons,f);if(this.bindSkeletons(f,d),t!==void 0){let h=!1;for(const m in o)if(o[m].data instanceof HTMLImageElement){h=!0;break}h===!1&&t(f)}return f}async parseAsync(e){const t=this.parseAnimations(e.animations),i=this.parseShapes(e.shapes),r=this.parseGeometries(e.geometries,i),s=await this.parseImagesAsync(e.images),o=this.parseTextures(e.textures,s),l=this.parseMaterials(e.materials,o),c=this.parseObject(e.object,r,l,o,t),f=this.parseSkeletons(e.skeletons,c);return this.bindSkeletons(c,f),c}parseShapes(e){const t={};if(e!==void 0)for(let i=0,r=e.length;i<r;i++){const s=new ra().fromJSON(e[i]);t[s.uuid]=s}return t}parseSkeletons(e,t){const i={},r={};if(t.traverse(function(s){s.isBone&&(r[s.uuid]=s)}),e!==void 0)for(let s=0,o=e.length;s<o;s++){const l=new mh().fromJSON(e[s],r);i[l.uuid]=l}return i}parseGeometries(e,t){const i={};if(e!==void 0){const r=new ey;for(let s=0,o=e.length;s<o;s++){let l;const c=e[s];switch(c.type){case"BufferGeometry":case"InstancedBufferGeometry":l=r.parse(c);break;default:c.type in T2?l=T2[c.type].fromJSON(c,t):console.warn(`THREE.ObjectLoader: Unsupported geometry type "${c.type}"`)}l.uuid=c.uuid,c.name!==void 0&&(l.name=c.name),l.isBufferGeometry===!0&&c.userData!==void 0&&(l.userData=c.userData),i[c.uuid]=l}}return i}parseMaterials(e,t){const i={},r={};if(e!==void 0){const s=new Lh;s.setTextures(t);for(let o=0,l=e.length;o<l;o++){const c=e[o];i[c.uuid]===void 0&&(i[c.uuid]=s.parse(c)),r[c.uuid]=i[c.uuid]}}return r}parseAnimations(e){const t={};if(e!==void 0)for(let i=0;i<e.length;i++){const r=e[i],s=zc.parse(r);t[s.uuid]=s}return t}parseImages(e,t){const i=this,r={};let s;function o(c){return i.manager.itemStart(c),s.load(c,function(){i.manager.itemEnd(c)},void 0,function(){i.manager.itemError(c),i.manager.itemEnd(c)})}function l(c){if(typeof c=="string"){const f=c,d=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(f)?f:i.resourcePath+f;return o(d)}else return c.data?{data:sl(c.type,c.data),width:c.width,height:c.height}:null}if(e!==void 0&&e.length>0){const c=new Zv(t);s=new Nc(c),s.setCrossOrigin(this.crossOrigin);for(let f=0,d=e.length;f<d;f++){const h=e[f],m=h.url;if(Array.isArray(m)){const g=[];for(let x=0,y=m.length;x<y;x++){const w=m[x],_=l(w);_!==null&&(_ instanceof HTMLImageElement?g.push(_):g.push(new Ll(_.data,_.width,_.height)))}r[h.uuid]=new Jo(g)}else{const g=l(h.url);r[h.uuid]=new Jo(g)}}}return r}async parseImagesAsync(e){const t=this,i={};let r;async function s(o){if(typeof o=="string"){const l=o,c=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(l)?l:t.resourcePath+l;return await r.loadAsync(c)}else return o.data?{data:sl(o.type,o.data),width:o.width,height:o.height}:null}if(e!==void 0&&e.length>0){r=new Nc(this.manager),r.setCrossOrigin(this.crossOrigin);for(let o=0,l=e.length;o<l;o++){const c=e[o],f=c.url;if(Array.isArray(f)){const d=[];for(let h=0,m=f.length;h<m;h++){const g=f[h],x=await s(g);x!==null&&(x instanceof HTMLImageElement?d.push(x):d.push(new Ll(x.data,x.width,x.height)))}i[c.uuid]=new Jo(d)}else{const d=await s(c.url);i[c.uuid]=new Jo(d)}}}return i}parseTextures(e,t){function i(s,o){return typeof s=="number"?s:(console.warn("THREE.ObjectLoader.parseTexture: Constant should be in numeric form.",s),o[s])}const r={};if(e!==void 0)for(let s=0,o=e.length;s<o;s++){const l=e[s];l.image===void 0&&console.warn('THREE.ObjectLoader: No "image" specified for',l.uuid),t[l.image]===void 0&&console.warn("THREE.ObjectLoader: Undefined image",l.image);const c=t[l.image],f=c.data;let d;Array.isArray(f)?(d=new ac,f.length===6&&(d.needsUpdate=!0)):(f&&f.data?d=new Ll:d=new un,f&&(d.needsUpdate=!0)),d.source=c,d.uuid=l.uuid,l.name!==void 0&&(d.name=l.name),l.mapping!==void 0&&(d.mapping=i(l.mapping,KD)),l.offset!==void 0&&d.offset.fromArray(l.offset),l.repeat!==void 0&&d.repeat.fromArray(l.repeat),l.center!==void 0&&d.center.fromArray(l.center),l.rotation!==void 0&&(d.rotation=l.rotation),l.wrap!==void 0&&(d.wrapS=i(l.wrap[0],Q2),d.wrapT=i(l.wrap[1],Q2)),l.format!==void 0&&(d.format=l.format),l.type!==void 0&&(d.type=l.type),l.encoding!==void 0&&(d.encoding=l.encoding),l.minFilter!==void 0&&(d.minFilter=i(l.minFilter,K2)),l.magFilter!==void 0&&(d.magFilter=i(l.magFilter,K2)),l.anisotropy!==void 0&&(d.anisotropy=l.anisotropy),l.flipY!==void 0&&(d.flipY=l.flipY),l.premultiplyAlpha!==void 0&&(d.premultiplyAlpha=l.premultiplyAlpha),l.unpackAlignment!==void 0&&(d.unpackAlignment=l.unpackAlignment),l.userData!==void 0&&(d.userData=l.userData),r[l.uuid]=d}return r}parseObject(e,t,i,r,s){let o;function l(m){return t[m]===void 0&&console.warn("THREE.ObjectLoader: Undefined geometry",m),t[m]}function c(m){if(m!==void 0){if(Array.isArray(m)){const g=[];for(let x=0,y=m.length;x<y;x++){const w=m[x];i[w]===void 0&&console.warn("THREE.ObjectLoader: Undefined material",w),g.push(i[w])}return g}return i[m]===void 0&&console.warn("THREE.ObjectLoader: Undefined material",m),i[m]}}function f(m){return r[m]===void 0&&console.warn("THREE.ObjectLoader: Undefined texture",m),r[m]}let d,h;switch(e.type){case"Scene":o=new Mv,e.background!==void 0&&(Number.isInteger(e.background)?o.background=new De(e.background):o.background=f(e.background)),e.environment!==void 0&&(o.environment=f(e.environment)),e.fog!==void 0&&(e.fog.type==="Fog"?o.fog=new uh(e.fog.color,e.fog.near,e.fog.far):e.fog.type==="FogExp2"&&(o.fog=new lh(e.fog.color,e.fog.density)));break;case"PerspectiveCamera":o=new Bt(e.fov,e.aspect,e.near,e.far),e.focus!==void 0&&(o.focus=e.focus),e.zoom!==void 0&&(o.zoom=e.zoom),e.filmGauge!==void 0&&(o.filmGauge=e.filmGauge),e.filmOffset!==void 0&&(o.filmOffset=e.filmOffset),e.view!==void 0&&(o.view=Object.assign({},e.view));break;case"OrthographicCamera":o=new oo(e.left,e.right,e.top,e.bottom,e.near,e.far),e.zoom!==void 0&&(o.zoom=e.zoom),e.view!==void 0&&(o.view=Object.assign({},e.view));break;case"AmbientLight":o=new q2(e.color,e.intensity);break;case"DirectionalLight":o=new Y2(e.color,e.intensity);break;case"PointLight":o=new j2(e.color,e.intensity,e.distance,e.decay);break;case"RectAreaLight":o=new Z2(e.color,e.intensity,e.width,e.height);break;case"SpotLight":o=new G2(e.color,e.intensity,e.distance,e.angle,e.penumbra,e.decay);break;case"HemisphereLight":o=new B2(e.color,e.groundColor,e.intensity);break;case"LightProbe":o=new Ph().fromJSON(e);break;case"SkinnedMesh":d=l(e.geometry),h=c(e.material),o=new JM(d,h),e.bindMode!==void 0&&(o.bindMode=e.bindMode),e.bindMatrix!==void 0&&o.bindMatrix.fromArray(e.bindMatrix),e.skeleton!==void 0&&(o.skeleton=e.skeleton);break;case"Mesh":d=l(e.geometry),h=c(e.material),o=new wn(d,h);break;case"InstancedMesh":d=l(e.geometry),h=c(e.material);const m=e.count,g=e.instanceMatrix,x=e.instanceColor;o=new e2(d,h,m),o.instanceMatrix=new Rl(new Float32Array(g.array),16),x!==void 0&&(o.instanceColor=new Rl(new Float32Array(x.array),x.itemSize));break;case"LOD":o=new XM;break;case"Line":o=new ao(l(e.geometry),c(e.material));break;case"LineLoop":o=new o2(l(e.geometry),c(e.material));break;case"LineSegments":o=new Pr(l(e.geometry),c(e.material));break;case"PointCloud":case"Points":o=new l2(l(e.geometry),c(e.material));break;case"Sprite":o=new WM(c(e.material));break;case"Group":o=new Tl;break;case"Bone":o=new bv;break;default:o=new Mt}if(o.uuid=e.uuid,e.name!==void 0&&(o.name=e.name),e.matrix!==void 0?(o.matrix.fromArray(e.matrix),e.matrixAutoUpdate!==void 0&&(o.matrixAutoUpdate=e.matrixAutoUpdate),o.matrixAutoUpdate&&o.matrix.decompose(o.position,o.quaternion,o.scale)):(e.position!==void 0&&o.position.fromArray(e.position),e.rotation!==void 0&&o.rotation.fromArray(e.rotation),e.quaternion!==void 0&&o.quaternion.fromArray(e.quaternion),e.scale!==void 0&&o.scale.fromArray(e.scale)),e.castShadow!==void 0&&(o.castShadow=e.castShadow),e.receiveShadow!==void 0&&(o.receiveShadow=e.receiveShadow),e.shadow&&(e.shadow.bias!==void 0&&(o.shadow.bias=e.shadow.bias),e.shadow.normalBias!==void 0&&(o.shadow.normalBias=e.shadow.normalBias),e.shadow.radius!==void 0&&(o.shadow.radius=e.shadow.radius),e.shadow.mapSize!==void 0&&o.shadow.mapSize.fromArray(e.shadow.mapSize),e.shadow.camera!==void 0&&(o.shadow.camera=this.parseObject(e.shadow.camera))),e.visible!==void 0&&(o.visible=e.visible),e.frustumCulled!==void 0&&(o.frustumCulled=e.frustumCulled),e.renderOrder!==void 0&&(o.renderOrder=e.renderOrder),e.userData!==void 0&&(o.userData=e.userData),e.layers!==void 0&&(o.layers.mask=e.layers),e.children!==void 0){const m=e.children;for(let g=0;g<m.length;g++)o.add(this.parseObject(m[g],t,i,r,s))}if(e.animations!==void 0){const m=e.animations;for(let g=0;g<m.length;g++){const x=m[g];o.animations.push(s[x])}}if(e.type==="LOD"){e.autoUpdate!==void 0&&(o.autoUpdate=e.autoUpdate);const m=e.levels;for(let g=0;g<m.length;g++){const x=m[g],y=o.getObjectByProperty("uuid",x.object);y!==void 0&&o.addLevel(y,x.distance)}}return o}bindSkeletons(e,t){Object.keys(t).length!==0&&e.traverse(function(i){if(i.isSkinnedMesh===!0&&i.skeleton!==void 0){const r=t[i.skeleton];r===void 0?console.warn("THREE.ObjectLoader: No skeleton found with UUID:",i.skeleton):i.bind(r,i.bindMatrix)}})}}const KD={UVMapping:Ed,CubeReflectionMapping:Ws,CubeRefractionMapping:Gs,EquirectangularReflectionMapping:Gu,EquirectangularRefractionMapping:Xu,CubeUVReflectionMapping:il},Q2={RepeatWrapping:ju,ClampToEdgeWrapping:Zn,MirroredRepeatWrapping:Yu},K2={NearestFilter:ln,NearestMipmapNearestFilter:Td,NearestMipmapLinearFilter:bd,LinearFilter:tn,LinearMipmapNearestFilter:g0,LinearMipmapLinearFilter:Wo};class $D extends Ai{constructor(e){super(e),this.isImageBitmapLoader=!0,typeof createImageBitmap>"u"&&console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported."),typeof fetch>"u"&&console.warn("THREE.ImageBitmapLoader: fetch() not supported."),this.options={premultiplyAlpha:"none"}}setOptions(e){return this.options=e,this}load(e,t,i,r){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const s=this,o=la.get(e);if(o!==void 0)return s.manager.itemStart(e),setTimeout(function(){t&&t(o),s.manager.itemEnd(e)},0),o;const l={};l.credentials=this.crossOrigin==="anonymous"?"same-origin":"include",l.headers=this.requestHeader,fetch(e,l).then(function(c){return c.blob()}).then(function(c){return createImageBitmap(c,Object.assign(s.options,{colorSpaceConversion:"none"}))}).then(function(c){la.add(e,c),t&&t(c),s.manager.itemEnd(e)}).catch(function(c){r&&r(c),s.manager.itemError(e),s.manager.itemEnd(e)}),s.manager.itemStart(e)}}let Rh;const ty={getContext:function(){return Rh===void 0&&(Rh=new(window.AudioContext||window.webkitAudioContext)),Rh},setContext:function(n){Rh=n}};class ez extends Ai{constructor(e){super(e)}load(e,t,i,r){const s=this,o=new fs(this.manager);o.setResponseType("arraybuffer"),o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(e,function(l){try{const c=l.slice(0);ty.getContext().decodeAudioData(c,function(d){t(d)})}catch(c){r?r(c):console.error(c),s.manager.itemError(e)}},i,r)}}class tz extends Ph{constructor(e,t,i=1){super(void 0,i),this.isHemisphereLightProbe=!0;const r=new De().set(e),s=new De().set(t),o=new R(r.r,r.g,r.b),l=new R(s.r,s.g,s.b),c=Math.sqrt(Math.PI),f=c*Math.sqrt(.75);this.sh.coefficients[0].copy(o).add(l).multiplyScalar(c),this.sh.coefficients[1].copy(o).sub(l).multiplyScalar(f)}}class nz extends Ph{constructor(e,t=1){super(void 0,t),this.isAmbientLightProbe=!0;const i=new De().set(e);this.sh.coefficients[0].set(i.r,i.g,i.b).multiplyScalar(2*Math.sqrt(Math.PI))}}const $2=new st,eE=new st,ua=new st;class iz{constructor(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new Bt,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new Bt,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}}update(e){const t=this._cache;if(t.focus!==e.focus||t.fov!==e.fov||t.aspect!==e.aspect*this.aspect||t.near!==e.near||t.far!==e.far||t.zoom!==e.zoom||t.eyeSep!==this.eyeSep){t.focus=e.focus,t.fov=e.fov,t.aspect=e.aspect*this.aspect,t.near=e.near,t.far=e.far,t.zoom=e.zoom,t.eyeSep=this.eyeSep,ua.copy(e.projectionMatrix);const r=t.eyeSep/2,s=r*t.near/t.focus,o=t.near*Math.tan(qo*t.fov*.5)/t.zoom;let l,c;eE.elements[12]=-r,$2.elements[12]=r,l=-o*t.aspect+s,c=o*t.aspect+s,ua.elements[0]=2*t.near/(c-l),ua.elements[8]=(c+l)/(c-l),this.cameraL.projectionMatrix.copy(ua),l=-o*t.aspect-s,c=o*t.aspect-s,ua.elements[0]=2*t.near/(c-l),ua.elements[8]=(c+l)/(c-l),this.cameraR.projectionMatrix.copy(ua)}this.cameraL.matrixWorld.copy(e.matrixWorld).multiply(eE),this.cameraR.matrixWorld.copy(e.matrixWorld).multiply($2)}}class ny{constructor(e=!0){this.autoStart=e,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}start(){this.startTime=tE(),this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0}stop(){this.getElapsedTime(),this.running=!1,this.autoStart=!1}getElapsedTime(){return this.getDelta(),this.elapsedTime}getDelta(){let e=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){const t=tE();e=(t-this.oldTime)/1e3,this.oldTime=t,this.elapsedTime+=e}return e}}function tE(){return(typeof performance>"u"?Date:performance).now()}const ca=new R,nE=new Fn,rz=new R,fa=new R;class sz extends Mt{constructor(){super(),this.type="AudioListener",this.context=ty.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null,this.timeDelta=0,this._clock=new ny}getInput(){return this.gain}removeFilter(){return this.filter!==null&&(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination),this.gain.connect(this.context.destination),this.filter=null),this}getFilter(){return this.filter}setFilter(e){return this.filter!==null?(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination)):this.gain.disconnect(this.context.destination),this.filter=e,this.gain.connect(this.filter),this.filter.connect(this.context.destination),this}getMasterVolume(){return this.gain.gain.value}setMasterVolume(e){return this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01),this}updateMatrixWorld(e){super.updateMatrixWorld(e);const t=this.context.listener,i=this.up;if(this.timeDelta=this._clock.getDelta(),this.matrixWorld.decompose(ca,nE,rz),fa.set(0,0,-1).applyQuaternion(nE),t.positionX){const r=this.context.currentTime+this.timeDelta;t.positionX.linearRampToValueAtTime(ca.x,r),t.positionY.linearRampToValueAtTime(ca.y,r),t.positionZ.linearRampToValueAtTime(ca.z,r),t.forwardX.linearRampToValueAtTime(fa.x,r),t.forwardY.linearRampToValueAtTime(fa.y,r),t.forwardZ.linearRampToValueAtTime(fa.z,r),t.upX.linearRampToValueAtTime(i.x,r),t.upY.linearRampToValueAtTime(i.y,r),t.upZ.linearRampToValueAtTime(i.z,r)}else t.setPosition(ca.x,ca.y,ca.z),t.setOrientation(fa.x,fa.y,fa.z,i.x,i.y,i.z)}}class iE extends Mt{constructor(e){super(),this.type="Audio",this.listener=e,this.context=e.context,this.gain=this.context.createGain(),this.gain.connect(e.getInput()),this.autoplay=!1,this.buffer=null,this.detune=0,this.loop=!1,this.loopStart=0,this.loopEnd=0,this.offset=0,this.duration=void 0,this.playbackRate=1,this.isPlaying=!1,this.hasPlaybackControl=!0,this.source=null,this.sourceType="empty",this._startedAt=0,this._progress=0,this._connected=!1,this.filters=[]}getOutput(){return this.gain}setNodeSource(e){return this.hasPlaybackControl=!1,this.sourceType="audioNode",this.source=e,this.connect(),this}setMediaElementSource(e){return this.hasPlaybackControl=!1,this.sourceType="mediaNode",this.source=this.context.createMediaElementSource(e),this.connect(),this}setMediaStreamSource(e){return this.hasPlaybackControl=!1,this.sourceType="mediaStreamNode",this.source=this.context.createMediaStreamSource(e),this.connect(),this}setBuffer(e){return this.buffer=e,this.sourceType="buffer",this.autoplay&&this.play(),this}play(e=0){if(this.isPlaying===!0){console.warn("THREE.Audio: Audio is already playing.");return}if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}this._startedAt=this.context.currentTime+e;const t=this.context.createBufferSource();return t.buffer=this.buffer,t.loop=this.loop,t.loopStart=this.loopStart,t.loopEnd=this.loopEnd,t.onended=this.onEnded.bind(this),t.start(this._startedAt,this._progress+this.offset,this.duration),this.isPlaying=!0,this.source=t,this.setDetune(this.detune),this.setPlaybackRate(this.playbackRate),this.connect()}pause(){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this.isPlaying===!0&&(this._progress+=Math.max(this.context.currentTime-this._startedAt,0)*this.playbackRate,this.loop===!0&&(this._progress=this._progress%(this.duration||this.buffer.duration)),this.source.stop(),this.source.onended=null,this.isPlaying=!1),this}stop(){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this._progress=0,this.source.stop(),this.source.onended=null,this.isPlaying=!1,this}connect(){if(this.filters.length>0){this.source.connect(this.filters[0]);for(let e=1,t=this.filters.length;e<t;e++)this.filters[e-1].connect(this.filters[e]);this.filters[this.filters.length-1].connect(this.getOutput())}else this.source.connect(this.getOutput());return this._connected=!0,this}disconnect(){if(this.filters.length>0){this.source.disconnect(this.filters[0]);for(let e=1,t=this.filters.length;e<t;e++)this.filters[e-1].disconnect(this.filters[e]);this.filters[this.filters.length-1].disconnect(this.getOutput())}else this.source.disconnect(this.getOutput());return this._connected=!1,this}getFilters(){return this.filters}setFilters(e){return e||(e=[]),this._connected===!0?(this.disconnect(),this.filters=e.slice(),this.connect()):this.filters=e.slice(),this}setDetune(e){if(this.detune=e,this.source.detune!==void 0)return this.isPlaying===!0&&this.source.detune.setTargetAtTime(this.detune,this.context.currentTime,.01),this}getDetune(){return this.detune}getFilter(){return this.getFilters()[0]}setFilter(e){return this.setFilters(e?[e]:[])}setPlaybackRate(e){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this.playbackRate=e,this.isPlaying===!0&&this.source.playbackRate.setTargetAtTime(this.playbackRate,this.context.currentTime,.01),this}getPlaybackRate(){return this.playbackRate}onEnded(){this.isPlaying=!1}getLoop(){return this.hasPlaybackControl===!1?(console.warn("THREE.Audio: this Audio has no playback control."),!1):this.loop}setLoop(e){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this.loop=e,this.isPlaying===!0&&(this.source.loop=this.loop),this}setLoopStart(e){return this.loopStart=e,this}setLoopEnd(e){return this.loopEnd=e,this}getVolume(){return this.gain.gain.value}setVolume(e){return this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01),this}}const da=new R,rE=new Fn,oz=new R,ha=new R;class az extends iE{constructor(e){super(e),this.panner=this.context.createPanner(),this.panner.panningModel="HRTF",this.panner.connect(this.gain)}disconnect(){super.disconnect(),this.panner.disconnect(this.gain)}getOutput(){return this.panner}getRefDistance(){return this.panner.refDistance}setRefDistance(e){return this.panner.refDistance=e,this}getRolloffFactor(){return this.panner.rolloffFactor}setRolloffFactor(e){return this.panner.rolloffFactor=e,this}getDistanceModel(){return this.panner.distanceModel}setDistanceModel(e){return this.panner.distanceModel=e,this}getMaxDistance(){return this.panner.maxDistance}setMaxDistance(e){return this.panner.maxDistance=e,this}setDirectionalCone(e,t,i){return this.panner.coneInnerAngle=e,this.panner.coneOuterAngle=t,this.panner.coneOuterGain=i,this}updateMatrixWorld(e){if(super.updateMatrixWorld(e),this.hasPlaybackControl===!0&&this.isPlaying===!1)return;this.matrixWorld.decompose(da,rE,oz),ha.set(0,0,1).applyQuaternion(rE);const t=this.panner;if(t.positionX){const i=this.context.currentTime+this.listener.timeDelta;t.positionX.linearRampToValueAtTime(da.x,i),t.positionY.linearRampToValueAtTime(da.y,i),t.positionZ.linearRampToValueAtTime(da.z,i),t.orientationX.linearRampToValueAtTime(ha.x,i),t.orientationY.linearRampToValueAtTime(ha.y,i),t.orientationZ.linearRampToValueAtTime(ha.z,i)}else t.setPosition(da.x,da.y,da.z),t.setOrientation(ha.x,ha.y,ha.z)}}class lz{constructor(e,t=2048){this.analyser=e.context.createAnalyser(),this.analyser.fftSize=t,this.data=new Uint8Array(this.analyser.frequencyBinCount),e.getOutput().connect(this.analyser)}getFrequencyData(){return this.analyser.getByteFrequencyData(this.data),this.data}getAverageFrequency(){let e=0;const t=this.getFrequencyData();for(let i=0;i<t.length;i++)e+=t[i];return e/t.length}}class sE{constructor(e,t,i){this.binding=e,this.valueSize=i;let r,s,o;switch(t){case"quaternion":r=this._slerp,s=this._slerpAdditive,o=this._setAdditiveIdentityQuaternion,this.buffer=new Float64Array(i*6),this._workIndex=5;break;case"string":case"bool":r=this._select,s=this._select,o=this._setAdditiveIdentityOther,this.buffer=new Array(i*5);break;default:r=this._lerp,s=this._lerpAdditive,o=this._setAdditiveIdentityNumeric,this.buffer=new Float64Array(i*5)}this._mixBufferRegion=r,this._mixBufferRegionAdditive=s,this._setIdentity=o,this._origIndex=3,this._addIndex=4,this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,this.useCount=0,this.referenceCount=0}accumulate(e,t){const i=this.buffer,r=this.valueSize,s=e*r+r;let o=this.cumulativeWeight;if(o===0){for(let l=0;l!==r;++l)i[s+l]=i[l];o=t}else{o+=t;const l=t/o;this._mixBufferRegion(i,s,0,l,r)}this.cumulativeWeight=o}accumulateAdditive(e){const t=this.buffer,i=this.valueSize,r=i*this._addIndex;this.cumulativeWeightAdditive===0&&this._setIdentity(),this._mixBufferRegionAdditive(t,r,0,e,i),this.cumulativeWeightAdditive+=e}apply(e){const t=this.valueSize,i=this.buffer,r=e*t+t,s=this.cumulativeWeight,o=this.cumulativeWeightAdditive,l=this.binding;if(this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,s<1){const c=t*this._origIndex;this._mixBufferRegion(i,r,c,1-s,t)}o>0&&this._mixBufferRegionAdditive(i,r,this._addIndex*t,1,t);for(let c=t,f=t+t;c!==f;++c)if(i[c]!==i[c+t]){l.setValue(i,r);break}}saveOriginalState(){const e=this.binding,t=this.buffer,i=this.valueSize,r=i*this._origIndex;e.getValue(t,r);for(let s=i,o=r;s!==o;++s)t[s]=t[r+s%i];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}restoreOriginalState(){const e=this.valueSize*3;this.binding.setValue(this.buffer,e)}_setAdditiveIdentityNumeric(){const e=this._addIndex*this.valueSize,t=e+this.valueSize;for(let i=e;i<t;i++)this.buffer[i]=0}_setAdditiveIdentityQuaternion(){this._setAdditiveIdentityNumeric(),this.buffer[this._addIndex*this.valueSize+3]=1}_setAdditiveIdentityOther(){const e=this._origIndex*this.valueSize,t=this._addIndex*this.valueSize;for(let i=0;i<this.valueSize;i++)this.buffer[t+i]=this.buffer[e+i]}_select(e,t,i,r,s){if(r>=.5)for(let o=0;o!==s;++o)e[t+o]=e[i+o]}_slerp(e,t,i,r){Fn.slerpFlat(e,t,e,t,e,i,r)}_slerpAdditive(e,t,i,r,s){const o=this._workIndex*s;Fn.multiplyQuaternionsFlat(e,o,e,t,e,i),Fn.slerpFlat(e,t,e,t,e,o,r)}_lerp(e,t,i,r,s){const o=1-r;for(let l=0;l!==s;++l){const c=t+l;e[c]=e[c]*o+e[i+l]*r}}_lerpAdditive(e,t,i,r,s){for(let o=0;o!==s;++o){const l=t+o;e[l]=e[l]+e[i+o]*r}}}const iy="\\[\\]\\.:\\/",uz=new RegExp("["+iy+"]","g"),ry="[^"+iy+"]",cz="[^"+iy.replace("\\.","")+"]",fz=/((?:WC+[\/:])*)/.source.replace("WC",ry),dz=/(WCOD+)?/.source.replace("WCOD",cz),hz=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",ry),pz=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",ry),mz=new RegExp("^"+fz+dz+hz+pz+"$"),gz=["material","materials","bones","map"];class vz{constructor(e,t,i){const r=i||St.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,r)}getValue(e,t){this.bind();const i=this._targetGroup.nCachedObjects_,r=this._bindings[i];r!==void 0&&r.getValue(e,t)}setValue(e,t){const i=this._bindings;for(let r=this._targetGroup.nCachedObjects_,s=i.length;r!==s;++r)i[r].setValue(e,t)}bind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,i=e.length;t!==i;++t)e[t].bind()}unbind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,i=e.length;t!==i;++t)e[t].unbind()}}class St{constructor(e,t,i){this.path=t,this.parsedPath=i||St.parseTrackName(t),this.node=St.findNode(e,this.parsedPath.nodeName)||e,this.rootNode=e,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(e,t,i){return e&&e.isAnimationObjectGroup?new St.Composite(e,t,i):new St(e,t,i)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(uz,"")}static parseTrackName(e){const t=mz.exec(e);if(t===null)throw new Error("PropertyBinding: Cannot parse trackName: "+e);const i={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},r=i.nodeName&&i.nodeName.lastIndexOf(".");if(r!==void 0&&r!==-1){const s=i.nodeName.substring(r+1);gz.indexOf(s)!==-1&&(i.nodeName=i.nodeName.substring(0,r),i.objectName=s)}if(i.propertyName===null||i.propertyName.length===0)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+e);return i}static findNode(e,t){if(t===void 0||t===""||t==="."||t===-1||t===e.name||t===e.uuid)return e;if(e.skeleton){const i=e.skeleton.getBoneByName(t);if(i!==void 0)return i}if(e.children){const i=function(s){for(let o=0;o<s.length;o++){const l=s[o];if(l.name===t||l.uuid===t)return l;const c=i(l.children);if(c)return c}return null},r=i(e.children);if(r)return r}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(e,t){e[t]=this.targetObject[this.propertyName]}_getValue_array(e,t){const i=this.resolvedProperty;for(let r=0,s=i.length;r!==s;++r)e[t++]=i[r]}_getValue_arrayElement(e,t){e[t]=this.resolvedProperty[this.propertyIndex]}_getValue_toArray(e,t){this.resolvedProperty.toArray(e,t)}_setValue_direct(e,t){this.targetObject[this.propertyName]=e[t]}_setValue_direct_setNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.needsUpdate=!0}_setValue_direct_setMatrixWorldNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_array(e,t){const i=this.resolvedProperty;for(let r=0,s=i.length;r!==s;++r)i[r]=e[t++]}_setValue_array_setNeedsUpdate(e,t){const i=this.resolvedProperty;for(let r=0,s=i.length;r!==s;++r)i[r]=e[t++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(e,t){const i=this.resolvedProperty;for(let r=0,s=i.length;r!==s;++r)i[r]=e[t++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(e,t){this.resolvedProperty[this.propertyIndex]=e[t]}_setValue_arrayElement_setNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.needsUpdate=!0}_setValue_arrayElement_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_fromArray(e,t){this.resolvedProperty.fromArray(e,t)}_setValue_fromArray_setNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.needsUpdate=!0}_setValue_fromArray_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.matrixWorldNeedsUpdate=!0}_getValue_unbound(e,t){this.bind(),this.getValue(e,t)}_setValue_unbound(e,t){this.bind(),this.setValue(e,t)}bind(){let e=this.node;const t=this.parsedPath,i=t.objectName,r=t.propertyName;let s=t.propertyIndex;if(e||(e=St.findNode(this.rootNode,t.nodeName)||this.rootNode,this.node=e),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!e){console.error("THREE.PropertyBinding: Trying to update node for track: "+this.path+" but it wasn't found.");return}if(i){let f=t.objectIndex;switch(i){case"materials":if(!e.material){console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.materials){console.error("THREE.PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);return}e=e.material.materials;break;case"bones":if(!e.skeleton){console.error("THREE.PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);return}e=e.skeleton.bones;for(let d=0;d<e.length;d++)if(e[d].name===f){f=d;break}break;case"map":if(!e.material){console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.map){console.error("THREE.PropertyBinding: Can not bind to material.map as node.material does not have a map.",this);return}e=e.material.map;break;default:if(e[i]===void 0){console.error("THREE.PropertyBinding: Can not bind to objectName of node undefined.",this);return}e=e[i]}if(f!==void 0){if(e[f]===void 0){console.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,e);return}e=e[f]}}const o=e[r];if(o===void 0){const f=t.nodeName;console.error("THREE.PropertyBinding: Trying to update property for track: "+f+"."+r+" but it wasn't found.",e);return}let l=this.Versioning.None;this.targetObject=e,e.needsUpdate!==void 0?l=this.Versioning.NeedsUpdate:e.matrixWorldNeedsUpdate!==void 0&&(l=this.Versioning.MatrixWorldNeedsUpdate);let c=this.BindingType.Direct;if(s!==void 0){if(r==="morphTargetInfluences"){if(!e.geometry){console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);return}if(!e.geometry.morphAttributes){console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);return}e.morphTargetDictionary[s]!==void 0&&(s=e.morphTargetDictionary[s])}c=this.BindingType.ArrayElement,this.resolvedProperty=o,this.propertyIndex=s}else o.fromArray!==void 0&&o.toArray!==void 0?(c=this.BindingType.HasFromToArray,this.resolvedProperty=o):Array.isArray(o)?(c=this.BindingType.EntireArray,this.resolvedProperty=o):this.propertyName=r;this.getValue=this.GetterByBindingType[c],this.setValue=this.SetterByBindingTypeAndVersioning[c][l]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}}St.Composite=vz,St.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3},St.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2},St.prototype.GetterByBindingType=[St.prototype._getValue_direct,St.prototype._getValue_array,St.prototype._getValue_arrayElement,St.prototype._getValue_toArray],St.prototype.SetterByBindingTypeAndVersioning=[[St.prototype._setValue_direct,St.prototype._setValue_direct_setNeedsUpdate,St.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[St.prototype._setValue_array,St.prototype._setValue_array_setNeedsUpdate,St.prototype._setValue_array_setMatrixWorldNeedsUpdate],[St.prototype._setValue_arrayElement,St.prototype._setValue_arrayElement_setNeedsUpdate,St.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[St.prototype._setValue_fromArray,St.prototype._setValue_fromArray_setNeedsUpdate,St.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];class yz{constructor(){this.isAnimationObjectGroup=!0,this.uuid=Mi(),this._objects=Array.prototype.slice.call(arguments),this.nCachedObjects_=0;const e={};this._indicesByUUID=e;for(let i=0,r=arguments.length;i!==r;++i)e[arguments[i].uuid]=i;this._paths=[],this._parsedPaths=[],this._bindings=[],this._bindingsIndicesByPath={};const t=this;this.stats={objects:{get total(){return t._objects.length},get inUse(){return this.total-t.nCachedObjects_}},get bindingsPerObject(){return t._bindings.length}}}add(){const e=this._objects,t=this._indicesByUUID,i=this._paths,r=this._parsedPaths,s=this._bindings,o=s.length;let l,c=e.length,f=this.nCachedObjects_;for(let d=0,h=arguments.length;d!==h;++d){const m=arguments[d],g=m.uuid;let x=t[g];if(x===void 0){x=c++,t[g]=x,e.push(m);for(let y=0,w=o;y!==w;++y)s[y].push(new St(m,i[y],r[y]))}else if(x<f){l=e[x];const y=--f,w=e[y];t[w.uuid]=x,e[x]=w,t[g]=y,e[y]=m;for(let _=0,S=o;_!==S;++_){const E=s[_],T=E[y];let C=E[x];E[x]=T,C===void 0&&(C=new St(m,i[_],r[_])),E[y]=C}}else e[x]!==l&&console.error("THREE.AnimationObjectGroup: Different objects with the same UUID detected. Clean the caches or recreate your infrastructure when reloading scenes.")}this.nCachedObjects_=f}remove(){const e=this._objects,t=this._indicesByUUID,i=this._bindings,r=i.length;let s=this.nCachedObjects_;for(let o=0,l=arguments.length;o!==l;++o){const c=arguments[o],f=c.uuid,d=t[f];if(d!==void 0&&d>=s){const h=s++,m=e[h];t[m.uuid]=d,e[d]=m,t[f]=h,e[h]=c;for(let g=0,x=r;g!==x;++g){const y=i[g],w=y[h],_=y[d];y[d]=w,y[h]=_}}}this.nCachedObjects_=s}uncache(){const e=this._objects,t=this._indicesByUUID,i=this._bindings,r=i.length;let s=this.nCachedObjects_,o=e.length;for(let l=0,c=arguments.length;l!==c;++l){const f=arguments[l],d=f.uuid,h=t[d];if(h!==void 0)if(delete t[d],h<s){const m=--s,g=e[m],x=--o,y=e[x];t[g.uuid]=h,e[h]=g,t[y.uuid]=m,e[m]=y,e.pop();for(let w=0,_=r;w!==_;++w){const S=i[w],E=S[m],T=S[x];S[h]=E,S[m]=T,S.pop()}}else{const m=--o,g=e[m];m>0&&(t[g.uuid]=h),e[h]=g,e.pop();for(let x=0,y=r;x!==y;++x){const w=i[x];w[h]=w[m],w.pop()}}}this.nCachedObjects_=s}subscribe_(e,t){const i=this._bindingsIndicesByPath;let r=i[e];const s=this._bindings;if(r!==void 0)return s[r];const o=this._paths,l=this._parsedPaths,c=this._objects,f=c.length,d=this.nCachedObjects_,h=new Array(f);r=s.length,i[e]=r,o.push(e),l.push(t),s.push(h);for(let m=d,g=c.length;m!==g;++m){const x=c[m];h[m]=new St(x,e,t)}return h}unsubscribe_(e){const t=this._bindingsIndicesByPath,i=t[e];if(i!==void 0){const r=this._paths,s=this._parsedPaths,o=this._bindings,l=o.length-1,c=o[l],f=e[l];t[f]=i,o[i]=c,o.pop(),s[i]=s[l],s.pop(),r[i]=r[l],r.pop()}}}class xz{constructor(e,t,i=null,r=t.blendMode){this._mixer=e,this._clip=t,this._localRoot=i,this.blendMode=r;const s=t.tracks,o=s.length,l=new Array(o),c={endingStart:jo,endingEnd:jo};for(let f=0;f!==o;++f){const d=s[f].createInterpolant(null);l[f]=d,d.settings=c}this._interpolantSettings=c,this._interpolants=l,this._propertyBindings=new Array(o),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=BS,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}play(){return this._mixer._activateAction(this),this}stop(){return this._mixer._deactivateAction(this),this.reset()}reset(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()}isRunning(){return this.enabled&&!this.paused&&this.timeScale!==0&&this._startTime===null&&this._mixer._isActiveAction(this)}isScheduled(){return this._mixer._isActiveAction(this)}startAt(e){return this._startTime=e,this}setLoop(e,t){return this.loop=e,this.repetitions=t,this}setEffectiveWeight(e){return this.weight=e,this._effectiveWeight=this.enabled?e:0,this.stopFading()}getEffectiveWeight(){return this._effectiveWeight}fadeIn(e){return this._scheduleFading(e,0,1)}fadeOut(e){return this._scheduleFading(e,1,0)}crossFadeFrom(e,t,i){if(e.fadeOut(t),this.fadeIn(t),i){const r=this._clip.duration,s=e._clip.duration,o=s/r,l=r/s;e.warp(1,o,t),this.warp(l,1,t)}return this}crossFadeTo(e,t,i){return e.crossFadeFrom(this,t,i)}stopFading(){const e=this._weightInterpolant;return e!==null&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}setEffectiveTimeScale(e){return this.timeScale=e,this._effectiveTimeScale=this.paused?0:e,this.stopWarping()}getEffectiveTimeScale(){return this._effectiveTimeScale}setDuration(e){return this.timeScale=this._clip.duration/e,this.stopWarping()}syncWith(e){return this.time=e.time,this.timeScale=e.timeScale,this.stopWarping()}halt(e){return this.warp(this._effectiveTimeScale,0,e)}warp(e,t,i){const r=this._mixer,s=r.time,o=this.timeScale;let l=this._timeScaleInterpolant;l===null&&(l=r._lendControlInterpolant(),this._timeScaleInterpolant=l);const c=l.parameterPositions,f=l.sampleValues;return c[0]=s,c[1]=s+i,f[0]=e/o,f[1]=t/o,this}stopWarping(){const e=this._timeScaleInterpolant;return e!==null&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}getMixer(){return this._mixer}getClip(){return this._clip}getRoot(){return this._localRoot||this._mixer._root}_update(e,t,i,r){if(!this.enabled){this._updateWeight(e);return}const s=this._startTime;if(s!==null){const c=(e-s)*i;c<0||i===0?t=0:(this._startTime=null,t=i*c)}t*=this._updateTimeScale(e);const o=this._updateTime(t),l=this._updateWeight(e);if(l>0){const c=this._interpolants,f=this._propertyBindings;switch(this.blendMode){case U0:for(let d=0,h=c.length;d!==h;++d)c[d].evaluate(o),f[d].accumulateAdditive(l);break;case Id:default:for(let d=0,h=c.length;d!==h;++d)c[d].evaluate(o),f[d].accumulate(r,l)}}}_updateWeight(e){let t=0;if(this.enabled){t=this.weight;const i=this._weightInterpolant;if(i!==null){const r=i.evaluate(e)[0];t*=r,e>i.parameterPositions[1]&&(this.stopFading(),r===0&&(this.enabled=!1))}}return this._effectiveWeight=t,t}_updateTimeScale(e){let t=0;if(!this.paused){t=this.timeScale;const i=this._timeScaleInterpolant;i!==null&&(t*=i.evaluate(e)[0],e>i.parameterPositions[1]&&(this.stopWarping(),t===0?this.paused=!0:this.timeScale=t))}return this._effectiveTimeScale=t,t}_updateTime(e){const t=this._clip.duration,i=this.loop;let r=this.time+e,s=this._loopCount;const o=i===VS;if(e===0)return s===-1?r:o&&(s&1)===1?t-r:r;if(i===US){s===-1&&(this._loopCount=0,this._setEndings(!0,!0,!1));e:{if(r>=t)r=t;else if(r<0)r=0;else{this.time=r;break e}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=r,this._mixer.dispatchEvent({type:"finished",action:this,direction:e<0?-1:1})}}else{if(s===-1&&(e>=0?(s=0,this._setEndings(!0,this.repetitions===0,o)):this._setEndings(this.repetitions===0,!0,o)),r>=t||r<0){const l=Math.floor(r/t);r-=t*l,s+=Math.abs(l);const c=this.repetitions-s;if(c<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,r=e>0?t:0,this.time=r,this._mixer.dispatchEvent({type:"finished",action:this,direction:e>0?1:-1});else{if(c===1){const f=e<0;this._setEndings(f,!f,o)}else this._setEndings(!1,!1,o);this._loopCount=s,this.time=r,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:l})}}else this.time=r;if(o&&(s&1)===1)return t-r}return r}_setEndings(e,t,i){const r=this._interpolantSettings;i?(r.endingStart=Yo,r.endingEnd=Yo):(e?r.endingStart=this.zeroSlopeAtStart?Yo:jo:r.endingStart=Ju,t?r.endingEnd=this.zeroSlopeAtEnd?Yo:jo:r.endingEnd=Ju)}_scheduleFading(e,t,i){const r=this._mixer,s=r.time;let o=this._weightInterpolant;o===null&&(o=r._lendControlInterpolant(),this._weightInterpolant=o);const l=o.parameterPositions,c=o.sampleValues;return l[0]=s,c[0]=t,l[1]=s+e,c[1]=i,this}}const _z=new Float32Array(1);class wz extends Ar{constructor(e){super(),this._root=e,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}_bindAction(e,t){const i=e._localRoot||this._root,r=e._clip.tracks,s=r.length,o=e._propertyBindings,l=e._interpolants,c=i.uuid,f=this._bindingsByRootAndName;let d=f[c];d===void 0&&(d={},f[c]=d);for(let h=0;h!==s;++h){const m=r[h],g=m.name;let x=d[g];if(x!==void 0)++x.referenceCount,o[h]=x;else{if(x=o[h],x!==void 0){x._cacheIndex===null&&(++x.referenceCount,this._addInactiveBinding(x,c,g));continue}const y=t&&t._propertyBindings[h].binding.parsedPath;x=new sE(St.create(i,g,y),m.ValueTypeName,m.getValueSize()),++x.referenceCount,this._addInactiveBinding(x,c,g),o[h]=x}l[h].resultBuffer=x.buffer}}_activateAction(e){if(!this._isActiveAction(e)){if(e._cacheIndex===null){const i=(e._localRoot||this._root).uuid,r=e._clip.uuid,s=this._actionsByClip[r];this._bindAction(e,s&&s.knownActions[0]),this._addInactiveAction(e,r,i)}const t=e._propertyBindings;for(let i=0,r=t.length;i!==r;++i){const s=t[i];s.useCount++===0&&(this._lendBinding(s),s.saveOriginalState())}this._lendAction(e)}}_deactivateAction(e){if(this._isActiveAction(e)){const t=e._propertyBindings;for(let i=0,r=t.length;i!==r;++i){const s=t[i];--s.useCount===0&&(s.restoreOriginalState(),this._takeBackBinding(s))}this._takeBackAction(e)}}_initMemoryManager(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;const e=this;this.stats={actions:{get total(){return e._actions.length},get inUse(){return e._nActiveActions}},bindings:{get total(){return e._bindings.length},get inUse(){return e._nActiveBindings}},controlInterpolants:{get total(){return e._controlInterpolants.length},get inUse(){return e._nActiveControlInterpolants}}}}_isActiveAction(e){const t=e._cacheIndex;return t!==null&&t<this._nActiveActions}_addInactiveAction(e,t,i){const r=this._actions,s=this._actionsByClip;let o=s[t];if(o===void 0)o={knownActions:[e],actionByRoot:{}},e._byClipCacheIndex=0,s[t]=o;else{const l=o.knownActions;e._byClipCacheIndex=l.length,l.push(e)}e._cacheIndex=r.length,r.push(e),o.actionByRoot[i]=e}_removeInactiveAction(e){const t=this._actions,i=t[t.length-1],r=e._cacheIndex;i._cacheIndex=r,t[r]=i,t.pop(),e._cacheIndex=null;const s=e._clip.uuid,o=this._actionsByClip,l=o[s],c=l.knownActions,f=c[c.length-1],d=e._byClipCacheIndex;f._byClipCacheIndex=d,c[d]=f,c.pop(),e._byClipCacheIndex=null;const h=l.actionByRoot,m=(e._localRoot||this._root).uuid;delete h[m],c.length===0&&delete o[s],this._removeInactiveBindingsForAction(e)}_removeInactiveBindingsForAction(e){const t=e._propertyBindings;for(let i=0,r=t.length;i!==r;++i){const s=t[i];--s.referenceCount===0&&this._removeInactiveBinding(s)}}_lendAction(e){const t=this._actions,i=e._cacheIndex,r=this._nActiveActions++,s=t[r];e._cacheIndex=r,t[r]=e,s._cacheIndex=i,t[i]=s}_takeBackAction(e){const t=this._actions,i=e._cacheIndex,r=--this._nActiveActions,s=t[r];e._cacheIndex=r,t[r]=e,s._cacheIndex=i,t[i]=s}_addInactiveBinding(e,t,i){const r=this._bindingsByRootAndName,s=this._bindings;let o=r[t];o===void 0&&(o={},r[t]=o),o[i]=e,e._cacheIndex=s.length,s.push(e)}_removeInactiveBinding(e){const t=this._bindings,i=e.binding,r=i.rootNode.uuid,s=i.path,o=this._bindingsByRootAndName,l=o[r],c=t[t.length-1],f=e._cacheIndex;c._cacheIndex=f,t[f]=c,t.pop(),delete l[s],Object.keys(l).length===0&&delete o[r]}_lendBinding(e){const t=this._bindings,i=e._cacheIndex,r=this._nActiveBindings++,s=t[r];e._cacheIndex=r,t[r]=e,s._cacheIndex=i,t[i]=s}_takeBackBinding(e){const t=this._bindings,i=e._cacheIndex,r=--this._nActiveBindings,s=t[r];e._cacheIndex=r,t[r]=e,s._cacheIndex=i,t[i]=s}_lendControlInterpolant(){const e=this._controlInterpolants,t=this._nActiveControlInterpolants++;let i=e[t];return i===void 0&&(i=new Yv(new Float32Array(2),new Float32Array(2),1,_z),i.__cacheIndex=t,e[t]=i),i}_takeBackControlInterpolant(e){const t=this._controlInterpolants,i=e.__cacheIndex,r=--this._nActiveControlInterpolants,s=t[r];e.__cacheIndex=r,t[r]=e,s.__cacheIndex=i,t[i]=s}clipAction(e,t,i){const r=t||this._root,s=r.uuid;let o=typeof e=="string"?zc.findByName(r,e):e;const l=o!==null?o.uuid:e,c=this._actionsByClip[l];let f=null;if(i===void 0&&(o!==null?i=o.blendMode:i=Id),c!==void 0){const h=c.actionByRoot[s];if(h!==void 0&&h.blendMode===i)return h;f=c.knownActions[0],o===null&&(o=f._clip)}if(o===null)return null;const d=new xz(this,o,t,i);return this._bindAction(d,f),this._addInactiveAction(d,l,s),d}existingAction(e,t){const i=t||this._root,r=i.uuid,s=typeof e=="string"?zc.findByName(i,e):e,o=s?s.uuid:e,l=this._actionsByClip[o];return l!==void 0&&l.actionByRoot[r]||null}stopAllAction(){const e=this._actions,t=this._nActiveActions;for(let i=t-1;i>=0;--i)e[i].stop();return this}update(e){e*=this.timeScale;const t=this._actions,i=this._nActiveActions,r=this.time+=e,s=Math.sign(e),o=this._accuIndex^=1;for(let f=0;f!==i;++f)t[f]._update(r,e,s,o);const l=this._bindings,c=this._nActiveBindings;for(let f=0;f!==c;++f)l[f].apply(o);return this}setTime(e){this.time=0;for(let t=0;t<this._actions.length;t++)this._actions[t].time=0;return this.update(e)}getRoot(){return this._root}uncacheClip(e){const t=this._actions,i=e.uuid,r=this._actionsByClip,s=r[i];if(s!==void 0){const o=s.knownActions;for(let l=0,c=o.length;l!==c;++l){const f=o[l];this._deactivateAction(f);const d=f._cacheIndex,h=t[t.length-1];f._cacheIndex=null,f._byClipCacheIndex=null,h._cacheIndex=d,t[d]=h,t.pop(),this._removeInactiveBindingsForAction(f)}delete r[i]}}uncacheRoot(e){const t=e.uuid,i=this._actionsByClip;for(const o in i){const l=i[o].actionByRoot,c=l[t];c!==void 0&&(this._deactivateAction(c),this._removeInactiveAction(c))}const r=this._bindingsByRootAndName,s=r[t];if(s!==void 0)for(const o in s){const l=s[o];l.restoreOriginalState(),this._removeInactiveBinding(l)}}uncacheAction(e,t){const i=this.existingAction(e,t);i!==null&&(this._deactivateAction(i),this._removeInactiveAction(i))}}class sy{constructor(e){this.value=e}clone(){return new sy(this.value.clone===void 0?this.value:this.value.clone())}}let Sz=0;class Mz extends Ar{constructor(){super(),this.isUniformsGroup=!0,Object.defineProperty(this,"id",{value:Sz++}),this.name="",this.usage=Qu,this.uniforms=[]}add(e){return this.uniforms.push(e),this}remove(e){const t=this.uniforms.indexOf(e);return t!==-1&&this.uniforms.splice(t,1),this}setName(e){return this.name=e,this}setUsage(e){return this.usage=e,this}dispose(){return this.dispatchEvent({type:"dispose"}),this}copy(e){this.name=e.name,this.usage=e.usage;const t=e.uniforms;this.uniforms.length=0;for(let i=0,r=t.length;i<r;i++)this.uniforms.push(t[i].clone());return this}clone(){return new this.constructor().copy(this)}}class Ih extends ch{constructor(e,t,i=1){super(e,t),this.isInstancedInterleavedBuffer=!0,this.meshPerAttribute=i}copy(e){return super.copy(e),this.meshPerAttribute=e.meshPerAttribute,this}clone(e){const t=super.clone(e);return t.meshPerAttribute=this.meshPerAttribute,t}toJSON(e){const t=super.toJSON(e);return t.isInstancedInterleavedBuffer=!0,t.meshPerAttribute=this.meshPerAttribute,t}}class Ez{constructor(e,t,i,r,s){this.isGLBufferAttribute=!0,this.buffer=e,this.type=t,this.itemSize=i,this.elementSize=r,this.count=s,this.version=0}set needsUpdate(e){e===!0&&this.version++}setBuffer(e){return this.buffer=e,this}setType(e,t){return this.type=e,this.elementSize=t,this}setItemSize(e){return this.itemSize=e,this}setCount(e){return this.count=e,this}}class oE{constructor(e,t,i=0,r=1/0){this.ray=new ic(e,t),this.near=i,this.far=r,this.camera=null,this.layers=new ea,this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}}}set(e,t){this.ray.set(e,t)}setFromCamera(e,t){t.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(t.matrixWorld),this.ray.direction.set(e.x,e.y,.5).unproject(t).sub(this.ray.origin).normalize(),this.camera=t):t.isOrthographicCamera?(this.ray.origin.set(e.x,e.y,(t.near+t.far)/(t.near-t.far)).unproject(t),this.ray.direction.set(0,0,-1).transformDirection(t.matrixWorld),this.camera=t):console.error("THREE.Raycaster: Unsupported camera type: "+t.type)}intersectObject(e,t=!0,i=[]){return oy(e,this,i,t),i.sort(aE),i}intersectObjects(e,t=!0,i=[]){for(let r=0,s=e.length;r<s;r++)oy(e[r],this,i,t);return i.sort(aE),i}}function aE(n,e){return n.distance-e.distance}function oy(n,e,t,i){if(n.layers.test(e.layers)&&n.raycast(e,t),i===!0){const r=n.children;for(let s=0,o=r.length;s<o;s++)oy(r[s],e,t,!0)}}class ay{constructor(e=1,t=0,i=0){return this.radius=e,this.phi=t,this.theta=i,this}set(e,t,i){return this.radius=e,this.phi=t,this.theta=i,this}copy(e){return this.radius=e.radius,this.phi=e.phi,this.theta=e.theta,this}makeSafe(){return this.phi=Math.max(1e-6,Math.min(Math.PI-1e-6,this.phi)),this}setFromVector3(e){return this.setFromCartesianCoords(e.x,e.y,e.z)}setFromCartesianCoords(e,t,i){return this.radius=Math.sqrt(e*e+t*t+i*i),this.radius===0?(this.theta=0,this.phi=0):(this.theta=Math.atan2(e,i),this.phi=Math.acos(nn(t/this.radius,-1,1))),this}clone(){return new this.constructor().copy(this)}}class Tz{constructor(e=1,t=0,i=0){return this.radius=e,this.theta=t,this.y=i,this}set(e,t,i){return this.radius=e,this.theta=t,this.y=i,this}copy(e){return this.radius=e.radius,this.theta=e.theta,this.y=e.y,this}setFromVector3(e){return this.setFromCartesianCoords(e.x,e.y,e.z)}setFromCartesianCoords(e,t,i){return this.radius=Math.sqrt(e*e+i*i),this.theta=Math.atan2(e,i),this.y=t,this}clone(){return new this.constructor().copy(this)}}const lE=new fe;class bz{constructor(e=new fe(1/0,1/0),t=new fe(-1/0,-1/0)){this.isBox2=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromPoints(e){this.makeEmpty();for(let t=0,i=e.length;t<i;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){const i=lE.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(i),this.max.copy(e).add(i),this}clone(){return new this.constructor().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=1/0,this.max.x=this.max.y=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y}getCenter(e){return this.isEmpty()?e.set(0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}containsPoint(e){return!(e.x<this.min.x||e.x>this.max.x||e.y<this.min.y||e.y>this.max.y)}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y))}intersectsBox(e){return!(e.max.x<this.min.x||e.min.x>this.max.x||e.max.y<this.min.y||e.min.y>this.max.y)}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return lE.copy(e).clamp(this.min,this.max).sub(e).length()}intersect(e){return this.min.max(e.min),this.max.min(e.max),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}const uE=new R,Dh=new R;class co{constructor(e=new R,t=new R){this.start=e,this.end=t}set(e,t){return this.start.copy(e),this.end.copy(t),this}copy(e){return this.start.copy(e.start),this.end.copy(e.end),this}getCenter(e){return e.addVectors(this.start,this.end).multiplyScalar(.5)}delta(e){return e.subVectors(this.end,this.start)}distanceSq(){return this.start.distanceToSquared(this.end)}distance(){return this.start.distanceTo(this.end)}at(e,t){return this.delta(t).multiplyScalar(e).add(this.start)}closestPointToPointParameter(e,t){uE.subVectors(e,this.start),Dh.subVectors(this.end,this.start);const i=Dh.dot(Dh);let s=Dh.dot(uE)/i;return t&&(s=nn(s,0,1)),s}closestPointToPoint(e,t,i){const r=this.closestPointToPointParameter(e,t);return this.delta(i).multiplyScalar(r).add(this.start)}applyMatrix4(e){return this.start.applyMatrix4(e),this.end.applyMatrix4(e),this}equals(e){return e.start.equals(this.start)&&e.end.equals(this.end)}clone(){return new this.constructor().copy(this)}}const cE=new R;class Az extends Mt{constructor(e,t){super(),this.light=e,this.light.updateMatrixWorld(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=t;const i=new lt,r=[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];for(let o=0,l=1,c=32;o<c;o++,l++){const f=o/c*Math.PI*2,d=l/c*Math.PI*2;r.push(Math.cos(f),Math.sin(f),1,Math.cos(d),Math.sin(d),1)}i.setAttribute("position",new Fe(r,3));const s=new ei({fog:!1,toneMapped:!1});this.cone=new Pr(i,s),this.add(this.cone),this.update()}dispose(){this.cone.geometry.dispose(),this.cone.material.dispose()}update(){this.light.updateMatrixWorld();const e=this.light.distance?this.light.distance:1e3,t=e*Math.tan(this.light.angle);this.cone.scale.set(t,t,e),cE.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(cE),this.color!==void 0?this.cone.material.color.set(this.color):this.cone.material.color.copy(this.light.color)}}const fo=new R,zh=new st,ly=new st;class Cz extends Pr{constructor(e){const t=fE(e),i=new lt,r=[],s=[],o=new De(0,0,1),l=new De(0,1,0);for(let f=0;f<t.length;f++){const d=t[f];d.parent&&d.parent.isBone&&(r.push(0,0,0),r.push(0,0,0),s.push(o.r,o.g,o.b),s.push(l.r,l.g,l.b))}i.setAttribute("position",new Fe(r,3)),i.setAttribute("color",new Fe(s,3));const c=new ei({vertexColors:!0,depthTest:!1,depthWrite:!1,toneMapped:!1,transparent:!0});super(i,c),this.isSkeletonHelper=!0,this.type="SkeletonHelper",this.root=e,this.bones=t,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1}updateMatrixWorld(e){const t=this.bones,i=this.geometry,r=i.getAttribute("position");ly.copy(this.root.matrixWorld).invert();for(let s=0,o=0;s<t.length;s++){const l=t[s];l.parent&&l.parent.isBone&&(zh.multiplyMatrices(ly,l.matrixWorld),fo.setFromMatrixPosition(zh),r.setXYZ(o,fo.x,fo.y,fo.z),zh.multiplyMatrices(ly,l.parent.matrixWorld),fo.setFromMatrixPosition(zh),r.setXYZ(o+1,fo.x,fo.y,fo.z),o+=2)}i.getAttribute("position").needsUpdate=!0,super.updateMatrixWorld(e)}}function fE(n){const e=[];n.isBone===!0&&e.push(n);for(let t=0;t<n.children.length;t++)e.push.apply(e,fE(n.children[t]));return e}class Pz extends wn{constructor(e,t,i){const r=new Nl(t,4,2),s=new eo({wireframe:!0,fog:!1,toneMapped:!1});super(r,s),this.light=e,this.light.updateMatrixWorld(),this.color=i,this.type="PointLightHelper",this.matrix=this.light.matrixWorld,this.matrixAutoUpdate=!1,this.update()}dispose(){this.geometry.dispose(),this.material.dispose()}update(){this.color!==void 0?this.material.color.set(this.color):this.material.color.copy(this.light.color)}}const Lz=new R,dE=new De,hE=new De;class Rz extends Mt{constructor(e,t,i){super(),this.light=e,this.light.updateMatrixWorld(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=i;const r=new zl(t);r.rotateY(Math.PI*.5),this.material=new eo({wireframe:!0,fog:!1,toneMapped:!1}),this.color===void 0&&(this.material.vertexColors=!0);const s=r.getAttribute("position"),o=new Float32Array(s.count*3);r.setAttribute("color",new It(o,3)),this.add(new wn(r,this.material)),this.update()}dispose(){this.children[0].geometry.dispose(),this.children[0].material.dispose()}update(){const e=this.children[0];if(this.color!==void 0)this.material.color.set(this.color);else{const t=e.geometry.getAttribute("color");dE.copy(this.light.color),hE.copy(this.light.groundColor);for(let i=0,r=t.count;i<r;i++){const s=i<r/2?dE:hE;t.setXYZ(i,s.r,s.g,s.b)}t.needsUpdate=!0}e.lookAt(Lz.setFromMatrixPosition(this.light.matrixWorld).negate())}}class Iz extends Pr{constructor(e=10,t=10,i=4473924,r=8947848){i=new De(i),r=new De(r);const s=t/2,o=e/t,l=e/2,c=[],f=[];for(let m=0,g=0,x=-l;m<=t;m++,x+=o){c.push(-l,0,x,l,0,x),c.push(x,0,-l,x,0,l);const y=m===s?i:r;y.toArray(f,g),g+=3,y.toArray(f,g),g+=3,y.toArray(f,g),g+=3,y.toArray(f,g),g+=3}const d=new lt;d.setAttribute("position",new Fe(c,3)),d.setAttribute("color",new Fe(f,3));const h=new ei({vertexColors:!0,toneMapped:!1});super(d,h),this.type="GridHelper"}}class Dz extends Pr{constructor(e=10,t=16,i=8,r=64,s=4473924,o=8947848){s=new De(s),o=new De(o);const l=[],c=[];if(t>1)for(let h=0;h<t;h++){const m=h/t*(Math.PI*2),g=Math.sin(m)*e,x=Math.cos(m)*e;l.push(0,0,0),l.push(g,0,x);const y=h&1?s:o;c.push(y.r,y.g,y.b),c.push(y.r,y.g,y.b)}for(let h=0;h<i;h++){const m=h&1?s:o,g=e-e/i*h;for(let x=0;x<r;x++){let y=x/r*(Math.PI*2),w=Math.sin(y)*g,_=Math.cos(y)*g;l.push(w,0,_),c.push(m.r,m.g,m.b),y=(x+1)/r*(Math.PI*2),w=Math.sin(y)*g,_=Math.cos(y)*g,l.push(w,0,_),c.push(m.r,m.g,m.b)}}const f=new lt;f.setAttribute("position",new Fe(l,3)),f.setAttribute("color",new Fe(c,3));const d=new ei({vertexColors:!0,toneMapped:!1});super(f,d),this.type="PolarGridHelper"}}const pE=new R,Nh=new R,mE=new R;class zz extends Mt{constructor(e,t,i){super(),this.light=e,this.light.updateMatrixWorld(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=i,t===void 0&&(t=1);let r=new lt;r.setAttribute("position",new Fe([-t,t,0,t,t,0,t,-t,0,-t,-t,0,-t,t,0],3));const s=new ei({fog:!1,toneMapped:!1});this.lightPlane=new ao(r,s),this.add(this.lightPlane),r=new lt,r.setAttribute("position",new Fe([0,0,0,0,0,1],3)),this.targetLine=new ao(r,s),this.add(this.targetLine),this.update()}dispose(){this.lightPlane.geometry.dispose(),this.lightPlane.material.dispose(),this.targetLine.geometry.dispose(),this.targetLine.material.dispose()}update(){pE.setFromMatrixPosition(this.light.matrixWorld),Nh.setFromMatrixPosition(this.light.target.matrixWorld),mE.subVectors(Nh,pE),this.lightPlane.lookAt(Nh),this.color!==void 0?(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(Nh),this.targetLine.scale.z=mE.length()}}const kh=new R,Kt=new oc;class Nz extends Pr{constructor(e){const t=new lt,i=new ei({color:16777215,vertexColors:!0,toneMapped:!1}),r=[],s=[],o={};l("n1","n2"),l("n2","n4"),l("n4","n3"),l("n3","n1"),l("f1","f2"),l("f2","f4"),l("f4","f3"),l("f3","f1"),l("n1","f1"),l("n2","f2"),l("n3","f3"),l("n4","f4"),l("p","n1"),l("p","n2"),l("p","n3"),l("p","n4"),l("u1","u2"),l("u2","u3"),l("u3","u1"),l("c","t"),l("p","c"),l("cn1","cn2"),l("cn3","cn4"),l("cf1","cf2"),l("cf3","cf4");function l(x,y){c(x),c(y)}function c(x){r.push(0,0,0),s.push(0,0,0),o[x]===void 0&&(o[x]=[]),o[x].push(r.length/3-1)}t.setAttribute("position",new Fe(r,3)),t.setAttribute("color",new Fe(s,3)),super(t,i),this.type="CameraHelper",this.camera=e,this.camera.updateProjectionMatrix&&this.camera.updateProjectionMatrix(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=o,this.update();const f=new De(16755200),d=new De(16711680),h=new De(43775),m=new De(16777215),g=new De(3355443);this.setColors(f,d,h,m,g)}setColors(e,t,i,r,s){const l=this.geometry.getAttribute("color");l.setXYZ(0,e.r,e.g,e.b),l.setXYZ(1,e.r,e.g,e.b),l.setXYZ(2,e.r,e.g,e.b),l.setXYZ(3,e.r,e.g,e.b),l.setXYZ(4,e.r,e.g,e.b),l.setXYZ(5,e.r,e.g,e.b),l.setXYZ(6,e.r,e.g,e.b),l.setXYZ(7,e.r,e.g,e.b),l.setXYZ(8,e.r,e.g,e.b),l.setXYZ(9,e.r,e.g,e.b),l.setXYZ(10,e.r,e.g,e.b),l.setXYZ(11,e.r,e.g,e.b),l.setXYZ(12,e.r,e.g,e.b),l.setXYZ(13,e.r,e.g,e.b),l.setXYZ(14,e.r,e.g,e.b),l.setXYZ(15,e.r,e.g,e.b),l.setXYZ(16,e.r,e.g,e.b),l.setXYZ(17,e.r,e.g,e.b),l.setXYZ(18,e.r,e.g,e.b),l.setXYZ(19,e.r,e.g,e.b),l.setXYZ(20,e.r,e.g,e.b),l.setXYZ(21,e.r,e.g,e.b),l.setXYZ(22,e.r,e.g,e.b),l.setXYZ(23,e.r,e.g,e.b),l.setXYZ(24,t.r,t.g,t.b),l.setXYZ(25,t.r,t.g,t.b),l.setXYZ(26,t.r,t.g,t.b),l.setXYZ(27,t.r,t.g,t.b),l.setXYZ(28,t.r,t.g,t.b),l.setXYZ(29,t.r,t.g,t.b),l.setXYZ(30,t.r,t.g,t.b),l.setXYZ(31,t.r,t.g,t.b),l.setXYZ(32,i.r,i.g,i.b),l.setXYZ(33,i.r,i.g,i.b),l.setXYZ(34,i.r,i.g,i.b),l.setXYZ(35,i.r,i.g,i.b),l.setXYZ(36,i.r,i.g,i.b),l.setXYZ(37,i.r,i.g,i.b),l.setXYZ(38,r.r,r.g,r.b),l.setXYZ(39,r.r,r.g,r.b),l.setXYZ(40,s.r,s.g,s.b),l.setXYZ(41,s.r,s.g,s.b),l.setXYZ(42,s.r,s.g,s.b),l.setXYZ(43,s.r,s.g,s.b),l.setXYZ(44,s.r,s.g,s.b),l.setXYZ(45,s.r,s.g,s.b),l.setXYZ(46,s.r,s.g,s.b),l.setXYZ(47,s.r,s.g,s.b),l.setXYZ(48,s.r,s.g,s.b),l.setXYZ(49,s.r,s.g,s.b),l.needsUpdate=!0}update(){const e=this.geometry,t=this.pointMap,i=1,r=1;Kt.projectionMatrixInverse.copy(this.camera.projectionMatrixInverse),rn("c",t,e,Kt,0,0,-1),rn("t",t,e,Kt,0,0,1),rn("n1",t,e,Kt,-i,-r,-1),rn("n2",t,e,Kt,i,-r,-1),rn("n3",t,e,Kt,-i,r,-1),rn("n4",t,e,Kt,i,r,-1),rn("f1",t,e,Kt,-i,-r,1),rn("f2",t,e,Kt,i,-r,1),rn("f3",t,e,Kt,-i,r,1),rn("f4",t,e,Kt,i,r,1),rn("u1",t,e,Kt,i*.7,r*1.1,-1),rn("u2",t,e,Kt,-i*.7,r*1.1,-1),rn("u3",t,e,Kt,0,r*2,-1),rn("cf1",t,e,Kt,-i,0,1),rn("cf2",t,e,Kt,i,0,1),rn("cf3",t,e,Kt,0,-r,1),rn("cf4",t,e,Kt,0,r,1),rn("cn1",t,e,Kt,-i,0,-1),rn("cn2",t,e,Kt,i,0,-1),rn("cn3",t,e,Kt,0,-r,-1),rn("cn4",t,e,Kt,0,r,-1),e.getAttribute("position").needsUpdate=!0}dispose(){this.geometry.dispose(),this.material.dispose()}}function rn(n,e,t,i,r,s,o){kh.set(r,s,o).unproject(i);const l=e[n];if(l!==void 0){const c=t.getAttribute("position");for(let f=0,d=l.length;f<d;f++)c.setXYZ(l[f],kh.x,kh.y,kh.z)}}const Oh=new Cr;class kz extends Pr{constructor(e,t=16776960){const 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]),r=new Float32Array(8*3),s=new lt;s.setIndex(new It(i,1)),s.setAttribute("position",new It(r,3)),super(s,new ei({color:t,toneMapped:!1})),this.object=e,this.type="BoxHelper",this.matrixAutoUpdate=!1,this.update()}update(e){if(e!==void 0&&console.warn("THREE.BoxHelper: .update() has no longer arguments."),this.object!==void 0&&Oh.setFromObject(this.object),Oh.isEmpty())return;const t=Oh.min,i=Oh.max,r=this.geometry.attributes.position,s=r.array;s[0]=i.x,s[1]=i.y,s[2]=i.z,s[3]=t.x,s[4]=i.y,s[5]=i.z,s[6]=t.x,s[7]=t.y,s[8]=i.z,s[9]=i.x,s[10]=t.y,s[11]=i.z,s[12]=i.x,s[13]=i.y,s[14]=t.z,s[15]=t.x,s[16]=i.y,s[17]=t.z,s[18]=t.x,s[19]=t.y,s[20]=t.z,s[21]=i.x,s[22]=t.y,s[23]=t.z,r.needsUpdate=!0,this.geometry.computeBoundingSphere()}setFromObject(e){return this.object=e,this.update(),this}copy(e,t){return super.copy(e,t),this.object=e.object,this}}class Oz extends Pr{constructor(e,t=16776960){const 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]),r=[1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,-1,-1,1,-1,-1,-1,-1,1,-1,-1],s=new lt;s.setIndex(new It(i,1)),s.setAttribute("position",new Fe(r,3)),super(s,new ei({color:t,toneMapped:!1})),this.box=e,this.type="Box3Helper",this.geometry.computeBoundingSphere()}updateMatrixWorld(e){const t=this.box;t.isEmpty()||(t.getCenter(this.position),t.getSize(this.scale),this.scale.multiplyScalar(.5),super.updateMatrixWorld(e))}}class Fz extends ao{constructor(e,t=1,i=16776960){const r=i,s=[1,-1,0,-1,1,0,-1,-1,0,1,1,0,-1,1,0,-1,-1,0,1,-1,0,1,1,0],o=new lt;o.setAttribute("position",new Fe(s,3)),o.computeBoundingSphere(),super(o,new ei({color:r,toneMapped:!1})),this.type="PlaneHelper",this.plane=e,this.size=t;const l=[1,1,0,-1,1,0,-1,-1,0,1,1,0,-1,-1,0,1,-1,0],c=new lt;c.setAttribute("position",new Fe(l,3)),c.computeBoundingSphere(),this.add(new wn(c,new eo({color:r,opacity:.2,transparent:!0,depthWrite:!1,toneMapped:!1})))}updateMatrixWorld(e){this.position.set(0,0,0),this.scale.set(.5*this.size,.5*this.size,1),this.lookAt(this.plane.normal),this.translateZ(-this.plane.constant),super.updateMatrixWorld(e)}}const gE=new R;let Fh,uy;class Uz extends Mt{constructor(e=new R(0,0,1),t=new R(0,0,0),i=1,r=16776960,s=i*.2,o=s*.2){super(),this.type="ArrowHelper",Fh===void 0&&(Fh=new lt,Fh.setAttribute("position",new Fe([0,0,0,0,1,0],3)),uy=new ia(0,.5,1,5,1),uy.translate(0,-.5,0)),this.position.copy(t),this.line=new ao(Fh,new ei({color:r,toneMapped:!1})),this.line.matrixAutoUpdate=!1,this.add(this.line),this.cone=new wn(uy,new eo({color:r,toneMapped:!1})),this.cone.matrixAutoUpdate=!1,this.add(this.cone),this.setDirection(e),this.setLength(i,s,o)}setDirection(e){if(e.y>.99999)this.quaternion.set(0,0,0,1);else if(e.y<-.99999)this.quaternion.set(1,0,0,0);else{gE.set(e.z,0,-e.x).normalize();const t=Math.acos(e.y);this.quaternion.setFromAxisAngle(gE,t)}}setLength(e,t=e*.2,i=t*.2){this.line.scale.set(1,Math.max(1e-4,e-t),1),this.line.updateMatrix(),this.cone.scale.set(i,t,i),this.cone.position.y=e,this.cone.updateMatrix()}setColor(e){this.line.material.color.set(e),this.cone.material.color.set(e)}copy(e){return super.copy(e,!1),this.line.copy(e.line),this.cone.copy(e.cone),this}}class Bz extends Pr{constructor(e=1){const t=[0,0,0,e,0,0,0,0,0,0,e,0,0,0,0,0,0,e],i=[1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],r=new lt;r.setAttribute("position",new Fe(t,3)),r.setAttribute("color",new Fe(i,3));const s=new ei({vertexColors:!0,toneMapped:!1});super(r,s),this.type="AxesHelper"}setColors(e,t,i){const r=new De,s=this.geometry.attributes.color.array;return r.set(e),r.toArray(s,0),r.toArray(s,3),r.set(t),r.toArray(s,6),r.toArray(s,9),r.set(i),r.toArray(s,12),r.toArray(s,15),this.geometry.attributes.color.needsUpdate=!0,this}dispose(){this.geometry.dispose(),this.material.dispose()}}class Vz{constructor(){this.type="ShapePath",this.color=new De,this.subPaths=[],this.currentPath=null}moveTo(e,t){return this.currentPath=new mc,this.subPaths.push(this.currentPath),this.currentPath.moveTo(e,t),this}lineTo(e,t){return this.currentPath.lineTo(e,t),this}quadraticCurveTo(e,t,i,r){return this.currentPath.quadraticCurveTo(e,t,i,r),this}bezierCurveTo(e,t,i,r,s,o){return this.currentPath.bezierCurveTo(e,t,i,r,s,o),this}splineThru(e){return this.currentPath.splineThru(e),this}toShapes(e){function t(_){const S=[];for(let E=0,T=_.length;E<T;E++){const C=_[E],P=new ra;P.curves=C.curves,S.push(P)}return S}function i(_,S){const E=S.length;let T=!1;for(let C=E-1,P=0;P<E;C=P++){let I=S[C],A=S[P],L=A.x-I.x,z=A.y-I.y;if(Math.abs(z)>Number.EPSILON){if(z<0&&(I=S[P],L=-L,A=S[C],z=-z),_.y<I.y||_.y>A.y)continue;if(_.y===I.y){if(_.x===I.x)return!0}else{const j=z*(_.x-I.x)-L*(_.y-I.y);if(j===0)return!0;if(j<0)continue;T=!T}}else{if(_.y!==I.y)continue;if(A.x<=_.x&&_.x<=I.x||I.x<=_.x&&_.x<=A.x)return!0}}return T}const r=Lr.isClockWise,s=this.subPaths;if(s.length===0)return[];let o,l,c;const f=[];if(s.length===1)return l=s[0],c=new ra,c.curves=l.curves,f.push(c),f;let d=!r(s[0].getPoints());d=e?!d:d;const h=[],m=[];let g=[],x=0,y;m[x]=void 0,g[x]=[];for(let _=0,S=s.length;_<S;_++)l=s[_],y=l.getPoints(),o=r(y),o=e?!o:o,o?(!d&&m[x]&&x++,m[x]={s:new ra,p:y},m[x].s.curves=l.curves,d&&x++,g[x]=[]):g[x].push({h:l,p:y[0]});if(!m[0])return t(s);if(m.length>1){let _=!1,S=0;for(let E=0,T=m.length;E<T;E++)h[E]=[];for(let E=0,T=m.length;E<T;E++){const C=g[E];for(let P=0;P<C.length;P++){const I=C[P];let A=!0;for(let L=0;L<m.length;L++)i(I.p,m[L].p)&&(E!==L&&S++,A?(A=!1,h[L].push(I)):_=!0);A&&h[E].push(I)}}S>0&&_===!1&&(g=h)}let w;for(let _=0,S=m.length;_<S;_++){c=m[_].s,f.push(c),w=g[_];for(let E=0,T=w.length;E<T;E++)c.holes.push(w[E].h)}return f}}const ds=Hz();function Hz(){const n=new ArrayBuffer(4),e=new Float32Array(n),t=new Uint32Array(n),i=new Uint32Array(512),r=new Uint32Array(512);for(let c=0;c<256;++c){const f=c-127;f<-27?(i[c]=0,i[c|256]=32768,r[c]=24,r[c|256]=24):f<-14?(i[c]=1024>>-f-14,i[c|256]=1024>>-f-14|32768,r[c]=-f-1,r[c|256]=-f-1):f<=15?(i[c]=f+15<<10,i[c|256]=f+15<<10|32768,r[c]=13,r[c|256]=13):f<128?(i[c]=31744,i[c|256]=64512,r[c]=24,r[c|256]=24):(i[c]=31744,i[c|256]=64512,r[c]=13,r[c|256]=13)}const s=new Uint32Array(2048),o=new Uint32Array(64),l=new Uint32Array(64);for(let c=1;c<1024;++c){let f=c<<13,d=0;for(;(f&8388608)===0;)f<<=1,d-=8388608;f&=-8388609,d+=947912704,s[c]=f|d}for(let c=1024;c<2048;++c)s[c]=939524096+(c-1024<<13);for(let c=1;c<31;++c)o[c]=c<<23;o[31]=1199570944,o[32]=2147483648;for(let c=33;c<63;++c)o[c]=2147483648+(c-32<<23);o[63]=3347054592;for(let c=1;c<64;++c)c!==32&&(l[c]=1024);return{floatView:e,uint32View:t,baseTable:i,shiftTable:r,mantissaTable:s,exponentTable:o,offsetTable:l}}function Wz(n){Math.abs(n)>65504&&console.warn("THREE.DataUtils.toHalfFloat(): Value out of range."),n=nn(n,-65504,65504),ds.floatView[0]=n;const e=ds.uint32View[0],t=e>>23&511;return ds.baseTable[t]+((e&8388607)>>ds.shiftTable[t])}function Gz(n){const e=n>>10;return ds.uint32View[0]=ds.mantissaTable[ds.offsetTable[e]+(n&1023)]+ds.exponentTable[e],ds.floatView[0]}var Xz=Object.freeze({__proto__:null,toHalfFloat:Wz,fromHalfFloat:Gz});function jz(){console.error("THREE.ImmediateRenderObject has been removed.")}class Yz extends Bi{constructor(e,t,i){console.error('THREE.WebGLMultisampleRenderTarget has been removed. Use a normal render target and set the "samples" property to greater 0 to enable multisampling.'),super(e,t,i),this.samples=4}}class qz extends tc{constructor(e,t,i,r){console.warn("THREE.DataTexture2DArray has been renamed to DataArrayTexture."),super(e,t,i,r)}}class Zz extends Ud{constructor(e,t,i,r){console.warn("THREE.DataTexture3D has been renamed to Data3DTexture."),super(e,t,i,r)}}class Jz extends ro{constructor(e,t,i,r,s,o){console.warn("THREE.BoxBufferGeometry has been renamed to THREE.BoxGeometry."),super(e,t,i,r,s,o)}}class Qz extends gc{constructor(e,t,i,r){console.warn("THREE.CapsuleBufferGeometry has been renamed to THREE.CapsuleGeometry."),super(e,t,i,r)}}class Kz extends vc{constructor(e,t,i,r){console.warn("THREE.CircleBufferGeometry has been renamed to THREE.CircleGeometry."),super(e,t,i,r)}}class $z extends yc{constructor(e,t,i,r,s,o,l){console.warn("THREE.ConeBufferGeometry has been renamed to THREE.ConeGeometry."),super(e,t,i,r,s,o,l)}}class eN extends ia{constructor(e,t,i,r,s,o,l,c){console.warn("THREE.CylinderBufferGeometry has been renamed to THREE.CylinderGeometry."),super(e,t,i,r,s,o,l,c)}}class tN extends xc{constructor(e,t){console.warn("THREE.DodecahedronBufferGeometry has been renamed to THREE.DodecahedronGeometry."),super(e,t)}}class nN extends Mc{constructor(e,t){console.warn("THREE.ExtrudeBufferGeometry has been renamed to THREE.ExtrudeGeometry."),super(e,t)}}class iN extends Ec{constructor(e,t){console.warn("THREE.IcosahedronBufferGeometry has been renamed to THREE.IcosahedronGeometry."),super(e,t)}}class rN extends Il{constructor(e,t,i,r){console.warn("THREE.LatheBufferGeometry has been renamed to THREE.LatheGeometry."),super(e,t,i,r)}}class sN extends zl{constructor(e,t){console.warn("THREE.OctahedronBufferGeometry has been renamed to THREE.OctahedronGeometry."),super(e,t)}}class oN extends wl{constructor(e,t,i,r){console.warn("THREE.PlaneBufferGeometry has been renamed to THREE.PlaneGeometry."),super(e,t,i,r)}}class aN extends us{constructor(e,t,i,r){console.warn("THREE.PolyhedronBufferGeometry has been renamed to THREE.PolyhedronGeometry."),super(e,t,i,r)}}class lN extends Tc{constructor(e,t,i,r,s,o){console.warn("THREE.RingBufferGeometry has been renamed to THREE.RingGeometry."),super(e,t,i,r,s,o)}}class uN extends bc{constructor(e,t){console.warn("THREE.ShapeBufferGeometry has been renamed to THREE.ShapeGeometry."),super(e,t)}}class cN extends Nl{constructor(e,t,i,r,s,o,l){console.warn("THREE.SphereBufferGeometry has been renamed to THREE.SphereGeometry."),super(e,t,i,r,s,o,l)}}class fN extends Ac{constructor(e,t){console.warn("THREE.TetrahedronBufferGeometry has been renamed to THREE.TetrahedronGeometry."),super(e,t)}}class dN extends Cc{constructor(e,t,i,r,s){console.warn("THREE.TorusBufferGeometry has been renamed to THREE.TorusGeometry."),super(e,t,i,r,s)}}class hN extends Pc{constructor(e,t,i,r,s,o){console.warn("THREE.TorusKnotBufferGeometry has been renamed to THREE.TorusKnotGeometry."),super(e,t,i,r,s,o)}}class pN extends Lc{constructor(e,t,i,r,s){console.warn("THREE.TubeBufferGeometry has been renamed to THREE.TubeGeometry."),super(e,t,i,r,s)}}typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:Sd}})),typeof window<"u"&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=Sd);const Uh=Object.freeze(Object.defineProperty({__proto__:null,ACESFilmicToneMapping:m0,AddEquation:Ho,AddOperation:xS,AdditiveAnimationBlendMode:U0,AdditiveBlending:l0,AlphaFormat:PS,AlwaysDepth:dS,AlwaysStencilFunc:XS,AmbientLight:q2,AmbientLightProbe:nz,AnimationClip:zc,AnimationLoader:WD,AnimationMixer:wz,AnimationObjectGroup:yz,AnimationUtils:UD,ArcCurve:f2,ArrayCamera:OM,ArrowHelper:Uz,Audio:iE,AudioAnalyser:lz,AudioContext:ty,AudioListener:sz,AudioLoader:ez,AxesHelper:Bz,BackSide:Si,BasicDepthPacking:HS,BasicShadowMap:qA,Bone:bv,BooleanKeyframeTrack:oa,Box2:bz,Box3:Cr,Box3Helper:Oz,BoxBufferGeometry:Jz,BoxGeometry:ro,BoxHelper:kz,BufferAttribute:It,BufferGeometry:lt,BufferGeometryLoader:ey,ByteType:ES,Cache:la,Camera:oc,CameraHelper:Nz,CanvasTexture:uD,CapsuleBufferGeometry:Qz,CapsuleGeometry:gc,CatmullRomCurve3:d2,CineonToneMapping:SS,CircleBufferGeometry:Kz,CircleGeometry:vc,ClampToEdgeWrapping:Zn,Clock:ny,Color:De,ColorKeyframeTrack:qv,ColorManagement:Ui,CompressedTexture:c2,CompressedTextureLoader:GD,ConeBufferGeometry:$z,ConeGeometry:yc,CubeCamera:lM,CubeReflectionMapping:Ws,CubeRefractionMapping:Gs,CubeTexture:ac,CubeTextureLoader:XD,CubeUVReflectionMapping:il,CubicBezierCurve:zv,CubicBezierCurve3:p2,CubicInterpolant:k2,CullFaceBack:s0,CullFaceFront:Kw,CullFaceFrontBack:YA,CullFaceNone:Qw,Curve:mr,CurvePath:g2,CustomBlending:$w,CustomToneMapping:MS,CylinderBufferGeometry:eN,CylinderGeometry:ia,Cylindrical:Tz,Data3DTexture:Ud,DataArrayTexture:tc,DataTexture:Ll,DataTexture2DArray:qz,DataTexture3D:Zz,DataTextureLoader:jD,DataUtils:Xz,DecrementStencilOp:oC,DecrementWrapStencilOp:lC,DefaultLoadingManager:U2,DepthFormat:Ys,DepthStencilFormat:Xo,DepthTexture:FM,DirectionalLight:Y2,DirectionalLightHelper:zz,DiscreteInterpolant:O2,DodecahedronBufferGeometry:tN,DodecahedronGeometry:xc,DoubleSide:Kr,DstAlphaFactor:oS,DstColorFactor:lS,DynamicCopyUsage:MC,DynamicDrawUsage:vC,DynamicReadUsage:_C,EdgesGeometry:v2,EllipseCurve:_h,EqualDepth:pS,EqualStencilFunc:dC,EquirectangularReflectionMapping:Gu,EquirectangularRefractionMapping:Xu,Euler:fl,EventDispatcher:Ar,ExtrudeBufferGeometry:nN,ExtrudeGeometry:Mc,FileLoader:fs,Float16BufferAttribute:iP,Float32BufferAttribute:Fe,Float64BufferAttribute:rP,FloatType:es,Fog:uh,FogExp2:lh,FramebufferTexture:lD,FrontSide:Bo,Frustum:rh,GLBufferAttribute:Ez,GLSL1:TC,GLSL3:B0,GreaterDepth:gS,GreaterEqualDepth:mS,GreaterEqualStencilFunc:gC,GreaterStencilFunc:pC,GridHelper:Iz,Group:Tl,HalfFloatType:rl,HemisphereLight:B2,HemisphereLightHelper:Rz,HemisphereLightProbe:tz,IcosahedronBufferGeometry:iN,IcosahedronGeometry:Ec,ImageBitmapLoader:$D,ImageLoader:Nc,ImageUtils:X0,ImmediateRenderObject:jz,IncrementStencilOp:sC,IncrementWrapStencilOp:aC,InstancedBufferAttribute:Rl,InstancedBufferGeometry:$v,InstancedInterleavedBuffer:Ih,InstancedMesh:e2,Int16BufferAttribute:tP,Int32BufferAttribute:nP,Int8BufferAttribute:KC,IntType:bS,InterleavedBuffer:ch,InterleavedBufferAttribute:bi,Interpolant:Rc,InterpolateDiscrete:qu,InterpolateLinear:Zu,InterpolateSmooth:Rd,InvertStencilOp:uC,KeepStencilOp:Dd,KeyframeTrack:gr,LOD:XM,LatheBufferGeometry:rN,LatheGeometry:Il,Layers:ea,LessDepth:hS,LessEqualDepth:Md,LessEqualStencilFunc:hC,LessStencilFunc:fC,Light:uo,LightProbe:Ph,Line:ao,Line3:co,LineBasicMaterial:ei,LineCurve:Sh,LineCurve3:m2,LineDashedMaterial:z2,LineLoop:o2,LineSegments:Pr,LinearEncoding:ts,LinearFilter:tn,LinearInterpolant:Yv,LinearMipMapLinearFilter:KA,LinearMipMapNearestFilter:QA,LinearMipmapLinearFilter:Wo,LinearMipmapNearestFilter:g0,LinearSRGBColorSpace:Zs,LinearToneMapping:_S,Loader:Ai,LoaderUtils:Kv,LoadingManager:Zv,LoopOnce:US,LoopPingPong:VS,LoopRepeat:BS,LuminanceAlphaFormat:IS,LuminanceFormat:RS,MOUSE:Fo,Material:Pn,MaterialLoader:Lh,MathUtils:qS,Matrix3:ui,Matrix4:st,MaxEquation:d0,Mesh:wn,MeshBasicMaterial:eo,MeshDepthMaterial:xv,MeshDistanceMaterial:_v,MeshLambertMaterial:I2,MeshMatcapMaterial:D2,MeshNormalMaterial:R2,MeshPhongMaterial:P2,MeshPhysicalMaterial:C2,MeshStandardMaterial:Wv,MeshToonMaterial:L2,MinEquation:f0,MirroredRepeatWrapping:Yu,MixOperation:yS,MultiplyBlending:c0,MultiplyOperation:Wu,NearestFilter:ln,NearestMipMapLinearFilter:JA,NearestMipMapNearestFilter:ZA,NearestMipmapLinearFilter:bd,NearestMipmapNearestFilter:Td,NeverDepth:fS,NeverStencilFunc:cC,NoBlending:$r,NoColorSpace:nC,NoToneMapping:cr,NormalAnimationBlendMode:Id,NormalBlending:Vo,NotEqualDepth:vS,NotEqualStencilFunc:mC,NumberKeyframeTrack:Ic,Object3D:Mt,ObjectLoader:QD,ObjectSpaceNormalMap:GS,OctahedronBufferGeometry:sN,OctahedronGeometry:zl,OneFactor:iS,OneMinusDstAlphaFactor:aS,OneMinusDstColorFactor:uS,OneMinusSrcAlphaFactor:p0,OneMinusSrcColorFactor:sS,OrthographicCamera:oo,PCFShadowMap:o0,PCFSoftShadowMap:a0,PMREMGenerator:mv,Path:mc,PerspectiveCamera:Bt,Plane:so,PlaneBufferGeometry:oN,PlaneGeometry:wl,PlaneHelper:Fz,PointLight:j2,PointLightHelper:Pz,Points:l2,PointsMaterial:Cv,PolarGridHelper:Dz,PolyhedronBufferGeometry:aN,PolyhedronGeometry:us,PositionalAudio:az,PropertyBinding:St,PropertyMixer:sE,QuadraticBezierCurve:Nv,QuadraticBezierCurve3:kv,Quaternion:Fn,QuaternionKeyframeTrack:kl,QuaternionLinearInterpolant:F2,REVISION:Sd,RGBADepthPacking:WS,RGBAFormat:Fi,RGBAIntegerFormat:OS,RGBA_ASTC_10x10_Format:N0,RGBA_ASTC_10x5_Format:I0,RGBA_ASTC_10x6_Format:D0,RGBA_ASTC_10x8_Format:z0,RGBA_ASTC_12x10_Format:k0,RGBA_ASTC_12x12_Format:O0,RGBA_ASTC_4x4_Format:E0,RGBA_ASTC_5x4_Format:T0,RGBA_ASTC_5x5_Format:b0,RGBA_ASTC_6x5_Format:A0,RGBA_ASTC_6x6_Format:C0,RGBA_ASTC_8x5_Format:P0,RGBA_ASTC_8x6_Format:L0,RGBA_ASTC_8x8_Format:R0,RGBA_BPTC_Format:F0,RGBA_ETC2_EAC_Format:M0,RGBA_PVRTC_2BPPV1_Format:w0,RGBA_PVRTC_4BPPV1_Format:_0,RGBA_S3TC_DXT1_Format:Cd,RGBA_S3TC_DXT3_Format:Pd,RGBA_S3TC_DXT5_Format:Ld,RGBFormat:LS,RGB_ETC1_Format:FS,RGB_ETC2_Format:S0,RGB_PVRTC_2BPPV1_Format:x0,RGB_PVRTC_4BPPV1_Format:y0,RGB_S3TC_DXT1_Format:Ad,RGFormat:NS,RGIntegerFormat:kS,RawShaderMaterial:A2,Ray:ic,Raycaster:oE,RectAreaLight:Z2,RedFormat:DS,RedIntegerFormat:zS,ReinhardToneMapping:wS,RepeatWrapping:ju,ReplaceStencilOp:rC,ReverseSubtractEquation:tS,RingBufferGeometry:lN,RingGeometry:Tc,SRGBColorSpace:br,Scene:Mv,ShaderChunk:dt,ShaderLib:Jn,ShaderMaterial:pr,ShadowMaterial:b2,Shape:ra,ShapeBufferGeometry:uN,ShapeGeometry:bc,ShapePath:Vz,ShapeUtils:Lr,ShortType:TS,Skeleton:mh,SkeletonHelper:Cz,SkinnedMesh:JM,Source:Jo,Sphere:rs,SphereBufferGeometry:cN,SphereGeometry:Nl,Spherical:ay,SphericalHarmonics3:J2,SplineCurve:Ov,SpotLight:G2,SpotLightHelper:Az,Sprite:WM,SpriteMaterial:Ev,SrcAlphaFactor:h0,SrcAlphaSaturateFactor:cS,SrcColorFactor:rS,StaticCopyUsage:SC,StaticDrawUsage:Qu,StaticReadUsage:xC,StereoCamera:iz,StreamCopyUsage:EC,StreamDrawUsage:yC,StreamReadUsage:wC,StringKeyframeTrack:aa,SubtractEquation:eS,SubtractiveBlending:u0,TOUCH:Uo,TangentSpaceNormalMap:qs,TetrahedronBufferGeometry:fN,TetrahedronGeometry:Ac,Texture:un,TextureLoader:YD,TorusBufferGeometry:dN,TorusGeometry:Cc,TorusKnotBufferGeometry:hN,TorusKnotGeometry:Pc,Triangle:Vi,TriangleFanDrawMode:tC,TriangleStripDrawMode:eC,TrianglesDrawMode:$A,TubeBufferGeometry:pN,TubeGeometry:Lc,UVMapping:Ed,Uint16BufferAttribute:rv,Uint32BufferAttribute:sv,Uint8BufferAttribute:$C,Uint8ClampedBufferAttribute:eP,Uniform:sy,UniformsGroup:Mz,UniformsLib:Se,UniformsUtils:nh,UnsignedByteType:Xs,UnsignedInt248Type:Go,UnsignedIntType:js,UnsignedShort4444Type:AS,UnsignedShort5551Type:CS,UnsignedShortType:v0,VSMShadowMap:nl,Vector2:fe,Vector3:R,Vector4:wt,VectorKeyframeTrack:Dc,VideoTexture:aD,WebGL1Renderer:UM,WebGL3DRenderTarget:HC,WebGLArrayRenderTarget:VC,WebGLCubeRenderTarget:uM,WebGLMultipleRenderTargets:WC,WebGLMultisampleRenderTarget:Yz,WebGLRenderTarget:Bi,WebGLRenderer:Sv,WebGLUtils:kM,WireframeGeometry:Hv,WrapAroundEnding:Ju,ZeroCurvatureEnding:jo,ZeroFactor:nS,ZeroSlopeEnding:Yo,ZeroStencilOp:iC,_SRGBAFormat:zd,sRGBEncoding:Ft},Symbol.toStringTag,{value:"Module"}));var pa={exports:{}},ma={};/**
 * @license React
 * react-reconciler-constants.production.min.js
 *
 * Copyright (c) Facebook, Inc. and its affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */ma.ConcurrentRoot=1,ma.ContinuousEventPriority=4,ma.DefaultEventPriority=16,ma.DiscreteEventPriority=1,ma.IdleEventPriority=536870912,ma.LegacyRoot=0,function(n){n.exports=ma}(pa);function mN(n){let e;const t=new Set,i=(f,d)=>{const h=typeof f=="function"?f(e):f;if(h!==e){const m=e;e=d?h:Object.assign({},e,h),t.forEach(g=>g(e,m))}},r=()=>e,s=(f,d=r,h=Object.is)=>{console.warn("[DEPRECATED] Please use `subscribeWithSelector` middleware");let m=d(e);function g(){const x=d(e);if(!h(m,x)){const y=m;f(m=x,y)}}return t.add(g),()=>t.delete(g)},c={setState:i,getState:r,subscribe:(f,d,h)=>d||h?s(f,d,h):(t.add(f),()=>t.delete(f)),destroy:()=>t.clear()};return e=n(i,r,c),c}const vE=typeof window>"u"||!window.navigator||/ServerSideRendering|^Deno\//.test(window.navigator.userAgent)?ke.exports.useEffect:ke.exports.useLayoutEffect;function gN(n){const e=typeof n=="function"?mN(n):n,t=(i=e.getState,r=Object.is)=>{const[,s]=ke.exports.useReducer(w=>w+1,0),o=e.getState(),l=ke.exports.useRef(o),c=ke.exports.useRef(i),f=ke.exports.useRef(r),d=ke.exports.useRef(!1),h=ke.exports.useRef();h.current===void 0&&(h.current=i(o));let m,g=!1;(l.current!==o||c.current!==i||f.current!==r||d.current)&&(m=i(o),g=!r(h.current,m)),vE(()=>{g&&(h.current=m),l.current=o,c.current=i,f.current=r,d.current=!1});const x=ke.exports.useRef(o);vE(()=>{const w=()=>{try{const S=e.getState(),E=c.current(S);f.current(h.current,E)||(l.current=S,h.current=E,s())}catch{d.current=!0,s()}},_=e.subscribe(w);return e.getState()!==x.current&&w(),_},[]);const y=g?m:h.current;return ke.exports.useDebugValue(y),y};return Object.assign(t,e),t[Symbol.iterator]=function(){console.warn("[useStore, api] = create() is deprecated and will be removed in v4");const i=[t,e];return{next(){const r=i.length<=0;return{value:i.shift(),done:r}}}},t}var yE={exports:{}},Bh={exports:{}},xE={};/**
 * @license React
 * scheduler.production.min.js
 *
 * Copyright (c) Facebook, Inc. and its affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */(function(n){function e(k,B){var F=k.length;k.push(B);e:for(;0<F;){var $=F-1>>>1,J=k[$];if(0<r(J,B))k[$]=B,k[F]=J,F=$;else break e}}function t(k){return k.length===0?null:k[0]}function i(k){if(k.length===0)return null;var B=k[0],F=k.pop();if(F!==B){k[0]=F;e:for(var $=0,J=k.length,me=J>>>1;$<me;){var Me=2*($+1)-1,Ve=k[Me],re=Me+1,Xe=k[re];if(0>r(Ve,F))re<J&&0>r(Xe,Ve)?(k[$]=Xe,k[re]=F,$=re):(k[$]=Ve,k[Me]=F,$=Me);else if(re<J&&0>r(Xe,F))k[$]=Xe,k[re]=F,$=re;else break e}}return B}function r(k,B){var F=k.sortIndex-B.sortIndex;return F!==0?F:k.id-B.id}if(typeof performance=="object"&&typeof performance.now=="function"){var s=performance;n.unstable_now=function(){return s.now()}}else{var o=Date,l=o.now();n.unstable_now=function(){return o.now()-l}}var c=[],f=[],d=1,h=null,m=3,g=!1,x=!1,y=!1,w=typeof setTimeout=="function"?setTimeout:null,_=typeof clearTimeout=="function"?clearTimeout:null,S=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function E(k){for(var B=t(f);B!==null;){if(B.callback===null)i(f);else if(B.startTime<=k)i(f),B.sortIndex=B.expirationTime,e(c,B);else break;B=t(f)}}function T(k){if(y=!1,E(k),!x)if(t(c)!==null)x=!0,ee(C);else{var B=t(f);B!==null&&pe(T,B.startTime-k)}}function C(k,B){x=!1,y&&(y=!1,_(A),A=-1),g=!0;var F=m;try{for(E(B),h=t(c);h!==null&&(!(h.expirationTime>B)||k&&!j());){var $=h.callback;if(typeof $=="function"){h.callback=null,m=h.priorityLevel;var J=$(h.expirationTime<=B);B=n.unstable_now(),typeof J=="function"?h.callback=J:h===t(c)&&i(c),E(B)}else i(c);h=t(c)}if(h!==null)var me=!0;else{var Me=t(f);Me!==null&&pe(T,Me.startTime-B),me=!1}return me}finally{h=null,m=F,g=!1}}var P=!1,I=null,A=-1,L=5,z=-1;function j(){return!(n.unstable_now()-z<L)}function ue(){if(I!==null){var k=n.unstable_now();z=k;var B=!0;try{B=I(!0,k)}finally{B?Z():(P=!1,I=null)}}else P=!1}var Z;if(typeof S=="function")Z=function(){S(ue)};else if(typeof MessageChannel<"u"){var G=new MessageChannel,ie=G.port2;G.port1.onmessage=ue,Z=function(){ie.postMessage(null)}}else Z=function(){w(ue,0)};function ee(k){I=k,P||(P=!0,Z())}function pe(k,B){A=w(function(){k(n.unstable_now())},B)}n.unstable_IdlePriority=5,n.unstable_ImmediatePriority=1,n.unstable_LowPriority=4,n.unstable_NormalPriority=3,n.unstable_Profiling=null,n.unstable_UserBlockingPriority=2,n.unstable_cancelCallback=function(k){k.callback=null},n.unstable_continueExecution=function(){x||g||(x=!0,ee(C))},n.unstable_forceFrameRate=function(k){0>k||125<k?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):L=0<k?Math.floor(1e3/k):5},n.unstable_getCurrentPriorityLevel=function(){return m},n.unstable_getFirstCallbackNode=function(){return t(c)},n.unstable_next=function(k){switch(m){case 1:case 2:case 3:var B=3;break;default:B=m}var F=m;m=B;try{return k()}finally{m=F}},n.unstable_pauseExecution=function(){},n.unstable_requestPaint=function(){},n.unstable_runWithPriority=function(k,B){switch(k){case 1:case 2:case 3:case 4:case 5:break;default:k=3}var F=m;m=k;try{return B()}finally{m=F}},n.unstable_scheduleCallback=function(k,B,F){var $=n.unstable_now();switch(typeof F=="object"&&F!==null?(F=F.delay,F=typeof F=="number"&&0<F?$+F:$):F=$,k){case 1:var J=-1;break;case 2:J=250;break;case 5:J=1073741823;break;case 4:J=1e4;break;default:J=5e3}return J=F+J,k={id:d++,callback:B,priorityLevel:k,startTime:F,expirationTime:J,sortIndex:-1},F>$?(k.sortIndex=F,e(f,k),t(c)===null&&k===t(f)&&(y?(_(A),A=-1):y=!0,pe(T,F-$))):(k.sortIndex=J,e(c,k),x||g||(x=!0,ee(C))),k},n.unstable_shouldYield=j,n.unstable_wrapCallback=function(k){var B=m;return function(){var F=m;m=B;try{return k.apply(this,arguments)}finally{m=F}}}})(xE),function(n){n.exports=xE}(Bh);/**
 * @license React
 * react-reconciler.production.min.js
 *
 * Copyright (c) Facebook, Inc. and its affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */var vN=function(e){var t={},i=ke.exports,r=Bh.exports,s=Object.assign;function o(a){for(var u="https://reactjs.org/docs/error-decoder.html?invariant="+a,p=1;p<arguments.length;p++)u+="&args[]="+encodeURIComponent(arguments[p]);return"Minified React error #"+a+"; visit "+u+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var l=i.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,c=Symbol.for("react.element"),f=Symbol.for("react.portal"),d=Symbol.for("react.fragment"),h=Symbol.for("react.strict_mode"),m=Symbol.for("react.profiler"),g=Symbol.for("react.provider"),x=Symbol.for("react.context"),y=Symbol.for("react.forward_ref"),w=Symbol.for("react.suspense"),_=Symbol.for("react.suspense_list"),S=Symbol.for("react.memo"),E=Symbol.for("react.lazy"),T=Symbol.for("react.offscreen"),C=Symbol.iterator;function P(a){return a===null||typeof a!="object"?null:(a=C&&a[C]||a["@@iterator"],typeof a=="function"?a:null)}function I(a){if(a==null)return null;if(typeof a=="function")return a.displayName||a.name||null;if(typeof a=="string")return a;switch(a){case d:return"Fragment";case f:return"Portal";case m:return"Profiler";case h:return"StrictMode";case w:return"Suspense";case _:return"SuspenseList"}if(typeof a=="object")switch(a.$$typeof){case x:return(a.displayName||"Context")+".Consumer";case g:return(a._context.displayName||"Context")+".Provider";case y:var u=a.render;return a=a.displayName,a||(a=u.displayName||u.name||"",a=a!==""?"ForwardRef("+a+")":"ForwardRef"),a;case S:return u=a.displayName||null,u!==null?u:I(a.type)||"Memo";case E:u=a._payload,a=a._init;try{return I(a(u))}catch{}}return null}function A(a){var u=a.type;switch(a.tag){case 24:return"Cache";case 9:return(u.displayName||"Context")+".Consumer";case 10:return(u._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return a=u.render,a=a.displayName||a.name||"",u.displayName||(a!==""?"ForwardRef("+a+")":"ForwardRef");case 7:return"Fragment";case 5:return u;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return I(u);case 8:return u===h?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof u=="function")return u.displayName||u.name||null;if(typeof u=="string")return u}return null}function L(a){var u=a,p=a;if(a.alternate)for(;u.return;)u=u.return;else{a=u;do u=a,(u.flags&4098)!==0&&(p=u.return),a=u.return;while(a)}return u.tag===3?p:null}function z(a){if(L(a)!==a)throw Error(o(188))}function j(a){var u=a.alternate;if(!u){if(u=L(a),u===null)throw Error(o(188));return u!==a?null:a}for(var p=a,v=u;;){var M=p.return;if(M===null)break;var b=M.alternate;if(b===null){if(v=M.return,v!==null){p=v;continue}break}if(M.child===b.child){for(b=M.child;b;){if(b===p)return z(M),a;if(b===v)return z(M),u;b=b.sibling}throw Error(o(188))}if(p.return!==v.return)p=M,v=b;else{for(var O=!1,H=M.child;H;){if(H===p){O=!0,p=M,v=b;break}if(H===v){O=!0,v=M,p=b;break}H=H.sibling}if(!O){for(H=b.child;H;){if(H===p){O=!0,p=b,v=M;break}if(H===v){O=!0,v=b,p=M;break}H=H.sibling}if(!O)throw Error(o(189))}}if(p.alternate!==v)throw Error(o(190))}if(p.tag!==3)throw Error(o(188));return p.stateNode.current===p?a:u}function ue(a){return a=j(a),a!==null?Z(a):null}function Z(a){if(a.tag===5||a.tag===6)return a;for(a=a.child;a!==null;){var u=Z(a);if(u!==null)return u;a=a.sibling}return null}function G(a){if(a.tag===5||a.tag===6)return a;for(a=a.child;a!==null;){if(a.tag!==4){var u=G(a);if(u!==null)return u}a=a.sibling}return null}var ie=Array.isArray,ee=e.getPublicInstance,pe=e.getRootHostContext,k=e.getChildHostContext,B=e.prepareForCommit,F=e.resetAfterCommit,$=e.createInstance,J=e.appendInitialChild,me=e.finalizeInitialChildren,Me=e.prepareUpdate,Ve=e.shouldSetTextContent,re=e.createTextInstance,Xe=e.scheduleTimeout,je=e.cancelTimeout,Je=e.noTimeout,be=e.isPrimaryRenderer,Qe=e.supportsMutation,he=e.supportsPersistence,oe=e.supportsHydration,xe=e.getInstanceFromNode,Ue=e.preparePortalMount,Ae=e.getCurrentEventPriority,$e=e.detachDeletedInstance,Ye=e.supportsMicrotasks,Ge=e.scheduleMicrotask,vt=e.supportsTestSelectors,Et=e.findFiberRoot,U=e.getBoundingRect,D=e.getTextContent,te=e.isHiddenSubtree,ve=e.matchAccessibilityRole,we=e.setFocusIfFocusable,Ce=e.setupIntersectionObserver,Ke=e.appendChild,se=e.appendChildToContainer,Be=e.commitTextUpdate,Ie=e.commitMount,V=e.commitUpdate,K=e.insertBefore,_e=e.insertInContainerBefore,Oe=e.removeChild,ot=e.removeChildFromContainer,W=e.resetTextContent,Le=e.hideInstance,le=e.hideTextInstance,Te=e.unhideInstance,Ee=e.unhideTextInstance,yt=e.clearContainer,fn=e.cloneInstance,Vt=e.createContainerChildSet,vr=e.appendChildToContainerChildSet,Ht=e.finalizeContainerChildren,Gi=e.replaceContainerChildren,ti=e.cloneHiddenInstance,Zh=e.cloneHiddenTextInstance,Vl=e.canHydrateInstance,Jh=e.canHydrateTextInstance,Ay=e.canHydrateSuspenseInstance,Qh=e.isSuspenseInstancePending,Vc=e.isSuspenseInstanceFallback,N=e.registerSuspenseInstanceRetry,q=e.getNextHydratableSibling,ce=e.getFirstHydratableChild,Y=e.getFirstHydratableChildWithinContainer,de=e.getFirstHydratableChildWithinSuspenseInstance,qe=e.hydrateInstance,et=e.hydrateTextInstance,ut=e.hydrateSuspenseInstance,tt=e.getNextHydratableInstanceAfterSuspenseInstance,Tt=e.commitHydratedContainer,mt=e.commitHydratedSuspenseInstance,gt=e.clearSuspenseBoundary,Wt=e.clearSuspenseBoundaryFromContainer,ps=e.shouldDeleteUnhydratedTailInstances,ho=e.didNotMatchHydratedContainerTextInstance,po=e.didNotMatchHydratedTextInstance,ci;function pt(a){if(ci===void 0)try{throw Error()}catch(p){var u=p.stack.trim().match(/\n( *(at )?)/);ci=u&&u[1]||""}return`
`+ci+a}var zr=!1;function Gt(a,u){if(!a||zr)return"";zr=!0;var p=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(u)if(u=function(){throw Error()},Object.defineProperty(u.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(u,[])}catch(ye){var v=ye}Reflect.construct(a,[],u)}else{try{u.call()}catch(ye){v=ye}a.call(u.prototype)}else{try{throw Error()}catch(ye){v=ye}a()}}catch(ye){if(ye&&v&&typeof ye.stack=="string"){for(var M=ye.stack.split(`
`),b=v.stack.split(`
`),O=M.length-1,H=b.length-1;1<=O&&0<=H&&M[O]!==b[H];)H--;for(;1<=O&&0<=H;O--,H--)if(M[O]!==b[H]){if(O!==1||H!==1)do if(O--,H--,0>H||M[O]!==b[H]){var ae=`
`+M[O].replace(" at new "," at ");return a.displayName&&ae.includes("<anonymous>")&&(ae=ae.replace("<anonymous>",a.displayName)),ae}while(1<=O&&0<=H);break}}}finally{zr=!1,Error.prepareStackTrace=p}return(a=a?a.displayName||a.name:"")?pt(a):""}var fi=Object.prototype.hasOwnProperty,Xi=[],ji=-1;function Yi(a){return{current:a}}function at(a){0>ji||(a.current=Xi[ji],Xi[ji]=null,ji--)}function xt(a,u){ji++,Xi[ji]=a.current,a.current=u}var qi={},Pt=Yi(qi),Sn=Yi(!1),ms=qi;function gs(a,u){var p=a.type.contextTypes;if(!p)return qi;var v=a.stateNode;if(v&&v.__reactInternalMemoizedUnmaskedChildContext===u)return v.__reactInternalMemoizedMaskedChildContext;var M={},b;for(b in p)M[b]=u[b];return v&&(a=a.stateNode,a.__reactInternalMemoizedUnmaskedChildContext=u,a.__reactInternalMemoizedMaskedChildContext=M),M}function di(a){return a=a.childContextTypes,a!=null}function Kh(){at(Sn),at(Pt)}function JE(a,u,p){if(Pt.current!==qi)throw Error(o(168));xt(Pt,u),xt(Sn,p)}function QE(a,u,p){var v=a.stateNode;if(u=u.childContextTypes,typeof v.getChildContext!="function")return p;v=v.getChildContext();for(var M in v)if(!(M in u))throw Error(o(108,A(a)||"Unknown",M));return s({},p,v)}function $h(a){return a=(a=a.stateNode)&&a.__reactInternalMemoizedMergedChildContext||qi,ms=Pt.current,xt(Pt,a),xt(Sn,Sn.current),!0}function KE(a,u,p){var v=a.stateNode;if(!v)throw Error(o(169));p?(a=QE(a,u,ms),v.__reactInternalMemoizedMergedChildContext=a,at(Sn),at(Pt),xt(Pt,a)):at(Sn),xt(Sn,p)}var yr=Math.clz32?Math.clz32:dk,ck=Math.log,fk=Math.LN2;function dk(a){return a>>>=0,a===0?32:31-(ck(a)/fk|0)|0}var ep=64,tp=4194304;function Hc(a){switch(a&-a){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return a&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return a&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return a}}function np(a,u){var p=a.pendingLanes;if(p===0)return 0;var v=0,M=a.suspendedLanes,b=a.pingedLanes,O=p&268435455;if(O!==0){var H=O&~M;H!==0?v=Hc(H):(b&=O,b!==0&&(v=Hc(b)))}else O=p&~M,O!==0?v=Hc(O):b!==0&&(v=Hc(b));if(v===0)return 0;if(u!==0&&u!==v&&(u&M)===0&&(M=v&-v,b=u&-u,M>=b||M===16&&(b&4194240)!==0))return u;if((v&4)!==0&&(v|=p&16),u=a.entangledLanes,u!==0)for(a=a.entanglements,u&=v;0<u;)p=31-yr(u),M=1<<p,v|=a[p],u&=~M;return v}function hk(a,u){switch(a){case 1:case 2:case 4:return u+250;case 8:case 16:case 32:case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return u+5e3;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function pk(a,u){for(var p=a.suspendedLanes,v=a.pingedLanes,M=a.expirationTimes,b=a.pendingLanes;0<b;){var O=31-yr(b),H=1<<O,ae=M[O];ae===-1?((H&p)===0||(H&v)!==0)&&(M[O]=hk(H,u)):ae<=u&&(a.expiredLanes|=H),b&=~H}}function Cy(a){return a=a.pendingLanes&-1073741825,a!==0?a:a&1073741824?1073741824:0}function Py(a){for(var u=[],p=0;31>p;p++)u.push(a);return u}function Wc(a,u,p){a.pendingLanes|=u,u!==536870912&&(a.suspendedLanes=0,a.pingedLanes=0),a=a.eventTimes,u=31-yr(u),a[u]=p}function mk(a,u){var p=a.pendingLanes&~u;a.pendingLanes=u,a.suspendedLanes=0,a.pingedLanes=0,a.expiredLanes&=u,a.mutableReadLanes&=u,a.entangledLanes&=u,u=a.entanglements;var v=a.eventTimes;for(a=a.expirationTimes;0<p;){var M=31-yr(p),b=1<<M;u[M]=0,v[M]=-1,a[M]=-1,p&=~b}}function Ly(a,u){var p=a.entangledLanes|=u;for(a=a.entanglements;p;){var v=31-yr(p),M=1<<v;M&u|a[v]&u&&(a[v]|=u),p&=~M}}var bt=0;function $E(a){return a&=-a,1<a?4<a?(a&268435455)!==0?16:536870912:4:1}var Ry=r.unstable_scheduleCallback,e3=r.unstable_cancelCallback,gk=r.unstable_shouldYield,vk=r.unstable_requestPaint,Mn=r.unstable_now,Iy=r.unstable_ImmediatePriority,yk=r.unstable_UserBlockingPriority,Dy=r.unstable_NormalPriority,xk=r.unstable_IdlePriority,ip=null,Nr=null;function _k(a){if(Nr&&typeof Nr.onCommitFiberRoot=="function")try{Nr.onCommitFiberRoot(ip,a,void 0,(a.current.flags&128)===128)}catch{}}function wk(a,u){return a===u&&(a!==0||1/a===1/u)||a!==a&&u!==u}var kr=typeof Object.is=="function"?Object.is:wk,vs=null,rp=!1,zy=!1;function t3(a){vs===null?vs=[a]:vs.push(a)}function Sk(a){rp=!0,t3(a)}function Or(){if(!zy&&vs!==null){zy=!0;var a=0,u=bt;try{var p=vs;for(bt=1;a<p.length;a++){var v=p[a];do v=v(!0);while(v!==null)}vs=null,rp=!1}catch(M){throw vs!==null&&(vs=vs.slice(a+1)),Ry(Iy,Or),M}finally{bt=u,zy=!1}}return null}var Mk=l.ReactCurrentBatchConfig;function sp(a,u){if(kr(a,u))return!0;if(typeof a!="object"||a===null||typeof u!="object"||u===null)return!1;var p=Object.keys(a),v=Object.keys(u);if(p.length!==v.length)return!1;for(v=0;v<p.length;v++){var M=p[v];if(!fi.call(u,M)||!kr(a[M],u[M]))return!1}return!0}function Ek(a){switch(a.tag){case 5:return pt(a.type);case 16:return pt("Lazy");case 13:return pt("Suspense");case 19:return pt("SuspenseList");case 0:case 2:case 15:return a=Gt(a.type,!1),a;case 11:return a=Gt(a.type.render,!1),a;case 1:return a=Gt(a.type,!0),a;default:return""}}function xr(a,u){if(a&&a.defaultProps){u=s({},u),a=a.defaultProps;for(var p in a)u[p]===void 0&&(u[p]=a[p]);return u}return u}var op=Yi(null),ap=null,Hl=null,Ny=null;function ky(){Ny=Hl=ap=null}function n3(a,u,p){be?(xt(op,u._currentValue),u._currentValue=p):(xt(op,u._currentValue2),u._currentValue2=p)}function Oy(a){var u=op.current;at(op),be?a._currentValue=u:a._currentValue2=u}function Fy(a,u,p){for(;a!==null;){var v=a.alternate;if((a.childLanes&u)!==u?(a.childLanes|=u,v!==null&&(v.childLanes|=u)):v!==null&&(v.childLanes&u)!==u&&(v.childLanes|=u),a===p)break;a=a.return}}function Wl(a,u){ap=a,Ny=Hl=null,a=a.dependencies,a!==null&&a.firstContext!==null&&((a.lanes&u)!==0&&(Li=!0),a.firstContext=null)}function Zi(a){var u=be?a._currentValue:a._currentValue2;if(Ny!==a)if(a={context:a,memoizedValue:u,next:null},Hl===null){if(ap===null)throw Error(o(308));Hl=a,ap.dependencies={lanes:0,firstContext:a}}else Hl=Hl.next=a;return u}var Fr=null,mo=!1;function Uy(a){a.updateQueue={baseState:a.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function i3(a,u){a=a.updateQueue,u.updateQueue===a&&(u.updateQueue={baseState:a.baseState,firstBaseUpdate:a.firstBaseUpdate,lastBaseUpdate:a.lastBaseUpdate,shared:a.shared,effects:a.effects})}function ys(a,u){return{eventTime:a,lane:u,tag:0,payload:null,callback:null,next:null}}function go(a,u){var p=a.updateQueue;p!==null&&(p=p.shared,dn!==null&&(a.mode&1)!==0&&(ft&2)===0?(a=p.interleaved,a===null?(u.next=u,Fr===null?Fr=[p]:Fr.push(p)):(u.next=a.next,a.next=u),p.interleaved=u):(a=p.pending,a===null?u.next=u:(u.next=a.next,a.next=u),p.pending=u))}function lp(a,u,p){if(u=u.updateQueue,u!==null&&(u=u.shared,(p&4194240)!==0)){var v=u.lanes;v&=a.pendingLanes,p|=v,u.lanes=p,Ly(a,p)}}function r3(a,u){var p=a.updateQueue,v=a.alternate;if(v!==null&&(v=v.updateQueue,p===v)){var M=null,b=null;if(p=p.firstBaseUpdate,p!==null){do{var O={eventTime:p.eventTime,lane:p.lane,tag:p.tag,payload:p.payload,callback:p.callback,next:null};b===null?M=b=O:b=b.next=O,p=p.next}while(p!==null);b===null?M=b=u:b=b.next=u}else M=b=u;p={baseState:v.baseState,firstBaseUpdate:M,lastBaseUpdate:b,shared:v.shared,effects:v.effects},a.updateQueue=p;return}a=p.lastBaseUpdate,a===null?p.firstBaseUpdate=u:a.next=u,p.lastBaseUpdate=u}function up(a,u,p,v){var M=a.updateQueue;mo=!1;var b=M.firstBaseUpdate,O=M.lastBaseUpdate,H=M.shared.pending;if(H!==null){M.shared.pending=null;var ae=H,ye=ae.next;ae.next=null,O===null?b=ye:O.next=ye,O=ae;var Ne=a.alternate;Ne!==null&&(Ne=Ne.updateQueue,H=Ne.lastBaseUpdate,H!==O&&(H===null?Ne.firstBaseUpdate=ye:H.next=ye,Ne.lastBaseUpdate=ae))}if(b!==null){var it=M.baseState;O=0,Ne=ye=ae=null,H=b;do{var Ze=H.lane,zt=H.eventTime;if((v&Ze)===Ze){Ne!==null&&(Ne=Ne.next={eventTime:zt,lane:0,tag:H.tag,payload:H.payload,callback:H.callback,next:null});e:{var We=a,Gn=H;switch(Ze=u,zt=p,Gn.tag){case 1:if(We=Gn.payload,typeof We=="function"){it=We.call(zt,it,Ze);break e}it=We;break e;case 3:We.flags=We.flags&-65537|128;case 0:if(We=Gn.payload,Ze=typeof We=="function"?We.call(zt,it,Ze):We,Ze==null)break e;it=s({},it,Ze);break e;case 2:mo=!0}}H.callback!==null&&H.lane!==0&&(a.flags|=64,Ze=M.effects,Ze===null?M.effects=[H]:Ze.push(H))}else zt={eventTime:zt,lane:Ze,tag:H.tag,payload:H.payload,callback:H.callback,next:null},Ne===null?(ye=Ne=zt,ae=it):Ne=Ne.next=zt,O|=Ze;if(H=H.next,H===null){if(H=M.shared.pending,H===null)break;Ze=H,H=Ze.next,Ze.next=null,M.lastBaseUpdate=Ze,M.shared.pending=null}}while(1);if(Ne===null&&(ae=it),M.baseState=ae,M.firstBaseUpdate=ye,M.lastBaseUpdate=Ne,u=M.shared.interleaved,u!==null){M=u;do O|=M.lane,M=M.next;while(M!==u)}else b===null&&(M.shared.lanes=0);Kl|=O,a.lanes=O,a.memoizedState=it}}function s3(a,u,p){if(a=u.effects,u.effects=null,a!==null)for(u=0;u<a.length;u++){var v=a[u],M=v.callback;if(M!==null){if(v.callback=null,v=p,typeof M!="function")throw Error(o(191,M));M.call(v)}}}var o3=new i.Component().refs;function By(a,u,p,v){u=a.memoizedState,p=p(v,u),p=p==null?u:s({},u,p),a.memoizedState=p,a.lanes===0&&(a.updateQueue.baseState=p)}var cp={isMounted:function(a){return(a=a._reactInternals)?L(a)===a:!1},enqueueSetState:function(a,u,p){a=a._reactInternals;var v=ii(),M=xo(a),b=ys(v,M);b.payload=u,p!=null&&(b.callback=p),go(a,b),u=er(a,M,v),u!==null&&lp(u,a,M)},enqueueReplaceState:function(a,u,p){a=a._reactInternals;var v=ii(),M=xo(a),b=ys(v,M);b.tag=1,b.payload=u,p!=null&&(b.callback=p),go(a,b),u=er(a,M,v),u!==null&&lp(u,a,M)},enqueueForceUpdate:function(a,u){a=a._reactInternals;var p=ii(),v=xo(a),M=ys(p,v);M.tag=2,u!=null&&(M.callback=u),go(a,M),u=er(a,v,p),u!==null&&lp(u,a,v)}};function a3(a,u,p,v,M,b,O){return a=a.stateNode,typeof a.shouldComponentUpdate=="function"?a.shouldComponentUpdate(v,b,O):u.prototype&&u.prototype.isPureReactComponent?!sp(p,v)||!sp(M,b):!0}function l3(a,u,p){var v=!1,M=qi,b=u.contextType;return typeof b=="object"&&b!==null?b=Zi(b):(M=di(u)?ms:Pt.current,v=u.contextTypes,b=(v=v!=null)?gs(a,M):qi),u=new u(p,b),a.memoizedState=u.state!==null&&u.state!==void 0?u.state:null,u.updater=cp,a.stateNode=u,u._reactInternals=a,v&&(a=a.stateNode,a.__reactInternalMemoizedUnmaskedChildContext=M,a.__reactInternalMemoizedMaskedChildContext=b),u}function u3(a,u,p,v){a=u.state,typeof u.componentWillReceiveProps=="function"&&u.componentWillReceiveProps(p,v),typeof u.UNSAFE_componentWillReceiveProps=="function"&&u.UNSAFE_componentWillReceiveProps(p,v),u.state!==a&&cp.enqueueReplaceState(u,u.state,null)}function Vy(a,u,p,v){var M=a.stateNode;M.props=p,M.state=a.memoizedState,M.refs=o3,Uy(a);var b=u.contextType;typeof b=="object"&&b!==null?M.context=Zi(b):(b=di(u)?ms:Pt.current,M.context=gs(a,b)),M.state=a.memoizedState,b=u.getDerivedStateFromProps,typeof b=="function"&&(By(a,u,b,p),M.state=a.memoizedState),typeof u.getDerivedStateFromProps=="function"||typeof M.getSnapshotBeforeUpdate=="function"||typeof M.UNSAFE_componentWillMount!="function"&&typeof M.componentWillMount!="function"||(u=M.state,typeof M.componentWillMount=="function"&&M.componentWillMount(),typeof M.UNSAFE_componentWillMount=="function"&&M.UNSAFE_componentWillMount(),u!==M.state&&cp.enqueueReplaceState(M,M.state,null),up(a,p,M,v),M.state=a.memoizedState),typeof M.componentDidMount=="function"&&(a.flags|=4194308)}var Gl=[],Xl=0,fp=null,dp=0,Ji=[],Qi=0,va=null,xs=1,_s="";function ya(a,u){Gl[Xl++]=dp,Gl[Xl++]=fp,fp=a,dp=u}function c3(a,u,p){Ji[Qi++]=xs,Ji[Qi++]=_s,Ji[Qi++]=va,va=a;var v=xs;a=_s;var M=32-yr(v)-1;v&=~(1<<M),p+=1;var b=32-yr(u)+M;if(30<b){var O=M-M%5;b=(v&(1<<O)-1).toString(32),v>>=O,M-=O,xs=1<<32-yr(u)+M|p<<M|v,_s=b+a}else xs=1<<b|p<<M|v,_s=a}function Hy(a){a.return!==null&&(ya(a,1),c3(a,1,0))}function Wy(a){for(;a===fp;)fp=Gl[--Xl],Gl[Xl]=null,dp=Gl[--Xl],Gl[Xl]=null;for(;a===va;)va=Ji[--Qi],Ji[Qi]=null,_s=Ji[--Qi],Ji[Qi]=null,xs=Ji[--Qi],Ji[Qi]=null}var Ci=null,Pi=null,Xt=!1,Gc=!1,_r=null;function f3(a,u){var p=tr(5,null,null,0);p.elementType="DELETED",p.stateNode=u,p.return=a,u=a.deletions,u===null?(a.deletions=[p],a.flags|=16):u.push(p)}function d3(a,u){switch(a.tag){case 5:return u=Vl(u,a.type,a.pendingProps),u!==null?(a.stateNode=u,Ci=a,Pi=ce(u),!0):!1;case 6:return u=Jh(u,a.pendingProps),u!==null?(a.stateNode=u,Ci=a,Pi=null,!0):!1;case 13:if(u=Ay(u),u!==null){var p=va!==null?{id:xs,overflow:_s}:null;return a.memoizedState={dehydrated:u,treeContext:p,retryLane:1073741824},p=tr(18,null,null,0),p.stateNode=u,p.return=a,a.child=p,Ci=a,Pi=null,!0}return!1;default:return!1}}function Gy(a){return(a.mode&1)!==0&&(a.flags&128)===0}function Xy(a){if(Xt){var u=Pi;if(u){var p=u;if(!d3(a,u)){if(Gy(a))throw Error(o(418));u=q(p);var v=Ci;u&&d3(a,u)?f3(v,p):(a.flags=a.flags&-4097|2,Xt=!1,Ci=a)}}else{if(Gy(a))throw Error(o(418));a.flags=a.flags&-4097|2,Xt=!1,Ci=a}}}function h3(a){for(a=a.return;a!==null&&a.tag!==5&&a.tag!==3&&a.tag!==13;)a=a.return;Ci=a}function Xc(a){if(!oe||a!==Ci)return!1;if(!Xt)return h3(a),Xt=!0,!1;if(a.tag!==3&&(a.tag!==5||ps(a.type)&&!Ve(a.type,a.memoizedProps))){var u=Pi;if(u){if(Gy(a)){for(a=Pi;a;)a=q(a);throw Error(o(418))}for(;u;)f3(a,u),u=q(u)}}if(h3(a),a.tag===13){if(!oe)throw Error(o(316));if(a=a.memoizedState,a=a!==null?a.dehydrated:null,!a)throw Error(o(317));Pi=tt(a)}else Pi=Ci?q(a.stateNode):null;return!0}function jl(){oe&&(Pi=Ci=null,Gc=Xt=!1)}function jy(a){_r===null?_r=[a]:_r.push(a)}function jc(a,u,p){if(a=p.ref,a!==null&&typeof a!="function"&&typeof a!="object"){if(p._owner){if(p=p._owner,p){if(p.tag!==1)throw Error(o(309));var v=p.stateNode}if(!v)throw Error(o(147,a));var M=v,b=""+a;return u!==null&&u.ref!==null&&typeof u.ref=="function"&&u.ref._stringRef===b?u.ref:(u=function(O){var H=M.refs;H===o3&&(H=M.refs={}),O===null?delete H[b]:H[b]=O},u._stringRef=b,u)}if(typeof a!="string")throw Error(o(284));if(!p._owner)throw Error(o(290,a))}return a}function hp(a,u){throw a=Object.prototype.toString.call(u),Error(o(31,a==="[object Object]"?"object with keys {"+Object.keys(u).join(", ")+"}":a))}function p3(a){var u=a._init;return u(a._payload)}function m3(a){function u(Q,X){if(a){var ne=Q.deletions;ne===null?(Q.deletions=[X],Q.flags|=16):ne.push(X)}}function p(Q,X){if(!a)return null;for(;X!==null;)u(Q,X),X=X.sibling;return null}function v(Q,X){for(Q=new Map;X!==null;)X.key!==null?Q.set(X.key,X):Q.set(X.index,X),X=X.sibling;return Q}function M(Q,X){return Q=wo(Q,X),Q.index=0,Q.sibling=null,Q}function b(Q,X,ne){return Q.index=ne,a?(ne=Q.alternate,ne!==null?(ne=ne.index,ne<X?(Q.flags|=2,X):ne):(Q.flags|=2,X)):(Q.flags|=1048576,X)}function O(Q){return a&&Q.alternate===null&&(Q.flags|=2),Q}function H(Q,X,ne,Re){return X===null||X.tag!==6?(X=Px(ne,Q.mode,Re),X.return=Q,X):(X=M(X,ne),X.return=Q,X)}function ae(Q,X,ne,Re){var He=ne.type;return He===d?Ne(Q,X,ne.props.children,Re,ne.key):X!==null&&(X.elementType===He||typeof He=="object"&&He!==null&&He.$$typeof===E&&p3(He)===X.type)?(Re=M(X,ne.props),Re.ref=jc(Q,X,ne),Re.return=Q,Re):(Re=Gp(ne.type,ne.key,ne.props,null,Q.mode,Re),Re.ref=jc(Q,X,ne),Re.return=Q,Re)}function ye(Q,X,ne,Re){return X===null||X.tag!==4||X.stateNode.containerInfo!==ne.containerInfo||X.stateNode.implementation!==ne.implementation?(X=Lx(ne,Q.mode,Re),X.return=Q,X):(X=M(X,ne.children||[]),X.return=Q,X)}function Ne(Q,X,ne,Re,He){return X===null||X.tag!==7?(X=Ta(ne,Q.mode,Re,He),X.return=Q,X):(X=M(X,ne),X.return=Q,X)}function it(Q,X,ne){if(typeof X=="string"&&X!==""||typeof X=="number")return X=Px(""+X,Q.mode,ne),X.return=Q,X;if(typeof X=="object"&&X!==null){switch(X.$$typeof){case c:return ne=Gp(X.type,X.key,X.props,null,Q.mode,ne),ne.ref=jc(Q,null,X),ne.return=Q,ne;case f:return X=Lx(X,Q.mode,ne),X.return=Q,X;case E:var Re=X._init;return it(Q,Re(X._payload),ne)}if(ie(X)||P(X))return X=Ta(X,Q.mode,ne,null),X.return=Q,X;hp(Q,X)}return null}function Ze(Q,X,ne,Re){var He=X!==null?X.key:null;if(typeof ne=="string"&&ne!==""||typeof ne=="number")return He!==null?null:H(Q,X,""+ne,Re);if(typeof ne=="object"&&ne!==null){switch(ne.$$typeof){case c:return ne.key===He?ae(Q,X,ne,Re):null;case f:return ne.key===He?ye(Q,X,ne,Re):null;case E:return He=ne._init,Ze(Q,X,He(ne._payload),Re)}if(ie(ne)||P(ne))return He!==null?null:Ne(Q,X,ne,Re,null);hp(Q,ne)}return null}function zt(Q,X,ne,Re,He){if(typeof Re=="string"&&Re!==""||typeof Re=="number")return Q=Q.get(ne)||null,H(X,Q,""+Re,He);if(typeof Re=="object"&&Re!==null){switch(Re.$$typeof){case c:return Q=Q.get(Re.key===null?ne:Re.key)||null,ae(X,Q,Re,He);case f:return Q=Q.get(Re.key===null?ne:Re.key)||null,ye(X,Q,Re,He);case E:var ct=Re._init;return zt(Q,X,ne,ct(Re._payload),He)}if(ie(Re)||P(Re))return Q=Q.get(ne)||null,Ne(X,Q,Re,He,null);hp(X,Re)}return null}function We(Q,X,ne,Re){for(var He=null,ct=null,rt=X,At=X=0,Tn=null;rt!==null&&At<ne.length;At++){rt.index>At?(Tn=rt,rt=null):Tn=rt.sibling;var Ct=Ze(Q,rt,ne[At],Re);if(Ct===null){rt===null&&(rt=Tn);break}a&&rt&&Ct.alternate===null&&u(Q,rt),X=b(Ct,X,At),ct===null?He=Ct:ct.sibling=Ct,ct=Ct,rt=Tn}if(At===ne.length)return p(Q,rt),Xt&&ya(Q,At),He;if(rt===null){for(;At<ne.length;At++)rt=it(Q,ne[At],Re),rt!==null&&(X=b(rt,X,At),ct===null?He=rt:ct.sibling=rt,ct=rt);return Xt&&ya(Q,At),He}for(rt=v(Q,rt);At<ne.length;At++)Tn=zt(rt,Q,At,ne[At],Re),Tn!==null&&(a&&Tn.alternate!==null&&rt.delete(Tn.key===null?At:Tn.key),X=b(Tn,X,At),ct===null?He=Tn:ct.sibling=Tn,ct=Tn);return a&&rt.forEach(function(So){return u(Q,So)}),Xt&&ya(Q,At),He}function Gn(Q,X,ne,Re){var He=P(ne);if(typeof He!="function")throw Error(o(150));if(ne=He.call(ne),ne==null)throw Error(o(151));for(var ct=He=null,rt=X,At=X=0,Tn=null,Ct=ne.next();rt!==null&&!Ct.done;At++,Ct=ne.next()){rt.index>At?(Tn=rt,rt=null):Tn=rt.sibling;var So=Ze(Q,rt,Ct.value,Re);if(So===null){rt===null&&(rt=Tn);break}a&&rt&&So.alternate===null&&u(Q,rt),X=b(So,X,At),ct===null?He=So:ct.sibling=So,ct=So,rt=Tn}if(Ct.done)return p(Q,rt),Xt&&ya(Q,At),He;if(rt===null){for(;!Ct.done;At++,Ct=ne.next())Ct=it(Q,Ct.value,Re),Ct!==null&&(X=b(Ct,X,At),ct===null?He=Ct:ct.sibling=Ct,ct=Ct);return Xt&&ya(Q,At),He}for(rt=v(Q,rt);!Ct.done;At++,Ct=ne.next())Ct=zt(rt,Q,At,Ct.value,Re),Ct!==null&&(a&&Ct.alternate!==null&&rt.delete(Ct.key===null?At:Ct.key),X=b(Ct,X,At),ct===null?He=Ct:ct.sibling=Ct,ct=Ct);return a&&rt.forEach(function(e4){return u(Q,e4)}),Xt&&ya(Q,At),He}function nr(Q,X,ne,Re){if(typeof ne=="object"&&ne!==null&&ne.type===d&&ne.key===null&&(ne=ne.props.children),typeof ne=="object"&&ne!==null){switch(ne.$$typeof){case c:e:{for(var He=ne.key,ct=X;ct!==null;){if(ct.key===He){if(He=ne.type,He===d){if(ct.tag===7){p(Q,ct.sibling),X=M(ct,ne.props.children),X.return=Q,Q=X;break e}}else if(ct.elementType===He||typeof He=="object"&&He!==null&&He.$$typeof===E&&p3(He)===ct.type){p(Q,ct.sibling),X=M(ct,ne.props),X.ref=jc(Q,ct,ne),X.return=Q,Q=X;break e}p(Q,ct);break}else u(Q,ct);ct=ct.sibling}ne.type===d?(X=Ta(ne.props.children,Q.mode,Re,ne.key),X.return=Q,Q=X):(Re=Gp(ne.type,ne.key,ne.props,null,Q.mode,Re),Re.ref=jc(Q,X,ne),Re.return=Q,Q=Re)}return O(Q);case f:e:{for(ct=ne.key;X!==null;){if(X.key===ct)if(X.tag===4&&X.stateNode.containerInfo===ne.containerInfo&&X.stateNode.implementation===ne.implementation){p(Q,X.sibling),X=M(X,ne.children||[]),X.return=Q,Q=X;break e}else{p(Q,X);break}else u(Q,X);X=X.sibling}X=Lx(ne,Q.mode,Re),X.return=Q,Q=X}return O(Q);case E:return ct=ne._init,nr(Q,X,ct(ne._payload),Re)}if(ie(ne))return We(Q,X,ne,Re);if(P(ne))return Gn(Q,X,ne,Re);hp(Q,ne)}return typeof ne=="string"&&ne!==""||typeof ne=="number"?(ne=""+ne,X!==null&&X.tag===6?(p(Q,X.sibling),X=M(X,ne),X.return=Q,Q=X):(p(Q,X),X=Px(ne,Q.mode,Re),X.return=Q,Q=X),O(Q)):p(Q,X)}return nr}var Yl=m3(!0),g3=m3(!1),Yc={},Ki=Yi(Yc),qc=Yi(Yc),ql=Yi(Yc);function Ur(a){if(a===Yc)throw Error(o(174));return a}function Yy(a,u){xt(ql,u),xt(qc,a),xt(Ki,Yc),a=pe(u),at(Ki),xt(Ki,a)}function Zl(){at(Ki),at(qc),at(ql)}function v3(a){var u=Ur(ql.current),p=Ur(Ki.current);u=k(p,a.type,u),p!==u&&(xt(qc,a),xt(Ki,u))}function qy(a){qc.current===a&&(at(Ki),at(qc))}var Jt=Yi(0);function pp(a){for(var u=a;u!==null;){if(u.tag===13){var p=u.memoizedState;if(p!==null&&(p=p.dehydrated,p===null||Qh(p)||Vc(p)))return u}else if(u.tag===19&&u.memoizedProps.revealOrder!==void 0){if((u.flags&128)!==0)return u}else if(u.child!==null){u.child.return=u,u=u.child;continue}if(u===a)break;for(;u.sibling===null;){if(u.return===null||u.return===a)return null;u=u.return}u.sibling.return=u.return,u=u.sibling}return null}var Zy=[];function Jy(){for(var a=0;a<Zy.length;a++){var u=Zy[a];be?u._workInProgressVersionPrimary=null:u._workInProgressVersionSecondary=null}Zy.length=0}var mp=l.ReactCurrentDispatcher,$i=l.ReactCurrentBatchConfig,Jl=0,$t=null,Vn=null,En=null,gp=!1,Zc=!1,Jc=0,Tk=0;function Hn(){throw Error(o(321))}function Qy(a,u){if(u===null)return!1;for(var p=0;p<u.length&&p<a.length;p++)if(!kr(a[p],u[p]))return!1;return!0}function Ky(a,u,p,v,M,b){if(Jl=b,$t=u,u.memoizedState=null,u.updateQueue=null,u.lanes=0,mp.current=a===null||a.memoizedState===null?Pk:Lk,a=p(v,M),Zc){b=0;do{if(Zc=!1,Jc=0,25<=b)throw Error(o(301));b+=1,En=Vn=null,u.updateQueue=null,mp.current=Rk,a=p(v,M)}while(Zc)}if(mp.current=wp,u=Vn!==null&&Vn.next!==null,Jl=0,En=Vn=$t=null,gp=!1,u)throw Error(o(300));return a}function $y(){var a=Jc!==0;return Jc=0,a}function ws(){var a={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return En===null?$t.memoizedState=En=a:En=En.next=a,En}function Br(){if(Vn===null){var a=$t.alternate;a=a!==null?a.memoizedState:null}else a=Vn.next;var u=En===null?$t.memoizedState:En.next;if(u!==null)En=u,Vn=a;else{if(a===null)throw Error(o(310));Vn=a,a={memoizedState:Vn.memoizedState,baseState:Vn.baseState,baseQueue:Vn.baseQueue,queue:Vn.queue,next:null},En===null?$t.memoizedState=En=a:En=En.next=a}return En}function xa(a,u){return typeof u=="function"?u(a):u}function vp(a){var u=Br(),p=u.queue;if(p===null)throw Error(o(311));p.lastRenderedReducer=a;var v=Vn,M=v.baseQueue,b=p.pending;if(b!==null){if(M!==null){var O=M.next;M.next=b.next,b.next=O}v.baseQueue=M=b,p.pending=null}if(M!==null){b=M.next,v=v.baseState;var H=O=null,ae=null,ye=b;do{var Ne=ye.lane;if((Jl&Ne)===Ne)ae!==null&&(ae=ae.next={lane:0,action:ye.action,hasEagerState:ye.hasEagerState,eagerState:ye.eagerState,next:null}),v=ye.hasEagerState?ye.eagerState:a(v,ye.action);else{var it={lane:Ne,action:ye.action,hasEagerState:ye.hasEagerState,eagerState:ye.eagerState,next:null};ae===null?(H=ae=it,O=v):ae=ae.next=it,$t.lanes|=Ne,Kl|=Ne}ye=ye.next}while(ye!==null&&ye!==b);ae===null?O=v:ae.next=H,kr(v,u.memoizedState)||(Li=!0),u.memoizedState=v,u.baseState=O,u.baseQueue=ae,p.lastRenderedState=v}if(a=p.interleaved,a!==null){M=a;do b=M.lane,$t.lanes|=b,Kl|=b,M=M.next;while(M!==a)}else M===null&&(p.lanes=0);return[u.memoizedState,p.dispatch]}function yp(a){var u=Br(),p=u.queue;if(p===null)throw Error(o(311));p.lastRenderedReducer=a;var v=p.dispatch,M=p.pending,b=u.memoizedState;if(M!==null){p.pending=null;var O=M=M.next;do b=a(b,O.action),O=O.next;while(O!==M);kr(b,u.memoizedState)||(Li=!0),u.memoizedState=b,u.baseQueue===null&&(u.baseState=b),p.lastRenderedState=b}return[b,v]}function y3(){}function x3(a,u){var p=$t,v=Br(),M=u(),b=!kr(v.memoizedState,M);if(b&&(v.memoizedState=M,Li=!0),v=v.queue,Kc(S3.bind(null,p,v,a),[a]),v.getSnapshot!==u||b||En!==null&&En.memoizedState.tag&1){if(p.flags|=2048,Qc(9,w3.bind(null,p,v,M,u),void 0,null),dn===null)throw Error(o(349));(Jl&30)!==0||_3(p,u,M)}return M}function _3(a,u,p){a.flags|=16384,a={getSnapshot:u,value:p},u=$t.updateQueue,u===null?(u={lastEffect:null,stores:null},$t.updateQueue=u,u.stores=[a]):(p=u.stores,p===null?u.stores=[a]:p.push(a))}function w3(a,u,p,v){u.value=p,u.getSnapshot=v,M3(u)&&er(a,1,-1)}function S3(a,u,p){return p(function(){M3(u)&&er(a,1,-1)})}function M3(a){var u=a.getSnapshot;a=a.value;try{var p=u();return!kr(a,p)}catch{return!0}}function ex(a){var u=ws();return typeof a=="function"&&(a=a()),u.memoizedState=u.baseState=a,a={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:xa,lastRenderedState:a},u.queue=a,a=a.dispatch=Ck.bind(null,$t,a),[u.memoizedState,a]}function Qc(a,u,p,v){return a={tag:a,create:u,destroy:p,deps:v,next:null},u=$t.updateQueue,u===null?(u={lastEffect:null,stores:null},$t.updateQueue=u,u.lastEffect=a.next=a):(p=u.lastEffect,p===null?u.lastEffect=a.next=a:(v=p.next,p.next=a,a.next=v,u.lastEffect=a)),a}function E3(){return Br().memoizedState}function xp(a,u,p,v){var M=ws();$t.flags|=a,M.memoizedState=Qc(1|u,p,void 0,v===void 0?null:v)}function _p(a,u,p,v){var M=Br();v=v===void 0?null:v;var b=void 0;if(Vn!==null){var O=Vn.memoizedState;if(b=O.destroy,v!==null&&Qy(v,O.deps)){M.memoizedState=Qc(u,p,b,v);return}}$t.flags|=a,M.memoizedState=Qc(1|u,p,b,v)}function tx(a,u){return xp(8390656,8,a,u)}function Kc(a,u){return _p(2048,8,a,u)}function T3(a,u){return _p(4,2,a,u)}function b3(a,u){return _p(4,4,a,u)}function A3(a,u){if(typeof u=="function")return a=a(),u(a),function(){u(null)};if(u!=null)return a=a(),u.current=a,function(){u.current=null}}function C3(a,u,p){return p=p!=null?p.concat([a]):null,_p(4,4,A3.bind(null,u,a),p)}function nx(){}function P3(a,u){var p=Br();u=u===void 0?null:u;var v=p.memoizedState;return v!==null&&u!==null&&Qy(u,v[1])?v[0]:(p.memoizedState=[a,u],a)}function L3(a,u){var p=Br();u=u===void 0?null:u;var v=p.memoizedState;return v!==null&&u!==null&&Qy(u,v[1])?v[0]:(a=a(),p.memoizedState=[a,u],a)}function bk(a,u){var p=bt;bt=p!==0&&4>p?p:4,a(!0);var v=$i.transition;$i.transition={};try{a(!1),u()}finally{bt=p,$i.transition=v}}function R3(){return Br().memoizedState}function Ak(a,u,p){var v=xo(a);p={lane:v,action:p,hasEagerState:!1,eagerState:null,next:null},I3(a)?D3(u,p):(z3(a,u,p),p=ii(),a=er(a,v,p),a!==null&&N3(a,u,v))}function Ck(a,u,p){var v=xo(a),M={lane:v,action:p,hasEagerState:!1,eagerState:null,next:null};if(I3(a))D3(u,M);else{z3(a,u,M);var b=a.alternate;if(a.lanes===0&&(b===null||b.lanes===0)&&(b=u.lastRenderedReducer,b!==null))try{var O=u.lastRenderedState,H=b(O,p);if(M.hasEagerState=!0,M.eagerState=H,kr(H,O))return}catch{}finally{}p=ii(),a=er(a,v,p),a!==null&&N3(a,u,v)}}function I3(a){var u=a.alternate;return a===$t||u!==null&&u===$t}function D3(a,u){Zc=gp=!0;var p=a.pending;p===null?u.next=u:(u.next=p.next,p.next=u),a.pending=u}function z3(a,u,p){dn!==null&&(a.mode&1)!==0&&(ft&2)===0?(a=u.interleaved,a===null?(p.next=p,Fr===null?Fr=[u]:Fr.push(u)):(p.next=a.next,a.next=p),u.interleaved=p):(a=u.pending,a===null?p.next=p:(p.next=a.next,a.next=p),u.pending=p)}function N3(a,u,p){if((p&4194240)!==0){var v=u.lanes;v&=a.pendingLanes,p|=v,u.lanes=p,Ly(a,p)}}var wp={readContext:Zi,useCallback:Hn,useContext:Hn,useEffect:Hn,useImperativeHandle:Hn,useInsertionEffect:Hn,useLayoutEffect:Hn,useMemo:Hn,useReducer:Hn,useRef:Hn,useState:Hn,useDebugValue:Hn,useDeferredValue:Hn,useTransition:Hn,useMutableSource:Hn,useSyncExternalStore:Hn,useId:Hn,unstable_isNewReconciler:!1},Pk={readContext:Zi,useCallback:function(a,u){return ws().memoizedState=[a,u===void 0?null:u],a},useContext:Zi,useEffect:tx,useImperativeHandle:function(a,u,p){return p=p!=null?p.concat([a]):null,xp(4194308,4,A3.bind(null,u,a),p)},useLayoutEffect:function(a,u){return xp(4194308,4,a,u)},useInsertionEffect:function(a,u){return xp(4,2,a,u)},useMemo:function(a,u){var p=ws();return u=u===void 0?null:u,a=a(),p.memoizedState=[a,u],a},useReducer:function(a,u,p){var v=ws();return u=p!==void 0?p(u):u,v.memoizedState=v.baseState=u,a={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:a,lastRenderedState:u},v.queue=a,a=a.dispatch=Ak.bind(null,$t,a),[v.memoizedState,a]},useRef:function(a){var u=ws();return a={current:a},u.memoizedState=a},useState:ex,useDebugValue:nx,useDeferredValue:function(a){var u=ex(a),p=u[0],v=u[1];return tx(function(){var M=$i.transition;$i.transition={};try{v(a)}finally{$i.transition=M}},[a]),p},useTransition:function(){var a=ex(!1),u=a[0];return a=bk.bind(null,a[1]),ws().memoizedState=a,[u,a]},useMutableSource:function(){},useSyncExternalStore:function(a,u,p){var v=$t,M=ws();if(Xt){if(p===void 0)throw Error(o(407));p=p()}else{if(p=u(),dn===null)throw Error(o(349));(Jl&30)!==0||_3(v,u,p)}M.memoizedState=p;var b={value:p,getSnapshot:u};return M.queue=b,tx(S3.bind(null,v,b,a),[a]),v.flags|=2048,Qc(9,w3.bind(null,v,b,p,u),void 0,null),p},useId:function(){var a=ws(),u=dn.identifierPrefix;if(Xt){var p=_s,v=xs;p=(v&~(1<<32-yr(v)-1)).toString(32)+p,u=":"+u+"R"+p,p=Jc++,0<p&&(u+="H"+p.toString(32)),u+=":"}else p=Tk++,u=":"+u+"r"+p.toString(32)+":";return a.memoizedState=u},unstable_isNewReconciler:!1},Lk={readContext:Zi,useCallback:P3,useContext:Zi,useEffect:Kc,useImperativeHandle:C3,useInsertionEffect:T3,useLayoutEffect:b3,useMemo:L3,useReducer:vp,useRef:E3,useState:function(){return vp(xa)},useDebugValue:nx,useDeferredValue:function(a){var u=vp(xa),p=u[0],v=u[1];return Kc(function(){var M=$i.transition;$i.transition={};try{v(a)}finally{$i.transition=M}},[a]),p},useTransition:function(){var a=vp(xa)[0],u=Br().memoizedState;return[a,u]},useMutableSource:y3,useSyncExternalStore:x3,useId:R3,unstable_isNewReconciler:!1},Rk={readContext:Zi,useCallback:P3,useContext:Zi,useEffect:Kc,useImperativeHandle:C3,useInsertionEffect:T3,useLayoutEffect:b3,useMemo:L3,useReducer:yp,useRef:E3,useState:function(){return yp(xa)},useDebugValue:nx,useDeferredValue:function(a){var u=yp(xa),p=u[0],v=u[1];return Kc(function(){var M=$i.transition;$i.transition={};try{v(a)}finally{$i.transition=M}},[a]),p},useTransition:function(){var a=yp(xa)[0],u=Br().memoizedState;return[a,u]},useMutableSource:y3,useSyncExternalStore:x3,useId:R3,unstable_isNewReconciler:!1};function ix(a,u){try{var p="",v=u;do p+=Ek(v),v=v.return;while(v);var M=p}catch(b){M=`
Error generating stack: `+b.message+`
`+b.stack}return{value:a,source:u,stack:M}}function rx(a,u){try{console.error(u.value)}catch(p){setTimeout(function(){throw p})}}var Ik=typeof WeakMap=="function"?WeakMap:Map;function k3(a,u,p){p=ys(-1,p),p.tag=3,p.payload={element:null};var v=u.value;return p.callback=function(){Op||(Op=!0,Sx=v),rx(a,u)},p}function O3(a,u,p){p=ys(-1,p),p.tag=3;var v=a.type.getDerivedStateFromError;if(typeof v=="function"){var M=u.value;p.payload=function(){return v(M)},p.callback=function(){rx(a,u)}}var b=a.stateNode;return b!==null&&typeof b.componentDidCatch=="function"&&(p.callback=function(){rx(a,u),typeof v!="function"&&(vo===null?vo=new Set([this]):vo.add(this));var O=u.stack;this.componentDidCatch(u.value,{componentStack:O!==null?O:""})}),p}function F3(a,u,p){var v=a.pingCache;if(v===null){v=a.pingCache=new Ik;var M=new Set;v.set(u,M)}else M=v.get(u),M===void 0&&(M=new Set,v.set(u,M));M.has(p)||(M.add(p),a=jk.bind(null,a,u,p),u.then(a,a))}function U3(a){do{var u;if((u=a.tag===13)&&(u=a.memoizedState,u=u!==null?u.dehydrated!==null:!0),u)return a;a=a.return}while(a!==null);return null}function B3(a,u,p,v,M){return(a.mode&1)===0?(a===u?a.flags|=65536:(a.flags|=128,p.flags|=131072,p.flags&=-52805,p.tag===1&&(p.alternate===null?p.tag=17:(u=ys(-1,1),u.tag=2,go(p,u))),p.lanes|=1),a):(a.flags|=65536,a.lanes=M,a)}function Vr(a){a.flags|=4}function V3(a,u){if(a!==null&&a.child===u.child)return!0;if((u.flags&16)!==0)return!1;for(a=u.child;a!==null;){if((a.flags&12854)!==0||(a.subtreeFlags&12854)!==0)return!1;a=a.sibling}return!0}var $c,ef,Sp,Mp;if(Qe)$c=function(a,u){for(var p=u.child;p!==null;){if(p.tag===5||p.tag===6)J(a,p.stateNode);else if(p.tag!==4&&p.child!==null){p.child.return=p,p=p.child;continue}if(p===u)break;for(;p.sibling===null;){if(p.return===null||p.return===u)return;p=p.return}p.sibling.return=p.return,p=p.sibling}},ef=function(){},Sp=function(a,u,p,v,M){if(a=a.memoizedProps,a!==v){var b=u.stateNode,O=Ur(Ki.current);p=Me(b,p,a,v,M,O),(u.updateQueue=p)&&Vr(u)}},Mp=function(a,u,p,v){p!==v&&Vr(u)};else if(he){$c=function(a,u,p,v){for(var M=u.child;M!==null;){if(M.tag===5){var b=M.stateNode;p&&v&&(b=ti(b,M.type,M.memoizedProps,M)),J(a,b)}else if(M.tag===6)b=M.stateNode,p&&v&&(b=Zh(b,M.memoizedProps,M)),J(a,b);else if(M.tag!==4){if(M.tag===22&&M.memoizedState!==null)b=M.child,b!==null&&(b.return=M),$c(a,M,!0,!0);else if(M.child!==null){M.child.return=M,M=M.child;continue}}if(M===u)break;for(;M.sibling===null;){if(M.return===null||M.return===u)return;M=M.return}M.sibling.return=M.return,M=M.sibling}};var H3=function(a,u,p,v){for(var M=u.child;M!==null;){if(M.tag===5){var b=M.stateNode;p&&v&&(b=ti(b,M.type,M.memoizedProps,M)),vr(a,b)}else if(M.tag===6)b=M.stateNode,p&&v&&(b=Zh(b,M.memoizedProps,M)),vr(a,b);else if(M.tag!==4){if(M.tag===22&&M.memoizedState!==null)b=M.child,b!==null&&(b.return=M),H3(a,M,!0,!0);else if(M.child!==null){M.child.return=M,M=M.child;continue}}if(M===u)break;for(;M.sibling===null;){if(M.return===null||M.return===u)return;M=M.return}M.sibling.return=M.return,M=M.sibling}};ef=function(a,u){var p=u.stateNode;if(!V3(a,u)){a=p.containerInfo;var v=Vt(a);H3(v,u,!1,!1),p.pendingChildren=v,Vr(u),Ht(a,v)}},Sp=function(a,u,p,v,M){var b=a.stateNode,O=a.memoizedProps;if((a=V3(a,u))&&O===v)u.stateNode=b;else{var H=u.stateNode,ae=Ur(Ki.current),ye=null;O!==v&&(ye=Me(H,p,O,v,M,ae)),a&&ye===null?u.stateNode=b:(b=fn(b,ye,p,O,v,u,a,H),me(b,p,v,M,ae)&&Vr(u),u.stateNode=b,a?Vr(u):$c(b,u,!1,!1))}},Mp=function(a,u,p,v){p!==v?(a=Ur(ql.current),p=Ur(Ki.current),u.stateNode=re(v,a,p,u),Vr(u)):u.stateNode=a.stateNode}}else ef=function(){},Sp=function(){},Mp=function(){};function tf(a,u){if(!Xt)switch(a.tailMode){case"hidden":u=a.tail;for(var p=null;u!==null;)u.alternate!==null&&(p=u),u=u.sibling;p===null?a.tail=null:p.sibling=null;break;case"collapsed":p=a.tail;for(var v=null;p!==null;)p.alternate!==null&&(v=p),p=p.sibling;v===null?u||a.tail===null?a.tail=null:a.tail.sibling=null:v.sibling=null}}function Wn(a){var u=a.alternate!==null&&a.alternate.child===a.child,p=0,v=0;if(u)for(var M=a.child;M!==null;)p|=M.lanes|M.childLanes,v|=M.subtreeFlags&14680064,v|=M.flags&14680064,M.return=a,M=M.sibling;else for(M=a.child;M!==null;)p|=M.lanes|M.childLanes,v|=M.subtreeFlags,v|=M.flags,M.return=a,M=M.sibling;return a.subtreeFlags|=v,a.childLanes=p,u}function Dk(a,u,p){var v=u.pendingProps;switch(Wy(u),u.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Wn(u),null;case 1:return di(u.type)&&Kh(),Wn(u),null;case 3:return v=u.stateNode,Zl(),at(Sn),at(Pt),Jy(),v.pendingContext&&(v.context=v.pendingContext,v.pendingContext=null),(a===null||a.child===null)&&(Xc(u)?Vr(u):a===null||a.memoizedState.isDehydrated&&(u.flags&256)===0||(u.flags|=1024,_r!==null&&(Tx(_r),_r=null))),ef(a,u),Wn(u),null;case 5:qy(u),p=Ur(ql.current);var M=u.type;if(a!==null&&u.stateNode!=null)Sp(a,u,M,v,p),a.ref!==u.ref&&(u.flags|=512,u.flags|=2097152);else{if(!v){if(u.stateNode===null)throw Error(o(166));return Wn(u),null}if(a=Ur(Ki.current),Xc(u)){if(!oe)throw Error(o(175));a=qe(u.stateNode,u.type,u.memoizedProps,p,a,u,!Gc),u.updateQueue=a,a!==null&&Vr(u)}else{var b=$(M,v,p,a,u);$c(b,u,!1,!1),u.stateNode=b,me(b,M,v,p,a)&&Vr(u)}u.ref!==null&&(u.flags|=512,u.flags|=2097152)}return Wn(u),null;case 6:if(a&&u.stateNode!=null)Mp(a,u,a.memoizedProps,v);else{if(typeof v!="string"&&u.stateNode===null)throw Error(o(166));if(a=Ur(ql.current),p=Ur(Ki.current),Xc(u)){if(!oe)throw Error(o(176));if(a=u.stateNode,v=u.memoizedProps,(p=et(a,v,u,!Gc))&&(M=Ci,M!==null))switch(b=(M.mode&1)!==0,M.tag){case 3:ho(M.stateNode.containerInfo,a,v,b);break;case 5:po(M.type,M.memoizedProps,M.stateNode,a,v,b)}p&&Vr(u)}else u.stateNode=re(v,a,p,u)}return Wn(u),null;case 13:if(at(Jt),v=u.memoizedState,Xt&&Pi!==null&&(u.mode&1)!==0&&(u.flags&128)===0){for(a=Pi;a;)a=q(a);return jl(),u.flags|=98560,u}if(v!==null&&v.dehydrated!==null){if(v=Xc(u),a===null){if(!v)throw Error(o(318));if(!oe)throw Error(o(344));if(a=u.memoizedState,a=a!==null?a.dehydrated:null,!a)throw Error(o(317));ut(a,u)}else jl(),(u.flags&128)===0&&(u.memoizedState=null),u.flags|=4;return Wn(u),null}return _r!==null&&(Tx(_r),_r=null),(u.flags&128)!==0?(u.lanes=p,u):(v=v!==null,p=!1,a===null?Xc(u):p=a.memoizedState!==null,v&&!p&&(u.child.flags|=8192,(u.mode&1)!==0&&(a===null||(Jt.current&1)!==0?vn===0&&(vn=3):Ax())),u.updateQueue!==null&&(u.flags|=4),Wn(u),null);case 4:return Zl(),ef(a,u),a===null&&Ue(u.stateNode.containerInfo),Wn(u),null;case 10:return Oy(u.type._context),Wn(u),null;case 17:return di(u.type)&&Kh(),Wn(u),null;case 19:if(at(Jt),M=u.memoizedState,M===null)return Wn(u),null;if(v=(u.flags&128)!==0,b=M.rendering,b===null)if(v)tf(M,!1);else{if(vn!==0||a!==null&&(a.flags&128)!==0)for(a=u.child;a!==null;){if(b=pp(a),b!==null){for(u.flags|=128,tf(M,!1),a=b.updateQueue,a!==null&&(u.updateQueue=a,u.flags|=4),u.subtreeFlags=0,a=p,v=u.child;v!==null;)p=v,M=a,p.flags&=14680066,b=p.alternate,b===null?(p.childLanes=0,p.lanes=M,p.child=null,p.subtreeFlags=0,p.memoizedProps=null,p.memoizedState=null,p.updateQueue=null,p.dependencies=null,p.stateNode=null):(p.childLanes=b.childLanes,p.lanes=b.lanes,p.child=b.child,p.subtreeFlags=0,p.deletions=null,p.memoizedProps=b.memoizedProps,p.memoizedState=b.memoizedState,p.updateQueue=b.updateQueue,p.type=b.type,M=b.dependencies,p.dependencies=M===null?null:{lanes:M.lanes,firstContext:M.firstContext}),v=v.sibling;return xt(Jt,Jt.current&1|2),u.child}a=a.sibling}M.tail!==null&&Mn()>wx&&(u.flags|=128,v=!0,tf(M,!1),u.lanes=4194304)}else{if(!v)if(a=pp(b),a!==null){if(u.flags|=128,v=!0,a=a.updateQueue,a!==null&&(u.updateQueue=a,u.flags|=4),tf(M,!0),M.tail===null&&M.tailMode==="hidden"&&!b.alternate&&!Xt)return Wn(u),null}else 2*Mn()-M.renderingStartTime>wx&&p!==1073741824&&(u.flags|=128,v=!0,tf(M,!1),u.lanes=4194304);M.isBackwards?(b.sibling=u.child,u.child=b):(a=M.last,a!==null?a.sibling=b:u.child=b,M.last=b)}return M.tail!==null?(u=M.tail,M.rendering=u,M.tail=u.sibling,M.renderingStartTime=Mn(),u.sibling=null,a=Jt.current,xt(Jt,v?a&1|2:a&1),u):(Wn(u),null);case 22:case 23:return bx(),v=u.memoizedState!==null,a!==null&&a.memoizedState!==null!==v&&(u.flags|=8192),v&&(u.mode&1)!==0?(Ri&1073741824)!==0&&(Wn(u),Qe&&u.subtreeFlags&6&&(u.flags|=8192)):Wn(u),null;case 24:return null;case 25:return null}throw Error(o(156,u.tag))}var zk=l.ReactCurrentOwner,Li=!1;function ni(a,u,p,v){u.child=a===null?g3(u,null,p,v):Yl(u,a.child,p,v)}function W3(a,u,p,v,M){p=p.render;var b=u.ref;return Wl(u,M),v=Ky(a,u,p,v,b,M),p=$y(),a!==null&&!Li?(u.updateQueue=a.updateQueue,u.flags&=-2053,a.lanes&=~M,Ss(a,u,M)):(Xt&&p&&Hy(u),u.flags|=1,ni(a,u,v,M),u.child)}function G3(a,u,p,v,M){if(a===null){var b=p.type;return typeof b=="function"&&!Cx(b)&&b.defaultProps===void 0&&p.compare===null&&p.defaultProps===void 0?(u.tag=15,u.type=b,X3(a,u,b,v,M)):(a=Gp(p.type,null,v,u,u.mode,M),a.ref=u.ref,a.return=u,u.child=a)}if(b=a.child,(a.lanes&M)===0){var O=b.memoizedProps;if(p=p.compare,p=p!==null?p:sp,p(O,v)&&a.ref===u.ref)return Ss(a,u,M)}return u.flags|=1,a=wo(b,v),a.ref=u.ref,a.return=u,u.child=a}function X3(a,u,p,v,M){if(a!==null&&sp(a.memoizedProps,v)&&a.ref===u.ref)if(Li=!1,(a.lanes&M)!==0)(a.flags&131072)!==0&&(Li=!0);else return u.lanes=a.lanes,Ss(a,u,M);return sx(a,u,p,v,M)}function j3(a,u,p){var v=u.pendingProps,M=v.children,b=a!==null?a.memoizedState:null;if(v.mode==="hidden")if((u.mode&1)===0)u.memoizedState={baseLanes:0,cachePool:null},xt(Ql,Ri),Ri|=p;else if((p&1073741824)!==0)u.memoizedState={baseLanes:0,cachePool:null},v=b!==null?b.baseLanes:p,xt(Ql,Ri),Ri|=v;else return a=b!==null?b.baseLanes|p:p,u.lanes=u.childLanes=1073741824,u.memoizedState={baseLanes:a,cachePool:null},u.updateQueue=null,xt(Ql,Ri),Ri|=a,null;else b!==null?(v=b.baseLanes|p,u.memoizedState=null):v=p,xt(Ql,Ri),Ri|=v;return ni(a,u,M,p),u.child}function Y3(a,u){var p=u.ref;(a===null&&p!==null||a!==null&&a.ref!==p)&&(u.flags|=512,u.flags|=2097152)}function sx(a,u,p,v,M){var b=di(p)?ms:Pt.current;return b=gs(u,b),Wl(u,M),p=Ky(a,u,p,v,b,M),v=$y(),a!==null&&!Li?(u.updateQueue=a.updateQueue,u.flags&=-2053,a.lanes&=~M,Ss(a,u,M)):(Xt&&v&&Hy(u),u.flags|=1,ni(a,u,p,M),u.child)}function q3(a,u,p,v,M){if(di(p)){var b=!0;$h(u)}else b=!1;if(Wl(u,M),u.stateNode===null)a!==null&&(a.alternate=null,u.alternate=null,u.flags|=2),l3(u,p,v),Vy(u,p,v,M),v=!0;else if(a===null){var O=u.stateNode,H=u.memoizedProps;O.props=H;var ae=O.context,ye=p.contextType;typeof ye=="object"&&ye!==null?ye=Zi(ye):(ye=di(p)?ms:Pt.current,ye=gs(u,ye));var Ne=p.getDerivedStateFromProps,it=typeof Ne=="function"||typeof O.getSnapshotBeforeUpdate=="function";it||typeof O.UNSAFE_componentWillReceiveProps!="function"&&typeof O.componentWillReceiveProps!="function"||(H!==v||ae!==ye)&&u3(u,O,v,ye),mo=!1;var Ze=u.memoizedState;O.state=Ze,up(u,v,O,M),ae=u.memoizedState,H!==v||Ze!==ae||Sn.current||mo?(typeof Ne=="function"&&(By(u,p,Ne,v),ae=u.memoizedState),(H=mo||a3(u,p,H,v,Ze,ae,ye))?(it||typeof O.UNSAFE_componentWillMount!="function"&&typeof O.componentWillMount!="function"||(typeof O.componentWillMount=="function"&&O.componentWillMount(),typeof O.UNSAFE_componentWillMount=="function"&&O.UNSAFE_componentWillMount()),typeof O.componentDidMount=="function"&&(u.flags|=4194308)):(typeof O.componentDidMount=="function"&&(u.flags|=4194308),u.memoizedProps=v,u.memoizedState=ae),O.props=v,O.state=ae,O.context=ye,v=H):(typeof O.componentDidMount=="function"&&(u.flags|=4194308),v=!1)}else{O=u.stateNode,i3(a,u),H=u.memoizedProps,ye=u.type===u.elementType?H:xr(u.type,H),O.props=ye,it=u.pendingProps,Ze=O.context,ae=p.contextType,typeof ae=="object"&&ae!==null?ae=Zi(ae):(ae=di(p)?ms:Pt.current,ae=gs(u,ae));var zt=p.getDerivedStateFromProps;(Ne=typeof zt=="function"||typeof O.getSnapshotBeforeUpdate=="function")||typeof O.UNSAFE_componentWillReceiveProps!="function"&&typeof O.componentWillReceiveProps!="function"||(H!==it||Ze!==ae)&&u3(u,O,v,ae),mo=!1,Ze=u.memoizedState,O.state=Ze,up(u,v,O,M);var We=u.memoizedState;H!==it||Ze!==We||Sn.current||mo?(typeof zt=="function"&&(By(u,p,zt,v),We=u.memoizedState),(ye=mo||a3(u,p,ye,v,Ze,We,ae)||!1)?(Ne||typeof O.UNSAFE_componentWillUpdate!="function"&&typeof O.componentWillUpdate!="function"||(typeof O.componentWillUpdate=="function"&&O.componentWillUpdate(v,We,ae),typeof O.UNSAFE_componentWillUpdate=="function"&&O.UNSAFE_componentWillUpdate(v,We,ae)),typeof O.componentDidUpdate=="function"&&(u.flags|=4),typeof O.getSnapshotBeforeUpdate=="function"&&(u.flags|=1024)):(typeof O.componentDidUpdate!="function"||H===a.memoizedProps&&Ze===a.memoizedState||(u.flags|=4),typeof O.getSnapshotBeforeUpdate!="function"||H===a.memoizedProps&&Ze===a.memoizedState||(u.flags|=1024),u.memoizedProps=v,u.memoizedState=We),O.props=v,O.state=We,O.context=ae,v=ye):(typeof O.componentDidUpdate!="function"||H===a.memoizedProps&&Ze===a.memoizedState||(u.flags|=4),typeof O.getSnapshotBeforeUpdate!="function"||H===a.memoizedProps&&Ze===a.memoizedState||(u.flags|=1024),v=!1)}return ox(a,u,p,v,b,M)}function ox(a,u,p,v,M,b){Y3(a,u);var O=(u.flags&128)!==0;if(!v&&!O)return M&&KE(u,p,!1),Ss(a,u,b);v=u.stateNode,zk.current=u;var H=O&&typeof p.getDerivedStateFromError!="function"?null:v.render();return u.flags|=1,a!==null&&O?(u.child=Yl(u,a.child,null,b),u.child=Yl(u,null,H,b)):ni(a,u,H,b),u.memoizedState=v.state,M&&KE(u,p,!0),u.child}function Z3(a){var u=a.stateNode;u.pendingContext?JE(a,u.pendingContext,u.pendingContext!==u.context):u.context&&JE(a,u.context,!1),Yy(a,u.containerInfo)}function J3(a,u,p,v,M){return jl(),jy(M),u.flags|=256,ni(a,u,p,v),u.child}var Ep={dehydrated:null,treeContext:null,retryLane:0};function Tp(a){return{baseLanes:a,cachePool:null}}function Q3(a,u,p){var v=u.pendingProps,M=Jt.current,b=!1,O=(u.flags&128)!==0,H;if((H=O)||(H=a!==null&&a.memoizedState===null?!1:(M&2)!==0),H?(b=!0,u.flags&=-129):(a===null||a.memoizedState!==null)&&(M|=1),xt(Jt,M&1),a===null)return Xy(u),a=u.memoizedState,a!==null&&(a=a.dehydrated,a!==null)?((u.mode&1)===0?u.lanes=1:Vc(a)?u.lanes=8:u.lanes=1073741824,null):(M=v.children,a=v.fallback,b?(v=u.mode,b=u.child,M={mode:"hidden",children:M},(v&1)===0&&b!==null?(b.childLanes=0,b.pendingProps=M):b=Xp(M,v,0,null),a=Ta(a,v,p,null),b.return=u,a.return=u,b.sibling=a,u.child=b,u.child.memoizedState=Tp(p),u.memoizedState=Ep,a):ax(u,M));if(M=a.memoizedState,M!==null){if(H=M.dehydrated,H!==null){if(O)return u.flags&256?(u.flags&=-257,bp(a,u,p,Error(o(422)))):u.memoizedState!==null?(u.child=a.child,u.flags|=128,null):(b=v.fallback,M=u.mode,v=Xp({mode:"visible",children:v.children},M,0,null),b=Ta(b,M,p,null),b.flags|=2,v.return=u,b.return=u,v.sibling=b,u.child=v,(u.mode&1)!==0&&Yl(u,a.child,null,p),u.child.memoizedState=Tp(p),u.memoizedState=Ep,b);if((u.mode&1)===0)u=bp(a,u,p,null);else if(Vc(H))u=bp(a,u,p,Error(o(419)));else if(v=(p&a.childLanes)!==0,Li||v){if(v=dn,v!==null){switch(p&-p){case 4:b=2;break;case 16:b=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:b=32;break;case 536870912:b=268435456;break;default:b=0}v=(b&(v.suspendedLanes|p))!==0?0:b,v!==0&&v!==M.retryLane&&(M.retryLane=v,er(a,v,-1))}Ax(),u=bp(a,u,p,Error(o(421)))}else Qh(H)?(u.flags|=128,u.child=a.child,u=Yk.bind(null,a),N(H,u),u=null):(p=M.treeContext,oe&&(Pi=de(H),Ci=u,Xt=!0,_r=null,Gc=!1,p!==null&&(Ji[Qi++]=xs,Ji[Qi++]=_s,Ji[Qi++]=va,xs=p.id,_s=p.overflow,va=u)),u=ax(u,u.pendingProps.children),u.flags|=4096);return u}return b?(v=$3(a,u,v.children,v.fallback,p),b=u.child,M=a.child.memoizedState,b.memoizedState=M===null?Tp(p):{baseLanes:M.baseLanes|p,cachePool:null},b.childLanes=a.childLanes&~p,u.memoizedState=Ep,v):(p=K3(a,u,v.children,p),u.memoizedState=null,p)}return b?(v=$3(a,u,v.children,v.fallback,p),b=u.child,M=a.child.memoizedState,b.memoizedState=M===null?Tp(p):{baseLanes:M.baseLanes|p,cachePool:null},b.childLanes=a.childLanes&~p,u.memoizedState=Ep,v):(p=K3(a,u,v.children,p),u.memoizedState=null,p)}function ax(a,u){return u=Xp({mode:"visible",children:u},a.mode,0,null),u.return=a,a.child=u}function K3(a,u,p,v){var M=a.child;return a=M.sibling,p=wo(M,{mode:"visible",children:p}),(u.mode&1)===0&&(p.lanes=v),p.return=u,p.sibling=null,a!==null&&(v=u.deletions,v===null?(u.deletions=[a],u.flags|=16):v.push(a)),u.child=p}function $3(a,u,p,v,M){var b=u.mode;a=a.child;var O=a.sibling,H={mode:"hidden",children:p};return(b&1)===0&&u.child!==a?(p=u.child,p.childLanes=0,p.pendingProps=H,u.deletions=null):(p=wo(a,H),p.subtreeFlags=a.subtreeFlags&14680064),O!==null?v=wo(O,v):(v=Ta(v,b,M,null),v.flags|=2),v.return=u,p.return=u,p.sibling=v,u.child=p,v}function bp(a,u,p,v){return v!==null&&jy(v),Yl(u,a.child,null,p),a=ax(u,u.pendingProps.children),a.flags|=2,u.memoizedState=null,a}function eT(a,u,p){a.lanes|=u;var v=a.alternate;v!==null&&(v.lanes|=u),Fy(a.return,u,p)}function lx(a,u,p,v,M){var b=a.memoizedState;b===null?a.memoizedState={isBackwards:u,rendering:null,renderingStartTime:0,last:v,tail:p,tailMode:M}:(b.isBackwards=u,b.rendering=null,b.renderingStartTime=0,b.last=v,b.tail=p,b.tailMode=M)}function tT(a,u,p){var v=u.pendingProps,M=v.revealOrder,b=v.tail;if(ni(a,u,v.children,p),v=Jt.current,(v&2)!==0)v=v&1|2,u.flags|=128;else{if(a!==null&&(a.flags&128)!==0)e:for(a=u.child;a!==null;){if(a.tag===13)a.memoizedState!==null&&eT(a,p,u);else if(a.tag===19)eT(a,p,u);else if(a.child!==null){a.child.return=a,a=a.child;continue}if(a===u)break e;for(;a.sibling===null;){if(a.return===null||a.return===u)break e;a=a.return}a.sibling.return=a.return,a=a.sibling}v&=1}if(xt(Jt,v),(u.mode&1)===0)u.memoizedState=null;else switch(M){case"forwards":for(p=u.child,M=null;p!==null;)a=p.alternate,a!==null&&pp(a)===null&&(M=p),p=p.sibling;p=M,p===null?(M=u.child,u.child=null):(M=p.sibling,p.sibling=null),lx(u,!1,M,p,b);break;case"backwards":for(p=null,M=u.child,u.child=null;M!==null;){if(a=M.alternate,a!==null&&pp(a)===null){u.child=M;break}a=M.sibling,M.sibling=p,p=M,M=a}lx(u,!0,p,null,b);break;case"together":lx(u,!1,null,null,void 0);break;default:u.memoizedState=null}return u.child}function Ss(a,u,p){if(a!==null&&(u.dependencies=a.dependencies),Kl|=u.lanes,(p&u.childLanes)===0)return null;if(a!==null&&u.child!==a.child)throw Error(o(153));if(u.child!==null){for(a=u.child,p=wo(a,a.pendingProps),u.child=p,p.return=u;a.sibling!==null;)a=a.sibling,p=p.sibling=wo(a,a.pendingProps),p.return=u;p.sibling=null}return u.child}function Nk(a,u,p){switch(u.tag){case 3:Z3(u),jl();break;case 5:v3(u);break;case 1:di(u.type)&&$h(u);break;case 4:Yy(u,u.stateNode.containerInfo);break;case 10:n3(u,u.type._context,u.memoizedProps.value);break;case 13:var v=u.memoizedState;if(v!==null)return v.dehydrated!==null?(xt(Jt,Jt.current&1),u.flags|=128,null):(p&u.child.childLanes)!==0?Q3(a,u,p):(xt(Jt,Jt.current&1),a=Ss(a,u,p),a!==null?a.sibling:null);xt(Jt,Jt.current&1);break;case 19:if(v=(p&u.childLanes)!==0,(a.flags&128)!==0){if(v)return tT(a,u,p);u.flags|=128}var M=u.memoizedState;if(M!==null&&(M.rendering=null,M.tail=null,M.lastEffect=null),xt(Jt,Jt.current),v)break;return null;case 22:case 23:return u.lanes=0,j3(a,u,p)}return Ss(a,u,p)}function kk(a,u){switch(Wy(u),u.tag){case 1:return di(u.type)&&Kh(),a=u.flags,a&65536?(u.flags=a&-65537|128,u):null;case 3:return Zl(),at(Sn),at(Pt),Jy(),a=u.flags,(a&65536)!==0&&(a&128)===0?(u.flags=a&-65537|128,u):null;case 5:return qy(u),null;case 13:if(at(Jt),a=u.memoizedState,a!==null&&a.dehydrated!==null){if(u.alternate===null)throw Error(o(340));jl()}return a=u.flags,a&65536?(u.flags=a&-65537|128,u):null;case 19:return at(Jt),null;case 4:return Zl(),null;case 10:return Oy(u.type._context),null;case 22:case 23:return bx(),null;case 24:return null;default:return null}}var Ap=!1,_a=!1,Ok=typeof WeakSet=="function"?WeakSet:Set,Pe=null;function Cp(a,u){var p=a.ref;if(p!==null)if(typeof p=="function")try{p(null)}catch(v){mi(a,u,v)}else p.current=null}function ux(a,u,p){try{p()}catch(v){mi(a,u,v)}}var nT=!1;function Fk(a,u){for(B(a.containerInfo),Pe=u;Pe!==null;)if(a=Pe,u=a.child,(a.subtreeFlags&1028)!==0&&u!==null)u.return=a,Pe=u;else for(;Pe!==null;){a=Pe;try{var p=a.alternate;if((a.flags&1024)!==0)switch(a.tag){case 0:case 11:case 15:break;case 1:if(p!==null){var v=p.memoizedProps,M=p.memoizedState,b=a.stateNode,O=b.getSnapshotBeforeUpdate(a.elementType===a.type?v:xr(a.type,v),M);b.__reactInternalSnapshotBeforeUpdate=O}break;case 3:Qe&&yt(a.stateNode.containerInfo);break;case 5:case 6:case 4:case 17:break;default:throw Error(o(163))}}catch(H){mi(a,a.return,H)}if(u=a.sibling,u!==null){u.return=a.return,Pe=u;break}Pe=a.return}return p=nT,nT=!1,p}function wa(a,u,p){var v=u.updateQueue;if(v=v!==null?v.lastEffect:null,v!==null){var M=v=v.next;do{if((M.tag&a)===a){var b=M.destroy;M.destroy=void 0,b!==void 0&&ux(u,p,b)}M=M.next}while(M!==v)}}function nf(a,u){if(u=u.updateQueue,u=u!==null?u.lastEffect:null,u!==null){var p=u=u.next;do{if((p.tag&a)===a){var v=p.create;p.destroy=v()}p=p.next}while(p!==u)}}function cx(a){var u=a.ref;if(u!==null){var p=a.stateNode;switch(a.tag){case 5:a=ee(p);break;default:a=p}typeof u=="function"?u(a):u.current=a}}function iT(a,u,p){if(Nr&&typeof Nr.onCommitFiberUnmount=="function")try{Nr.onCommitFiberUnmount(ip,u)}catch{}switch(u.tag){case 0:case 11:case 14:case 15:if(a=u.updateQueue,a!==null&&(a=a.lastEffect,a!==null)){var v=a=a.next;do{var M=v,b=M.destroy;M=M.tag,b!==void 0&&((M&2)!==0||(M&4)!==0)&&ux(u,p,b),v=v.next}while(v!==a)}break;case 1:if(Cp(u,p),a=u.stateNode,typeof a.componentWillUnmount=="function")try{a.props=u.memoizedProps,a.state=u.memoizedState,a.componentWillUnmount()}catch(O){mi(u,p,O)}break;case 5:Cp(u,p);break;case 4:Qe?uT(a,u,p):he&&he&&(u=u.stateNode.containerInfo,p=Vt(u),Gi(u,p))}}function rT(a,u,p){for(var v=u;;)if(iT(a,v,p),v.child===null||Qe&&v.tag===4){if(v===u)break;for(;v.sibling===null;){if(v.return===null||v.return===u)return;v=v.return}v.sibling.return=v.return,v=v.sibling}else v.child.return=v,v=v.child}function sT(a){var u=a.alternate;u!==null&&(a.alternate=null,sT(u)),a.child=null,a.deletions=null,a.sibling=null,a.tag===5&&(u=a.stateNode,u!==null&&$e(u)),a.stateNode=null,a.return=null,a.dependencies=null,a.memoizedProps=null,a.memoizedState=null,a.pendingProps=null,a.stateNode=null,a.updateQueue=null}function oT(a){return a.tag===5||a.tag===3||a.tag===4}function aT(a){e:for(;;){for(;a.sibling===null;){if(a.return===null||oT(a.return))return null;a=a.return}for(a.sibling.return=a.return,a=a.sibling;a.tag!==5&&a.tag!==6&&a.tag!==18;){if(a.flags&2||a.child===null||a.tag===4)continue e;a.child.return=a,a=a.child}if(!(a.flags&2))return a.stateNode}}function lT(a){if(Qe){e:{for(var u=a.return;u!==null;){if(oT(u))break e;u=u.return}throw Error(o(160))}var p=u;switch(p.tag){case 5:u=p.stateNode,p.flags&32&&(W(u),p.flags&=-33),p=aT(a),dx(a,p,u);break;case 3:case 4:u=p.stateNode.containerInfo,p=aT(a),fx(a,p,u);break;default:throw Error(o(161))}}}function fx(a,u,p){var v=a.tag;if(v===5||v===6)a=a.stateNode,u?_e(p,a,u):se(p,a);else if(v!==4&&(a=a.child,a!==null))for(fx(a,u,p),a=a.sibling;a!==null;)fx(a,u,p),a=a.sibling}function dx(a,u,p){var v=a.tag;if(v===5||v===6)a=a.stateNode,u?K(p,a,u):Ke(p,a);else if(v!==4&&(a=a.child,a!==null))for(dx(a,u,p),a=a.sibling;a!==null;)dx(a,u,p),a=a.sibling}function uT(a,u,p){for(var v=u,M=!1,b,O;;){if(!M){M=v.return;e:for(;;){if(M===null)throw Error(o(160));switch(b=M.stateNode,M.tag){case 5:O=!1;break e;case 3:b=b.containerInfo,O=!0;break e;case 4:b=b.containerInfo,O=!0;break e}M=M.return}M=!0}if(v.tag===5||v.tag===6)rT(a,v,p),O?ot(b,v.stateNode):Oe(b,v.stateNode);else if(v.tag===18)O?Wt(b,v.stateNode):gt(b,v.stateNode);else if(v.tag===4){if(v.child!==null){b=v.stateNode.containerInfo,O=!0,v.child.return=v,v=v.child;continue}}else if(iT(a,v,p),v.child!==null){v.child.return=v,v=v.child;continue}if(v===u)break;for(;v.sibling===null;){if(v.return===null||v.return===u)return;v=v.return,v.tag===4&&(M=!1)}v.sibling.return=v.return,v=v.sibling}}function hx(a,u){if(Qe){switch(u.tag){case 0:case 11:case 14:case 15:wa(3,u,u.return),nf(3,u),wa(5,u,u.return);return;case 1:return;case 5:var p=u.stateNode;if(p!=null){var v=u.memoizedProps;a=a!==null?a.memoizedProps:v;var M=u.type,b=u.updateQueue;u.updateQueue=null,b!==null&&V(p,b,M,a,v,u)}return;case 6:if(u.stateNode===null)throw Error(o(162));p=u.memoizedProps,Be(u.stateNode,a!==null?a.memoizedProps:p,p);return;case 3:oe&&a!==null&&a.memoizedState.isDehydrated&&Tt(u.stateNode.containerInfo);return;case 12:return;case 13:Pp(u);return;case 19:Pp(u);return;case 17:return}throw Error(o(163))}switch(u.tag){case 0:case 11:case 14:case 15:wa(3,u,u.return),nf(3,u),wa(5,u,u.return);return;case 12:return;case 13:Pp(u);return;case 19:Pp(u);return;case 3:oe&&a!==null&&a.memoizedState.isDehydrated&&Tt(u.stateNode.containerInfo);break;case 22:case 23:return}e:if(he){switch(u.tag){case 1:case 5:case 6:break e;case 3:case 4:u=u.stateNode,Gi(u.containerInfo,u.pendingChildren);break e}throw Error(o(163))}}function Pp(a){var u=a.updateQueue;if(u!==null){a.updateQueue=null;var p=a.stateNode;p===null&&(p=a.stateNode=new Ok),u.forEach(function(v){var M=qk.bind(null,a,v);p.has(v)||(p.add(v),v.then(M,M))})}}function Uk(a,u){for(Pe=u;Pe!==null;){u=Pe;var p=u.deletions;if(p!==null)for(var v=0;v<p.length;v++){var M=p[v];try{var b=a;Qe?uT(b,M,u):rT(b,M,u);var O=M.alternate;O!==null&&(O.return=null),M.return=null}catch(He){mi(M,u,He)}}if(p=u.child,(u.subtreeFlags&12854)!==0&&p!==null)p.return=u,Pe=p;else for(;Pe!==null;){u=Pe;try{var H=u.flags;if(H&32&&Qe&&W(u.stateNode),H&512){var ae=u.alternate;if(ae!==null){var ye=ae.ref;ye!==null&&(typeof ye=="function"?ye(null):ye.current=null)}}if(H&8192)switch(u.tag){case 13:if(u.memoizedState!==null){var Ne=u.alternate;(Ne===null||Ne.memoizedState===null)&&(_x=Mn())}break;case 22:var it=u.memoizedState!==null,Ze=u.alternate,zt=Ze!==null&&Ze.memoizedState!==null;if(p=u,Qe){e:if(v=p,M=it,b=null,Qe)for(var We=v;;){if(We.tag===5){if(b===null){b=We;var Gn=We.stateNode;M?Le(Gn):Te(We.stateNode,We.memoizedProps)}}else if(We.tag===6){if(b===null){var nr=We.stateNode;M?le(nr):Ee(nr,We.memoizedProps)}}else if((We.tag!==22&&We.tag!==23||We.memoizedState===null||We===v)&&We.child!==null){We.child.return=We,We=We.child;continue}if(We===v)break;for(;We.sibling===null;){if(We.return===null||We.return===v)break e;b===We&&(b=null),We=We.return}b===We&&(b=null),We.sibling.return=We.return,We=We.sibling}}if(it&&!zt&&(p.mode&1)!==0){Pe=p;for(var Q=p.child;Q!==null;){for(p=Pe=Q;Pe!==null;){v=Pe;var X=v.child;switch(v.tag){case 0:case 11:case 14:case 15:wa(4,v,v.return);break;case 1:Cp(v,v.return);var ne=v.stateNode;if(typeof ne.componentWillUnmount=="function"){var Re=v.return;try{ne.props=v.memoizedProps,ne.state=v.memoizedState,ne.componentWillUnmount()}catch(He){mi(v,Re,He)}}break;case 5:Cp(v,v.return);break;case 22:if(v.memoizedState!==null){dT(p);continue}}X!==null?(X.return=v,Pe=X):dT(p)}Q=Q.sibling}}}switch(H&4102){case 2:lT(u),u.flags&=-3;break;case 6:lT(u),u.flags&=-3,hx(u.alternate,u);break;case 4096:u.flags&=-4097;break;case 4100:u.flags&=-4097,hx(u.alternate,u);break;case 4:hx(u.alternate,u)}}catch(He){mi(u,u.return,He)}if(p=u.sibling,p!==null){p.return=u.return,Pe=p;break}Pe=u.return}}}function Bk(a,u,p){Pe=a,cT(a)}function cT(a,u,p){for(var v=(a.mode&1)!==0;Pe!==null;){var M=Pe,b=M.child;if(M.tag===22&&v){var O=M.memoizedState!==null||Ap;if(!O){var H=M.alternate,ae=H!==null&&H.memoizedState!==null||_a;H=Ap;var ye=_a;if(Ap=O,(_a=ae)&&!ye)for(Pe=M;Pe!==null;)O=Pe,ae=O.child,O.tag===22&&O.memoizedState!==null?hT(M):ae!==null?(ae.return=O,Pe=ae):hT(M);for(;b!==null;)Pe=b,cT(b),b=b.sibling;Pe=M,Ap=H,_a=ye}fT(a)}else(M.subtreeFlags&8772)!==0&&b!==null?(b.return=M,Pe=b):fT(a)}}function fT(a){for(;Pe!==null;){var u=Pe;if((u.flags&8772)!==0){var p=u.alternate;try{if((u.flags&8772)!==0)switch(u.tag){case 0:case 11:case 15:_a||nf(5,u);break;case 1:var v=u.stateNode;if(u.flags&4&&!_a)if(p===null)v.componentDidMount();else{var M=u.elementType===u.type?p.memoizedProps:xr(u.type,p.memoizedProps);v.componentDidUpdate(M,p.memoizedState,v.__reactInternalSnapshotBeforeUpdate)}var b=u.updateQueue;b!==null&&s3(u,b,v);break;case 3:var O=u.updateQueue;if(O!==null){if(p=null,u.child!==null)switch(u.child.tag){case 5:p=ee(u.child.stateNode);break;case 1:p=u.child.stateNode}s3(u,O,p)}break;case 5:var H=u.stateNode;p===null&&u.flags&4&&Ie(H,u.type,u.memoizedProps,u);break;case 6:break;case 4:break;case 12:break;case 13:if(oe&&u.memoizedState===null){var ae=u.alternate;if(ae!==null){var ye=ae.memoizedState;if(ye!==null){var Ne=ye.dehydrated;Ne!==null&&mt(Ne)}}}break;case 19:case 17:case 21:case 22:case 23:break;default:throw Error(o(163))}_a||u.flags&512&&cx(u)}catch(it){mi(u,u.return,it)}}if(u===a){Pe=null;break}if(p=u.sibling,p!==null){p.return=u.return,Pe=p;break}Pe=u.return}}function dT(a){for(;Pe!==null;){var u=Pe;if(u===a){Pe=null;break}var p=u.sibling;if(p!==null){p.return=u.return,Pe=p;break}Pe=u.return}}function hT(a){for(;Pe!==null;){var u=Pe;try{switch(u.tag){case 0:case 11:case 15:var p=u.return;try{nf(4,u)}catch(ae){mi(u,p,ae)}break;case 1:var v=u.stateNode;if(typeof v.componentDidMount=="function"){var M=u.return;try{v.componentDidMount()}catch(ae){mi(u,M,ae)}}var b=u.return;try{cx(u)}catch(ae){mi(u,b,ae)}break;case 5:var O=u.return;try{cx(u)}catch(ae){mi(u,O,ae)}}}catch(ae){mi(u,u.return,ae)}if(u===a){Pe=null;break}var H=u.sibling;if(H!==null){H.return=u.return,Pe=H;break}Pe=u.return}}var Lp=0,Rp=1,Ip=2,Dp=3,zp=4;if(typeof Symbol=="function"&&Symbol.for){var rf=Symbol.for;Lp=rf("selector.component"),Rp=rf("selector.has_pseudo_class"),Ip=rf("selector.role"),Dp=rf("selector.test_id"),zp=rf("selector.text")}function px(a){var u=xe(a);if(u!=null){if(typeof u.memoizedProps["data-testname"]!="string")throw Error(o(364));return u}if(a=Et(a),a===null)throw Error(o(362));return a.stateNode.current}function mx(a,u){switch(u.$$typeof){case Lp:if(a.type===u.value)return!0;break;case Rp:e:{u=u.value,a=[a,0];for(var p=0;p<a.length;){var v=a[p++],M=a[p++],b=u[M];if(v.tag!==5||!te(v)){for(;b!=null&&mx(v,b);)M++,b=u[M];if(M===u.length){u=!0;break e}else for(v=v.child;v!==null;)a.push(v,M),v=v.sibling}}u=!1}return u;case Ip:if(a.tag===5&&ve(a.stateNode,u.value))return!0;break;case zp:if((a.tag===5||a.tag===6)&&(a=D(a),a!==null&&0<=a.indexOf(u.value)))return!0;break;case Dp:if(a.tag===5&&(a=a.memoizedProps["data-testname"],typeof a=="string"&&a.toLowerCase()===u.value.toLowerCase()))return!0;break;default:throw Error(o(365))}return!1}function gx(a){switch(a.$$typeof){case Lp:return"<"+(I(a.value)||"Unknown")+">";case Rp:return":has("+(gx(a)||"")+")";case Ip:return'[role="'+a.value+'"]';case zp:return'"'+a.value+'"';case Dp:return'[data-testname="'+a.value+'"]';default:throw Error(o(365))}}function pT(a,u){var p=[];a=[a,0];for(var v=0;v<a.length;){var M=a[v++],b=a[v++],O=u[b];if(M.tag!==5||!te(M)){for(;O!=null&&mx(M,O);)b++,O=u[b];if(b===u.length)p.push(M);else for(M=M.child;M!==null;)a.push(M,b),M=M.sibling}}return p}function vx(a,u){if(!vt)throw Error(o(363));a=px(a),a=pT(a,u),u=[],a=Array.from(a);for(var p=0;p<a.length;){var v=a[p++];if(v.tag===5)te(v)||u.push(v.stateNode);else for(v=v.child;v!==null;)a.push(v),v=v.sibling}return u}var Vk=Math.ceil,Np=l.ReactCurrentDispatcher,yx=l.ReactCurrentOwner,on=l.ReactCurrentBatchConfig,ft=0,dn=null,hn=null,In=0,Ri=0,Ql=Yi(0),vn=0,sf=null,Kl=0,kp=0,xx=0,of=null,hi=null,_x=0,wx=1/0;function $l(){wx=Mn()+500}var Op=!1,Sx=null,vo=null,Fp=!1,yo=null,Up=0,af=0,Mx=null,Bp=-1,Vp=0;function ii(){return(ft&6)!==0?Mn():Bp!==-1?Bp:Bp=Mn()}function xo(a){return(a.mode&1)===0?1:(ft&2)!==0&&In!==0?In&-In:Mk.transition!==null?(Vp===0&&(a=ep,ep<<=1,(ep&4194240)===0&&(ep=64),Vp=a),Vp):(a=bt,a!==0?a:Ae())}function er(a,u,p){if(50<af)throw af=0,Mx=null,Error(o(185));var v=Hp(a,u);return v===null?null:(Wc(v,u,p),((ft&2)===0||v!==dn)&&(v===dn&&((ft&2)===0&&(kp|=u),vn===4&&_o(v,In)),pi(v,p),u===1&&ft===0&&(a.mode&1)===0&&($l(),rp&&Or())),v)}function Hp(a,u){a.lanes|=u;var p=a.alternate;for(p!==null&&(p.lanes|=u),p=a,a=a.return;a!==null;)a.childLanes|=u,p=a.alternate,p!==null&&(p.childLanes|=u),p=a,a=a.return;return p.tag===3?p.stateNode:null}function pi(a,u){var p=a.callbackNode;pk(a,u);var v=np(a,a===dn?In:0);if(v===0)p!==null&&e3(p),a.callbackNode=null,a.callbackPriority=0;else if(u=v&-v,a.callbackPriority!==u){if(p!=null&&e3(p),u===1)a.tag===0?Sk(gT.bind(null,a)):t3(gT.bind(null,a)),Ye?Ge(function(){ft===0&&Or()}):Ry(Iy,Or),p=null;else{switch($E(v)){case 1:p=Iy;break;case 4:p=yk;break;case 16:p=Dy;break;case 536870912:p=xk;break;default:p=Dy}p=TT(p,mT.bind(null,a))}a.callbackPriority=u,a.callbackNode=p}}function mT(a,u){if(Bp=-1,Vp=0,(ft&6)!==0)throw Error(o(327));var p=a.callbackNode;if(Ea()&&a.callbackNode!==p)return null;var v=np(a,a===dn?In:0);if(v===0)return null;if((v&30)!==0||(v&a.expiredLanes)!==0||u)u=Wp(a,v);else{u=v;var M=ft;ft|=2;var b=xT();(dn!==a||In!==u)&&($l(),Sa(a,u));do try{Gk();break}catch(H){yT(a,H)}while(1);ky(),Np.current=b,ft=M,hn!==null?u=0:(dn=null,In=0,u=vn)}if(u!==0){if(u===2&&(M=Cy(a),M!==0&&(v=M,u=Ex(a,M))),u===1)throw p=sf,Sa(a,0),_o(a,v),pi(a,Mn()),p;if(u===6)_o(a,v);else{if(M=a.current.alternate,(v&30)===0&&!Hk(M)&&(u=Wp(a,v),u===2&&(b=Cy(a),b!==0&&(v=b,u=Ex(a,b))),u===1))throw p=sf,Sa(a,0),_o(a,v),pi(a,Mn()),p;switch(a.finishedWork=M,a.finishedLanes=v,u){case 0:case 1:throw Error(o(345));case 2:Ma(a,hi);break;case 3:if(_o(a,v),(v&130023424)===v&&(u=_x+500-Mn(),10<u)){if(np(a,0)!==0)break;if(M=a.suspendedLanes,(M&v)!==v){ii(),a.pingedLanes|=a.suspendedLanes&M;break}a.timeoutHandle=Xe(Ma.bind(null,a,hi),u);break}Ma(a,hi);break;case 4:if(_o(a,v),(v&4194240)===v)break;for(u=a.eventTimes,M=-1;0<v;){var O=31-yr(v);b=1<<O,O=u[O],O>M&&(M=O),v&=~b}if(v=M,v=Mn()-v,v=(120>v?120:480>v?480:1080>v?1080:1920>v?1920:3e3>v?3e3:4320>v?4320:1960*Vk(v/1960))-v,10<v){a.timeoutHandle=Xe(Ma.bind(null,a,hi),v);break}Ma(a,hi);break;case 5:Ma(a,hi);break;default:throw Error(o(329))}}}return pi(a,Mn()),a.callbackNode===p?mT.bind(null,a):null}function Ex(a,u){var p=of;return a.current.memoizedState.isDehydrated&&(Sa(a,u).flags|=256),a=Wp(a,u),a!==2&&(u=hi,hi=p,u!==null&&Tx(u)),a}function Tx(a){hi===null?hi=a:hi.push.apply(hi,a)}function Hk(a){for(var u=a;;){if(u.flags&16384){var p=u.updateQueue;if(p!==null&&(p=p.stores,p!==null))for(var v=0;v<p.length;v++){var M=p[v],b=M.getSnapshot;M=M.value;try{if(!kr(b(),M))return!1}catch{return!1}}}if(p=u.child,u.subtreeFlags&16384&&p!==null)p.return=u,u=p;else{if(u===a)break;for(;u.sibling===null;){if(u.return===null||u.return===a)return!0;u=u.return}u.sibling.return=u.return,u=u.sibling}}return!0}function _o(a,u){for(u&=~xx,u&=~kp,a.suspendedLanes|=u,a.pingedLanes&=~u,a=a.expirationTimes;0<u;){var p=31-yr(u),v=1<<p;a[p]=-1,u&=~v}}function gT(a){if((ft&6)!==0)throw Error(o(327));Ea();var u=np(a,0);if((u&1)===0)return pi(a,Mn()),null;var p=Wp(a,u);if(a.tag!==0&&p===2){var v=Cy(a);v!==0&&(u=v,p=Ex(a,v))}if(p===1)throw p=sf,Sa(a,0),_o(a,u),pi(a,Mn()),p;if(p===6)throw Error(o(345));return a.finishedWork=a.current.alternate,a.finishedLanes=u,Ma(a,hi),pi(a,Mn()),null}function vT(a){yo!==null&&yo.tag===0&&(ft&6)===0&&Ea();var u=ft;ft|=1;var p=on.transition,v=bt;try{if(on.transition=null,bt=1,a)return a()}finally{bt=v,on.transition=p,ft=u,(ft&6)===0&&Or()}}function bx(){Ri=Ql.current,at(Ql)}function Sa(a,u){a.finishedWork=null,a.finishedLanes=0;var p=a.timeoutHandle;if(p!==Je&&(a.timeoutHandle=Je,je(p)),hn!==null)for(p=hn.return;p!==null;){var v=p;switch(Wy(v),v.tag){case 1:v=v.type.childContextTypes,v!=null&&Kh();break;case 3:Zl(),at(Sn),at(Pt),Jy();break;case 5:qy(v);break;case 4:Zl();break;case 13:at(Jt);break;case 19:at(Jt);break;case 10:Oy(v.type._context);break;case 22:case 23:bx()}p=p.return}if(dn=a,hn=a=wo(a.current,null),In=Ri=u,vn=0,sf=null,xx=kp=Kl=0,hi=of=null,Fr!==null){for(u=0;u<Fr.length;u++)if(p=Fr[u],v=p.interleaved,v!==null){p.interleaved=null;var M=v.next,b=p.pending;if(b!==null){var O=b.next;b.next=M,v.next=O}p.pending=v}Fr=null}return a}function yT(a,u){do{var p=hn;try{if(ky(),mp.current=wp,gp){for(var v=$t.memoizedState;v!==null;){var M=v.queue;M!==null&&(M.pending=null),v=v.next}gp=!1}if(Jl=0,En=Vn=$t=null,Zc=!1,Jc=0,yx.current=null,p===null||p.return===null){vn=1,sf=u,hn=null;break}e:{var b=a,O=p.return,H=p,ae=u;if(u=In,H.flags|=32768,ae!==null&&typeof ae=="object"&&typeof ae.then=="function"){var ye=ae,Ne=H,it=Ne.tag;if((Ne.mode&1)===0&&(it===0||it===11||it===15)){var Ze=Ne.alternate;Ze?(Ne.updateQueue=Ze.updateQueue,Ne.memoizedState=Ze.memoizedState,Ne.lanes=Ze.lanes):(Ne.updateQueue=null,Ne.memoizedState=null)}var zt=U3(O);if(zt!==null){zt.flags&=-257,B3(zt,O,H,b,u),zt.mode&1&&F3(b,ye,u),u=zt,ae=ye;var We=u.updateQueue;if(We===null){var Gn=new Set;Gn.add(ae),u.updateQueue=Gn}else We.add(ae);break e}else{if((u&1)===0){F3(b,ye,u),Ax();break e}ae=Error(o(426))}}else if(Xt&&H.mode&1){var nr=U3(O);if(nr!==null){(nr.flags&65536)===0&&(nr.flags|=256),B3(nr,O,H,b,u),jy(ae);break e}}b=ae,vn!==4&&(vn=2),of===null?of=[b]:of.push(b),ae=ix(ae,H),H=O;do{switch(H.tag){case 3:H.flags|=65536,u&=-u,H.lanes|=u;var Q=k3(H,ae,u);r3(H,Q);break e;case 1:b=ae;var X=H.type,ne=H.stateNode;if((H.flags&128)===0&&(typeof X.getDerivedStateFromError=="function"||ne!==null&&typeof ne.componentDidCatch=="function"&&(vo===null||!vo.has(ne)))){H.flags|=65536,u&=-u,H.lanes|=u;var Re=O3(H,b,u);r3(H,Re);break e}}H=H.return}while(H!==null)}wT(p)}catch(He){u=He,hn===p&&p!==null&&(hn=p=p.return);continue}break}while(1)}function xT(){var a=Np.current;return Np.current=wp,a===null?wp:a}function Ax(){(vn===0||vn===3||vn===2)&&(vn=4),dn===null||(Kl&268435455)===0&&(kp&268435455)===0||_o(dn,In)}function Wp(a,u){var p=ft;ft|=2;var v=xT();dn===a&&In===u||Sa(a,u);do try{Wk();break}catch(M){yT(a,M)}while(1);if(ky(),ft=p,Np.current=v,hn!==null)throw Error(o(261));return dn=null,In=0,vn}function Wk(){for(;hn!==null;)_T(hn)}function Gk(){for(;hn!==null&&!gk();)_T(hn)}function _T(a){var u=ET(a.alternate,a,Ri);a.memoizedProps=a.pendingProps,u===null?wT(a):hn=u,yx.current=null}function wT(a){var u=a;do{var p=u.alternate;if(a=u.return,(u.flags&32768)===0){if(p=Dk(p,u,Ri),p!==null){hn=p;return}}else{if(p=kk(p,u),p!==null){p.flags&=32767,hn=p;return}if(a!==null)a.flags|=32768,a.subtreeFlags=0,a.deletions=null;else{vn=6,hn=null;return}}if(u=u.sibling,u!==null){hn=u;return}hn=u=a}while(u!==null);vn===0&&(vn=5)}function Ma(a,u){var p=bt,v=on.transition;try{on.transition=null,bt=1,Xk(a,u,p)}finally{on.transition=v,bt=p}return null}function Xk(a,u,p){do Ea();while(yo!==null);if((ft&6)!==0)throw Error(o(327));var v=a.finishedWork,M=a.finishedLanes;if(v===null)return null;if(a.finishedWork=null,a.finishedLanes=0,v===a.current)throw Error(o(177));a.callbackNode=null,a.callbackPriority=0;var b=v.lanes|v.childLanes;if(mk(a,b),a===dn&&(hn=dn=null,In=0),(v.subtreeFlags&2064)===0&&(v.flags&2064)===0||Fp||(Fp=!0,TT(Dy,function(){return Ea(),null})),b=(v.flags&15990)!==0,(v.subtreeFlags&15990)!==0||b){b=on.transition,on.transition=null;var O=bt;bt=1;var H=ft;ft|=4,yx.current=null,Fk(a,v),Uk(a,v),F(a.containerInfo),a.current=v,Bk(v),vk(),ft=H,bt=O,on.transition=b}else a.current=v;if(Fp&&(Fp=!1,yo=a,Up=M),b=a.pendingLanes,b===0&&(vo=null),_k(v.stateNode),pi(a,Mn()),u!==null)for(p=a.onRecoverableError,v=0;v<u.length;v++)p(u[v]);if(Op)throw Op=!1,a=Sx,Sx=null,a;return(Up&1)!==0&&a.tag!==0&&Ea(),b=a.pendingLanes,(b&1)!==0?a===Mx?af++:(af=0,Mx=a):af=0,Or(),null}function Ea(){if(yo!==null){var a=$E(Up),u=on.transition,p=bt;try{if(on.transition=null,bt=16>a?16:a,yo===null)var v=!1;else{if(a=yo,yo=null,Up=0,(ft&6)!==0)throw Error(o(331));var M=ft;for(ft|=4,Pe=a.current;Pe!==null;){var b=Pe,O=b.child;if((Pe.flags&16)!==0){var H=b.deletions;if(H!==null){for(var ae=0;ae<H.length;ae++){var ye=H[ae];for(Pe=ye;Pe!==null;){var Ne=Pe;switch(Ne.tag){case 0:case 11:case 15:wa(8,Ne,b)}var it=Ne.child;if(it!==null)it.return=Ne,Pe=it;else for(;Pe!==null;){Ne=Pe;var Ze=Ne.sibling,zt=Ne.return;if(sT(Ne),Ne===ye){Pe=null;break}if(Ze!==null){Ze.return=zt,Pe=Ze;break}Pe=zt}}}var We=b.alternate;if(We!==null){var Gn=We.child;if(Gn!==null){We.child=null;do{var nr=Gn.sibling;Gn.sibling=null,Gn=nr}while(Gn!==null)}}Pe=b}}if((b.subtreeFlags&2064)!==0&&O!==null)O.return=b,Pe=O;else e:for(;Pe!==null;){if(b=Pe,(b.flags&2048)!==0)switch(b.tag){case 0:case 11:case 15:wa(9,b,b.return)}var Q=b.sibling;if(Q!==null){Q.return=b.return,Pe=Q;break e}Pe=b.return}}var X=a.current;for(Pe=X;Pe!==null;){O=Pe;var ne=O.child;if((O.subtreeFlags&2064)!==0&&ne!==null)ne.return=O,Pe=ne;else e:for(O=X;Pe!==null;){if(H=Pe,(H.flags&2048)!==0)try{switch(H.tag){case 0:case 11:case 15:nf(9,H)}}catch(He){mi(H,H.return,He)}if(H===O){Pe=null;break e}var Re=H.sibling;if(Re!==null){Re.return=H.return,Pe=Re;break e}Pe=H.return}}if(ft=M,Or(),Nr&&typeof Nr.onPostCommitFiberRoot=="function")try{Nr.onPostCommitFiberRoot(ip,a)}catch{}v=!0}return v}finally{bt=p,on.transition=u}}return!1}function ST(a,u,p){u=ix(p,u),u=k3(a,u,1),go(a,u),u=ii(),a=Hp(a,1),a!==null&&(Wc(a,1,u),pi(a,u))}function mi(a,u,p){if(a.tag===3)ST(a,a,p);else for(;u!==null;){if(u.tag===3){ST(u,a,p);break}else if(u.tag===1){var v=u.stateNode;if(typeof u.type.getDerivedStateFromError=="function"||typeof v.componentDidCatch=="function"&&(vo===null||!vo.has(v))){a=ix(p,a),a=O3(u,a,1),go(u,a),a=ii(),u=Hp(u,1),u!==null&&(Wc(u,1,a),pi(u,a));break}}u=u.return}}function jk(a,u,p){var v=a.pingCache;v!==null&&v.delete(u),u=ii(),a.pingedLanes|=a.suspendedLanes&p,dn===a&&(In&p)===p&&(vn===4||vn===3&&(In&130023424)===In&&500>Mn()-_x?Sa(a,0):xx|=p),pi(a,u)}function MT(a,u){u===0&&((a.mode&1)===0?u=1:(u=tp,tp<<=1,(tp&130023424)===0&&(tp=4194304)));var p=ii();a=Hp(a,u),a!==null&&(Wc(a,u,p),pi(a,p))}function Yk(a){var u=a.memoizedState,p=0;u!==null&&(p=u.retryLane),MT(a,p)}function qk(a,u){var p=0;switch(a.tag){case 13:var v=a.stateNode,M=a.memoizedState;M!==null&&(p=M.retryLane);break;case 19:v=a.stateNode;break;default:throw Error(o(314))}v!==null&&v.delete(u),MT(a,p)}var ET;ET=function(a,u,p){if(a!==null)if(a.memoizedProps!==u.pendingProps||Sn.current)Li=!0;else{if((a.lanes&p)===0&&(u.flags&128)===0)return Li=!1,Nk(a,u,p);Li=(a.flags&131072)!==0}else Li=!1,Xt&&(u.flags&1048576)!==0&&c3(u,dp,u.index);switch(u.lanes=0,u.tag){case 2:var v=u.type;a!==null&&(a.alternate=null,u.alternate=null,u.flags|=2),a=u.pendingProps;var M=gs(u,Pt.current);Wl(u,p),M=Ky(null,u,v,a,M,p);var b=$y();return u.flags|=1,typeof M=="object"&&M!==null&&typeof M.render=="function"&&M.$$typeof===void 0?(u.tag=1,u.memoizedState=null,u.updateQueue=null,di(v)?(b=!0,$h(u)):b=!1,u.memoizedState=M.state!==null&&M.state!==void 0?M.state:null,Uy(u),M.updater=cp,u.stateNode=M,M._reactInternals=u,Vy(u,v,a,p),u=ox(null,u,v,!0,b,p)):(u.tag=0,Xt&&b&&Hy(u),ni(null,u,M,p),u=u.child),u;case 16:v=u.elementType;e:{switch(a!==null&&(a.alternate=null,u.alternate=null,u.flags|=2),a=u.pendingProps,M=v._init,v=M(v._payload),u.type=v,M=u.tag=Jk(v),a=xr(v,a),M){case 0:u=sx(null,u,v,a,p);break e;case 1:u=q3(null,u,v,a,p);break e;case 11:u=W3(null,u,v,a,p);break e;case 14:u=G3(null,u,v,xr(v.type,a),p);break e}throw Error(o(306,v,""))}return u;case 0:return v=u.type,M=u.pendingProps,M=u.elementType===v?M:xr(v,M),sx(a,u,v,M,p);case 1:return v=u.type,M=u.pendingProps,M=u.elementType===v?M:xr(v,M),q3(a,u,v,M,p);case 3:e:{if(Z3(u),a===null)throw Error(o(387));v=u.pendingProps,b=u.memoizedState,M=b.element,i3(a,u),up(u,v,null,p);var O=u.memoizedState;if(v=O.element,oe&&b.isDehydrated)if(b={element:v,isDehydrated:!1,cache:O.cache,transitions:O.transitions},u.updateQueue.baseState=b,u.memoizedState=b,u.flags&256){M=Error(o(423)),u=J3(a,u,v,p,M);break e}else if(v!==M){M=Error(o(424)),u=J3(a,u,v,p,M);break e}else for(oe&&(Pi=Y(u.stateNode.containerInfo),Ci=u,Xt=!0,_r=null,Gc=!1),p=g3(u,null,v,p),u.child=p;p;)p.flags=p.flags&-3|4096,p=p.sibling;else{if(jl(),v===M){u=Ss(a,u,p);break e}ni(a,u,v,p)}u=u.child}return u;case 5:return v3(u),a===null&&Xy(u),v=u.type,M=u.pendingProps,b=a!==null?a.memoizedProps:null,O=M.children,Ve(v,M)?O=null:b!==null&&Ve(v,b)&&(u.flags|=32),Y3(a,u),ni(a,u,O,p),u.child;case 6:return a===null&&Xy(u),null;case 13:return Q3(a,u,p);case 4:return Yy(u,u.stateNode.containerInfo),v=u.pendingProps,a===null?u.child=Yl(u,null,v,p):ni(a,u,v,p),u.child;case 11:return v=u.type,M=u.pendingProps,M=u.elementType===v?M:xr(v,M),W3(a,u,v,M,p);case 7:return ni(a,u,u.pendingProps,p),u.child;case 8:return ni(a,u,u.pendingProps.children,p),u.child;case 12:return ni(a,u,u.pendingProps.children,p),u.child;case 10:e:{if(v=u.type._context,M=u.pendingProps,b=u.memoizedProps,O=M.value,n3(u,v,O),b!==null)if(kr(b.value,O)){if(b.children===M.children&&!Sn.current){u=Ss(a,u,p);break e}}else for(b=u.child,b!==null&&(b.return=u);b!==null;){var H=b.dependencies;if(H!==null){O=b.child;for(var ae=H.firstContext;ae!==null;){if(ae.context===v){if(b.tag===1){ae=ys(-1,p&-p),ae.tag=2;var ye=b.updateQueue;if(ye!==null){ye=ye.shared;var Ne=ye.pending;Ne===null?ae.next=ae:(ae.next=Ne.next,Ne.next=ae),ye.pending=ae}}b.lanes|=p,ae=b.alternate,ae!==null&&(ae.lanes|=p),Fy(b.return,p,u),H.lanes|=p;break}ae=ae.next}}else if(b.tag===10)O=b.type===u.type?null:b.child;else if(b.tag===18){if(O=b.return,O===null)throw Error(o(341));O.lanes|=p,H=O.alternate,H!==null&&(H.lanes|=p),Fy(O,p,u),O=b.sibling}else O=b.child;if(O!==null)O.return=b;else for(O=b;O!==null;){if(O===u){O=null;break}if(b=O.sibling,b!==null){b.return=O.return,O=b;break}O=O.return}b=O}ni(a,u,M.children,p),u=u.child}return u;case 9:return M=u.type,v=u.pendingProps.children,Wl(u,p),M=Zi(M),v=v(M),u.flags|=1,ni(a,u,v,p),u.child;case 14:return v=u.type,M=xr(v,u.pendingProps),M=xr(v.type,M),G3(a,u,v,M,p);case 15:return X3(a,u,u.type,u.pendingProps,p);case 17:return v=u.type,M=u.pendingProps,M=u.elementType===v?M:xr(v,M),a!==null&&(a.alternate=null,u.alternate=null,u.flags|=2),u.tag=1,di(v)?(a=!0,$h(u)):a=!1,Wl(u,p),l3(u,v,M),Vy(u,v,M,p),ox(null,u,v,!0,a,p);case 19:return tT(a,u,p);case 22:return j3(a,u,p)}throw Error(o(156,u.tag))};function TT(a,u){return Ry(a,u)}function Zk(a,u,p,v){this.tag=a,this.key=p,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=u,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=v,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function tr(a,u,p,v){return new Zk(a,u,p,v)}function Cx(a){return a=a.prototype,!(!a||!a.isReactComponent)}function Jk(a){if(typeof a=="function")return Cx(a)?1:0;if(a!=null){if(a=a.$$typeof,a===y)return 11;if(a===S)return 14}return 2}function wo(a,u){var p=a.alternate;return p===null?(p=tr(a.tag,u,a.key,a.mode),p.elementType=a.elementType,p.type=a.type,p.stateNode=a.stateNode,p.alternate=a,a.alternate=p):(p.pendingProps=u,p.type=a.type,p.flags=0,p.subtreeFlags=0,p.deletions=null),p.flags=a.flags&14680064,p.childLanes=a.childLanes,p.lanes=a.lanes,p.child=a.child,p.memoizedProps=a.memoizedProps,p.memoizedState=a.memoizedState,p.updateQueue=a.updateQueue,u=a.dependencies,p.dependencies=u===null?null:{lanes:u.lanes,firstContext:u.firstContext},p.sibling=a.sibling,p.index=a.index,p.ref=a.ref,p}function Gp(a,u,p,v,M,b){var O=2;if(v=a,typeof a=="function")Cx(a)&&(O=1);else if(typeof a=="string")O=5;else e:switch(a){case d:return Ta(p.children,M,b,u);case h:O=8,M|=8;break;case m:return a=tr(12,p,u,M|2),a.elementType=m,a.lanes=b,a;case w:return a=tr(13,p,u,M),a.elementType=w,a.lanes=b,a;case _:return a=tr(19,p,u,M),a.elementType=_,a.lanes=b,a;case T:return Xp(p,M,b,u);default:if(typeof a=="object"&&a!==null)switch(a.$$typeof){case g:O=10;break e;case x:O=9;break e;case y:O=11;break e;case S:O=14;break e;case E:O=16,v=null;break e}throw Error(o(130,a==null?a:typeof a,""))}return u=tr(O,p,u,M),u.elementType=a,u.type=v,u.lanes=b,u}function Ta(a,u,p,v){return a=tr(7,a,v,u),a.lanes=p,a}function Xp(a,u,p,v){return a=tr(22,a,v,u),a.elementType=T,a.lanes=p,a.stateNode={},a}function Px(a,u,p){return a=tr(6,a,null,u),a.lanes=p,a}function Lx(a,u,p){return u=tr(4,a.children!==null?a.children:[],a.key,u),u.lanes=p,u.stateNode={containerInfo:a.containerInfo,pendingChildren:null,implementation:a.implementation},u}function Qk(a,u,p,v,M){this.tag=u,this.containerInfo=a,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=Je,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Py(0),this.expirationTimes=Py(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Py(0),this.identifierPrefix=v,this.onRecoverableError=M,oe&&(this.mutableSourceEagerHydrationData=null)}function bT(a,u,p,v,M,b,O,H,ae){return a=new Qk(a,u,p,H,ae),u===1?(u=1,b===!0&&(u|=8)):u=0,b=tr(3,null,null,u),a.current=b,b.stateNode=a,b.memoizedState={element:v,isDehydrated:p,cache:null,transitions:null},Uy(b),a}function AT(a){if(!a)return qi;a=a._reactInternals;e:{if(L(a)!==a||a.tag!==1)throw Error(o(170));var u=a;do{switch(u.tag){case 3:u=u.stateNode.context;break e;case 1:if(di(u.type)){u=u.stateNode.__reactInternalMemoizedMergedChildContext;break e}}u=u.return}while(u!==null);throw Error(o(171))}if(a.tag===1){var p=a.type;if(di(p))return QE(a,p,u)}return u}function CT(a){var u=a._reactInternals;if(u===void 0)throw typeof a.render=="function"?Error(o(188)):(a=Object.keys(a).join(","),Error(o(268,a)));return a=ue(u),a===null?null:a.stateNode}function PT(a,u){if(a=a.memoizedState,a!==null&&a.dehydrated!==null){var p=a.retryLane;a.retryLane=p!==0&&p<u?p:u}}function Rx(a,u){PT(a,u),(a=a.alternate)&&PT(a,u)}function Kk(a){return a=ue(a),a===null?null:a.stateNode}function $k(){return null}return t.attemptContinuousHydration=function(a){if(a.tag===13){var u=ii();er(a,134217728,u),Rx(a,134217728)}},t.attemptHydrationAtCurrentPriority=function(a){if(a.tag===13){var u=ii(),p=xo(a);er(a,p,u),Rx(a,p)}},t.attemptSynchronousHydration=function(a){switch(a.tag){case 3:var u=a.stateNode;if(u.current.memoizedState.isDehydrated){var p=Hc(u.pendingLanes);p!==0&&(Ly(u,p|1),pi(u,Mn()),(ft&6)===0&&($l(),Or()))}break;case 13:var v=ii();vT(function(){return er(a,1,v)}),Rx(a,1)}},t.batchedUpdates=function(a,u){var p=ft;ft|=1;try{return a(u)}finally{ft=p,ft===0&&($l(),rp&&Or())}},t.createComponentSelector=function(a){return{$$typeof:Lp,value:a}},t.createContainer=function(a,u,p,v,M,b,O){return bT(a,u,!1,null,p,v,M,b,O)},t.createHasPseudoClassSelector=function(a){return{$$typeof:Rp,value:a}},t.createHydrationContainer=function(a,u,p,v,M,b,O,H,ae){return a=bT(p,v,!0,a,M,b,O,H,ae),a.context=AT(null),p=a.current,v=ii(),M=xo(p),b=ys(v,M),b.callback=u!=null?u:null,go(p,b),a.current.lanes=M,Wc(a,M,v),pi(a,v),a},t.createPortal=function(a,u,p){var v=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:f,key:v==null?null:""+v,children:a,containerInfo:u,implementation:p}},t.createRoleSelector=function(a){return{$$typeof:Ip,value:a}},t.createTestNameSelector=function(a){return{$$typeof:Dp,value:a}},t.createTextSelector=function(a){return{$$typeof:zp,value:a}},t.deferredUpdates=function(a){var u=bt,p=on.transition;try{return on.transition=null,bt=16,a()}finally{bt=u,on.transition=p}},t.discreteUpdates=function(a,u,p,v,M){var b=bt,O=on.transition;try{return on.transition=null,bt=1,a(u,p,v,M)}finally{bt=b,on.transition=O,ft===0&&$l()}},t.findAllNodes=vx,t.findBoundingRects=function(a,u){if(!vt)throw Error(o(363));u=vx(a,u),a=[];for(var p=0;p<u.length;p++)a.push(U(u[p]));for(u=a.length-1;0<u;u--){p=a[u];for(var v=p.x,M=v+p.width,b=p.y,O=b+p.height,H=u-1;0<=H;H--)if(u!==H){var ae=a[H],ye=ae.x,Ne=ye+ae.width,it=ae.y,Ze=it+ae.height;if(v>=ye&&b>=it&&M<=Ne&&O<=Ze){a.splice(u,1);break}else if(v!==ye||p.width!==ae.width||Ze<b||it>O){if(!(b!==it||p.height!==ae.height||Ne<v||ye>M)){ye>v&&(ae.width+=ye-v,ae.x=v),Ne<M&&(ae.width=M-ye),a.splice(u,1);break}}else{it>b&&(ae.height+=it-b,ae.y=b),Ze<O&&(ae.height=O-it),a.splice(u,1);break}}}return a},t.findHostInstance=CT,t.findHostInstanceWithNoPortals=function(a){return a=j(a),a=a!==null?G(a):null,a===null?null:a.stateNode},t.findHostInstanceWithWarning=function(a){return CT(a)},t.flushControlled=function(a){var u=ft;ft|=1;var p=on.transition,v=bt;try{on.transition=null,bt=1,a()}finally{bt=v,on.transition=p,ft=u,ft===0&&($l(),Or())}},t.flushPassiveEffects=Ea,t.flushSync=vT,t.focusWithin=function(a,u){if(!vt)throw Error(o(363));for(a=px(a),u=pT(a,u),u=Array.from(u),a=0;a<u.length;){var p=u[a++];if(!te(p)){if(p.tag===5&&we(p.stateNode))return!0;for(p=p.child;p!==null;)u.push(p),p=p.sibling}}return!1},t.getCurrentUpdatePriority=function(){return bt},t.getFindAllNodesFailureDescription=function(a,u){if(!vt)throw Error(o(363));var p=0,v=[];a=[px(a),0];for(var M=0;M<a.length;){var b=a[M++],O=a[M++],H=u[O];if((b.tag!==5||!te(b))&&(mx(b,H)&&(v.push(gx(H)),O++,O>p&&(p=O)),O<u.length))for(b=b.child;b!==null;)a.push(b,O),b=b.sibling}if(p<u.length){for(a=[];p<u.length;p++)a.push(gx(u[p]));return`findAllNodes was able to match part of the selector:
  `+(v.join(" > ")+`

No matching component was found for:
  `)+a.join(" > ")}return null},t.getPublicRootInstance=function(a){if(a=a.current,!a.child)return null;switch(a.child.tag){case 5:return ee(a.child.stateNode);default:return a.child.stateNode}},t.injectIntoDevTools=function(a){if(a={bundleType:a.bundleType,version:a.version,rendererPackageName:a.rendererPackageName,rendererConfig:a.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:l.ReactCurrentDispatcher,findHostInstanceByFiber:Kk,findFiberByHostInstance:a.findFiberByHostInstance||$k,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.0.0-fc46dba67-20220329"},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u")a=!1;else{var u=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(u.isDisabled||!u.supportsFiber)a=!0;else{try{ip=u.inject(a),Nr=u}catch{}a=!!u.checkDCE}}return a},t.isAlreadyRendering=function(){return!1},t.observeVisibleRects=function(a,u,p,v){if(!vt)throw Error(o(363));a=vx(a,u);var M=Ce(a,p,v).disconnect;return{disconnect:function(){M()}}},t.registerMutableSourceForHydration=function(a,u){var p=u._getVersion;p=p(u._source),a.mutableSourceEagerHydrationData==null?a.mutableSourceEagerHydrationData=[u,p]:a.mutableSourceEagerHydrationData.push(u,p)},t.runWithPriority=function(a,u){var p=bt;try{return bt=a,u()}finally{bt=p}},t.shouldError=function(){return null},t.shouldSuspend=function(){return!1},t.updateContainer=function(a,u,p,v){var M=u.current,b=ii(),O=xo(M);return p=AT(p),u.context===null?u.context=p:u.pendingContext=p,u=ys(b,O),u.payload={element:a},v=v===void 0?null:v,v!==null&&(u.callback=v),go(M,u),a=er(M,O,b),a!==null&&lp(a,M,O),O},t};(function(n){n.exports=vN})(yE);const yN=ba(yE.exports);var cy={exports:{}},Vh={};/**
 * @license React
 * react-jsx-runtime.production.min.js
 *
 * Copyright (c) Facebook, Inc. and its affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */var xN=ke.exports,_N=Symbol.for("react.element"),wN=Symbol.for("react.fragment"),SN=Object.prototype.hasOwnProperty,MN=xN.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,EN={key:!0,ref:!0,__self:!0,__source:!0};function _E(n,e,t){var i,r={},s=null,o=null;t!==void 0&&(s=""+t),e.key!==void 0&&(s=""+e.key),e.ref!==void 0&&(o=e.ref);for(i in e)SN.call(e,i)&&!EN.hasOwnProperty(i)&&(r[i]=e[i]);if(n&&n.defaultProps)for(i in e=n.defaultProps,e)r[i]===void 0&&(r[i]=e[i]);return{$$typeof:_N,type:n,key:s,ref:o,props:r,_owner:MN.current}}Vh.Fragment=wN,Vh.jsx=_E,Vh.jsxs=_E,function(n){n.exports=Vh}(cy);const Dt=cy.exports.jsx,Hh=cy.exports.jsxs;var wE,SE;const ME=n=>n&&n.isOrthographicCamera,TN=n=>n&&n.hasOwnProperty("current"),Oc=typeof window<"u"&&((wE=window.document)!=null&&wE.createElement||((SE=window.navigator)==null?void 0:SE.product)==="ReactNative")?ke.exports.useLayoutEffect:ke.exports.useEffect;function EE(n){const e=ke.exports.useRef(n);return Oc(()=>void(e.current=n),[n]),e}function bN({set:n}){return Oc(()=>(n(new Promise(()=>null)),()=>n(!1)),[n]),null}class TE extends ke.exports.Component{constructor(...e){super(...e),this.state={error:!1}}componentDidCatch(e){this.props.set(e)}render(){return this.state.error?null:this.props.children}}TE.getDerivedStateFromError=()=>({error:!0});const bE="__default",AN=n=>n&&!!n.memoized&&!!n.changes;function AE(n){const e=typeof window<"u"?window.devicePixelRatio:1;return Array.isArray(n)?Math.min(Math.max(n[0],e),n[1]):n}const Fc=n=>{var e;return(e=n.__r3f)==null?void 0:e.root.getState()},sn={obj:n=>n===Object(n)&&!sn.arr(n)&&typeof n!="function",fun:n=>typeof n=="function",str:n=>typeof n=="string",num:n=>typeof n=="number",boo:n=>typeof n=="boolean",und:n=>n===void 0,arr:n=>Array.isArray(n),equ(n,e,{arrays:t="shallow",objects:i="reference",strict:r=!0}={}){if(typeof n!=typeof e||!!n!=!!e)return!1;if(sn.str(n)||sn.num(n))return n===e;const s=sn.obj(n);if(s&&i==="reference")return n===e;const o=sn.arr(n);if(o&&t==="reference")return n===e;if((o||s)&&n===e)return!0;let l;for(l in n)if(!(l in e))return!1;for(l in r?e:n)if(n[l]!==e[l])return!1;if(sn.und(l)){if(o&&n.length===0&&e.length===0||s&&Object.keys(n).length===0&&Object.keys(e).length===0)return!0;if(n!==e)return!1}return!0}};function CN(n){n.dispose&&n.type!=="Scene"&&n.dispose();for(const e in n)e.dispose==null||e.dispose(),delete n[e]}function Ol(n,e){const t=n;return(e!=null&&e.primitive||!t.__r3f)&&(t.__r3f={type:"",root:null,previousAttach:null,memoizedProps:{},eventCount:0,handlers:{},objects:[],parent:null,...e}),n}function fy(n,e){let t=n;if(e.includes("-")){const i=e.split("-"),r=i.pop();return t=i.reduce((s,o)=>s[o],n),{target:t,key:r}}else return{target:t,key:e}}const CE=/-\d+$/;function dy(n,e,t){if(sn.str(t)){if(CE.test(t)){const s=t.replace(CE,""),{target:o,key:l}=fy(n,s);Array.isArray(o[l])||(o[l]=[])}const{target:i,key:r}=fy(n,t);e.__r3f.previousAttach=i[r],i[r]=e}else e.__r3f.previousAttach=t(n,e)}function PE(n,e,t){var i,r;if(sn.str(t)){const{target:s,key:o}=fy(n,t),l=e.__r3f.previousAttach;l===void 0?delete s[o]:s[o]=l}else(i=e.__r3f)==null||i.previousAttach==null||i.previousAttach(n,e);(r=e.__r3f)==null||delete r.previousAttach}function LE(n,{children:e,key:t,ref:i,...r},{children:s,key:o,ref:l,...c}={},f=!1){var d;const h=(d=n==null?void 0:n.__r3f)!=null?d:{},m=Object.entries(r),g=[];if(f){const y=Object.keys(c);for(let w=0;w<y.length;w++)r.hasOwnProperty(y[w])||m.unshift([y[w],bE+"remove"])}m.forEach(([y,w])=>{var _;if((_=n.__r3f)!=null&&_.primitive&&y==="object"||sn.equ(w,c[y]))return;if(/^on(Pointer|Click|DoubleClick|ContextMenu|Wheel)/.test(y))return g.push([y,w,!0,[]]);let S=[];y.includes("-")&&(S=y.split("-")),g.push([y,w,!1,S])});const x={...r};return h.memoizedProps&&h.memoizedProps.args&&(x.args=h.memoizedProps.args),h.memoizedProps&&h.memoizedProps.attach&&(x.attach=h.memoizedProps.attach),{memoized:x,changes:g}}function hy(n,e){var t,i;const r=(t=n.__r3f)!=null?t:{},s=r.root,o=(i=s==null||s.getState==null?void 0:s.getState())!=null?i:{},{memoized:l,changes:c}=AN(e)?e:LE(n,e),f=r.eventCount;if(n.__r3f&&(n.__r3f.memoizedProps=l),c.forEach(([d,h,m,g])=>{let x=n,y=x[d];if(g.length&&(y=g.reduce((S,E)=>S[E],n),!(y&&y.set))){const[S,...E]=g.reverse();x=E.reverse().reduce((T,C)=>T[C],n),d=S}if(h===bE+"remove")if(y&&y.constructor){var w;h=new y.constructor(...(w=l.args)!=null?w:[])}else if(x.constructor){var _;const S=new x.constructor(...(_=x.__r3f.memoizedProps.args)!=null?_:[]);h=S[y],S.dispose&&S.dispose()}else h=0;if(m)h?r.handlers[d]=h:delete r.handlers[d],r.eventCount=Object.keys(r.handlers).length;else if(y&&y.set&&(y.copy||y instanceof ea)){if(Array.isArray(h))y.fromArray?y.fromArray(h):y.set(...h);else if(y.copy&&h&&h.constructor&&y.constructor.name===h.constructor.name)y.copy(h);else if(h!==void 0){const S=y instanceof De;!S&&y.setScalar?y.setScalar(h):y instanceof ea&&h instanceof ea?y.mask=h.mask:y.set(h),!("ColorManagement"in Uh)&&!o.linear&&S&&y.convertSRGBToLinear()}}else x[d]=h,!o.linear&&x[d]instanceof un&&(x[d].encoding=Ft);Fl(n)}),r.parent&&o.internal&&n.raycast&&f!==r.eventCount){const d=o.internal.interaction.indexOf(n);d>-1&&o.internal.interaction.splice(d,1),r.eventCount&&o.internal.interaction.push(n)}return c.length&&n.parent&&py(n),n}function Fl(n){var e,t;const i=(e=n.__r3f)==null||(t=e.root)==null||t.getState==null?void 0:t.getState();i&&i.internal.frames===0&&i.invalidate()}function py(n){n.onUpdate==null||n.onUpdate(n)}function PN(n,e){n.manual||(ME(n)?(n.left=e.width/-2,n.right=e.width/2,n.top=e.height/2,n.bottom=e.height/-2):n.aspect=e.width/e.height,n.updateProjectionMatrix(),n.updateMatrixWorld())}function LN(n,e,t){const i=t.pop(),r=t.reduce((s,o)=>s[o],n);return r[i]=e}function my(n){return(n.eventObject||n.object).uuid+"/"+n.index+n.instanceId}function RN(){var n;const e=typeof self<"u"&&self||typeof window<"u"&&window;if(!e)return pa.exports.DefaultEventPriority;switch((n=e.event)==null?void 0:n.type){case"click":case"contextmenu":case"dblclick":case"pointercancel":case"pointerdown":case"pointerup":return pa.exports.DiscreteEventPriority;case"pointermove":case"pointerout":case"pointerover":case"pointerenter":case"pointerleave":case"wheel":return pa.exports.ContinuousEventPriority;default:return pa.exports.DefaultEventPriority}}function RE(n,e,t,i){const r=t.get(e);r&&(t.delete(e),t.size===0&&(n.delete(i),r.target.releasePointerCapture(i)))}function IN(n,e){const{internal:t}=n.getState();t.interaction=t.interaction.filter(i=>i!==e),t.initialHits=t.initialHits.filter(i=>i!==e),t.hovered.forEach((i,r)=>{(i.eventObject===e||i.object===e)&&t.hovered.delete(r)}),t.capturedMap.forEach((i,r)=>{RE(t.capturedMap,e,i,r)})}function DN(n){function e(c){const{internal:f}=n.getState(),d=c.offsetX-f.initialClick[0],h=c.offsetY-f.initialClick[1];return Math.round(Math.sqrt(d*d+h*h))}function t(c){return c.filter(f=>["Move","Over","Enter","Out","Leave"].some(d=>{var h;return(h=f.__r3f)==null?void 0:h.handlers["onPointer"+d]}))}function i(c,f){const d=n.getState(),h=new Set,m=[],g=f?f(d.internal.interaction):d.internal.interaction;g.forEach(w=>{const _=Fc(w);_&&(_.raycaster.camera=void 0)}),d.previousRoot||d.events.compute==null||d.events.compute(c,d);let x=g.flatMap(w=>{const _=Fc(w);if(!_||!_.events.enabled||_.raycaster.camera===null)return[];if(_.raycaster.camera===void 0){var S;_.events.compute==null||_.events.compute(c,_,(S=_.previousRoot)==null?void 0:S.getState()),_.raycaster.camera===void 0&&(_.raycaster.camera=null)}return _.raycaster.camera?_.raycaster.intersectObject(w,!0):[]}).sort((w,_)=>{const S=Fc(w.object),E=Fc(_.object);return!S||!E?0:E.events.priority-S.events.priority||w.distance-_.distance}).filter(w=>{const _=my(w);return h.has(_)?!1:(h.add(_),!0)});d.events.filter&&(x=d.events.filter(x,d));for(const w of x){let _=w.object;for(;_;){var y;(y=_.__r3f)!=null&&y.eventCount&&m.push({...w,eventObject:_}),_=_.parent}}if("pointerId"in c&&d.internal.capturedMap.has(c.pointerId))for(let w of d.internal.capturedMap.get(c.pointerId).values())m.push(w.intersection);return m}function r(c,f,d,h){if(c.length){const m={stopped:!1};for(const g of c){const x=Fc(g.object);if(x){const{raycaster:y,pointer:w,camera:_,internal:S}=x,E=new R(w.x,w.y,0).unproject(_),T=L=>{var z,j;return(z=(j=S.capturedMap.get(L))==null?void 0:j.has(g.eventObject))!=null?z:!1},C=L=>{const z={intersection:g,target:f.target};S.capturedMap.has(L)?S.capturedMap.get(L).set(g.eventObject,z):S.capturedMap.set(L,new Map([[g.eventObject,z]])),f.target.setPointerCapture(L)},P=L=>{const z=S.capturedMap.get(L);z&&RE(S.capturedMap,g.eventObject,z,L)};let I={};for(let L in f){let z=f[L];typeof z!="function"&&(I[L]=z)}let A={...g,...I,pointer:w,intersections:c,stopped:m.stopped,delta:d,unprojectedPoint:E,ray:y.ray,camera:_,stopPropagation:()=>{const L="pointerId"in f&&S.capturedMap.get(f.pointerId);if((!L||L.has(g.eventObject))&&(A.stopped=m.stopped=!0,S.hovered.size&&Array.from(S.hovered.values()).find(z=>z.eventObject===g.eventObject))){const z=c.slice(0,c.indexOf(g));s([...z,g])}},target:{hasPointerCapture:T,setPointerCapture:C,releasePointerCapture:P},currentTarget:{hasPointerCapture:T,setPointerCapture:C,releasePointerCapture:P},nativeEvent:f};if(h(A),m.stopped===!0)break}}}return c}function s(c){const{internal:f}=n.getState();Array.from(f.hovered.values()).forEach(d=>{if(!c.length||!c.find(h=>h.object===d.object&&h.index===d.index&&h.instanceId===d.instanceId)){const m=d.eventObject.__r3f,g=m==null?void 0:m.handlers;if(f.hovered.delete(my(d)),m!=null&&m.eventCount){const x={...d,intersections:c};g.onPointerOut==null||g.onPointerOut(x),g.onPointerLeave==null||g.onPointerLeave(x)}}})}const o=c=>{switch(c){case"onPointerLeave":case"onPointerCancel":return()=>s([]);case"onLostPointerCapture":return f=>{const{internal:d}=n.getState();"pointerId"in f&&!d.capturedMap.has(f.pointerId)&&(d.capturedMap.delete(f.pointerId),s([]))}}return f=>{const{onPointerMissed:d,internal:h}=n.getState();h.lastEvent.current=f;const m=c==="onPointerMove",g=c==="onClick"||c==="onContextMenu"||c==="onDoubleClick",y=i(f,m?t:void 0),w=g?e(f):0;c==="onPointerDown"&&(h.initialClick=[f.offsetX,f.offsetY],h.initialHits=y.map(_=>_.eventObject)),g&&!y.length&&w<=2&&(l(f,h.interaction),d&&d(f)),m&&s(y),r(y,f,w,_=>{const S=_.eventObject,E=S.__r3f,T=E==null?void 0:E.handlers;if(!!(E!=null&&E.eventCount))if(m){if(T.onPointerOver||T.onPointerEnter||T.onPointerOut||T.onPointerLeave){const C=my(_),P=h.hovered.get(C);P?P.stopped&&_.stopPropagation():(h.hovered.set(C,_),T.onPointerOver==null||T.onPointerOver(_),T.onPointerEnter==null||T.onPointerEnter(_))}T.onPointerMove==null||T.onPointerMove(_)}else{const C=T[c];C?(!g||h.initialHits.includes(S))&&(l(f,h.interaction.filter(P=>!h.initialHits.includes(P))),C(_)):g&&h.initialHits.includes(S)&&l(f,h.interaction.filter(P=>!h.initialHits.includes(P)))}})}};function l(c,f){f.forEach(d=>{var h;return(h=d.__r3f)==null||h.handlers.onPointerMissed==null?void 0:h.handlers.onPointerMissed(c)})}return{handlePointer:o}}let gy={},zN=n=>void(gy={...gy,...n});function NN(n,e){function t(d,{args:h=[],attach:m,...g},x){let y=`${d[0].toUpperCase()}${d.slice(1)}`,w;if(d==="primitive"){if(g.object===void 0)throw new Error("R3F: Primitives without 'object' are invalid!");const _=g.object;w=Ol(_,{type:d,root:x,attach:m,primitive:!0})}else{const _=gy[y];if(!_)throw new Error(`R3F: ${y} is not part of the THREE namespace! Did you forget to extend? See: https://docs.pmnd.rs/react-three-fiber/api/objects#using-3rd-party-objects-declaratively`);if(!Array.isArray(h))throw new Error("R3F: The args prop must be an array!");w=Ol(new _(...h),{type:d,root:x,attach:m,memoizedProps:{args:h}})}return w.__r3f.attach===void 0&&(w instanceof lt?w.__r3f.attach="geometry":w instanceof Pn&&(w.__r3f.attach="material")),y!=="inject"&&hy(w,g),w}function i(d,h){let m=!1;if(h){var g,x;(g=h.__r3f)!=null&&g.attach?dy(d,h,h.__r3f.attach):h.isObject3D&&d.isObject3D&&(d.add(h),m=!0),m||(x=d.__r3f)==null||x.objects.push(h),h.__r3f||Ol(h,{}),h.__r3f.parent=d,py(h),Fl(h)}}function r(d,h,m){let g=!1;if(h){var x,y;if((x=h.__r3f)!=null&&x.attach)dy(d,h,h.__r3f.attach);else if(h.isObject3D&&d.isObject3D){h.parent=d,h.dispatchEvent({type:"added"});const w=d.children.filter(S=>S!==h),_=w.indexOf(m);d.children=[...w.slice(0,_),h,...w.slice(_)],g=!0}g||(y=d.__r3f)==null||y.objects.push(h),h.__r3f||Ol(h,{}),h.__r3f.parent=d,py(h),Fl(h)}}function s(d,h,m=!1){d&&[...d].forEach(g=>o(h,g,m))}function o(d,h,m){if(h){var g,x,y;if(h.__r3f&&(h.__r3f.parent=null),(g=d.__r3f)!=null&&g.objects&&(d.__r3f.objects=d.__r3f.objects.filter(T=>T!==h)),(x=h.__r3f)!=null&&x.attach)PE(d,h,h.__r3f.attach);else if(h.isObject3D&&d.isObject3D){var w;d.remove(h),(w=h.__r3f)!=null&&w.root&&IN(h.__r3f.root,h)}const S=(y=h.__r3f)==null?void 0:y.primitive,E=m===void 0?h.dispose!==null&&!S:m;if(!S){var _;s((_=h.__r3f)==null?void 0:_.objects,h,E),s(h.children,h,E)}h.__r3f&&(delete h.__r3f.root,delete h.__r3f.objects,delete h.__r3f.handlers,delete h.__r3f.memoizedProps,S||delete h.__r3f),E&&h.dispose&&h.type!=="Scene"&&Bh.exports.unstable_scheduleCallback(Bh.exports.unstable_IdlePriority,()=>{try{h.dispose()}catch{}}),Fl(d)}}function l(d,h,m,g){var x;const y=(x=d.__r3f)==null?void 0:x.parent;if(!y)return;const w=t(h,m,d.__r3f.root);if(d.children){for(const _ of d.children)_.__r3f&&i(w,_);d.children=d.children.filter(_=>!_.__r3f)}d.__r3f.objects.forEach(_=>i(w,_)),d.__r3f.objects=[],o(y,d),i(y,w),w.raycast&&w.__r3f.eventCount&&w.__r3f.root.getState().internal.interaction.push(w),[g,g.alternate].forEach(_=>{_!==null&&(_.stateNode=w,_.ref&&(typeof _.ref=="function"?_.ref(w):_.ref.current=w))})}const c=()=>console.warn("Text is not allowed in the R3F tree! This could be stray whitespace or characters.");return{reconciler:yN({createInstance:t,removeChild:o,appendChild:i,appendInitialChild:i,insertBefore:r,supportsMutation:!0,isPrimaryRenderer:!1,supportsPersistence:!1,supportsHydration:!1,noTimeout:-1,appendChildToContainer:(d,h)=>{if(!h)return;const m=d.getState().scene;!m.__r3f||(m.__r3f.root=d,i(m,h))},removeChildFromContainer:(d,h)=>{!h||o(d.getState().scene,h)},insertInContainerBefore:(d,h,m)=>{if(!h||!m)return;const g=d.getState().scene;!g.__r3f||r(g,h,m)},getRootHostContext:()=>null,getChildHostContext:d=>d,finalizeInitialChildren(d){var h;const m=(h=d==null?void 0:d.__r3f)!=null?h:{};return Boolean(m.handlers)},prepareUpdate(d,h,m,g){if(d.__r3f.primitive&&g.object&&g.object!==d)return[!0];{const{args:x=[],children:y,...w}=g,{args:_=[],children:S,...E}=m;if(!Array.isArray(x))throw new Error("R3F: the args prop must be an array!");if(x.some((C,P)=>C!==_[P]))return[!0];const T=LE(d,w,E,!0);return T.changes.length?[!1,T]:null}},commitUpdate(d,[h,m],g,x,y,w){h?l(d,g,y,w):hy(d,m)},commitMount(d,h,m,g){var x;const y=(x=d.__r3f)!=null?x:{};d.raycast&&y.handlers&&y.eventCount&&d.__r3f.root.getState().internal.interaction.push(d)},getPublicInstance:d=>d,prepareForCommit:()=>null,preparePortalMount:d=>Ol(d.getState().scene),resetAfterCommit:()=>{},shouldSetTextContent:()=>!1,clearContainer:()=>!1,hideInstance(d){var h;const{attach:m,parent:g}=(h=d.__r3f)!=null?h:{};m&&g&&PE(g,d,m),d.isObject3D&&(d.visible=!1),Fl(d)},unhideInstance(d,h){var m;const{attach:g,parent:x}=(m=d.__r3f)!=null?m:{};g&&x&&dy(x,d,g),(d.isObject3D&&h.visible==null||h.visible)&&(d.visible=!0),Fl(d)},createTextInstance:c,hideTextInstance:c,unhideTextInstance:c,getCurrentEventPriority:()=>e?e():pa.exports.DefaultEventPriority,beforeActiveInstanceBlur:()=>{},afterActiveInstanceBlur:()=>{},detachDeletedInstance:()=>{},now:typeof performance<"u"&&sn.fun(performance.now)?performance.now:sn.fun(Date.now)?Date.now:()=>0,scheduleTimeout:sn.fun(setTimeout)?setTimeout:void 0,cancelTimeout:sn.fun(clearTimeout)?clearTimeout:void 0}),applyProps:hy}}const IE=n=>!!(n!=null&&n.render),DE=ke.exports.createContext(null),kN=(n,e)=>{const t=gN((l,c)=>{const f=new R,d=new R,h=new R;function m(_=c().camera,S=d,E=c().size){const{width:T,height:C,top:P,left:I}=E,A=T/C;S instanceof R?h.copy(S):h.set(...S);const L=_.getWorldPosition(f).distanceTo(h);if(ME(_))return{width:T/_.zoom,height:C/_.zoom,top:P,left:I,factor:1,distance:L,aspect:A};{const z=_.fov*Math.PI/180,j=2*Math.tan(z/2)*L,ue=j*(T/C);return{width:ue,height:j,top:P,left:I,factor:T/ue,distance:L,aspect:A}}}let g;const x=_=>l(S=>({performance:{...S.performance,current:_}})),y=new fe;return{set:l,get:c,gl:null,camera:null,raycaster:null,events:{priority:1,enabled:!0,connected:!1},xr:null,invalidate:(_=1)=>n(c(),_),advance:(_,S)=>e(_,S,c()),legacy:!1,linear:!1,flat:!1,scene:Ol(new Mv),controls:null,clock:new ny,pointer:y,mouse:y,frameloop:"always",onPointerMissed:void 0,performance:{current:1,min:.5,max:1,debounce:200,regress:()=>{const _=c();g&&clearTimeout(g),_.performance.current!==_.performance.min&&x(_.performance.min),g=setTimeout(()=>x(c().performance.max),_.performance.debounce)}},size:{width:0,height:0,top:0,left:0,updateStyle:!1},viewport:{initialDpr:0,dpr:0,width:0,height:0,top:0,left:0,aspect:0,distance:0,factor:0,getCurrentViewport:m},setEvents:_=>l(S=>({...S,events:{...S.events,..._}})),setSize:(_,S,E,T,C)=>{const P=c().camera,I={width:_,height:S,top:T||0,left:C||0,updateStyle:E};l(A=>({size:I,viewport:{...A.viewport,...m(P,d,I)}}))},setDpr:_=>l(S=>{const E=AE(_);return{viewport:{...S.viewport,dpr:E,initialDpr:S.viewport.initialDpr||E}}}),setFrameloop:(_="always")=>{const S=c().clock;S.stop(),S.elapsedTime=0,_!=="never"&&(S.start(),S.elapsedTime=0),l(()=>({frameloop:_}))},previousRoot:void 0,internal:{active:!1,priority:0,frames:0,lastEvent:ke.exports.createRef(),interaction:[],hovered:new Map,subscribers:[],initialClick:[0,0],initialHits:[],capturedMap:new Map,subscribe:(_,S,E)=>{const T=c().internal;return T.priority=T.priority+(S>0?1:0),T.subscribers.push({ref:_,priority:S,store:E}),T.subscribers=T.subscribers.sort((C,P)=>C.priority-P.priority),()=>{const C=c().internal;C!=null&&C.subscribers&&(C.priority=C.priority-(S>0?1:0),C.subscribers=C.subscribers.filter(P=>P.ref!==_))}}}}}),i=t.getState();let r=i.size,s=i.viewport.dpr,o=i.camera;return t.subscribe(()=>{const{camera:l,size:c,viewport:f,gl:d,set:h}=t.getState();(c!==r||f.dpr!==s)&&(r=c,s=f.dpr,PN(l,c),d.setPixelRatio(f.dpr),d.setSize(c.width,c.height,c.updateStyle)),l!==o&&(o=l,h(m=>({viewport:{...m.viewport,...m.viewport.getCurrentViewport(l)}})))}),t.subscribe(l=>n(l)),t};let Wh,ON=new Set,FN=new Set,UN=new Set;function vy(n,e){!n.size||n.forEach(({callback:t})=>t(e))}function Uc(n,e){switch(n){case"before":return vy(ON,e);case"after":return vy(FN,e);case"tail":return vy(UN,e)}}let yy,xy;function _y(n,e,t){let i=e.clock.getDelta();for(e.frameloop==="never"&&typeof n=="number"&&(i=n-e.clock.elapsedTime,e.clock.oldTime=e.clock.elapsedTime,e.clock.elapsedTime=n),yy=e.internal.subscribers,Wh=0;Wh<yy.length;Wh++)xy=yy[Wh],xy.ref.current(xy.store.getState(),i,t);return!e.internal.priority&&e.gl.render&&e.gl.render(e.scene,e.camera),e.internal.frames=Math.max(0,e.internal.frames-1),e.frameloop==="always"?1:e.internal.frames}function BN(n){let e=!1,t,i,r;function s(c){if(i=requestAnimationFrame(s),e=!0,t=0,Uc("before",c),n.forEach(f=>{var d;r=f.store.getState(),r.internal.active&&(r.frameloop==="always"||r.internal.frames>0)&&!((d=r.gl.xr)!=null&&d.isPresenting)&&(t+=_y(c,r))}),Uc("after",c),t===0)return Uc("tail",c),e=!1,cancelAnimationFrame(i)}function o(c,f=1){var d;if(!c)return n.forEach(h=>o(h.store.getState()),f);(d=c.gl.xr)!=null&&d.isPresenting||!c.internal.active||c.frameloop==="never"||(c.internal.frames=Math.min(60,c.internal.frames+f),e||(e=!0,requestAnimationFrame(s)))}function l(c,f=!0,d,h){f&&Uc("before",c),d?_y(c,d,h):n.forEach(m=>_y(c,m.store.getState())),f&&Uc("after",c)}return{loop:s,invalidate:o,advance:l}}function zE(){const n=ke.exports.useContext(DE);if(!n)throw new Error("R3F: Hooks can only be used within the Canvas component!");return n}function hs(n=t=>t,e){return zE()(n,e)}function VN(n,e=0){const t=zE(),i=t.getState().internal.subscribe,r=EE(n);return Oc(()=>i(r,e,t),[e,i,t]),null}const Ul=new Map,{invalidate:NE,advance:kE}=BN(Ul),{reconciler:Gh,applyProps:Xh}=NN(Ul,RN),Bl={objects:"shallow",strict:!1},HN=(n,e)=>{const t=typeof n=="function"?n(e):n;return IE(t)?t:new Sv({powerPreference:"high-performance",canvas:e,antialias:!0,alpha:!0,...n})};function WN(n){return n instanceof HTMLCanvasElement}function GN(n,e){if(e)return e;if(WN(n)&&n.parentElement){const{width:t,height:i,top:r,left:s}=n.parentElement.getBoundingClientRect();return{width:t,height:i,top:r,left:s}}return{width:0,height:0,top:0,left:0}}function XN(n){const e=Ul.get(n),t=e==null?void 0:e.fiber,i=e==null?void 0:e.store;e&&console.warn("R3F.createRoot should only be called once!");const r=typeof reportError=="function"?reportError:console.error,s=i||kN(NE,kE),o=t||Gh.createContainer(s,pa.exports.ConcurrentRoot,null,!1,null,"",r,null);e||Ul.set(n,{fiber:o,store:s});let l,c=!1;return{configure(f={}){let{gl:d,size:h,events:m,onCreated:g,shadows:x=!1,linear:y=!1,flat:w=!1,legacy:_=!1,orthographic:S=!1,frameloop:E="always",dpr:T=[1,2],performance:C,raycaster:P,camera:I,onPointerMissed:A}=f,L=s.getState(),z=L.gl;L.gl||L.set({gl:z=HN(d,n)});let j=L.raycaster;j||L.set({raycaster:j=new oE});const{params:ue,...Z}=P||{};if(sn.equ(Z,j,Bl)||Xh(j,{...Z}),sn.equ(ue,j.params,Bl)||Xh(j,{params:{...j.params,...ue}}),!L.camera){const pe=I instanceof oc,k=pe?I:S?new oo(0,0,0,0,.1,1e3):new Bt(75,0,.1,1e3);pe||(k.position.z=5,I&&Xh(k,I),I!=null&&I.rotation||k.lookAt(0,0,0)),L.set({camera:k})}if(!L.xr){const pe=(F,$)=>{const J=s.getState();J.frameloop!=="never"&&kE(F,!0,J,$)},k=()=>{const F=s.getState();F.gl.xr.enabled=F.gl.xr.isPresenting,F.gl.xr.setAnimationLoop(F.gl.xr.isPresenting?pe:null),F.gl.xr.isPresenting||NE(F)},B={connect(){const F=s.getState().gl;F.xr.addEventListener("sessionstart",k),F.xr.addEventListener("sessionend",k)},disconnect(){const F=s.getState().gl;F.xr.removeEventListener("sessionstart",k),F.xr.removeEventListener("sessionend",k)}};z.xr&&B.connect(),L.set({xr:B})}if(z.shadowMap){const pe=sn.boo(x);if(pe&&z.shadowMap.enabled!==x||!sn.equ(x,z.shadowMap,Bl)){const k=z.shadowMap.enabled;z.shadowMap.enabled=!!x,pe?z.shadowMap.type=a0:Object.assign(z.shadowMap,x),k!==z.shadowMap.enabled&&(z.shadowMap.needsUpdate=!0)}}"ColorManagement"in Uh&&LN(Uh,_,["ColorManagement","legacyMode"]);const G=y?ts:Ft,ie=w?cr:m0;z.outputEncoding!==G&&(z.outputEncoding=G),z.toneMapping!==ie&&(z.toneMapping=ie),L.legacy!==_&&L.set(()=>({legacy:_})),L.linear!==y&&L.set(()=>({linear:y})),L.flat!==w&&L.set(()=>({flat:w})),d&&!sn.fun(d)&&!IE(d)&&!sn.equ(d,z,Bl)&&Xh(z,d),m&&!L.events.handlers&&L.set({events:m(s)}),T&&L.viewport.dpr!==AE(T)&&L.setDpr(T);const ee=GN(n,h);return sn.equ(ee,L.size,Bl)||L.setSize(ee.width,ee.height,ee.updateStyle,ee.top,ee.left),L.frameloop!==E&&L.setFrameloop(E),L.onPointerMissed||L.set({onPointerMissed:A}),C&&!sn.equ(C,L.performance,Bl)&&L.set(pe=>({performance:{...pe.performance,...C}})),l=g,c=!0,this},render(f){return c||this.configure(),Gh.updateContainer(Dt(jN,{store:s,children:f,onCreated:l,rootElement:n}),o,null,()=>{}),s},unmount(){OE(n)}}}function jN({store:n,children:e,onCreated:t,rootElement:i}){return Oc(()=>{const r=n.getState();r.set(s=>({internal:{...s.internal,active:!0}})),t&&t(r),n.getState().events.connected||r.events.connect==null||r.events.connect(i)},[]),ke.exports.createElement(DE.Provider,{value:n},e)}function OE(n,e){const t=Ul.get(n),i=t==null?void 0:t.fiber;if(i){const r=t==null?void 0:t.store.getState();r&&(r.internal.active=!1),Gh.updateContainer(null,i,null,()=>{r&&setTimeout(()=>{try{var s,o,l,c;r.events.disconnect==null||r.events.disconnect(),(s=r.gl)==null||(o=s.renderLists)==null||o.dispose==null||o.dispose(),(l=r.gl)==null||l.forceContextLoss==null||l.forceContextLoss(),(c=r.gl)!=null&&c.xr&&r.xr.disconnect(),CN(r),Ul.delete(n),e&&e(n)}catch{}},500)})}}Gh.injectIntoDevTools({bundleType:0,rendererPackageName:"@react-three/fiber",version:ke.exports.version});function wy(n,e,t){var i,r,s,o,l;e==null&&(e=100);function c(){var d=Date.now()-o;d<e&&d>=0?i=setTimeout(c,e-d):(i=null,t||(l=n.apply(s,r),s=r=null))}var f=function(){s=this,r=arguments,o=Date.now();var d=t&&!i;return i||(i=setTimeout(c,e)),d&&(l=n.apply(s,r),s=r=null),l};return f.clear=function(){i&&(clearTimeout(i),i=null)},f.flush=function(){i&&(l=n.apply(s,r),s=r=null,clearTimeout(i),i=null)},f}wy.debounce=wy;var FE=wy;function YN(n){let{debounce:e,scroll:t,polyfill:i,offsetSize:r}=n===void 0?{debounce:0,scroll:!1,offsetSize:!1}:n;const s=i||(typeof window>"u"?class{}:window.ResizeObserver);if(!s)throw new Error("This browser does not support ResizeObserver out of the box. See: https://github.com/react-spring/react-use-measure/#resize-observer-polyfills");const[o,l]=ke.exports.useState({left:0,top:0,width:0,height:0,bottom:0,right:0,x:0,y:0}),c=ke.exports.useRef({element:null,scrollContainers:null,resizeObserver:null,lastBounds:o}),f=e?typeof e=="number"?e:e.scroll:null,d=e?typeof e=="number"?e:e.resize:null,h=ke.exports.useRef(!1);ke.exports.useEffect(()=>(h.current=!0,()=>void(h.current=!1)));const[m,g,x]=ke.exports.useMemo(()=>{const S=()=>{if(!c.current.element)return;const{left:E,top:T,width:C,height:P,bottom:I,right:A,x:L,y:z}=c.current.element.getBoundingClientRect(),j={left:E,top:T,width:C,height:P,bottom:I,right:A,x:L,y:z};c.current.element instanceof HTMLElement&&r&&(j.height=c.current.element.offsetHeight,j.width=c.current.element.offsetWidth),Object.freeze(j),h.current&&!QN(c.current.lastBounds,j)&&l(c.current.lastBounds=j)};return[S,d?FE(S,d):S,f?FE(S,f):S]},[l,r,f,d]);function y(){c.current.scrollContainers&&(c.current.scrollContainers.forEach(S=>S.removeEventListener("scroll",x,!0)),c.current.scrollContainers=null),c.current.resizeObserver&&(c.current.resizeObserver.disconnect(),c.current.resizeObserver=null)}function w(){!c.current.element||(c.current.resizeObserver=new s(x),c.current.resizeObserver.observe(c.current.element),t&&c.current.scrollContainers&&c.current.scrollContainers.forEach(S=>S.addEventListener("scroll",x,{capture:!0,passive:!0})))}const _=S=>{!S||S===c.current.element||(y(),c.current.element=S,c.current.scrollContainers=UE(S),w())};return ZN(x,Boolean(t)),qN(g),ke.exports.useEffect(()=>{y(),w()},[t,x,g]),ke.exports.useEffect(()=>y,[]),[_,o,m]}function qN(n){ke.exports.useEffect(()=>{const e=n;return window.addEventListener("resize",e),()=>void window.removeEventListener("resize",e)},[n])}function ZN(n,e){ke.exports.useEffect(()=>{if(e){const t=n;return window.addEventListener("scroll",t,{capture:!0,passive:!0}),()=>void window.removeEventListener("scroll",t,!0)}},[n,e])}function UE(n){const e=[];if(!n||n===document.body)return e;const{overflow:t,overflowX:i,overflowY:r}=window.getComputedStyle(n);return[t,i,r].some(s=>s==="auto"||s==="scroll")&&e.push(n),[...e,...UE(n.parentElement)]}const JN=["x","y","top","bottom","left","right","width","height"],QN=(n,e)=>JN.every(t=>n[t]===e[t]),Sy={onClick:["click",!1],onContextMenu:["contextmenu",!1],onDoubleClick:["dblclick",!1],onWheel:["wheel",!0],onPointerDown:["pointerdown",!0],onPointerUp:["pointerup",!0],onPointerLeave:["pointerleave",!0],onPointerMove:["pointermove",!0],onPointerCancel:["pointercancel",!0],onLostPointerCapture:["lostpointercapture",!0]};function KN(n){const{handlePointer:e}=DN(n);return{priority:1,enabled:!0,compute(t,i,r){i.pointer.set(t.offsetX/i.size.width*2-1,-(t.offsetY/i.size.height)*2+1),i.raycaster.setFromCamera(i.pointer,i.camera)},connected:void 0,handlers:Object.keys(Sy).reduce((t,i)=>({...t,[i]:e(i)}),{}),connect:t=>{var i;const{set:r,events:s}=n.getState();s.disconnect==null||s.disconnect(),r(o=>({events:{...o.events,connected:t}})),Object.entries((i=s.handlers)!=null?i:[]).forEach(([o,l])=>{const[c,f]=Sy[o];t.addEventListener(c,l,{passive:f})})},disconnect:()=>{const{set:t,events:i}=n.getState();if(i.connected){var r;Object.entries((r=i.handlers)!=null?r:[]).forEach(([s,o])=>{if(i&&i.connected instanceof HTMLElement){const[l]=Sy[s];i.connected.removeEventListener(l,o)}}),t(s=>({events:{...s.events,connected:void 0}}))}}}}const $N=ke.exports.forwardRef(function({children:e,fallback:t,resize:i,style:r,gl:s,events:o=KN,eventSource:l,eventPrefix:c,shadows:f,linear:d,flat:h,legacy:m,orthographic:g,frameloop:x,dpr:y,performance:w,raycaster:_,camera:S,onPointerMissed:E,onCreated:T,...C},P){ke.exports.useMemo(()=>zN(Uh),[]);const[I,A]=YN({scroll:!0,debounce:{scroll:50,resize:0},...i}),L=ke.exports.useRef(null),z=ke.exports.useRef(null),[j,ue]=ke.exports.useState(null);ke.exports.useImperativeHandle(P,()=>L.current);const Z=EE(E),[G,ie]=ke.exports.useState(!1),[ee,pe]=ke.exports.useState(!1);if(G)throw G;if(ee)throw ee;const k=ke.exports.useRef(null);return A.width>0&&A.height>0&&j&&(k.current||(k.current=XN(j)),k.current.configure({gl:s,events:o,shadows:f,linear:d,flat:h,legacy:m,orthographic:g,frameloop:x,dpr:y,performance:w,raycaster:_,camera:S,size:A,onPointerMissed:(...F)=>Z.current==null?void 0:Z.current(...F),onCreated:F=>{F.events.connect==null||F.events.connect(l?TN(l)?l.current:l:z.current),c&&F.setEvents({compute:($,J)=>{const me=$[c+"X"],Me=$[c+"Y"];J.pointer.set(me/J.size.width*2-1,-(Me/J.size.height)*2+1),J.raycaster.setFromCamera(J.pointer,J.camera)}}),T==null||T(F)}}),k.current.render(Dt(TE,{set:pe,children:Dt(ke.exports.Suspense,{fallback:Dt(bN,{set:ie}),children:e})}))),Oc(()=>{ue(L.current)},[]),ke.exports.useEffect(()=>{if(j)return()=>OE(j)},[j]),Dt("div",{ref:z,style:{position:"relative",width:"100%",height:"100%",overflow:"hidden",pointerEvents:l?"none":"auto",...r},...C,children:Dt("div",{ref:I,style:{width:"100%",height:"100%"},children:Dt("canvas",{ref:L,style:{display:"block"},children:t})})})});function nt(n,e,t){return e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}const BE=(n,e)=>(n%e+e)%e;class ek extends Ar{constructor(e,t){super(),nt(this,"object",void 0),nt(this,"domElement",void 0),nt(this,"enabled",!0),nt(this,"target",new R),nt(this,"minDistance",0),nt(this,"maxDistance",1/0),nt(this,"minZoom",0),nt(this,"maxZoom",1/0),nt(this,"minPolarAngle",0),nt(this,"maxPolarAngle",Math.PI),nt(this,"minAzimuthAngle",-1/0),nt(this,"maxAzimuthAngle",1/0),nt(this,"enableDamping",!1),nt(this,"dampingFactor",.05),nt(this,"enableZoom",!0),nt(this,"zoomSpeed",1),nt(this,"enableRotate",!0),nt(this,"rotateSpeed",1),nt(this,"enablePan",!0),nt(this,"panSpeed",1),nt(this,"screenSpacePanning",!0),nt(this,"keyPanSpeed",7),nt(this,"autoRotate",!1),nt(this,"autoRotateSpeed",2),nt(this,"reverseOrbit",!1),nt(this,"keys",{LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"}),nt(this,"mouseButtons",{LEFT:Fo.ROTATE,MIDDLE:Fo.DOLLY,RIGHT:Fo.PAN}),nt(this,"touches",{ONE:Uo.ROTATE,TWO:Uo.DOLLY_PAN}),nt(this,"target0",void 0),nt(this,"position0",void 0),nt(this,"zoom0",void 0),nt(this,"_domElementKeyEvents",null),nt(this,"getPolarAngle",void 0),nt(this,"getAzimuthalAngle",void 0),nt(this,"setPolarAngle",void 0),nt(this,"setAzimuthalAngle",void 0),nt(this,"getDistance",void 0),nt(this,"listenToKeyEvents",void 0),nt(this,"saveState",void 0),nt(this,"reset",void 0),nt(this,"update",void 0),nt(this,"connect",void 0),nt(this,"dispose",void 0),this.object=e,this.domElement=t,this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object instanceof Bt?this.object.zoom:1,this.getPolarAngle=()=>d.phi,this.getAzimuthalAngle=()=>d.theta,this.setPolarAngle=V=>{let K=BE(V,2*Math.PI),_e=d.phi;_e<0&&(_e+=2*Math.PI),K<0&&(K+=2*Math.PI);let Oe=Math.abs(K-_e);2*Math.PI-Oe<Oe&&(K<_e?K+=2*Math.PI:_e+=2*Math.PI),h.phi=K-_e,i.update()},this.setAzimuthalAngle=V=>{let K=BE(V,2*Math.PI),_e=d.theta;_e<0&&(_e+=2*Math.PI),K<0&&(K+=2*Math.PI);let Oe=Math.abs(K-_e);2*Math.PI-Oe<Oe&&(K<_e?K+=2*Math.PI:_e+=2*Math.PI),h.theta=K-_e,i.update()},this.getDistance=()=>i.object.position.distanceTo(i.target),this.listenToKeyEvents=V=>{V.addEventListener("keydown",te),this._domElementKeyEvents=V},this.saveState=()=>{i.target0.copy(i.target),i.position0.copy(i.object.position),i.zoom0=i.object instanceof Bt?i.object.zoom:1},this.reset=()=>{i.target.copy(i.target0),i.object.position.copy(i.position0),i.object instanceof Bt&&(i.object.zoom=i.zoom0,i.object.updateProjectionMatrix()),i.dispatchEvent(r),i.update(),c=l.NONE},this.update=(()=>{const V=new R,K=new Fn().setFromUnitVectors(e.up,new R(0,1,0)),_e=K.clone().invert(),Oe=new R,ot=new Fn,W=2*Math.PI;return function(){const le=i.object.position;V.copy(le).sub(i.target),V.applyQuaternion(K),d.setFromVector3(V),i.autoRotate&&c===l.NONE&&ue(z()),i.enableDamping?(d.theta+=h.theta*i.dampingFactor,d.phi+=h.phi*i.dampingFactor):(d.theta+=h.theta,d.phi+=h.phi);let Te=i.minAzimuthAngle,Ee=i.maxAzimuthAngle;return isFinite(Te)&&isFinite(Ee)&&(Te<-Math.PI?Te+=W:Te>Math.PI&&(Te-=W),Ee<-Math.PI?Ee+=W:Ee>Math.PI&&(Ee-=W),Te<=Ee?d.theta=Math.max(Te,Math.min(Ee,d.theta)):d.theta=d.theta>(Te+Ee)/2?Math.max(Te,d.theta):Math.min(Ee,d.theta)),d.phi=Math.max(i.minPolarAngle,Math.min(i.maxPolarAngle,d.phi)),d.makeSafe(),d.radius*=m,d.radius=Math.max(i.minDistance,Math.min(i.maxDistance,d.radius)),i.enableDamping===!0?i.target.addScaledVector(g,i.dampingFactor):i.target.add(g),V.setFromSpherical(d),V.applyQuaternion(_e),le.copy(i.target).add(V),i.object.lookAt(i.target),i.enableDamping===!0?(h.theta*=1-i.dampingFactor,h.phi*=1-i.dampingFactor,g.multiplyScalar(1-i.dampingFactor)):(h.set(0,0,0),g.set(0,0,0)),m=1,x||Oe.distanceToSquared(i.object.position)>f||8*(1-ot.dot(i.object.quaternion))>f?(i.dispatchEvent(r),Oe.copy(i.object.position),ot.copy(i.object.quaternion),x=!1,!0):!1}})(),this.connect=V=>{V===document&&console.error('THREE.OrbitControls: "document" should not be used as the target "domElement". Please use "renderer.domElement" instead.'),i.domElement=V,i.domElement.style.touchAction="none",i.domElement.addEventListener("contextmenu",Ce),i.domElement.addEventListener("pointerdown",$e),i.domElement.addEventListener("pointercancel",vt),i.domElement.addEventListener("wheel",D)},this.dispose=()=>{var V,K,_e,Oe,ot,W;(V=i.domElement)===null||V===void 0||V.removeEventListener("contextmenu",Ce),(K=i.domElement)===null||K===void 0||K.removeEventListener("pointerdown",$e),(_e=i.domElement)===null||_e===void 0||_e.removeEventListener("pointercancel",vt),(Oe=i.domElement)===null||Oe===void 0||Oe.removeEventListener("wheel",D),(ot=i.domElement)===null||ot===void 0||ot.ownerDocument.removeEventListener("pointermove",Ye),(W=i.domElement)===null||W===void 0||W.ownerDocument.removeEventListener("pointerup",Ge),i._domElementKeyEvents!==null&&i._domElementKeyEvents.removeEventListener("keydown",te)};const i=this,r={type:"change"},s={type:"start"},o={type:"end"},l={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6};let c=l.NONE;const f=1e-6,d=new ay,h=new ay;let m=1;const g=new R;let x=!1;const y=new fe,w=new fe,_=new fe,S=new fe,E=new fe,T=new fe,C=new fe,P=new fe,I=new fe,A=[],L={};function z(){return 2*Math.PI/60/60*i.autoRotateSpeed}function j(){return Math.pow(.95,i.zoomSpeed)}function ue(V){i.reverseOrbit?h.theta+=V:h.theta-=V}function Z(V){i.reverseOrbit?h.phi+=V:h.phi-=V}const G=(()=>{const V=new R;return function(_e,Oe){V.setFromMatrixColumn(Oe,0),V.multiplyScalar(-_e),g.add(V)}})(),ie=(()=>{const V=new R;return function(_e,Oe){i.screenSpacePanning===!0?V.setFromMatrixColumn(Oe,1):(V.setFromMatrixColumn(Oe,0),V.crossVectors(i.object.up,V)),V.multiplyScalar(_e),g.add(V)}})(),ee=(()=>{const V=new R;return function(_e,Oe){const ot=i.domElement;if(ot&&i.object instanceof Bt&&i.object.isPerspectiveCamera){const W=i.object.position;V.copy(W).sub(i.target);let Le=V.length();Le*=Math.tan(i.object.fov/2*Math.PI/180),G(2*_e*Le/ot.clientHeight,i.object.matrix),ie(2*Oe*Le/ot.clientHeight,i.object.matrix)}else ot&&i.object instanceof oo&&i.object.isOrthographicCamera?(G(_e*(i.object.right-i.object.left)/i.object.zoom/ot.clientWidth,i.object.matrix),ie(Oe*(i.object.top-i.object.bottom)/i.object.zoom/ot.clientHeight,i.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),i.enablePan=!1)}})();function pe(V){i.object instanceof Bt&&i.object.isPerspectiveCamera?m/=V:i.object instanceof oo&&i.object.isOrthographicCamera?(i.object.zoom=Math.max(i.minZoom,Math.min(i.maxZoom,i.object.zoom*V)),i.object.updateProjectionMatrix(),x=!0):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),i.enableZoom=!1)}function k(V){i.object instanceof Bt&&i.object.isPerspectiveCamera?m*=V:i.object instanceof oo&&i.object.isOrthographicCamera?(i.object.zoom=Math.max(i.minZoom,Math.min(i.maxZoom,i.object.zoom/V)),i.object.updateProjectionMatrix(),x=!0):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),i.enableZoom=!1)}function B(V){y.set(V.clientX,V.clientY)}function F(V){C.set(V.clientX,V.clientY)}function $(V){S.set(V.clientX,V.clientY)}function J(V){w.set(V.clientX,V.clientY),_.subVectors(w,y).multiplyScalar(i.rotateSpeed);const K=i.domElement;K&&(ue(2*Math.PI*_.x/K.clientHeight),Z(2*Math.PI*_.y/K.clientHeight)),y.copy(w),i.update()}function me(V){P.set(V.clientX,V.clientY),I.subVectors(P,C),I.y>0?pe(j()):I.y<0&&k(j()),C.copy(P),i.update()}function Me(V){E.set(V.clientX,V.clientY),T.subVectors(E,S).multiplyScalar(i.panSpeed),ee(T.x,T.y),S.copy(E),i.update()}function Ve(V){V.deltaY<0?k(j()):V.deltaY>0&&pe(j()),i.update()}function re(V){let K=!1;switch(V.code){case i.keys.UP:ee(0,i.keyPanSpeed),K=!0;break;case i.keys.BOTTOM:ee(0,-i.keyPanSpeed),K=!0;break;case i.keys.LEFT:ee(i.keyPanSpeed,0),K=!0;break;case i.keys.RIGHT:ee(-i.keyPanSpeed,0),K=!0;break}K&&(V.preventDefault(),i.update())}function Xe(){if(A.length==1)y.set(A[0].pageX,A[0].pageY);else{const V=.5*(A[0].pageX+A[1].pageX),K=.5*(A[0].pageY+A[1].pageY);y.set(V,K)}}function je(){if(A.length==1)S.set(A[0].pageX,A[0].pageY);else{const V=.5*(A[0].pageX+A[1].pageX),K=.5*(A[0].pageY+A[1].pageY);S.set(V,K)}}function Je(){const V=A[0].pageX-A[1].pageX,K=A[0].pageY-A[1].pageY,_e=Math.sqrt(V*V+K*K);C.set(0,_e)}function be(){i.enableZoom&&Je(),i.enablePan&&je()}function Qe(){i.enableZoom&&Je(),i.enableRotate&&Xe()}function he(V){if(A.length==1)w.set(V.pageX,V.pageY);else{const _e=Ie(V),Oe=.5*(V.pageX+_e.x),ot=.5*(V.pageY+_e.y);w.set(Oe,ot)}_.subVectors(w,y).multiplyScalar(i.rotateSpeed);const K=i.domElement;K&&(ue(2*Math.PI*_.x/K.clientHeight),Z(2*Math.PI*_.y/K.clientHeight)),y.copy(w)}function oe(V){if(A.length==1)E.set(V.pageX,V.pageY);else{const K=Ie(V),_e=.5*(V.pageX+K.x),Oe=.5*(V.pageY+K.y);E.set(_e,Oe)}T.subVectors(E,S).multiplyScalar(i.panSpeed),ee(T.x,T.y),S.copy(E)}function xe(V){const K=Ie(V),_e=V.pageX-K.x,Oe=V.pageY-K.y,ot=Math.sqrt(_e*_e+Oe*Oe);P.set(0,ot),I.set(0,Math.pow(P.y/C.y,i.zoomSpeed)),pe(I.y),C.copy(P)}function Ue(V){i.enableZoom&&xe(V),i.enablePan&&oe(V)}function Ae(V){i.enableZoom&&xe(V),i.enableRotate&&he(V)}function $e(V){if(i.enabled!==!1){if(A.length===0){var K,_e;(K=i.domElement)===null||K===void 0||K.ownerDocument.addEventListener("pointermove",Ye),(_e=i.domElement)===null||_e===void 0||_e.ownerDocument.addEventListener("pointerup",Ge)}Ke(V),V.pointerType==="touch"?ve(V):Et(V)}}function Ye(V){i.enabled!==!1&&(V.pointerType==="touch"?we(V):U(V))}function Ge(V){if(se(V),A.length===0){var K,_e,Oe;(K=i.domElement)===null||K===void 0||K.releasePointerCapture(V.pointerId),(_e=i.domElement)===null||_e===void 0||_e.ownerDocument.removeEventListener("pointermove",Ye),(Oe=i.domElement)===null||Oe===void 0||Oe.ownerDocument.removeEventListener("pointerup",Ge)}i.dispatchEvent(o),c=l.NONE}function vt(V){se(V)}function Et(V){let K;switch(V.button){case 0:K=i.mouseButtons.LEFT;break;case 1:K=i.mouseButtons.MIDDLE;break;case 2:K=i.mouseButtons.RIGHT;break;default:K=-1}switch(K){case Fo.DOLLY:if(i.enableZoom===!1)return;F(V),c=l.DOLLY;break;case Fo.ROTATE:if(V.ctrlKey||V.metaKey||V.shiftKey){if(i.enablePan===!1)return;$(V),c=l.PAN}else{if(i.enableRotate===!1)return;B(V),c=l.ROTATE}break;case Fo.PAN:if(V.ctrlKey||V.metaKey||V.shiftKey){if(i.enableRotate===!1)return;B(V),c=l.ROTATE}else{if(i.enablePan===!1)return;$(V),c=l.PAN}break;default:c=l.NONE}c!==l.NONE&&i.dispatchEvent(s)}function U(V){if(i.enabled!==!1)switch(c){case l.ROTATE:if(i.enableRotate===!1)return;J(V);break;case l.DOLLY:if(i.enableZoom===!1)return;me(V);break;case l.PAN:if(i.enablePan===!1)return;Me(V);break}}function D(V){i.enabled===!1||i.enableZoom===!1||c!==l.NONE&&c!==l.ROTATE||(V.preventDefault(),i.dispatchEvent(s),Ve(V),i.dispatchEvent(o))}function te(V){i.enabled===!1||i.enablePan===!1||re(V)}function ve(V){switch(Be(V),A.length){case 1:switch(i.touches.ONE){case Uo.ROTATE:if(i.enableRotate===!1)return;Xe(),c=l.TOUCH_ROTATE;break;case Uo.PAN:if(i.enablePan===!1)return;je(),c=l.TOUCH_PAN;break;default:c=l.NONE}break;case 2:switch(i.touches.TWO){case Uo.DOLLY_PAN:if(i.enableZoom===!1&&i.enablePan===!1)return;be(),c=l.TOUCH_DOLLY_PAN;break;case Uo.DOLLY_ROTATE:if(i.enableZoom===!1&&i.enableRotate===!1)return;Qe(),c=l.TOUCH_DOLLY_ROTATE;break;default:c=l.NONE}break;default:c=l.NONE}c!==l.NONE&&i.dispatchEvent(s)}function we(V){switch(Be(V),c){case l.TOUCH_ROTATE:if(i.enableRotate===!1)return;he(V),i.update();break;case l.TOUCH_PAN:if(i.enablePan===!1)return;oe(V),i.update();break;case l.TOUCH_DOLLY_PAN:if(i.enableZoom===!1&&i.enablePan===!1)return;Ue(V),i.update();break;case l.TOUCH_DOLLY_ROTATE:if(i.enableZoom===!1&&i.enableRotate===!1)return;Ae(V),i.update();break;default:c=l.NONE}}function Ce(V){i.enabled!==!1&&V.preventDefault()}function Ke(V){A.push(V)}function se(V){delete L[V.pointerId];for(let K=0;K<A.length;K++)if(A[K].pointerId==V.pointerId){A.splice(K,1);return}}function Be(V){let K=L[V.pointerId];K===void 0&&(K=new fe,L[V.pointerId]=K),K.set(V.pageX,V.pageY)}function Ie(V){const K=V.pointerId===A[0].pointerId?A[1]:A[0];return L[K.pointerId]}t!==void 0&&this.connect(t),this.update()}}const VE=new Cr,jh=new R;class HE extends $v{constructor(){super(),this.isLineSegmentsGeometry=!0,this.type="LineSegmentsGeometry";const e=[-1,2,0,1,2,0,-1,1,0,1,1,0,-1,0,0,1,0,0,-1,-1,0,1,-1,0],t=[-1,2,1,2,-1,1,1,1,-1,-1,1,-1,-1,-2,1,-2],i=[0,2,1,2,3,1,2,4,3,4,5,3,4,6,5,6,7,5];this.setIndex(i),this.setAttribute("position",new Fe(e,3)),this.setAttribute("uv",new Fe(t,2))}applyMatrix4(e){const t=this.attributes.instanceStart,i=this.attributes.instanceEnd;return t!==void 0&&(t.applyMatrix4(e),i.applyMatrix4(e),t.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}setPositions(e){let t;e instanceof Float32Array?t=e:Array.isArray(e)&&(t=new Float32Array(e));const i=new Ih(t,6,1);return this.setAttribute("instanceStart",new bi(i,3,0)),this.setAttribute("instanceEnd",new bi(i,3,3)),this.computeBoundingBox(),this.computeBoundingSphere(),this}setColors(e){let t;e instanceof Float32Array?t=e:Array.isArray(e)&&(t=new Float32Array(e));const i=new Ih(t,6,1);return this.setAttribute("instanceColorStart",new bi(i,3,0)),this.setAttribute("instanceColorEnd",new bi(i,3,3)),this}fromWireframeGeometry(e){return this.setPositions(e.attributes.position.array),this}fromEdgesGeometry(e){return this.setPositions(e.attributes.position.array),this}fromMesh(e){return this.fromWireframeGeometry(new Hv(e.geometry)),this}fromLineSegments(e){const t=e.geometry;return this.setPositions(t.attributes.position.array),this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new Cr);const e=this.attributes.instanceStart,t=this.attributes.instanceEnd;e!==void 0&&t!==void 0&&(this.boundingBox.setFromBufferAttribute(e),VE.setFromBufferAttribute(t),this.boundingBox.union(VE))}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new rs),this.boundingBox===null&&this.computeBoundingBox();const e=this.attributes.instanceStart,t=this.attributes.instanceEnd;if(e!==void 0&&t!==void 0){const i=this.boundingSphere.center;this.boundingBox.getCenter(i);let r=0;for(let s=0,o=e.count;s<o;s++)jh.fromBufferAttribute(e,s),r=Math.max(r,i.distanceToSquared(jh)),jh.fromBufferAttribute(t,s),r=Math.max(r,i.distanceToSquared(jh));this.boundingSphere.radius=Math.sqrt(r),isNaN(this.boundingSphere.radius)&&console.error("THREE.LineSegmentsGeometry.computeBoundingSphere(): Computed radius is NaN. The instanced position data is likely to have NaN values.",this)}}toJSON(){}applyMatrix(e){return console.warn("THREE.LineSegmentsGeometry: applyMatrix() has been renamed to applyMatrix4()."),this.applyMatrix4(e)}}class WE extends HE{constructor(){super(),this.isLineGeometry=!0,this.type="LineGeometry"}setPositions(e){const t=e.length-3,i=new Float32Array(2*t);for(let r=0;r<t;r+=3)i[2*r]=e[r],i[2*r+1]=e[r+1],i[2*r+2]=e[r+2],i[2*r+3]=e[r+3],i[2*r+4]=e[r+4],i[2*r+5]=e[r+5];return super.setPositions(i),this}setColors(e){const t=e.length-3,i=new Float32Array(2*t);for(let r=0;r<t;r+=3)i[2*r]=e[r],i[2*r+1]=e[r+1],i[2*r+2]=e[r+2],i[2*r+3]=e[r+3],i[2*r+4]=e[r+4],i[2*r+5]=e[r+5];return super.setColors(i),this}fromLine(e){const t=e.geometry;return this.setPositions(t.attributes.position.array),this}}Se.line={worldUnits:{value:1},linewidth:{value:1},resolution:{value:new fe(1,1)},dashOffset:{value:0},dashScale:{value:1},dashSize:{value:1},gapSize:{value:1}},Jn.line={uniforms:nh.merge([Se.common,Se.fog,Se.line]),vertexShader:`
		#include <common>
		#include <color_pars_vertex>
		#include <fog_pars_vertex>
		#include <logdepthbuf_pars_vertex>
		#include <clipping_planes_pars_vertex>

		uniform float linewidth;
		uniform vec2 resolution;

		attribute vec3 instanceStart;
		attribute vec3 instanceEnd;

		attribute vec3 instanceColorStart;
		attribute vec3 instanceColorEnd;

		#ifdef WORLD_UNITS

			varying vec4 worldPos;
			varying vec3 worldStart;
			varying vec3 worldEnd;

			#ifdef USE_DASH

				varying vec2 vUv;

			#endif

		#else

			varying vec2 vUv;

		#endif

		#ifdef USE_DASH

			uniform float dashScale;
			attribute float instanceDistanceStart;
			attribute float instanceDistanceEnd;
			varying float vLineDistance;

		#endif

		void trimSegment( const in vec4 start, inout vec4 end ) {

			// trim end segment so it terminates between the camera plane and the near plane

			// conservative estimate of the near plane
			float a = projectionMatrix[ 2 ][ 2 ]; // 3nd entry in 3th column
			float b = projectionMatrix[ 3 ][ 2 ]; // 3nd entry in 4th column
			float nearEstimate = - 0.5 * b / a;

			float alpha = ( nearEstimate - start.z ) / ( end.z - start.z );

			end.xyz = mix( start.xyz, end.xyz, alpha );

		}

		void main() {

			#ifdef USE_COLOR

				vColor.xyz = ( position.y < 0.5 ) ? instanceColorStart : instanceColorEnd;

			#endif

			#ifdef USE_DASH

				vLineDistance = ( position.y < 0.5 ) ? dashScale * instanceDistanceStart : dashScale * instanceDistanceEnd;
				vUv = uv;

			#endif

			float aspect = resolution.x / resolution.y;

			// camera space
			vec4 start = modelViewMatrix * vec4( instanceStart, 1.0 );
			vec4 end = modelViewMatrix * vec4( instanceEnd, 1.0 );

			#ifdef WORLD_UNITS

				worldStart = start.xyz;
				worldEnd = end.xyz;

			#else

				vUv = uv;

			#endif

			// special case for perspective projection, and segments that terminate either in, or behind, the camera plane
			// clearly the gpu firmware has a way of addressing this issue when projecting into ndc space
			// but we need to perform ndc-space calculations in the shader, so we must address this issue directly
			// perhaps there is a more elegant solution -- WestLangley

			bool perspective = ( projectionMatrix[ 2 ][ 3 ] == - 1.0 ); // 4th entry in the 3rd column

			if ( perspective ) {

				if ( start.z < 0.0 && end.z >= 0.0 ) {

					trimSegment( start, end );

				} else if ( end.z < 0.0 && start.z >= 0.0 ) {

					trimSegment( end, start );

				}

			}

			// clip space
			vec4 clipStart = projectionMatrix * start;
			vec4 clipEnd = projectionMatrix * end;

			// ndc space
			vec3 ndcStart = clipStart.xyz / clipStart.w;
			vec3 ndcEnd = clipEnd.xyz / clipEnd.w;

			// direction
			vec2 dir = ndcEnd.xy - ndcStart.xy;

			// account for clip-space aspect ratio
			dir.x *= aspect;
			dir = normalize( dir );

			#ifdef WORLD_UNITS

				// get the offset direction as perpendicular to the view vector
				vec3 worldDir = normalize( end.xyz - start.xyz );
				vec3 offset;
				if ( position.y < 0.5 ) {

					offset = normalize( cross( start.xyz, worldDir ) );

				} else {

					offset = normalize( cross( end.xyz, worldDir ) );

				}

				// sign flip
				if ( position.x < 0.0 ) offset *= - 1.0;

				float forwardOffset = dot( worldDir, vec3( 0.0, 0.0, 1.0 ) );

				// don't extend the line if we're rendering dashes because we
				// won't be rendering the endcaps
				#ifndef USE_DASH

					// extend the line bounds to encompass  endcaps
					start.xyz += - worldDir * linewidth * 0.5;
					end.xyz += worldDir * linewidth * 0.5;

					// shift the position of the quad so it hugs the forward edge of the line
					offset.xy -= dir * forwardOffset;
					offset.z += 0.5;

				#endif

				// endcaps
				if ( position.y > 1.0 || position.y < 0.0 ) {

					offset.xy += dir * 2.0 * forwardOffset;

				}

				// adjust for linewidth
				offset *= linewidth * 0.5;

				// set the world position
				worldPos = ( position.y < 0.5 ) ? start : end;
				worldPos.xyz += offset;

				// project the worldpos
				vec4 clip = projectionMatrix * worldPos;

				// shift the depth of the projected points so the line
				// segments overlap neatly
				vec3 clipPose = ( position.y < 0.5 ) ? ndcStart : ndcEnd;
				clip.z = clipPose.z * clip.w;

			#else

				vec2 offset = vec2( dir.y, - dir.x );
				// undo aspect ratio adjustment
				dir.x /= aspect;
				offset.x /= aspect;

				// sign flip
				if ( position.x < 0.0 ) offset *= - 1.0;

				// endcaps
				if ( position.y < 0.0 ) {

					offset += - dir;

				} else if ( position.y > 1.0 ) {

					offset += dir;

				}

				// adjust for linewidth
				offset *= linewidth;

				// adjust for clip-space to screen-space conversion // maybe resolution should be based on viewport ...
				offset /= resolution.y;

				// select end
				vec4 clip = ( position.y < 0.5 ) ? clipStart : clipEnd;

				// back to clip space
				offset *= clip.w;

				clip.xy += offset;

			#endif

			gl_Position = clip;

			vec4 mvPosition = ( position.y < 0.5 ) ? start : end; // this is an approximation

			#include <logdepthbuf_vertex>
			#include <clipping_planes_vertex>
			#include <fog_vertex>

		}
		`,fragmentShader:`
		uniform vec3 diffuse;
		uniform float opacity;
		uniform float linewidth;

		#ifdef USE_DASH

			uniform float dashOffset;
			uniform float dashSize;
			uniform float gapSize;

		#endif

		varying float vLineDistance;

		#ifdef WORLD_UNITS

			varying vec4 worldPos;
			varying vec3 worldStart;
			varying vec3 worldEnd;

			#ifdef USE_DASH

				varying vec2 vUv;

			#endif

		#else

			varying vec2 vUv;

		#endif

		#include <common>
		#include <color_pars_fragment>
		#include <fog_pars_fragment>
		#include <logdepthbuf_pars_fragment>
		#include <clipping_planes_pars_fragment>

		vec2 closestLineToLine(vec3 p1, vec3 p2, vec3 p3, vec3 p4) {

			float mua;
			float mub;

			vec3 p13 = p1 - p3;
			vec3 p43 = p4 - p3;

			vec3 p21 = p2 - p1;

			float d1343 = dot( p13, p43 );
			float d4321 = dot( p43, p21 );
			float d1321 = dot( p13, p21 );
			float d4343 = dot( p43, p43 );
			float d2121 = dot( p21, p21 );

			float denom = d2121 * d4343 - d4321 * d4321;

			float numer = d1343 * d4321 - d1321 * d4343;

			mua = numer / denom;
			mua = clamp( mua, 0.0, 1.0 );
			mub = ( d1343 + d4321 * ( mua ) ) / d4343;
			mub = clamp( mub, 0.0, 1.0 );

			return vec2( mua, mub );

		}

		void main() {

			#include <clipping_planes_fragment>

			#ifdef USE_DASH

				if ( vUv.y < - 1.0 || vUv.y > 1.0 ) discard; // discard endcaps

				if ( mod( vLineDistance + dashOffset, dashSize + gapSize ) > dashSize ) discard; // todo - FIX

			#endif

			float alpha = opacity;

			#ifdef WORLD_UNITS

				// Find the closest points on the view ray and the line segment
				vec3 rayEnd = normalize( worldPos.xyz ) * 1e5;
				vec3 lineDir = worldEnd - worldStart;
				vec2 params = closestLineToLine( worldStart, worldEnd, vec3( 0.0, 0.0, 0.0 ), rayEnd );

				vec3 p1 = worldStart + lineDir * params.x;
				vec3 p2 = rayEnd * params.y;
				vec3 delta = p1 - p2;
				float len = length( delta );
				float norm = len / linewidth;

				#ifndef USE_DASH

					#ifdef USE_ALPHA_TO_COVERAGE

						float dnorm = fwidth( norm );
						alpha = 1.0 - smoothstep( 0.5 - dnorm, 0.5 + dnorm, norm );

					#else

						if ( norm > 0.5 ) {

							discard;

						}

					#endif

				#endif

			#else

				#ifdef USE_ALPHA_TO_COVERAGE

					// artifacts appear on some hardware if a derivative is taken within a conditional
					float a = vUv.x;
					float b = ( vUv.y > 0.0 ) ? vUv.y - 1.0 : vUv.y + 1.0;
					float len2 = a * a + b * b;
					float dlen = fwidth( len2 );

					if ( abs( vUv.y ) > 1.0 ) {

						alpha = 1.0 - smoothstep( 1.0 - dlen, 1.0 + dlen, len2 );

					}

				#else

					if ( abs( vUv.y ) > 1.0 ) {

						float a = vUv.x;
						float b = ( vUv.y > 0.0 ) ? vUv.y - 1.0 : vUv.y + 1.0;
						float len2 = a * a + b * b;

						if ( len2 > 1.0 ) discard;

					}

				#endif

			#endif

			vec4 diffuseColor = vec4( diffuse, alpha );

			#include <logdepthbuf_fragment>
			#include <color_fragment>

			gl_FragColor = vec4( diffuseColor.rgb, alpha );

			#include <tonemapping_fragment>
			#include <encodings_fragment>
			#include <fog_fragment>
			#include <premultiplied_alpha_fragment>

		}
		`};class My extends pr{constructor(e){super({type:"LineMaterial",uniforms:nh.clone(Jn.line.uniforms),vertexShader:Jn.line.vertexShader,fragmentShader:Jn.line.fragmentShader,clipping:!0}),this.isLineMaterial=!0,Object.defineProperties(this,{color:{enumerable:!0,get:function(){return this.uniforms.diffuse.value},set:function(t){this.uniforms.diffuse.value=t}},worldUnits:{enumerable:!0,get:function(){return"WORLD_UNITS"in this.defines},set:function(t){t===!0?this.defines.WORLD_UNITS="":delete this.defines.WORLD_UNITS}},linewidth:{enumerable:!0,get:function(){return this.uniforms.linewidth.value},set:function(t){this.uniforms.linewidth.value=t}},dashed:{enumerable:!0,get:function(){return Boolean("USE_DASH"in this.defines)},set(t){Boolean(t)!==Boolean("USE_DASH"in this.defines)&&(this.needsUpdate=!0),t===!0?this.defines.USE_DASH="":delete this.defines.USE_DASH}},dashScale:{enumerable:!0,get:function(){return this.uniforms.dashScale.value},set:function(t){this.uniforms.dashScale.value=t}},dashSize:{enumerable:!0,get:function(){return this.uniforms.dashSize.value},set:function(t){this.uniforms.dashSize.value=t}},dashOffset:{enumerable:!0,get:function(){return this.uniforms.dashOffset.value},set:function(t){this.uniforms.dashOffset.value=t}},gapSize:{enumerable:!0,get:function(){return this.uniforms.gapSize.value},set:function(t){this.uniforms.gapSize.value=t}},opacity:{enumerable:!0,get:function(){return this.uniforms.opacity.value},set:function(t){this.uniforms.opacity.value=t}},resolution:{enumerable:!0,get:function(){return this.uniforms.resolution.value},set:function(t){this.uniforms.resolution.value.copy(t)}},alphaToCoverage:{enumerable:!0,get:function(){return Boolean("USE_ALPHA_TO_COVERAGE"in this.defines)},set:function(t){Boolean(t)!==Boolean("USE_ALPHA_TO_COVERAGE"in this.defines)&&(this.needsUpdate=!0),t===!0?(this.defines.USE_ALPHA_TO_COVERAGE="",this.extensions.derivatives=!0):(delete this.defines.USE_ALPHA_TO_COVERAGE,this.extensions.derivatives=!1)}}}),this.setValues(e)}}const GE=new R,XE=new R,Ln=new wt,Rn=new wt,Rr=new wt,Ey=new R,Ty=new st,Bn=new co,jE=new R,Yh=new Cr,qh=new rs,Ir=new wt;let Dr,by,YE,ga;function qE(n,e,t){return Ir.set(0,0,-e,1).applyMatrix4(n.projectionMatrix),Ir.multiplyScalar(1/Ir.w),Ir.x=ga/t.width,Ir.y=ga/t.height,Ir.applyMatrix4(n.projectionMatrixInverse),Ir.multiplyScalar(1/Ir.w),Math.abs(Math.max(Ir.x,Ir.y))}function tk(n,e){for(let t=0,i=by.count;t<i;t++){Bn.start.fromBufferAttribute(by,t),Bn.end.fromBufferAttribute(YE,t);const r=new R,s=new R;Dr.distanceSqToSegment(Bn.start,Bn.end,s,r),s.distanceTo(r)<ga*.5&&e.push({point:s,pointOnLine:r,distance:Dr.origin.distanceTo(s),object:n,face:null,faceIndex:t,uv:null,uv2:null})}}function nk(n,e,t){const i=e.projectionMatrix,s=n.material.resolution,o=n.matrixWorld,l=n.geometry,c=l.attributes.instanceStart,f=l.attributes.instanceEnd,d=-e.near;Dr.at(1,Rr),Rr.w=1,Rr.applyMatrix4(e.matrixWorldInverse),Rr.applyMatrix4(i),Rr.multiplyScalar(1/Rr.w),Rr.x*=s.x/2,Rr.y*=s.y/2,Rr.z=0,Ey.copy(Rr),Ty.multiplyMatrices(e.matrixWorldInverse,o);for(let h=0,m=c.count;h<m;h++){if(Ln.fromBufferAttribute(c,h),Rn.fromBufferAttribute(f,h),Ln.w=1,Rn.w=1,Ln.applyMatrix4(Ty),Rn.applyMatrix4(Ty),Ln.z>d&&Rn.z>d)continue;if(Ln.z>d){const S=Ln.z-Rn.z,E=(Ln.z-d)/S;Ln.lerp(Rn,E)}else if(Rn.z>d){const S=Rn.z-Ln.z,E=(Rn.z-d)/S;Rn.lerp(Ln,E)}Ln.applyMatrix4(i),Rn.applyMatrix4(i),Ln.multiplyScalar(1/Ln.w),Rn.multiplyScalar(1/Rn.w),Ln.x*=s.x/2,Ln.y*=s.y/2,Rn.x*=s.x/2,Rn.y*=s.y/2,Bn.start.copy(Ln),Bn.start.z=0,Bn.end.copy(Rn),Bn.end.z=0;const x=Bn.closestPointToPointParameter(Ey,!0);Bn.at(x,jE);const y=qS.lerp(Ln.z,Rn.z,x),w=y>=-1&&y<=1,_=Ey.distanceTo(jE)<ga*.5;if(w&&_){Bn.start.fromBufferAttribute(c,h),Bn.end.fromBufferAttribute(f,h),Bn.start.applyMatrix4(o),Bn.end.applyMatrix4(o);const S=new R,E=new R;Dr.distanceSqToSegment(Bn.start,Bn.end,E,S),t.push({point:E,pointOnLine:S,distance:Dr.origin.distanceTo(E),object:n,face:null,faceIndex:h,uv:null,uv2:null})}}}class ik extends wn{constructor(e=new HE,t=new My({color:Math.random()*16777215})){super(e,t),this.isLineSegments2=!0,this.type="LineSegments2"}computeLineDistances(){const e=this.geometry,t=e.attributes.instanceStart,i=e.attributes.instanceEnd,r=new Float32Array(2*t.count);for(let o=0,l=0,c=t.count;o<c;o++,l+=2)GE.fromBufferAttribute(t,o),XE.fromBufferAttribute(i,o),r[l]=l===0?0:r[l-1],r[l+1]=r[l]+GE.distanceTo(XE);const s=new Ih(r,2,1);return e.setAttribute("instanceDistanceStart",new bi(s,1,0)),e.setAttribute("instanceDistanceEnd",new bi(s,1,1)),this}raycast(e,t){const i=this.material.worldUnits,r=e.camera;r===null&&!i&&console.error('LineSegments2: "Raycaster.camera" needs to be set in order to raycast against LineSegments2 while worldUnits is set to false.');const s=e.params.Line2!==void 0&&e.params.Line2.threshold||0;Dr=e.ray;const o=this.matrixWorld,l=this.geometry,c=this.material;ga=c.linewidth+s,by=l.attributes.instanceStart,YE=l.attributes.instanceEnd,l.boundingSphere===null&&l.computeBoundingSphere(),qh.copy(l.boundingSphere).applyMatrix4(o);let f;if(i)f=ga*.5;else{const h=Math.max(r.near,qh.distanceToPoint(Dr.origin));f=qE(r,h,c.resolution)}if(qh.radius+=f,Dr.intersectsSphere(qh)===!1)return;l.boundingBox===null&&l.computeBoundingBox(),Yh.copy(l.boundingBox).applyMatrix4(o);let d;if(i)d=ga*.5;else{const h=Math.max(r.near,Yh.distanceToPoint(Dr.origin));d=qE(r,h,c.resolution)}Yh.expandByScalar(d),Dr.intersectsBox(Yh)!==!1&&(i?tk(this,t):nk(this,r,t))}}class rk extends ik{constructor(e=new WE,t=new My({color:Math.random()*16777215})){super(e,t),this.isLine2=!0,this.type="Line2"}}const Bc=ke.exports.forwardRef(function({points:e,color:t="black",vertexColors:i,linewidth:r,lineWidth:s,dashed:o,...l},c){const f=hs(g=>g.size),[d]=ke.exports.useState(()=>new rk),[h]=ke.exports.useState(()=>new My),m=ke.exports.useMemo(()=>{const g=new WE,x=e.map(y=>y instanceof R?y.toArray():y);if(g.setPositions(x.flat()),i){const y=i.map(w=>w instanceof De?w.toArray():w);g.setColors(y.flat())}return g},[e,i]);return ke.exports.useLayoutEffect(()=>{d.computeLineDistances()},[e,d]),ke.exports.useLayoutEffect(()=>{o?h.defines.USE_DASH="":delete h.defines.USE_DASH,h.needsUpdate=!0},[o,h]),ke.exports.useEffect(()=>()=>m.dispose(),[m]),Hh("primitive",{object:d,ref:c,...l,children:[Dt("primitive",{object:m,attach:"geometry"}),Dt("primitive",{object:h,attach:"material",color:t,vertexColors:Boolean(i),resolution:[f.width,f.height],linewidth:r!=null?r:s,dashed:o,...l})]})}),sk=ke.exports.forwardRef(({makeDefault:n,camera:e,regress:t,domElement:i,enableDamping:r=!0,onChange:s,onStart:o,onEnd:l,...c},f)=>{const d=hs(T=>T.invalidate),h=hs(T=>T.camera),m=hs(T=>T.gl),g=hs(T=>T.events),x=hs(T=>T.set),y=hs(T=>T.get),w=hs(T=>T.performance),_=e||h,S=i||g.connected||m.domElement,E=ke.exports.useMemo(()=>new ek(_),[_]);return VN(()=>{E.enabled&&E.update()},-1),ke.exports.useEffect(()=>(E.connect(S),()=>void E.dispose()),[S,t,E,d]),ke.exports.useEffect(()=>{const T=C=>{d(),t&&w.regress(),s&&s(C)};return E.addEventListener("change",T),o&&E.addEventListener("start",o),l&&E.addEventListener("end",l),()=>{o&&E.removeEventListener("start",o),l&&E.removeEventListener("end",l),E.removeEventListener("change",T)}},[s,o,l,E,d]),ke.exports.useEffect(()=>{if(n){const T=y().controls;return x({controls:E}),()=>x({controls:T})}},[n,E]),Dt("primitive",{ref:f,object:E,enableDamping:r,...c})});function ok({gridSpacing:n=1,gridLineCount:e=50,gridThickFrequency:t=10}){const i=new R(0,0,0),r=-e*n,s=r,o=e*n,l=o;let c=[],f=[];for(let d=-e;d<=e;d++){let h=d*n,m=d*n;if(d===0){f.push(new co(new R(0,s,0),new R(0,0,0))),f.push(new co(new R(r,0,0),new R(0,0,0)));continue}d%t===0?(f.push(new co(new R(h,s,0),new R(h,l,0))),f.push(new co(new R(r,m,0),new R(o,m,0)))):(c.push(new co(new R(h,s,0),new R(h,l,0))),c.push(new co(new R(r,m,0),new R(o,m,0))))}return Hh("group",{children:[Dt(Bc,{points:[i,new R(o,0,0)],color:16711680}),Dt(Bc,{points:[i,new R(0,l,0)],color:32768}),f.map((d,h)=>Dt(Bc,{points:[d.start,d.end],linewidth:.5,color:2236962},`majorLines_${h}`)),c.map((d,h)=>Dt(Bc,{points:[d.start,d.end],linewidth:.3,color:6710886},`minorLines_${h}`))]})}const ak=({data:n,option:e})=>{const t=ke.exports.useMemo(()=>new ey().parse(n),[n]);return Dt("mesh",{geometry:t,children:Dt("meshStandardMaterial",{attach:"material",...e==null?void 0:e.defaultMatParams})})},lk=ke.exports.forwardRef(({},n)=>{const e=hs(t=>t.scene);return ke.exports.useImperativeHandle(n,()=>({scene:e}),[]),Dt("group",{})}),ZE=ke.exports.forwardRef(({onMounted:n,meshbuffers:e,wirebuffers:t,option:i},r)=>{const s=ke.exports.useRef(null);ke.exports.useImperativeHandle(r,()=>{var l;return{scene:(l=s.current)==null?void 0:l.scene,clear(){}}},[]),ke.exports.useEffect(()=>{n&&n()},[]);const o=ke.exports.useMemo(()=>{const l=[];for(let{data:c,options:f}of t){const d=[];for(let h=0;h<c.length;h+=3){const m=c[h],g=c[h+1],x=c[h+2];d.push([m,g,x])}l.push({data:d,options:f})}return l},[t]);return Hh($N,{style:{width:"100%"},shadows:!0,camera:{position:[60,-60,60],up:[0,0,1],fov:60},children:[Dt(lk,{ref:s}),Dt("ambientLight",{intensity:.4}),Dt("directionalLight",{castShadow:!0,position:[500,-500,500],intensity:1,"shadow-mapSize-width":2048,"shadow-mapSize-height":2048,"shadow-camera-far":3e3,"shadow-camera-near":0,"shadow-camera-left":-50,"shadow-camera-right":50,"shadow-camera-top":50,"shadow-camera-bottom":-50,"shadow-bias":-5e-5}),Dt("pointLight",{position:[0,-10,0],intensity:1.5}),Dt(sk,{enableDamping:!1}),Hh("mesh",{rotation:[0,0,0],position:[0,-.5,0],receiveShadow:!0,children:[Dt("planeGeometry",{attach:"geometry",args:[1e3,1e3]}),Dt("shadowMaterial",{attach:"material",transparent:!0,opacity:.4})]}),Dt(ok,{}),e.map((l,c)=>Dt(ak,{data:l,option:i==null?void 0:i.buffers},c)),o.map(({data:l,options:c},f)=>Dt(Bc,{points:l,...c!==void 0?c:i==null?void 0:i.wires},f))]})});function uk(n,e,t,i){const r=Hx.createElement;Qp.createRoot(n).render(r(Hx.StrictMode,null,r(ZE,{meshbuffers:e,wirebuffers:t,option:i})))}Mo.DisplayPortal=ZE,Mo.default=uk,Object.defineProperties(Mo,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});


/***/ }),

/***/ "./package.json":
/*!**********************!*\
  !*** ./package.json ***!
  \**********************/
/***/ ((module) => {

"use strict";
module.exports = JSON.parse('{"name":"jmv","version":"0.1.0","description":"jupyter moon view","keywords":["jupyter","jupyterlab","jupyterlab-extension","widgets"],"files":["lib/**/*.js","dist/*.js","css/*.css"],"homepage":"https://github.com/KaivnD/jmv","bugs":{"url":"https://github.com/KaivnD/jmv/issues"},"license":"BSD-3-Clause","author":{"name":"KaivnD","email":"KaivnD@hotmail.com"},"main":"lib/index.js","types":"./lib/index.d.ts","repository":{"type":"git","url":"https://github.com/KaivnD/jmv"},"scripts":{"build":"pnpm run build:lib && pnpm run build:nbextension && pnpm run build:labextension:dev","build:prod":"pnpm run build:lib && pnpm run build:nbextension && pnpm run build:labextension","build:labextension":"jupyter labextension build .","build:labextension:dev":"jupyter labextension build --development True .","build:lib":"tsc","build:nbextension":"webpack","clean":"pnpm run clean:lib && pnpm run clean:nbextension && pnpm run clean:labextension","clean:lib":"rimraf lib","clean:labextension":"rimraf jmv/labextension","clean:nbextension":"rimraf jmv/nbextension/static/index.js","lint":"eslint . --ext .ts,.tsx --fix","lint:check":"eslint . --ext .ts,.tsx","prepack":"pnpm run build:lib","test":"jest","watch":"npm-run-all -p watch:*","watch:lib":"tsc -w","watch:nbextension":"webpack --watch --mode=development","watch:labextension":"jupyter labextension watch ."},"dependencies":{"@jupyter-widgets/base":"^1.1.10 || ^2.0.0 || ^3.0.0 || ^4.0.0"},"devDependencies":{"3dp":"^0.0.1","@babel/core":"^7.5.0","@babel/preset-env":"^7.5.0","@jupyterlab/builder":"^3.0.0","@phosphor/application":"^1.6.0","@phosphor/widgets":"^1.6.0","@types/jest":"^26.0.24","@types/webpack-env":"^1.13.6","@typescript-eslint/eslint-plugin":"^3.6.0","@typescript-eslint/parser":"^3.6.0","acorn":"^7.2.0","crypto":"1.0.1","css-loader":"^3.2.0","eslint":"^7.4.0","eslint-config-prettier":"^6.11.0","eslint-plugin-prettier":"^3.1.4","fs-extra":"^7.0.0","htm":"^3.1.1","identity-obj-proxy":"^3.0.0","jest":"^26.0.0","mkdirp":"^0.5.1","npm-run-all":"^4.1.3","prettier":"^2.0.5","rimraf":"^2.6.2","source-map-loader":"^1.1.3","style-loader":"^1.0.0","ts-jest":"^26.0.0","ts-loader":"^8.0.0","typescript":"~4.1.3","webpack":"^5.61.0","webpack-cli":"^4.0.0"},"jupyterlab":{"extension":"lib/plugin","outputDir":"jmv/labextension/","sharedPackages":{"@jupyter-widgets/base":{"bundled":false,"singleton":true}}}}');

/***/ })

/******/ 	});
/************************************************************************/
/******/ 	// The module cache
/******/ 	var __webpack_module_cache__ = {};
/******/ 	
/******/ 	// The require function
/******/ 	function __webpack_require__(moduleId) {
/******/ 		// Check if module is in cache
/******/ 		var cachedModule = __webpack_module_cache__[moduleId];
/******/ 		if (cachedModule !== undefined) {
/******/ 			return cachedModule.exports;
/******/ 		}
/******/ 		// Create a new module (and put it into the cache)
/******/ 		var module = __webpack_module_cache__[moduleId] = {
/******/ 			id: moduleId,
/******/ 			// no module.loaded needed
/******/ 			exports: {}
/******/ 		};
/******/ 	
/******/ 		// Execute the module function
/******/ 		__webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/ 	
/******/ 		// Return the exports of the module
/******/ 		return module.exports;
/******/ 	}
/******/ 	
/************************************************************************/
/******/ 	/* webpack/runtime/nonce */
/******/ 	(() => {
/******/ 		__webpack_require__.nc = undefined;
/******/ 	})();
/******/ 	
/************************************************************************/
/******/ 	
/******/ 	// startup
/******/ 	// Load entry module and return exports
/******/ 	// This entry module is referenced by other modules so it can't be inlined
/******/ 	var __webpack_exports__ = __webpack_require__("./src/extension.ts");
/******/ 	
/******/ 	return __webpack_exports__;
/******/ })()
;
});;
//# sourceMappingURL=index.js.map