/**
* @license
* Copyright 2010-2022 Three.js Authors
* SPDX-License-Identifier: MIT
*/
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
typeof define === 'function' && define.amd ? define(['exports'], factory) :
(global = global || self, factory(global.THREE = {}));
}(this, (function (exports) { 'use strict';
function noop() {}
function _classCallCheck(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
}
function _defineProperties(target, props) {
for (var i = 0; i < props.length; i++) {
var descriptor = props[i];
descriptor.enumerable = descriptor.enumerable || false;
descriptor.configurable = true;
if ("value" in descriptor) { descriptor.writable = true; }
Object.defineProperty(target, descriptor.key, descriptor);
}
}
function _createClass(Constructor, protoProps, staticProps) {
if (protoProps) { _defineProperties(Constructor.prototype, protoProps); }
if (staticProps) { _defineProperties(Constructor, staticProps); }
return Constructor;
}
function _inherits(subClass, superClass) {
if (typeof superClass !== "function" && superClass !== null) {
throw new TypeError("Super expression must either be null or a function");
}
subClass.prototype = Object.create(superClass && superClass.prototype, {
constructor: {
value: subClass,
writable: true,
configurable: true
}
});
if (superClass) { _setPrototypeOf(subClass, superClass); }
}
function _getPrototypeOf(o) {
_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
return o.__proto__ || Object.getPrototypeOf(o);
};
return _getPrototypeOf(o);
}
function _setPrototypeOf(o, p) {
_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
o.__proto__ = p;
return o;
};
return _setPrototypeOf(o, p);
}
function _assertThisInitialized(self) {
if (self === void 0) {
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
}
return self;
}
function _possibleConstructorReturn(self, call) {
if (call && (typeof call === "object" || typeof call === "function")) {
return call;
}
return _assertThisInitialized(self);
}
function _toConsumableArray(arr) {
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread();
}
function _arrayWithoutHoles(arr) {
if (Array.isArray(arr)) {
for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; }
return arr2;
}
}
function _iterableToArray(iter) {
if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") { return Array.from(iter); }
}
function _nonIterableSpread() {
throw new TypeError("Invalid attempt to spread non-iterable instance");
}
var performance$1;
if (wx.getPerformance) {
var _wx$getSystemInfoSync = wx.getSystemInfoSync(),
platform = _wx$getSystemInfoSync.platform;
var wxPerf = wx.getPerformance();
var initTime = wxPerf.now();
var clientPerfAdapter = Object.assign({}, wxPerf, {
now: function now() {
return (wxPerf.now() - initTime) / 1000;
}
});
performance$1 = platform === 'devtools' ? wxPerf : clientPerfAdapter;
}
var performance$1$1 = performance$1;
var _wx$getSystemInfoSync$1 = wx.getSystemInfoSync(),
screenWidth = _wx$getSystemInfoSync$1.screenWidth,
screenHeight = _wx$getSystemInfoSync$1.screenHeight,
devicePixelRatio = _wx$getSystemInfoSync$1.devicePixelRatio;
var innerWidth = screenWidth;
var innerHeight = screenHeight;
var screen = {
width: screenWidth,
height: screenHeight,
availWidth: innerWidth,
availHeight: innerHeight,
availLeft: 0,
availTop: 0
};
var scrollX = 0;
var scrollY = 0;
var ontouchstart = null;
var ontouchmove = null;
var ontouchend = null;
function parentNode(obj, level) {
if (!('parentNode' in obj)) {
var _parent;
if (level === 0) {
_parent = function _parent() {
// return document
return null;
};
} else if (level === 1) {
_parent = function _parent() {
return document$1.documentElement;
};
} else {
_parent = function _parent() {
return document$1.body;
};
}
Object.defineProperty(obj, 'parentNode', {
enumerable: true,
get: _parent
});
}
if (!('parentElement' in obj)) {
var _parent2;
if (level === 0) {
_parent2 = function _parent2() {
return null;
};
} else if (level === 1) {
_parent2 = function _parent2() {
return document$1.documentElement;
};
} else {
_parent2 = function _parent2() {
return document$1.body;
};
}
Object.defineProperty(obj, 'parentElement', {
enumerable: true,
get: _parent2
});
}
}
function style(obj) {
obj.style = obj.style || {};
Object.assign(obj.style, {
top: '0px',
left: '0px',
width: innerWidth + 'px',
height: innerHeight + 'px',
margin: '0px',
padding: '0px'
});
}
function clientRegion(obj) {
if (!('clientLeft' in obj)) {
obj.clientLeft = 0;
obj.clientTop = 0;
}
if (!('clientWidth' in obj)) {
obj.clientWidth = innerWidth;
obj.clientHeight = innerHeight;
}
if (!('getBoundingClientRect' in obj)) {
obj.getBoundingClientRect = function () {
var ret = {
x: 0,
y: 0,
top: 0,
left: 0,
width: this.clientWidth,
height: this.clientHeight
};
ret.right = ret.width;
ret.bottom = ret.height;
return ret;
};
}
}
function offsetRegion(obj) {
if (!('offsetLeft' in obj)) {
obj.offsetLeft = 0;
obj.offsetTop = 0;
}
if (!('offsetWidth' in obj)) {
obj.offsetWidth = innerWidth;
obj.offsetHeight = innerHeight;
}
}
function scrollRegion(obj) {
if (!('scrollLeft' in obj)) {
obj.scrollLeft = 0;
obj.scrollTop = 0;
}
if (!('scrollWidth' in obj)) {
obj.scrollWidth = innerWidth;
obj.scrollHeight = innerHeight;
}
}
function classList(obj) {
var noop = function noop() {};
obj.classList = [];
obj.classList.add = noop;
obj.classList.remove = noop;
obj.classList.contains = noop;
obj.classList.toggle = noop;
}
function copyProperties(target, source) {
var _iteratorNormalCompletion = true;
var _didIteratorError = false;
var _iteratorError = undefined;
try {
for (var _iterator = Object.getOwnPropertyNames(source)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
var key = _step.value;
if (key !== 'constructor' && key !== 'prototype' && key !== 'name') {
var desc = Object.getOwnPropertyDescriptor(source, key);
Object.defineProperty(target, key, desc);
}
}
} catch (err) {
_didIteratorError = true;
_iteratorError = err;
} finally {
try {
if (!_iteratorNormalCompletion && _iterator["return"] != null) {
_iterator["return"]();
}
} finally {
if (_didIteratorError) {
throw _iteratorError;
}
}
}
}
var _events = new WeakMap();
var EventTarget =
/*#__PURE__*/
function () {
function EventTarget() {
_classCallCheck(this, EventTarget);
_events.set(this, {});
}
_createClass(EventTarget, [{