Remove excess mesh-viewer code
authorLanius Trolling <lanius@laniustrolling.dev>
Tue, 14 Feb 2023 17:14:19 +0000 (12:14 -0500)
committerLanius Trolling <lanius@laniustrolling.dev>
Tue, 14 Feb 2023 17:14:19 +0000 (12:14 -0500)
56 files changed:
src/main/kotlin/info/mechyrdia/lore/parser_tags.kt
src/main/kotlin/info/mechyrdia/lore/view_tpl.kt
src/main/resources/static/gltf-viewer/bower_components/polymer/lib/elements/array-selector.html [deleted file]
src/main/resources/static/gltf-viewer/bower_components/polymer/lib/elements/custom-style.html [deleted file]
src/main/resources/static/gltf-viewer/bower_components/polymer/lib/elements/dom-bind.html [deleted file]
src/main/resources/static/gltf-viewer/bower_components/polymer/lib/elements/dom-if.html [deleted file]
src/main/resources/static/gltf-viewer/bower_components/polymer/lib/elements/dom-module.html [deleted file]
src/main/resources/static/gltf-viewer/bower_components/polymer/lib/elements/dom-repeat.html [deleted file]
src/main/resources/static/gltf-viewer/bower_components/polymer/lib/legacy/class.html [deleted file]
src/main/resources/static/gltf-viewer/bower_components/polymer/lib/legacy/legacy-element-mixin.html [deleted file]
src/main/resources/static/gltf-viewer/bower_components/polymer/lib/legacy/mutable-data-behavior.html [deleted file]
src/main/resources/static/gltf-viewer/bower_components/polymer/lib/legacy/polymer-fn.html [deleted file]
src/main/resources/static/gltf-viewer/bower_components/polymer/lib/legacy/polymer.dom.html [deleted file]
src/main/resources/static/gltf-viewer/bower_components/polymer/lib/legacy/templatizer-behavior.html [deleted file]
src/main/resources/static/gltf-viewer/bower_components/polymer/lib/mixins/element-mixin.html [deleted file]
src/main/resources/static/gltf-viewer/bower_components/polymer/lib/mixins/gesture-event-listeners.html [deleted file]
src/main/resources/static/gltf-viewer/bower_components/polymer/lib/mixins/mutable-data.html [deleted file]
src/main/resources/static/gltf-viewer/bower_components/polymer/lib/mixins/property-accessors.html [deleted file]
src/main/resources/static/gltf-viewer/bower_components/polymer/lib/mixins/property-effects.html [deleted file]
src/main/resources/static/gltf-viewer/bower_components/polymer/lib/mixins/template-stamp.html [deleted file]
src/main/resources/static/gltf-viewer/bower_components/polymer/lib/utils/array-splice.html [deleted file]
src/main/resources/static/gltf-viewer/bower_components/polymer/lib/utils/async.html [deleted file]
src/main/resources/static/gltf-viewer/bower_components/polymer/lib/utils/boot.html [deleted file]
src/main/resources/static/gltf-viewer/bower_components/polymer/lib/utils/case-map.html [deleted file]
src/main/resources/static/gltf-viewer/bower_components/polymer/lib/utils/debounce.html [deleted file]
src/main/resources/static/gltf-viewer/bower_components/polymer/lib/utils/flattened-nodes-observer.html [deleted file]
src/main/resources/static/gltf-viewer/bower_components/polymer/lib/utils/flush.html [deleted file]
src/main/resources/static/gltf-viewer/bower_components/polymer/lib/utils/gestures.html [deleted file]
src/main/resources/static/gltf-viewer/bower_components/polymer/lib/utils/import-href.html [deleted file]
src/main/resources/static/gltf-viewer/bower_components/polymer/lib/utils/mixin.html [deleted file]
src/main/resources/static/gltf-viewer/bower_components/polymer/lib/utils/path.html [deleted file]
src/main/resources/static/gltf-viewer/bower_components/polymer/lib/utils/render-status.html [deleted file]
src/main/resources/static/gltf-viewer/bower_components/polymer/lib/utils/resolve-url.html [deleted file]
src/main/resources/static/gltf-viewer/bower_components/polymer/lib/utils/style-gather.html [deleted file]
src/main/resources/static/gltf-viewer/bower_components/polymer/lib/utils/templatize.html [deleted file]
src/main/resources/static/gltf-viewer/bower_components/polymer/lib/utils/unresolved.html [deleted file]
src/main/resources/static/gltf-viewer/bower_components/polymer/polymer-element.html [deleted file]
src/main/resources/static/gltf-viewer/bower_components/polymer/polymer.html [deleted file]
src/main/resources/static/gltf-viewer/bower_components/shadycss/apply-shim.html [deleted file]
src/main/resources/static/gltf-viewer/bower_components/shadycss/apply-shim.min.js [deleted file]
src/main/resources/static/gltf-viewer/bower_components/shadycss/apply-shim.min.js.map [deleted file]
src/main/resources/static/gltf-viewer/bower_components/shadycss/custom-style-interface.html [deleted file]
src/main/resources/static/gltf-viewer/bower_components/shadycss/custom-style-interface.min.js [deleted file]
src/main/resources/static/gltf-viewer/bower_components/shadycss/custom-style-interface.min.js.map [deleted file]
src/main/resources/static/gltf-viewer/bower_components/shadycss/scoping-shim.min.js [deleted file]
src/main/resources/static/gltf-viewer/bower_components/shadycss/scoping-shim.min.js.map [deleted file]
src/main/resources/static/gltf-viewer/bower_components/webcomponentsjs/webcomponents-lite.js [deleted file]
src/main/resources/static/gltf-viewer/bower_components/webcomponentsjs/webcomponents-lite.js.map [deleted file]
src/main/resources/static/gltf-viewer/gltf-viewer.html [deleted file]
src/main/resources/static/gltf-viewer/js/OrbitControls.js [deleted file]
src/main/resources/static/gltf-viewer/js/three-examples.js [deleted file]
src/main/resources/static/gltf-viewer/js/three.js [deleted file]
src/main/resources/static/init.js
src/main/resources/static/obj-viewer/OrbitControls.js [new file with mode: 0644]
src/main/resources/static/obj-viewer/three-examples.js [new file with mode: 0644]
src/main/resources/static/obj-viewer/three.js [new file with mode: 0644]

index 3fbfdf51c01c6d7893c79039c1f059f5d61e9c3c..3a1cbc18f674cc115b4a3509951f9fa15ebed248 100644 (file)
@@ -164,7 +164,7 @@ enum class TextParserFormattingTag(val type: TextParserTagType<Unit>) {
                        val (width, height) = getSizeParam(tagParam)
                        val sizeAttrs = getImageSizeAttributes(width, height)
                        
-                       "<gltf-viewer src=\"/assets/meshes/$modelUrl.obj\"$sizeAttrs interactive></gltf-viewer>"
+                       "<canvas data-model=\"$modelUrl\"$sizeAttrs></canvas>"
                }
        ),
        
index c93af0afa878d470afacd7527a6fa7bcf24b40fd..78066707453d40cd848671c4f0457599dbb32a1e 100644 (file)
@@ -17,8 +17,9 @@ fun ApplicationCall.page(pageTitle: String, navBar: List<NavItem>? = null, sideb
                        meta(charset = "utf-8")
                        meta(name = "viewport", content = "width=device-width, initial-scale=1.0")
                        
-                       script(src = "/static/gltf-viewer/bower_components/webcomponentsjs/webcomponents-lite.js") {}
-                       link(rel = "import", href = "/static/gltf-viewer/gltf-viewer.html")
+                       script(src = "/static/obj-viewer/three.js") {}
+                       script(src = "/static/obj-viewer/three-examples.js") {}
+                       script(src = "/static/obj-viewer/OrbitControls.js") {}
                        
                        link(rel = "icon", type = "image/svg+xml", href = "/static/images/icon.svg")
                        
diff --git a/src/main/resources/static/gltf-viewer/bower_components/polymer/lib/elements/array-selector.html b/src/main/resources/static/gltf-viewer/bower_components/polymer/lib/elements/array-selector.html
deleted file mode 100644 (file)
index 85603aa..0000000
+++ /dev/null
@@ -1,410 +0,0 @@
-<!--
-@license
-Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
-This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
-The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
-The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
-Code distributed by Google as part of the polymer project is also
-subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
--->
-
-<link rel="import" href="../../polymer-element.html">
-<link rel="import" href="../utils/mixin.html">
-<link rel="import" href="../utils/array-splice.html">
-
-<script>
-(function() {
-  'use strict';
-
-  /**
-   * Element mixin for recording  dynamic associations between item paths in a
-   * master `items` array and a `selected` array such that path changes to the
-   * master array (at the host) element or elsewhere via data-binding) are
-   * correctly propagated to items in the selected array and vice-versa.
-   *
-   * The `items` property accepts an array of user data, and via the
-   * `select(item)` and `deselect(item)` API, updates the `selected` property
-   * which may be bound to other parts of the application, and any changes to
-   * sub-fields of `selected` item(s) will be kept in sync with items in the
-   * `items` array.  When `multi` is false, `selected` is a property
-   * representing the last selected item.  When `multi` is true, `selected`
-   * is an array of multiply selected items.
-   *
-   * @polymerMixin
-   * @memberof Polymer
-   */
-  let ArraySelectorMixin = Polymer.dedupingMixin(superClass => {
-
-    /**
-     * @polymerMixinClass
-     * @implements {Polymer_ArraySelectorMixin}
-     */
-    class ArraySelectorMixin extends superClass {
-
-      static get properties() {
-
-        return {
-
-          /**
-           * An array containing items from which selection will be made.
-           */
-          items: {
-            type: Array,
-          },
-
-          /**
-           * When `true`, multiple items may be selected at once (in this case,
-           * `selected` is an array of currently selected items).  When `false`,
-           * only one item may be selected at a time.
-           */
-          multi: {
-            type: Boolean,
-            value: false,
-          },
-
-          /**
-           * When `multi` is true, this is an array that contains any selected.
-           * When `multi` is false, this is the currently selected item, or `null`
-           * if no item is selected.
-           */
-          selected: {
-            type: Object,
-            notify: true
-          },
-
-          /**
-           * When `multi` is false, this is the currently selected item, or `null`
-           * if no item is selected.
-           */
-          selectedItem: {
-            type: Object,
-            notify: true
-          },
-
-          /**
-           * When `true`, calling `select` on an item that is already selected
-           * will deselect the item.
-           */
-          toggle: {
-            type: Boolean,
-            value: false
-          }
-
-        }
-      }
-
-      static get observers() {
-        return ['__updateSelection(multi, items.*)']
-      }
-
-      constructor() {
-        super();
-        this.__lastItems = null;
-        this.__lastMulti = null;
-        this.__selectedMap = null;
-      }
-
-      __updateSelection(multi, itemsInfo) {
-        let path = itemsInfo.path;
-        if (path == 'items') {
-          // Case 1 - items array changed, so diff against previous array and
-          // deselect any removed items and adjust selected indices
-          let newItems = itemsInfo.base || [];
-          let lastItems = this.__lastItems;
-          let lastMulti = this.__lastMulti;
-          if (multi !== lastMulti) {
-            this.clearSelection();
-          }
-          if (lastItems) {
-            let splices = Polymer.ArraySplice.calculateSplices(newItems, lastItems);
-            this.__applySplices(splices);
-          }
-          this.__lastItems = newItems;
-          this.__lastMulti = multi;
-        } else if (itemsInfo.path == 'items.splices') {
-          // Case 2 - got specific splice information describing the array mutation:
-          // deselect any removed items and adjust selected indices
-          this.__applySplices(itemsInfo.value.indexSplices);
-        } else {
-          // Case 3 - an array element was changed, so deselect the previous
-          // item for that index if it was previously selected
-          let part = path.slice('items.'.length);
-          let idx = parseInt(part, 10);
-          if ((part.indexOf('.') < 0) && part == idx) {
-            this.__deselectChangedIdx(idx);
-          }
-        }
-      }
-
-      __applySplices(splices) {
-        let selected = this.__selectedMap;
-        // Adjust selected indices and mark removals
-        for (let i=0; i<splices.length; i++) {
-          let s = splices[i];
-          selected.forEach((idx, item) => {
-            if (idx < s.index) {
-              // no change
-            } else if (idx >= s.index + s.removed.length) {
-              // adjust index
-              selected.set(item, idx + s.addedCount - s.removed.length);
-            } else {
-              // remove index
-              selected.set(item, -1);
-            }
-          });
-          for (let j=0; j<s.addedCount; j++) {
-            let idx = s.index + j;
-            if (selected.has(this.items[idx])) {
-              selected.set(this.items[idx], idx);
-            }
-          }
-        }
-        // Update linked paths
-        this.__updateLinks();
-        // Remove selected items that were removed from the items array
-        let sidx = 0;
-        selected.forEach((idx, item) => {
-          if (idx < 0) {
-            if (this.multi) {
-              this.splice('selected', sidx, 1);
-            } else {
-              this.selected = this.selectedItem = null;
-            }
-            selected.delete(item);
-          } else {
-            sidx++;
-          }
-        });
-      }
-
-      __updateLinks() {
-        this.__dataLinkedPaths = {};
-        if (this.multi) {
-          let sidx = 0;
-          this.__selectedMap.forEach(idx => {
-            if (idx >= 0) {
-              this.linkPaths('items.' + idx, 'selected.' + sidx++);
-            }
-          });
-        } else {
-          this.__selectedMap.forEach(idx => {
-            this.linkPaths('selected', 'items.' + idx);
-            this.linkPaths('selectedItem', 'items.' + idx);
-          });
-        }
-      }
-
-      /**
-       * Clears the selection state.
-       *
-       */
-      clearSelection() {
-        // Unbind previous selection
-        this.__dataLinkedPaths = {};
-        // The selected map stores 3 pieces of information:
-        // key: items array object
-        // value: items array index
-        // order: selected array index
-        this.__selectedMap = new Map();
-        // Initialize selection
-        this.selected = this.multi ? [] : null
-        this.selectedItem = null;
-      }
-
-      /**
-       * Returns whether the item is currently selected.
-       *
-       * @param {*} item Item from `items` array to test
-       * @return {boolean} Whether the item is selected
-       */
-      isSelected(item) {
-        return this.__selectedMap.has(item);
-      }
-
-      /**
-       * Returns whether the item is currently selected.
-       *
-       * @param {*} idx Index from `items` array to test
-       * @return {boolean} Whether the item is selected
-       */
-      isIndexSelected(idx) {
-        return this.isSelected(this.items[idx]);
-      }
-
-      __deselectChangedIdx(idx) {
-        let sidx = this.__selectedIndexForItemIndex(idx);
-        if (sidx >= 0) {
-          let i = 0;
-          this.__selectedMap.forEach((idx, item) => {
-            if (sidx == i++) {
-              this.deselect(item);
-            }
-          });
-        }
-      }
-
-      __selectedIndexForItemIndex(idx) {
-        let selected = this.__dataLinkedPaths['items.' + idx];
-        if (selected) {
-          return parseInt(selected.slice('selected.'.length), 10);
-        }
-      }
-
-      /**
-       * Deselects the given item if it is already selected.
-       *
-       * @param {*} item Item from `items` array to deselect
-       */
-      deselect(item) {
-        let idx = this.__selectedMap.get(item);
-        if (idx >= 0) {
-          this.__selectedMap.delete(item);
-          let sidx;
-          if (this.multi) {
-            sidx = this.__selectedIndexForItemIndex(idx);
-          }
-          this.__updateLinks();
-          if (this.multi) {
-            this.splice('selected', sidx, 1);
-          } else {
-            this.selected = this.selectedItem = null;
-          }
-        }
-      }
-
-      /**
-       * Deselects the given index if it is already selected.
-       *
-       * @param {number} idx Index from `items` array to deselect
-       */
-      deselectIndex(idx) {
-        this.deselect(this.items[idx]);
-      }
-
-      /**
-       * Selects the given item.  When `toggle` is true, this will automatically
-       * deselect the item if already selected.
-       *
-       * @param {*} item Item from `items` array to select
-       */
-      select(item) {
-        this.selectIndex(this.items.indexOf(item));
-      }
-
-      /**
-       * Selects the given index.  When `toggle` is true, this will automatically
-       * deselect the item if already selected.
-       *
-       * @param {number} idx Index from `items` array to select
-       */
-      selectIndex(idx) {
-        let item = this.items[idx];
-        if (!this.isSelected(item)) {
-          if (!this.multi) {
-            this.__selectedMap.clear();
-          }
-          this.__selectedMap.set(item, idx);
-          this.__updateLinks();
-          if (this.multi) {
-            this.push('selected', item);
-          } else {
-            this.selected = this.selectedItem = item;
-          }
-        } else if (this.toggle) {
-          this.deselectIndex(idx);
-        }
-      }
-
-    }
-
-    return ArraySelectorMixin;
-
-  });
-
-  // export mixin
-  Polymer.ArraySelectorMixin = ArraySelectorMixin;
-
-  /**
-   * @constructor
-   * @extends {Polymer.Element}
-   * @implements {Polymer_ArraySelectorMixin}
-   */
-  let baseArraySelector = ArraySelectorMixin(Polymer.Element);
-
-  /**
-   * Element implementing the `Polymer.ArraySelector` mixin, which records
-   * dynamic associations between item paths in a master `items` array and a
-   * `selected` array such that path changes to the master array (at the host)
-   * element or elsewhere via data-binding) are correctly propagated to items
-   * in the selected array and vice-versa.
-   *
-   * The `items` property accepts an array of user data, and via the
-   * `select(item)` and `deselect(item)` API, updates the `selected` property
-   * which may be bound to other parts of the application, and any changes to
-   * sub-fields of `selected` item(s) will be kept in sync with items in the
-   * `items` array.  When `multi` is false, `selected` is a property
-   * representing the last selected item.  When `multi` is true, `selected`
-   * is an array of multiply selected items.
-   *
-   * Example:
-   *
-   * ```html
-   * <dom-module id="employee-list">
-   *
-   *   <template>
-   *
-   *     <div> Employee list: </div>
-   *     <template is="dom-repeat" id="employeeList" items="{{employees}}">
-   *         <div>First name: <span>{{item.first}}</span></div>
-   *         <div>Last name: <span>{{item.last}}</span></div>
-   *         <button on-click="toggleSelection">Select</button>
-   *     </template>
-   *
-   *     <array-selector id="selector" items="{{employees}}" selected="{{selected}}" multi toggle></array-selector>
-   *
-   *     <div> Selected employees: </div>
-   *     <template is="dom-repeat" items="{{selected}}">
-   *         <div>First name: <span>{{item.first}}</span></div>
-   *         <div>Last name: <span>{{item.last}}</span></div>
-   *     </template>
-   *
-   *   </template>
-   *
-   * </dom-module>
-   * ```
-   *
-   * ```js
-   * Polymer({
-   *   is: 'employee-list',
-   *   ready() {
-   *     this.employees = [
-   *         {first: 'Bob', last: 'Smith'},
-   *         {first: 'Sally', last: 'Johnson'},
-   *         ...
-   *     ];
-   *   },
-   *   toggleSelection(e) {
-   *     let item = this.$.employeeList.itemForElement(e.target);
-   *     this.$.selector.select(item);
-   *   }
-   * });
-   * ```
-   *
-   * @polymerElement
-   * @extends Polymer.Element
-   * @mixes Polymer.ArraySelectorMixin
-   * @memberof Polymer
-   * @summary Custom element that links paths between an input `items` array and
-   *   an output `selected` item or array based on calls to its selection API.
-   */
-  class ArraySelector extends baseArraySelector {
-    // Not needed to find template; can be removed once the analyzer
-    // can find the tag name from customElements.define call
-    static get is() { return 'array-selector' }
-  }
-  customElements.define(ArraySelector.is, ArraySelector);
-  Polymer.ArraySelector = ArraySelector;
-
-})();
-
-</script>
diff --git a/src/main/resources/static/gltf-viewer/bower_components/polymer/lib/elements/custom-style.html b/src/main/resources/static/gltf-viewer/bower_components/polymer/lib/elements/custom-style.html
deleted file mode 100644 (file)
index 8aae908..0000000
+++ /dev/null
@@ -1,73 +0,0 @@
-<!--
-@license
-Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
-This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
-The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
-The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
-Code distributed by Google as part of the polymer project is also
-subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
--->
-<link rel="import" href="../../../shadycss/custom-style-interface.html">
-<link rel="import" href="../utils/style-gather.html">
-<script>
-(function() {
-  'use strict';
-
-  const attr = 'include';
-
-  const CustomStyleInterface = window.ShadyCSS.CustomStyleInterface;
-
-  /**
-   * Custom element for defining styles in the main document that can take
-   * advantage of several special features of Polymer's styling system:
-   *
-   * - Document styles defined in a custom-style are shimmed to ensure they
-   *   do not leak into local DOM when running on browsers without native
-   *   Shadow DOM.
-   * - Custom properties used by Polymer's shim for cross-scope styling may
-   *   be defined in an custom-style. Use the :root selector to define custom
-   *   properties that apply to all custom elements.
-   *
-   * To use, simply wrap an inline `<style>` tag in the main document whose
-   * CSS uses these features with a `<custom-style>` element.
-   *
-   * @extends HTMLElement
-   * @memberof Polymer
-   * @summary Custom element for defining styles in the main document that can
-   *   take advantage of Polymer's style scoping and custom properties shims.
-   */
-  class CustomStyle extends HTMLElement {
-    constructor() {
-      super();
-      this._style = null;
-      CustomStyleInterface.addCustomStyle(this);
-    }
-    /**
-     * Returns the light-DOM `<style>` child this element wraps.  Upon first
-     * call any style modules referenced via the `include` attribute will be
-     * concatenated to this element's `<style>`.
-     *
-     * @return {HTMLStyleElement} This element's light-DOM `<style>`
-     */
-    getStyle() {
-      if (this._style) {
-        return this._style;
-      }
-      const style = this.querySelector('style');
-      if (!style) {
-        return;
-      }
-      this._style = style;
-      const include = style.getAttribute(attr);
-      if (include) {
-        style.removeAttribute(attr);
-        style.textContent = Polymer.StyleGather.cssFromModules(include) + style.textContent;
-      }
-      return this._style;
-    }
-  }
-
-  window.customElements.define('custom-style', CustomStyle);
-  Polymer.CustomStyle = CustomStyle;
-})();
-</script>
diff --git a/src/main/resources/static/gltf-viewer/bower_components/polymer/lib/elements/dom-bind.html b/src/main/resources/static/gltf-viewer/bower_components/polymer/lib/elements/dom-bind.html
deleted file mode 100644 (file)
index 436791d..0000000
+++ /dev/null
@@ -1,121 +0,0 @@
-<!--
-@license
-Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
-This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
-The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
-The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
-Code distributed by Google as part of the polymer project is also
-subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
--->
-
-<link rel="import" href="../utils/boot.html">
-<link rel="import" href="../mixins/property-effects.html">
-<link rel="import" href="../mixins/mutable-data.html">
-<link rel="import" href="../mixins/gesture-event-listeners.html">
-
-<script>
-
-  (function() {
-    'use strict';
-
-    /**
-     * @constructor
-     * @implements {Polymer_PropertyEffects}
-     * @implements {Polymer_OptionalMutableData}
-     * @implements {Polymer_GestureEventListener}
-     * @extends {HTMLElement}
-     */
-    const domBindBase =
-      Polymer.GestureEventListeners(
-        Polymer.OptionalMutableData(
-          Polymer.PropertyEffects(HTMLElement)));
-
-    /**
-     * Custom element to allow using Polymer's template features (data binding,
-     * declarative event listeners, etc.) in the main document without defining
-     * a new custom element.
-     *
-     * `<template>` tags utilizing bindings may be wrapped with the `<dom-bind>`
-     * element, which will immediately stamp the wrapped template into the main
-     * document and bind elements to the `dom-bind` element itself as the
-     * binding scope.
-     *
-     * @extends HTMLElement
-     * @mixes Polymer.PropertyEffects
-     * @memberof Polymer
-     * @summary Custom element to allow using Polymer's template features (data
-     *   binding, declarative event listeners, etc.) in the main document.
-     */
-    class DomBind extends domBindBase {
-
-      static get observedAttributes() { return ['mutable-data'] }
-
-      // assumes only one observed attribute
-      attributeChangedCallback() {
-        this.mutableData = true;
-      }
-
-      connectedCallback() {
-        this.render();
-      }
-
-      disconnectedCallback() {
-        this.__removeChildren();
-      }
-
-      __insertChildren() {
-        this.parentNode.insertBefore(this.root, this);
-      }
-
-      __removeChildren() {
-        if (this.__children) {
-          for (let i=0; i<this.__children.length; i++) {
-            this.root.appendChild(this.__children[i]);
-          }
-        }
-      }
-
-      /**
-       * Forces the element to render its content. This is typically only
-       * necessary to call if HTMLImports with the async attribute are used.
-       */
-      render() {
-        let template;
-        if (!this.__children) {
-          template = template || this.querySelector('template');
-          if (!template) {
-            // Wait until childList changes and template should be there by then
-            let observer = new MutationObserver(() => {
-              template = this.querySelector('template');
-              if (template) {
-                observer.disconnect();
-                this.render(template);
-              } else {
-                throw new Error('dom-bind requires a <template> child');
-              }
-            })
-            observer.observe(this, {childList: true});
-            return;
-          }
-          this.root = this._stampTemplate(template);
-          this.$ = this.root.$;
-          this.__children = [];
-          for (let n=this.root.firstChild; n; n=n.nextSibling) {
-            this.__children[this.__children.length] = n;
-          }
-          this._flushProperties();
-        }
-        this.__insertChildren();
-        this.dispatchEvent(new CustomEvent('dom-change', {
-          bubbles: true,
-          composed: true
-        }));
-      }
-
-    }
-
-    customElements.define('dom-bind', DomBind);
-
-  })();
-
-</script>
diff --git a/src/main/resources/static/gltf-viewer/bower_components/polymer/lib/elements/dom-if.html b/src/main/resources/static/gltf-viewer/bower_components/polymer/lib/elements/dom-if.html
deleted file mode 100644 (file)
index 842e5a6..0000000
+++ /dev/null
@@ -1,265 +0,0 @@
-<!--
-@license
-Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
-This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
-The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
-The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
-Code distributed by Google as part of the polymer project is also
-subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
--->
-
-<link rel="import" href="../../polymer-element.html">
-<link rel="import" href="../utils/templatize.html">
-<link rel="import" href="../utils/debounce.html">
-<link rel="import" href="../utils/flush.html">
-
-<script>
-
-(function() {
-  'use strict';
-
-  /**
-   * The `<dom-if>` element will stamp a light-dom `<template>` child when
-   * the `if` property becomes truthy, and the template can use Polymer
-   * data-binding and declarative event features when used in the context of
-   * a Polymer element's template.
-   *
-   * When `if` becomes falsey, the stamped content is hidden but not
-   * removed from dom. When `if` subsequently becomes truthy again, the content
-   * is simply re-shown. This approach is used due to its favorable performance
-   * characteristics: the expense of creating template content is paid only
-   * once and lazily.
-   *
-   * Set the `restamp` property to true to force the stamped content to be
-   * created / destroyed when the `if` condition changes.
-   *
-   * @polymerElement
-   * @extends Polymer.Element
-   * @memberof Polymer
-   * @summary Custom element that conditionally stamps and hides or removes
-   *   template content based on a boolean flag.
-   */
-  class DomIf extends Polymer.Element {
-
-    // Not needed to find template; can be removed once the analyzer
-    // can find the tag name from customElements.define call
-    static get is() { return 'dom-if'; }
-
-    static get template() { return null; }
-
-    static get properties() {
-
-      return {
-
-        /**
-         * Fired whenever DOM is added or removed/hidden by this template (by
-         * default, rendering occurs lazily).  To force immediate rendering, call
-         * `render`.
-         *
-         * @event dom-change
-         */
-
-        /**
-         * A boolean indicating whether this template should stamp.
-         */
-        if: {
-          type: Boolean,
-          observer: '__debounceRender'
-        },
-
-        /**
-         * When true, elements will be removed from DOM and discarded when `if`
-         * becomes false and re-created and added back to the DOM when `if`
-         * becomes true.  By default, stamped elements will be hidden but left
-         * in the DOM when `if` becomes false, which is generally results
-         * in better performance.
-         */
-        restamp: {
-          type: Boolean,
-          observer: '__debounceRender'
-        }
-
-      }
-
-    }
-
-    constructor() {
-      super();
-      this.__renderDebouncer = null;
-      this.__invalidProps = null;
-      this.__instance = null;
-    }
-
-    __debounceRender() {
-      // Render is async for 2 reasons:
-      // 1. To eliminate dom creation trashing if user code thrashes `if` in the
-      //    same turn. This was more common in 1.x where a compound computed
-      //    property could result in the result changing multiple times, but is
-      //    mitigated to a large extent by batched property processing in 2.x.
-      // 2. To avoid double object propagation when a bag including values bound
-      //    to the `if` property as well as one or more hostProps could enqueue
-      //    the <dom-if> to flush before the <template>'s host property
-      //    forwarding. In that scenario creating an instance would result in
-      //    the host props being set once, and then the enqueued changes on the
-      //    template would set properties a second time, potentially causing an
-      //    object to be set to an instance more than once.  Creating the
-      //    instance async from flushing data ensures this doesn't happen. If
-      //    we wanted a sync option in the future, simply having <dom-if> flush
-      //    (or clear) its template's pending host properties before creating
-      //    the instance would also avoid the problem.
-      this.__renderDebouncer = Polymer.Debouncer.debounce(
-            this.__renderDebouncer
-          , Polymer.Async.microTask
-          , () => this.__render());
-      Polymer.enqueueDebouncer(this.__renderDebouncer);
-    }
-
-    disconnectedCallback() {
-      super.disconnectedCallback();
-      if (!this.parentNode ||
-          (this.parentNode.nodeType == Node.DOCUMENT_FRAGMENT_NODE &&
-           !this.parentNode.host)) {
-        this.__teardownInstance();
-      }
-    }
-
-    connectedCallback() {
-      super.connectedCallback();
-      if (this.if) {
-        this.__debounceRender();
-      }
-    }
-
-    /**
-     * Forces the element to render its content. Normally rendering is
-     * asynchronous to a provoking change. This is done for efficiency so
-     * that multiple changes trigger only a single render. The render method
-     * should be called if, for example, template rendering is required to
-     * validate application state.
-     */
-    render() {
-      Polymer.flush();
-    }
-
-    __render() {
-      if (this.if) {
-        if (!this.__ensureInstance()) {
-          // No template found yet
-          return;
-        }
-        this._showHideChildren();
-      } else if (this.restamp) {
-        this.__teardownInstance();
-      }
-      if (!this.restamp && this.__instance) {
-        this._showHideChildren();
-      }
-      if (this.if != this._lastIf) {
-        this.dispatchEvent(new CustomEvent('dom-change', {
-          bubbles: true,
-          composed: true
-        }));
-        this._lastIf = this.if;
-      }
-    }
-
-    __ensureInstance() {
-      let parentNode = this.parentNode;
-      // Guard against element being detached while render was queued
-      if (parentNode) {
-        if (!this.__ctor) {
-          let template = this.querySelector('template');
-          if (!template) {
-            // Wait until childList changes and template should be there by then
-            let observer = new MutationObserver(() => {
-              if (this.querySelector('template')) {
-                observer.disconnect();
-                this.__render();
-              } else {
-                throw new Error('dom-if requires a <template> child');
-              }
-            })
-            observer.observe(this, {childList: true});
-            return false;
-          }
-          this.__ctor = Polymer.Templatize.templatize(template, this, {
-            // dom-if templatizer instances require `mutable: true`, as
-            // `__syncHostProperties` relies on that behavior to sync objects
-            mutableData: true,
-            forwardHostProp: function(prop, value) {
-              if (this.__instance) {
-                if (this.if) {
-                  this.__instance.forwardHostProp(prop, value);
-                } else {
-                  // If we have an instance but are squelching host property
-                  // forwarding due to if being false, note the invalidated
-                  // properties so `__syncHostProperties` can sync them the next
-                  // time `if` becomes true
-                  this.__invalidProps = this.__invalidProps || Object.create(null);
-                  this.__invalidProps[Polymer.Path.root(prop)] = true;
-                }
-              }
-            }
-          });
-        }
-        if (!this.__instance) {
-          this.__instance = new this.__ctor();
-          parentNode.insertBefore(this.__instance.root, this);
-        } else {
-          this.__syncHostProperties();
-          let c$ = this.__instance.children;
-          if (c$ && c$.length) {
-            // Detect case where dom-if was re-attached in new position
-            let lastChild = this.previousSibling;
-            if (lastChild !== c$[c$.length-1]) {
-              for (let i=0, n; (i<c$.length) && (n=c$[i]); i++) {
-                parentNode.insertBefore(n, this);
-              }
-            }
-          }
-        }
-      }
-      return true;
-    }
-
-    __syncHostProperties() {
-      let props = this.__invalidProps;
-      if (props) {
-        for (let prop in props) {
-          this.__instance._setPendingProperty(prop, this.__dataHost[prop]);
-        }
-        this.__invalidProps = null;
-        this.__instance._flushProperties();
-      }
-    }
-
-    __teardownInstance() {
-      if (this.__instance) {
-        let c$ = this.__instance.children;
-        if (c$ && c$.length) {
-          // use first child parent, for case when dom-if may have been detached
-          let parent = c$[0].parentNode;
-          for (let i=0, n; (i<c$.length) && (n=c$[i]); i++) {
-            parent.removeChild(n);
-          }
-        }
-        this.__instance = null;
-        this.__invalidProps = null;
-      }
-    }
-
-    _showHideChildren() {
-      let hidden = this.__hideTemplateChildren__ || !this.if;
-      if (this.__instance) {
-        this.__instance._showHideChildren(hidden);
-      }
-    }
-
-  }
-
-  customElements.define(DomIf.is, DomIf);
-
-  Polymer.DomIf = DomIf;
-
-})();
-</script>
diff --git a/src/main/resources/static/gltf-viewer/bower_components/polymer/lib/elements/dom-module.html b/src/main/resources/static/gltf-viewer/bower_components/polymer/lib/elements/dom-module.html
deleted file mode 100644 (file)
index 99edb7f..0000000
+++ /dev/null
@@ -1,134 +0,0 @@
-<!--
-@license
-Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
-This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
-The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
-The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
-Code distributed by Google as part of the polymer project is also
-subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
--->
-<link rel="import" href="../utils/boot.html">
-<link rel="import" href="../utils/resolve-url.html">
-<script>
-(function() {
-  'use strict';
-
-  let modules = {};
-  let lcModules = {};
-  function findModule(id) {
-    return modules[id] || lcModules[id.toLowerCase()];
-  }
-
-  function styleOutsideTemplateCheck(inst) {
-    if (inst.querySelector('style')) {
-      console.warn('dom-module %s has style outside template', inst.id);
-    }
-  }
-
-  /**
-   * The `dom-module` element registers the dom it contains to the name given
-   * by the module's id attribute. It provides a unified database of dom
-   * accessible via its static `import` API.
-   *
-   * A key use case of `dom-module` is for providing custom element `<template>`s
-   * via HTML imports that are parsed by the native HTML parser, that can be
-   * relocated during a bundling pass and still looked up by `id`.
-   *
-   * Example:
-   *
-   *     <dom-module id="foo">
-   *       <img src="stuff.png">
-   *     </dom-module>
-   *
-   * Then in code in some other location that cannot access the dom-module above
-   *
-   *     let img = document.createElement('dom-module').import('foo', 'img');
-   *
-   * @extends HTMLElement
-   * @memberof Polymer
-   * @summary Custom element that provides a registry of relocatable DOM content
-   *   by `id` that is agnostic to bundling.
-   */
-  class DomModule extends HTMLElement {
-
-    static get observedAttributes() { return ['id'] }
-
-    /**
-     * Retrieves the element specified by the css `selector` in the module
-     * registered by `id`. For example, this.import('foo', 'img');
-     * @param {string} id The id of the dom-module in which to search.
-     * @param {string=} selector The css selector by which to find the element.
-     * @return {Element} Returns the element which matches `selector` in the
-     * module registered at the specified `id`.
-     */
-    static import(id, selector) {
-      if (id) {
-        let m = findModule(id);
-        if (m && selector) {
-          return m.querySelector(selector);
-        }
-        return m;
-      }
-      return null;
-    }
-
-    attributeChangedCallback(name, old, value) {
-      if (old !== value) {
-        this.register();
-      }
-    }
-
-    /**
-     * The absolute URL of the original location of this `dom-module`.
-     *
-     * This value will differ from this element's `ownerDocument` in the
-     * following ways:
-     * - Takes into account any `assetpath` attribute added during bundling
-     *   to indicate the original location relative to the bundled location
-     * - Uses the HTMLImports polyfill's `importForElement` API to ensure
-     *   the path is relative to the import document's location since
-     *   `ownerDocument` is not currently polyfilled
-     */
-    get assetpath() {
-      // Don't override existing assetpath.
-      if (!this.__assetpath) {
-        // note: assetpath set via an attribute must be relative to this
-        // element's location; accomodate polyfilled HTMLImports
-        const owner = window.HTMLImports && HTMLImports.importForElement ?
-          HTMLImports.importForElement(this) || document : this.ownerDocument;
-        const url = Polymer.ResolveUrl.resolveUrl(
-          this.getAttribute('assetpath') || '', owner.baseURI);
-        this.__assetpath = Polymer.ResolveUrl.pathFromUrl(url);
-      }
-      return this.__assetpath;
-    }
-
-    /**
-     * Registers the dom-module at a given id. This method should only be called
-     * when a dom-module is imperatively created. For
-     * example, `document.createElement('dom-module').register('foo')`.
-     * @param {string=} id The id at which to register the dom-module.
-     */
-    register(id) {
-      id = id || this.id;
-      if (id) {
-        this.id = id;
-        // store id separate from lowercased id so that
-        // in all cases mixedCase id will stored distinctly
-        // and lowercase version is a fallback
-        modules[id] = this;
-        lcModules[id.toLowerCase()] = this;
-        styleOutsideTemplateCheck(this);
-      }
-    }
-  }
-
-  DomModule.prototype['modules'] = modules;
-
-  customElements.define('dom-module', DomModule);
-
-  // export
-  Polymer.DomModule = DomModule;
-
-})();
-</script>
diff --git a/src/main/resources/static/gltf-viewer/bower_components/polymer/lib/elements/dom-repeat.html b/src/main/resources/static/gltf-viewer/bower_components/polymer/lib/elements/dom-repeat.html
deleted file mode 100644 (file)
index 6969014..0000000
+++ /dev/null
@@ -1,687 +0,0 @@
-<!--
-@license
-Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
-This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
-The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
-The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
-Code distributed by Google as part of the polymer project is also
-subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
--->
-
-<link rel="import" href="../../polymer-element.html">
-<link rel="import" href="../utils/templatize.html">
-<link rel="import" href="../utils/debounce.html">
-<link rel="import" href="../utils/flush.html">
-<link rel="import" href="../mixins/mutable-data.html">
-
-<script>
-(function() {
-  'use strict';
-
-  /**
-   * @constructor
-   * @implements {Polymer_OptionalMutableData}
-   * @extends {Polymer.Element}
-   */
-  const domRepeatBase = Polymer.OptionalMutableData(Polymer.Element);
-
-  /**
-   * The `<dom-repeat>` element will automatically stamp and binds one instance
-   * of template content to each object in a user-provided array.
-   * `dom-repeat` accepts an `items` property, and one instance of the template
-   * is stamped for each item into the DOM at the location of the `dom-repeat`
-   * element.  The `item` property will be set on each instance's binding
-   * scope, thus templates should bind to sub-properties of `item`.
-   *
-   * Example:
-   *
-   * ```html
-   * <dom-module id="employee-list">
-   *
-   *   <template>
-   *
-   *     <div> Employee list: </div>
-   *     <template is="dom-repeat" items="{{employees}}">
-   *         <div>First name: <span>{{item.first}}</span></div>
-   *         <div>Last name: <span>{{item.last}}</span></div>
-   *     </template>
-   *
-   *   </template>
-   *
-   *   <script>
-   *     Polymer({
-   *       is: 'employee-list',
-   *       ready: function() {
-   *         this.employees = [
-   *             {first: 'Bob', last: 'Smith'},
-   *             {first: 'Sally', last: 'Johnson'},
-   *             ...
-   *         ];
-   *       }
-   *     });
-   *   < /script>
-   *
-   * </dom-module>
-   * ```
-   *
-   * Notifications for changes to items sub-properties will be forwarded to template
-   * instances, which will update via the normal structured data notification system.
-   *
-   * Mutations to the `items` array itself should me made using the Array
-   * mutation API's on `Polymer.Base` (`push`, `pop`, `splice`, `shift`,
-   * `unshift`), and template instances will be kept in sync with the data in the
-   * array.
-   *
-   * Events caught by event handlers within the `dom-repeat` template will be
-   * decorated with a `model` property, which represents the binding scope for
-   * each template instance.  The model is an instance of Polymer.Base, and should
-   * be used to manipulate data on the instance, for example
-   * `event.model.set('item.checked', true);`.
-   *
-   * Alternatively, the model for a template instance for an element stamped by
-   * a `dom-repeat` can be obtained using the `modelForElement` API on the
-   * `dom-repeat` that stamped it, for example
-   * `this.$.domRepeat.modelForElement(event.target).set('item.checked', true);`.
-   * This may be useful for manipulating instance data of event targets obtained
-   * by event handlers on parents of the `dom-repeat` (event delegation).
-   *
-   * A view-specific filter/sort may be applied to each `dom-repeat` by supplying a
-   * `filter` and/or `sort` property.  This may be a string that names a function on
-   * the host, or a function may be assigned to the property directly.  The functions
-   * should implemented following the standard `Array` filter/sort API.
-   *
-   * In order to re-run the filter or sort functions based on changes to sub-fields
-   * of `items`, the `observe` property may be set as a space-separated list of
-   * `item` sub-fields that should cause a re-filter/sort when modified.  If
-   * the filter or sort function depends on properties not contained in `items`,
-   * the user should observe changes to those properties and call `render` to update
-   * the view based on the dependency change.
-   *
-   * For example, for an `dom-repeat` with a filter of the following:
-   *
-   * ```js
-   * isEngineer: function(item) {
-   *     return item.type == 'engineer' || item.manager.type == 'engineer';
-   * }
-   * ```
-   *
-   * Then the `observe` property should be configured as follows:
-   *
-   * ```html
-   * <template is="dom-repeat" items="{{employees}}"
-   *           filter="isEngineer" observe="type manager.type">
-   * ```
-   *
-   * @polymerElement
-   * @memberof Polymer
-   * @extends Polymer.Element
-   * @mixes Polymer.MutableData
-   * @summary Custom element for stamping instance of a template bound to
-   *   items in an array.
-   */
-  class DomRepeat extends domRepeatBase {
-
-    // Not needed to find template; can be removed once the analyzer
-    // can find the tag name from customElements.define call
-    static get is() { return 'dom-repeat'; }
-
-    static get template() { return null; }
-
-    static get properties() {
-
-      /**
-       * Fired whenever DOM is added or removed by this template (by
-       * default, rendering occurs lazily).  To force immediate rendering, call
-       * `render`.
-       *
-       * @event dom-change
-       */
-      return {
-
-        /**
-         * An array containing items determining how many instances of the template
-         * to stamp and that that each template instance should bind to.
-         */
-        items: {
-          type: Array
-        },
-
-        /**
-         * The name of the variable to add to the binding scope for the array
-         * element associated with a given template instance.
-         */
-        as: {
-          type: String,
-          value: 'item'
-        },
-
-        /**
-         * The name of the variable to add to the binding scope with the index
-         * for the inst.  If `sort` is provided, the index will reflect the
-         * sorted order (rather than the original array order).
-         */
-        indexAs: {
-          type: String,
-          value: 'index'
-        },
-
-        /**
-         * The name of the variable to add to the binding scope with the index
-         * for the inst.  If `sort` is provided, the index will reflect the
-         * sorted order (rather than the original array order).
-         */
-        itemsIndexAs: {
-          type: String,
-          value: 'itemsIndex'
-        },
-
-        /**
-         * A function that should determine the sort order of the items.  This
-         * property should either be provided as a string, indicating a method
-         * name on the element's host, or else be an actual function.  The
-         * function should match the sort function passed to `Array.sort`.
-         * Using a sort function has no effect on the underlying `items` array.
-         */
-        sort: {
-          type: Function,
-          observer: '__sortChanged'
-        },
-
-        /**
-         * A function that can be used to filter items out of the view.  This
-         * property should either be provided as a string, indicating a method
-         * name on the element's host, or else be an actual function.  The
-         * function should match the sort function passed to `Array.filter`.
-         * Using a filter function has no effect on the underlying `items` array.
-         */
-        filter: {
-          type: Function,
-          observer: '__filterChanged'
-        },
-
-        /**
-         * When using a `filter` or `sort` function, the `observe` property
-         * should be set to a space-separated list of the names of item
-         * sub-fields that should trigger a re-sort or re-filter when changed.
-         * These should generally be fields of `item` that the sort or filter
-         * function depends on.
-         */
-        observe: {
-          type: String,
-          observer: '__observeChanged'
-        },
-
-        /**
-         * When using a `filter` or `sort` function, the `delay` property
-         * determines a debounce time after a change to observed item
-         * properties that must pass before the filter or sort is re-run.
-         * This is useful in rate-limiting shuffing of the view when
-         * item changes may be frequent.
-         */
-        delay: Number,
-
-        /**
-         * Count of currently rendered items after `filter` (if any) has been applied.
-         * If "chunking mode" is enabled, `renderedItemCount` is updated each time a
-         * set of template instances is rendered.
-         *
-         */
-        renderedItemCount: {
-          type: Number,
-          notify: true,
-          readOnly: true
-        },
-
-        /**
-         * Defines an initial count of template instances to render after setting
-         * the `items` array, before the next paint, and puts the `dom-repeat`
-         * into "chunking mode".  The remaining items will be created and rendered
-         * incrementally at each animation frame therof until all instances have
-         * been rendered.
-         */
-        initialCount: {
-          type: Number,
-          observer: '__initializeChunking'
-        },
-
-        /**
-         * When `initialCount` is used, this property defines a frame rate to
-         * target by throttling the number of instances rendered each frame to
-         * not exceed the budget for the target frame rate.  Setting this to a
-         * higher number will allow lower latency and higher throughput for
-         * things like event handlers, but will result in a longer time for the
-         * remaining items to complete rendering.
-         */
-        targetFramerate: {
-          type: Number,
-          value: 20
-        },
-
-        _targetFrameTime: {
-          type: Number,
-          computed: '__computeFrameTime(targetFramerate)'
-        }
-
-      }
-
-    }
-
-    static get observers() {
-      return [ '__itemsChanged(items.*)' ]
-    }
-
-    constructor() {
-      super();
-      this.__instances = [];
-      this.__limit = Infinity;
-      this.__pool = [];
-      this.__renderDebouncer = null;
-      this.__itemsIdxToInstIdx = {};
-      this.__chunkCount = null;
-      this.__lastChunkTime = null;
-      this.__needFullRefresh = false;
-      this.__sortFn = null;
-      this.__filterFn = null;
-      this.__observePaths = null;
-      this.__ctor = null;
-    }
-
-    disconnectedCallback() {
-      super.disconnectedCallback();
-      this.__isDetached = true;
-      for (let i=0; i<this.__instances.length; i++) {
-        this.__detachInstance(i);
-      }
-    }
-
-    connectedCallback() {
-      super.connectedCallback();
-      // only perform attachment if the element was previously detached.
-      if (this.__isDetached) {
-        this.__isDetached = false;
-        let parent = this.parentNode;
-        for (let i=0; i<this.__instances.length; i++) {
-          this.__attachInstance(i, parent);
-        }
-      }
-    }
-
-    __ensureTemplatized() {
-      // Templatizing (generating the instance constructor) needs to wait
-      // until ready, since won't have its template content handed back to
-      // it until then
-      if (!this.__ctor) {
-        let template = this.template = this.querySelector('template');
-        if (!template) {
-          // // Wait until childList changes and template should be there by then
-          let observer = new MutationObserver(() => {
-            if (this.querySelector('template')) {
-              observer.disconnect();
-              this.__render();
-            } else {
-              throw new Error('dom-repeat requires a <template> child');
-            }
-          })
-          observer.observe(this, {childList: true});
-          return false;
-        }
-        // Template instance props that should be excluded from forwarding
-        let instanceProps = {};
-        instanceProps[this.as] = true;
-        instanceProps[this.indexAs] = true;
-        instanceProps[this.itemsIndexAs] = true;
-        this.__ctor = Polymer.Templatize.templatize(template, this, {
-          mutableData: this.mutableData,
-          parentModel: true,
-          instanceProps: instanceProps,
-          forwardHostProp: function(prop, value) {
-            let i$ = this.__instances;
-            for (let i=0, inst; (i<i$.length) && (inst=i$[i]); i++) {
-              inst.forwardHostProp(prop, value);
-            }
-          },
-          notifyInstanceProp: function(inst, prop, value) {
-            if (Polymer.Path.matches(this.as, prop)) {
-              let idx = inst[this.itemsIndexAs];
-              if (prop == this.as) {
-                this.items[idx] = value;
-              }
-              let path = Polymer.Path.translate(this.as, 'items.' + idx, prop);
-              this.notifyPath(path, value);
-            }
-          }
-        });
-      }
-      return true;
-    }
-
-    __getMethodHost() {
-      // Technically this should be the owner of the outermost template.
-      // In shadow dom, this is always getRootNode().host, but we can
-      // approximate this via cooperation with our dataHost always setting
-      // `_methodHost` as long as there were bindings (or id's) on this
-      // instance causing it to get a dataHost.
-      return this.__dataHost._methodHost || this.__dataHost;
-    }
-
-    __sortChanged(sort) {
-      let methodHost = this.__getMethodHost();
-      this.__sortFn = sort && (typeof sort == 'function' ? sort :
-        function() { return methodHost[sort].apply(methodHost, arguments); });
-      this.__needFullRefresh = true;
-      if (this.items) {
-        this.__debounceRender(this.__render);
-      }
-    }
-
-    __filterChanged(filter) {
-      let methodHost = this.__getMethodHost();
-      this.__filterFn = filter && (typeof filter == 'function' ? filter :
-        function() { return methodHost[filter].apply(methodHost, arguments); });
-      this.__needFullRefresh = true;
-      if (this.items) {
-        this.__debounceRender(this.__render);
-      }
-    }
-
-    __computeFrameTime(rate) {
-      return Math.ceil(1000/rate);
-    }
-
-    __initializeChunking() {
-      if (this.initialCount) {
-        this.__limit = this.initialCount;
-        this.__chunkCount = this.initialCount;
-        this.__lastChunkTime = performance.now();
-      }
-    }
-
-    __tryRenderChunk() {
-      // Debounced so that multiple calls through `_render` between animation
-      // frames only queue one new rAF (e.g. array mutation & chunked render)
-      if (this.items && this.__limit < this.items.length) {
-        this.__debounceRender(this.__requestRenderChunk);
-      }
-    }
-
-    __requestRenderChunk() {
-      requestAnimationFrame(()=>this.__renderChunk());
-    }
-
-    __renderChunk() {
-      // Simple auto chunkSize throttling algorithm based on feedback loop:
-      // measure actual time between frames and scale chunk count by ratio
-      // of target/actual frame time
-      let currChunkTime = performance.now();
-      let ratio = this._targetFrameTime / (currChunkTime - this.__lastChunkTime);
-      this.__chunkCount = Math.round(this.__chunkCount * ratio) || 1;
-      this.__limit += this.__chunkCount;
-      this.__lastChunkTime = currChunkTime;
-      this.__debounceRender(this.__render);
-    }
-
-    __observeChanged() {
-      this.__observePaths = this.observe &&
-        this.observe.replace('.*', '.').split(' ');
-    }
-
-    __itemsChanged(change) {
-      if (this.items && !Array.isArray(this.items)) {
-        console.warn('dom-repeat expected array for `items`, found', this.items);
-      }
-      // If path was to an item (e.g. 'items.3' or 'items.3.foo'), forward the
-      // path to that instance synchronously (retuns false for non-item paths)
-      if (!this.__handleItemPath(change.path, change.value)) {
-        // Otherwise, the array was reset ('items') or spliced ('items.splices'),
-        // so queue a full refresh
-        this.__needFullRefresh = true;
-        this.__initializeChunking();
-        this.__debounceRender(this.__render);
-      }
-    }
-
-    __handleObservedPaths(path) {
-      if (this.__observePaths) {
-        path = path.substring(path.indexOf('.') + 1);
-        let paths = this.__observePaths;
-        for (let i=0; i<paths.length; i++) {
-          if (path.indexOf(paths[i]) === 0) {
-            this.__needFullRefresh = true;
-            this.__debounceRender(this.__render, this.delay);
-            return true;
-          }
-        }
-      }
-    }
-
-    /**
-     * @param {function()} fn Function to debounce.
-     * @param {number=} delay Delay in ms to debounce by.
-     */
-    __debounceRender(fn, delay) {
-      this.__renderDebouncer = Polymer.Debouncer.debounce(
-            this.__renderDebouncer
-          , delay > 0 ? Polymer.Async.timeOut.after(delay) : Polymer.Async.microTask
-          , fn.bind(this));
-      Polymer.enqueueDebouncer(this.__renderDebouncer);
-    }
-
-    /**
-     * Forces the element to render its content. Normally rendering is
-     * asynchronous to a provoking change. This is done for efficiency so
-     * that multiple changes trigger only a single render. The render method
-     * should be called if, for example, template rendering is required to
-     * validate application state.
-     */
-    render() {
-      // Queue this repeater, then flush all in order
-      this.__needFullRefresh = true;
-      this.__debounceRender(this.__render);
-      Polymer.flush();
-    }
-
-    __render() {
-      if (!this.__ensureTemplatized()) {
-        // No template found yet
-        return;
-      }
-      this.__applyFullRefresh();
-      // Reset the pool
-      // TODO(kschaaf): Reuse pool across turns and nested templates
-      // Now that objects/arrays are re-evaluated when set, we can safely
-      // reuse pooled instances across turns, however we still need to decide
-      // semantics regarding how long to hold, how many to hold, etc.
-      this.__pool.length = 0;
-      // Set rendered item count
-      this._setRenderedItemCount(this.__instances.length);
-      // Notify users
-      this.dispatchEvent(new CustomEvent('dom-change', {
-        bubbles: true,
-        composed: true
-      }));
-      // Check to see if we need to render more items
-      this.__tryRenderChunk();
-    }
-
-    __applyFullRefresh() {
-      const items = this.items || [];
-      let isntIdxToItemsIdx = new Array(items.length);
-      for (let i=0; i<items.length; i++) {
-        isntIdxToItemsIdx[i] = i;
-      }
-      // Apply user filter
-      if (this.__filterFn) {
-        isntIdxToItemsIdx = isntIdxToItemsIdx.filter((i, idx, array) =>
-          this.__filterFn(items[i], idx, array));
-      }
-      // Apply user sort
-      if (this.__sortFn) {
-        isntIdxToItemsIdx.sort((a, b) => this.__sortFn(items[a], items[b]));
-      }
-      // items->inst map kept for item path forwarding
-      const itemsIdxToInstIdx = this.__itemsIdxToInstIdx = {};
-      let instIdx = 0;
-      // Generate instances and assign items
-      const limit = Math.min(isntIdxToItemsIdx.length, this.__limit);
-      for (; instIdx<limit; instIdx++) {
-        let inst = this.__instances[instIdx];
-        let itemIdx = isntIdxToItemsIdx[instIdx];
-        let item = items[itemIdx];
-        itemsIdxToInstIdx[itemIdx] = instIdx;
-        if (inst && instIdx < this.__limit) {
-          inst._setPendingProperty(this.as, item);
-          inst._setPendingProperty(this.indexAs, instIdx);
-          inst._setPendingProperty(this.itemsIndexAs, itemIdx);
-          inst._flushProperties();
-        } else {
-          this.__insertInstance(item, instIdx, itemIdx);
-        }
-      }
-      // Remove any extra instances from previous state
-      for (let i=this.__instances.length-1; i>=instIdx; i--) {
-        this.__detachAndRemoveInstance(i);
-      }
-    }
-
-    __detachInstance(idx) {
-      let inst = this.__instances[idx];
-      for (let i=0; i<inst.children.length; i++) {
-        let el = inst.children[i];
-        inst.root.appendChild(el);
-      }
-      return inst;
-    }
-
-    __attachInstance(idx, parent) {
-      let inst = this.__instances[idx];
-      parent.insertBefore(inst.root, this);
-    }
-
-    __detachAndRemoveInstance(idx) {
-      let inst = this.__detachInstance(idx);
-      if (inst) {
-        this.__pool.push(inst);
-      }
-      this.__instances.splice(idx, 1);
-    }
-
-    __stampInstance(item, instIdx, itemIdx) {
-      let model = {};
-      model[this.as] = item;
-      model[this.indexAs] = instIdx;
-      model[this.itemsIndexAs] = itemIdx;
-      return new this.__ctor(model);
-    }
-
-    __insertInstance(item, instIdx, itemIdx) {
-      let inst = this.__pool.pop();
-      if (inst) {
-        // TODO(kschaaf): If the pool is shared across turns, hostProps
-        // need to be re-set to reused instances in addition to item
-        inst._setPendingProperty(this.as, item);
-        inst._setPendingProperty(this.indexAs, instIdx);
-        inst._setPendingProperty(this.itemsIndexAs, itemIdx);
-        inst._flushProperties();
-      } else {
-        inst = this.__stampInstance(item, instIdx, itemIdx);
-      }
-      let beforeRow = this.__instances[instIdx + 1];
-      let beforeNode = beforeRow ? beforeRow.children[0] : this;
-      this.parentNode.insertBefore(inst.root, beforeNode);
-      this.__instances[instIdx] = inst;
-      return inst;
-    }
-
-    // Implements extension point from Templatize mixin
-    _showHideChildren(hidden) {
-      for (let i=0; i<this.__instances.length; i++) {
-        this.__instances[i]._showHideChildren(hidden);
-      }
-    }
-
-    // Called as a side effect of a host items.<key>.<path> path change,
-    // responsible for notifying item.<path> changes to inst for key
-    __handleItemPath(path, value) {
-      let itemsPath = path.slice(6); // 'items.'.length == 6
-      let dot = itemsPath.indexOf('.');
-      let itemsIdx = dot < 0 ? itemsPath : itemsPath.substring(0, dot);
-      // If path was index into array...
-      if (itemsIdx == parseInt(itemsIdx, 10)) {
-        let itemSubPath = dot < 0 ? '' : itemsPath.substring(dot+1);
-        // See if the item subpath should trigger a full refresh...
-        if (!this.__handleObservedPaths(itemSubPath)) {
-          // If not, forward to the instance for that index
-          let instIdx = this.__itemsIdxToInstIdx[itemsIdx];
-          let inst = this.__instances[instIdx];
-          if (inst) {
-            let itemPath = this.as + (itemSubPath ? '.' + itemSubPath : '');
-            // This is effectively `notifyPath`, but avoids some of the overhead
-            // of the public API
-            inst._setPendingPropertyOrPath(itemPath, value, false, true);
-            inst._flushProperties();
-          }
-        }
-        return true;
-      }
-    }
-
-    /**
-     * Returns the item associated with a given element stamped by
-     * this `dom-repeat`.
-     *
-     * Note, to modify sub-properties of the item,
-     * `modelForElement(el).set('item.<sub-prop>', value)`
-     * should be used.
-     *
-     * @param {HTMLElement} el Element for which to return the item.
-     * @return {*} Item associated with the element.
-     */
-    itemForElement(el) {
-      let instance = this.modelForElement(el);
-      return instance && instance[this.as];
-    }
-
-    /**
-     * Returns the inst index for a given element stamped by this `dom-repeat`.
-     * If `sort` is provided, the index will reflect the sorted order (rather
-     * than the original array order).
-     *
-     * @param {HTMLElement} el Element for which to return the index.
-     * @return {*} Row index associated with the element (note this may
-     *   not correspond to the array index if a user `sort` is applied).
-     */
-    indexForElement(el) {
-      let instance = this.modelForElement(el);
-      return instance && instance[this.indexAs];
-    }
-
-    /**
-     * Returns the template "model" associated with a given element, which
-     * serves as the binding scope for the template instance the element is
-     * contained in. A template model is an instance of `Polymer.Base`, and
-     * should be used to manipulate data associated with this template instance.
-     *
-     * Example:
-     *
-     *   let model = modelForElement(el);
-     *   if (model.index < 10) {
-     *     model.set('item.checked', true);
-     *   }
-     *
-     * @param {HTMLElement} el Element for which to return a template model.
-     * @return {TemplateInstanceBase} Model representing the binding scope for
-     *   the element.
-     */
-    modelForElement(el) {
-      return Polymer.Templatize.modelForElement(this.template, el);
-    }
-
-  }
-
-  customElements.define(DomRepeat.is, DomRepeat);
-
-  Polymer.DomRepeat = DomRepeat;
-
-})();
-
-</script>
diff --git a/src/main/resources/static/gltf-viewer/bower_components/polymer/lib/legacy/class.html b/src/main/resources/static/gltf-viewer/bower_components/polymer/lib/legacy/class.html
deleted file mode 100644 (file)
index a63c6a1..0000000
+++ /dev/null
@@ -1,334 +0,0 @@
-<!--
-@license
-Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
-This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
-The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
-The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
-Code distributed by Google as part of the polymer project is also
-subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
--->
-<link rel="import" href="legacy-element-mixin.html">
-<script>
-
-  (function() {
-
-    'use strict';
-
-    let LegacyElementMixin = Polymer.LegacyElementMixin;
-
-    let metaProps = {
-      attached: true,
-      detached: true,
-      ready: true,
-      created: true,
-      beforeRegister: true,
-      registered: true,
-      attributeChanged: true,
-      // meta objects
-      behaviors: true
-    }
-
-    /**
-     * Applies a "legacy" behavior or array of behaviors to the provided class.
-     *
-     * Note: this method will automatically also apply the `Polymer.LegacyElementMixin`
-     * to ensure that any legacy behaviors can rely on legacy Polymer API on
-     * the underlying element.
-     *
-     * @param {Object|Array} behaviors Behavior object or array of behaviors.
-     * @param {HTMLElement} klass Element class.
-     * @return {HTMLElement} Returns a new Element class extended by the
-     * passed in `behaviors` and also by `Polymer.LegacyElementMixin`.
-     * @memberof Polymer
-     */
-    function mixinBehaviors(behaviors, klass) {
-      if (!behaviors) {
-        return klass;
-      }
-      // NOTE: ensure the bahevior is extending a class with
-      // legacy element api. This is necessary since behaviors expect to be able
-      // to access 1.x legacy api.
-      klass = LegacyElementMixin(klass);
-      if (!Array.isArray(behaviors)) {
-        behaviors = [behaviors];
-      }
-      let superBehaviors = klass.prototype.behaviors;
-      // get flattened, deduped list of behaviors *not* already on super class
-      behaviors = flattenBehaviors(behaviors, null, superBehaviors);
-      // mixin new behaviors
-      klass = _mixinBehaviors(behaviors, klass);
-      if (superBehaviors) {
-        behaviors = superBehaviors.concat(behaviors);
-      }
-      // Set behaviors on prototype for BC...
-      klass.prototype.behaviors = behaviors;
-      return klass;
-    }
-
-    // NOTE:
-    // 1.x
-    // Behaviors were mixed in *in reverse order* and de-duped on the fly.
-    // The rule was that behavior properties were copied onto the element
-    // prototype if and only if the property did not already exist.
-    // Given: Polymer{ behaviors: [A, B, C, A, B]}, property copy order was:
-    // (1), B, (2), A, (3) C. This means prototype properties win over
-    // B properties win over A win over C. This mirrors what would happen
-    // with inheritance if element extended B extended A extended C.
-    //
-    // Again given, Polymer{ behaviors: [A, B, C, A, B]}, the resulting
-    // `behaviors` array was [C, A, B].
-    // Behavior lifecycle methods were called in behavior array order
-    // followed by the element, e.g. (1) C.created, (2) A.created,
-    // (3) B.created, (4) element.created. There was no support for
-    // super, and "super-behavior" methods were callable only by name).
-    //
-    // 2.x
-    // Behaviors are made into proper mixins which live in the
-    // element's prototype chain. Behaviors are placed in the element prototype
-    // eldest to youngest and de-duped youngest to oldest:
-    // So, first [A, B, C, A, B] becomes [C, A, B] then,
-    // the element prototype becomes (oldest) (1) Polymer.Element, (2) class(C),
-    // (3) class(A), (4) class(B), (5) class(Polymer({...})).
-    // Result:
-    // This means element properties win over B properties win over A win
-    // over C. (same as 1.x)
-    // If lifecycle is called (super then me), order is
-    // (1) C.created, (2) A.created, (3) B.created, (4) element.created
-    // (again same as 1.x)
-    function _mixinBehaviors(behaviors, klass) {
-      for (let i=0; i<behaviors.length; i++) {
-        let b = behaviors[i];
-        if (b) {
-          klass = Array.isArray(b) ? _mixinBehaviors(b, klass) :
-            GenerateClassFromInfo(b, klass);
-        }
-      }
-      return klass;
-    }
-
-    /**
-     * @param {Array} behaviors List of behaviors to flatten.
-     * @param {Array=} list Target list to flatten behaviors into.
-     * @param {Array=} exclude List of behaviors to exclude from the list.
-     * @return {Array} Returns the list of flattened behaviors.
-     */
-    function flattenBehaviors(behaviors, list, exclude) {
-      list = list || [];
-      for (let i=behaviors.length-1; i >= 0; i--) {
-        let b = behaviors[i];
-        if (b) {
-          if (Array.isArray(b)) {
-            flattenBehaviors(b, list);
-          } else {
-            // dedup
-            if (list.indexOf(b) < 0 && (!exclude || exclude.indexOf(b) < 0)) {
-              list.unshift(b);
-            }
-          }
-        } else {
-          console.warn('behavior is null, check for missing or 404 import');
-        }
-      }
-      return list;
-    }
-
-    function GenerateClassFromInfo(info, Base) {
-
-      class PolymerGenerated extends Base {
-
-        static get properties() {
-          return info.properties;
-        }
-
-        static get observers() {
-          return info.observers;
-        }
-
-        static get template() {
-          // get template first from any imperative set in `info._template`
-          return info._template ||
-            // next look in dom-module associated with this element's is.
-            Polymer.DomModule.import(this.is, 'template') ||
-            // next look for superclass template (note: use superclass symbol
-            // to ensure correct `this.is`)
-            Base.template ||
-            // finally fall back to `_template` in element's protoype.
-            this.prototype._template;
-        }
-
-        created() {
-          super.created();
-          if (info.created) {
-            info.created.call(this);
-          }
-        }
-
-        _registered() {
-          super._registered();
-          /* NOTE: `beforeRegister` is called here for bc, but the behavior
-           is different than in 1.x. In 1.0, the method was called *after*
-           mixing prototypes together but *before* processing of meta-objects.
-           However, dynamic effects can still be set here and can be done either
-           in `beforeRegister` or `registered`. It is no longer possible to set
-           `is` in `beforeRegister` as you could in 1.x.
-          */
-          if (info.beforeRegister) {
-            info.beforeRegister.call(Object.getPrototypeOf(this));
-          }
-          if (info.registered) {
-            info.registered.call(Object.getPrototypeOf(this));
-          }
-        }
-
-        _applyListeners() {
-          super._applyListeners();
-          if (info.listeners) {
-            for (let l in info.listeners) {
-              this._addMethodEventListenerToNode(this, l, info.listeners[l]);
-            }
-          }
-        }
-
-        // note: exception to "super then me" rule;
-        // do work before calling super so that super attributes
-        // only apply if not already set.
-        _ensureAttributes() {
-          if (info.hostAttributes) {
-            for (let a in info.hostAttributes) {
-              this._ensureAttribute(a, info.hostAttributes[a]);
-            }
-          }
-          super._ensureAttributes();
-        }
-
-        ready() {
-          super.ready();
-          if (info.ready) {
-            info.ready.call(this);
-          }
-        }
-
-        attached() {
-          super.attached();
-          if (info.attached) {
-            info.attached.call(this);
-          }
-        }
-
-        detached() {
-          super.detached();
-          if (info.detached) {
-            info.detached.call(this);
-          }
-        }
-
-        attributeChanged(name, old, value) {
-          super.attributeChanged(name, old, value);
-          if (info.attributeChanged) {
-            info.attributeChanged.call(this, name, old, value);
-          }
-       }
-      }
-
-      PolymerGenerated.generatedFrom =  info
-
-      for (let p in info) {
-        // NOTE: cannot copy `metaProps` methods onto prototype at least because
-        // `super.ready` must be called and is not included in the user fn.
-        if (!(p in metaProps)) {
-          let pd = Object.getOwnPropertyDescriptor(info, p);
-          if (pd) {
-            Object.defineProperty(PolymerGenerated.prototype, p, pd);
-          }
-        }
-      }
-
-      return PolymerGenerated;
-    }
-
-    /**
-     * Generates a class that extends `Polymer.LegacyElement` based on the
-     * provided info object.  Metadata objects on the `info` object
-     * (`properties`, `observers`, `listeners`, `behaviors`, `is`) are used
-     * for Polymer's meta-programming systems, and any functions are copied
-     * to the generated class.
-     *
-     * Valid "metadata" values are as follows:
-     *
-     * `is`: String providing the tag name to register the element under. In
-     * addition, if a `dom-module` with the same id exists, the first template
-     * in that `dom-module` will be stamped into the shadow root of this element,
-     * with support for declarative event listeners (`on-...`), Polymer data
-     * bindings (`[[...]]` and `{{...}}`), and id-based node finding into
-     * `this.$`.
-     *
-     * `properties`: Object describing property-related metadata used by Polymer
-     * features (key: property names, value: object containing property metadata).
-     * Valid keys in per-property metadata include:
-     * - `type` (String|Number|Object|Array|...): Used by
-     *   `attributeChangedCallback` to determine how string-based attributes
-     *   are deserialized to JavaScript property values.
-     * - `notify` (boolean): Causes a change in the property to fire a
-     *   non-bubbling event called `<property>-changed`. Elements that have
-     *   enabled two-way binding to the property use this event to observe changes.
-     * - `readOnly` (boolean): Creates a getter for the property, but no setter.
-     *   To set a read-only property, use the private setter method
-     *   `_setProperty(property, value)`.
-     * - `observer` (string): Observer method name that will be called when
-     *   the property changes. The arguments of the method are
-     *   `(value, previousValue)`.
-     * - `computed` (string): String describing method and dependent properties
-     *   for computing the value of this property (e.g. `'computeFoo(bar, zot)'`).
-     *   Computed properties are read-only by default and can only be changed
-     *   via the return value of the computing method.
-     *
-     * `observers`: Array of strings describing multi-property observer methods
-     *  and their dependent properties (e.g. `'observeABC(a, b, c)'`).
-     *
-     * `listeners`: Object describing event listeners to be added to each
-     *  instance of this element (key: event name, value: method name).
-     *
-     * `behaviors`: Array of additional `info` objects containing metadata
-     * and callbacks in the same format as the `info` object here which are
-     * merged into this element.
-     *
-     * `hostAttributes`: Object listing attributes to be applied to the host
-     *  once created (key: attribute name, value: attribute value).  Values
-     *  are serialized based on the type of the value.  Host attributes should
-     *  generally be limited to attributes such as `tabIndex` and `aria-...`.
-     *  Attributes in `hostAttributes` are only applied if a user-supplied
-     *  attribute is not already present (attributes in markup override
-     *  `hostAttributes`).
-     *
-     * In addition, the following Polymer-specific callbacks may be provided:
-     * - `registered`: called after first instance of this element,
-     * - `created`: called during `constructor`
-     * - `attached`: called during `connectedCallback`
-     * - `detached`: called during `disconnectedCallback`
-     * - `ready`: called before first `attached`, after all properties of
-     *   this element have been propagated to its template and all observers
-     *   have run
-     *
-     * @param {Object} info Object containing Polymer metadata and functions
-     *   to become class methods.
-     * @return {Polymer.LegacyElement} Generated class
-     * @memberof Polymer
-     */
-    Polymer.Class = function(info) {
-      if (!info) {
-        console.warn('Polymer.Class requires `info` argument');
-      }
-      let klass = GenerateClassFromInfo(info, info.behaviors ?
-        // note: mixinBehaviors ensures `LegacyElementMixin`.
-        mixinBehaviors(info.behaviors, HTMLElement) :
-        LegacyElementMixin(HTMLElement));
-      // decorate klass with registration info
-      klass.is = info.is;
-      return klass;
-    }
-
-    Polymer.mixinBehaviors = mixinBehaviors;
-
-  })();
-
-</script>
diff --git a/src/main/resources/static/gltf-viewer/bower_components/polymer/lib/legacy/legacy-element-mixin.html b/src/main/resources/static/gltf-viewer/bower_components/polymer/lib/legacy/legacy-element-mixin.html
deleted file mode 100644 (file)
index e831d6c..0000000
+++ /dev/null
@@ -1,917 +0,0 @@
-<!--
-@license
-Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
-This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
-The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
-The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
-Code distributed by Google as part of the polymer project is also
-subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
--->
-
-<link rel="import" href="../../../shadycss/apply-shim.html">
-<link rel="import" href="../mixins/element-mixin.html">
-<link rel="import" href="../mixins/gesture-event-listeners.html">
-<link rel="import" href="../utils/mixin.html">
-<link rel="import" href="../utils/import-href.html">
-<link rel="import" href="../utils/render-status.html">
-<link rel="import" href="../utils/unresolved.html">
-<link rel="import" href="polymer.dom.html">
-
-<script>
-(function() {
-
-  'use strict';
-
-  let styleInterface = window.ShadyCSS;
-
-  /**
-   * Element class mixin that provides Polymer's "legacy" API intended to be
-   * backward-compatible to the greatest extent possible with the API
-   * found on the Polymer 1.x `Polymer.Base` prototype applied to all elements
-   * defined using the `Polymer({...})` function.
-   *
-   * @polymerMixin
-   * @mixes Polymer.ElementMixin
-   * @mixes Polymer.GestureEventListeners
-   * @property isAttached {boolean} Set to `true` in this element's
-   *   `connectedCallback` and `false` in `disconnectedCallback`
-   * @memberof Polymer
-   * @summary Element class mixin that provides Polymer's "legacy" API
-   */
-  Polymer.LegacyElementMixin = Polymer.dedupingMixin(base => {
-
-    /**
-     * @constructor
-     * @extends {base}
-     * @implements {Polymer_ElementMixin}
-     * @implements {Polymer_GestureEventListeners}
-     */
-    const legacyElementBase = Polymer.GestureEventListeners(Polymer.ElementMixin(base));
-
-    /**
-     * Map of simple names to touch action names
-     * @dict
-     */
-    const DIRECTION_MAP = {
-      'x': 'pan-x',
-      'y': 'pan-y',
-      'none': 'none',
-      'all': 'auto'
-    };
-
-    /**
-     * @polymerMixinClass
-     * @implements {Polymer_LegacyElement}
-     */
-    class LegacyElement extends legacyElementBase {
-
-      constructor() {
-        super();
-        this.root = this;
-        this.created();
-      }
-
-      /**
-       * Legacy callback called during the `constructor`, for overriding
-       * by the user.
-       */
-      created() {}
-
-      connectedCallback() {
-        super.connectedCallback();
-        this.isAttached = true;
-        this.attached();
-      }
-
-      /**
-       * Legacy callback called during `connectedCallback`, for overriding
-       * by the user.
-       */
-      attached() {}
-
-      disconnectedCallback() {
-        super.disconnectedCallback();
-        this.isAttached = false;
-        this.detached();
-      }
-
-      /**
-       * Legacy callback called during `disconnectedCallback`, for overriding
-       * by the user.
-       */
-      detached() {}
-
-      attributeChangedCallback(name, old, value) {
-        if (old !== value) {
-          super.attributeChangedCallback(name, old, value);
-          this.attributeChanged(name, old, value);
-        }
-      }
-
-      /**
-       * Legacy callback called during `attributeChangedChallback`, for overriding
-       * by the user.
-       */
-      attributeChanged() {}
-
-      /**
-       * Overrides the default `Polymer.PropertyEffects` implementation to
-       * add support for class initialization via the `_registered` callback.
-       * This is called only when the first instance of the element is created.
-       *
-       * @override
-       */
-      _initializeProperties() {
-        let proto = Object.getPrototypeOf(this);
-        if (!proto.hasOwnProperty('__hasRegisterFinished')) {
-          proto.__hasRegisterFinished = true;
-          this._registered();
-        }
-        super._initializeProperties();
-      }
-
-      /**
-       * Called automatically when an element is initializing.
-       * Users may override this method to perform class registration time
-       * work. The implementation should ensure the work is performed
-       * only once for the class.
-       * @protected
-       */
-      _registered() {}
-
-      /**
-       * Overrides the default `Polymer.PropertyEffects` implementation to
-       * add support for installing `hostAttributes` and `listeners`.
-       *
-       * @override
-       */
-      ready() {
-        this._ensureAttributes();
-        this._applyListeners();
-        super.ready();
-      }
-
-      /**
-       * Ensures an element has required attributes. Called when the element
-       * is being readied via `ready`. Users should override to set the
-       * element's required attributes. The implementation should be sure
-       * to check and not override existing attributes added by
-       * the user of the element. Typically, setting attributes should be left
-       * to the element user and not done here; reasonable exceptions include
-       * setting aria roles and focusability.
-       * @protected
-       */
-      _ensureAttributes() {}
-
-      /**
-       * Adds element event listeners. Called when the element
-       * is being readied via `ready`. Users should override to
-       * add any required element event listeners.
-       * In performance critical elements, the work done here should be kept
-       * to a minimum since it is done before the element is rendered. In
-       * these elements, consider adding listeners asychronously so as not to
-       * block render.
-       * @protected
-       */
-      _applyListeners() {}
-
-      /**
-       * Converts a typed JavaScript value to a string.
-       *
-       * Note this method is provided as backward-compatible legacy API
-       * only.  It is not directly called by any Polymer features. To customize
-       * how properties are serialized to attributes for attribute bindings and
-       * `reflectToAttribute: true` properties as well as this method, override
-       * the `_serializeValue` method provided by `Polymer.PropertyAccessors`.
-       *
-       * @param {*} value Value to deserialize
-       * @return {string} Serialized value
-       */
-      serialize(value) {
-        return this._serializeValue(value);
-      }
-
-      /**
-       * Converts a string to a typed JavaScript value.
-       *
-       * Note this method is provided as backward-compatible legacy API
-       * only.  It is not directly called by any Polymer features.  To customize
-       * how attributes are deserialized to properties for in
-       * `attributeChangedCallback`, override `_deserializeValue` method
-       * provided by `Polymer.PropertyAccessors`.
-       *
-       * @param {string} value String to deserialize
-       * @param {*} type Type to deserialize the string to
-       * @return {*} Returns the deserialized value in the `type` given.
-       */
-      deserialize(value, type) {
-        return this._deserializeValue(value, type);
-      }
-
-      /**
-       * Serializes a property to its associated attribute.
-       *
-       * Note this method is provided as backward-compatible legacy API
-       * only.  It is not directly called by any Polymer features.
-       *
-       * @param {string} property Property name to reflect.
-       * @param {string=} attribute Attribute name to reflect.
-       * @param {*=} value Property value to refect.
-       */
-      reflectPropertyToAttribute(property, attribute, value) {
-        this._propertyToAttribute(property, attribute, value);
-      }
-
-      /**
-       * Sets a typed value to an HTML attribute on a node.
-       *
-       * Note this method is provided as backward-compatible legacy API
-       * only.  It is not directly called by any Polymer features.
-       *
-       * @param {*} value Value to serialize.
-       * @param {string} attribute Attribute name to serialize to.
-       * @param {Element} node Element to set attribute to.
-       */
-      serializeValueToAttribute(value, attribute, node) {
-        this._valueToNodeAttribute(node || this, value, attribute);
-      }
-
-      /**
-       * Copies own properties (including accessor descriptors) from a source
-       * object to a target object.
-       *
-       * @param {Object} prototype Target object to copy properties to.
-       * @param {Object} api Source object to copy properties from.
-       * @return {Object} prototype object that was passed as first argument.
-       */
-      extend(prototype, api) {
-        if (!(prototype && api)) {
-          return prototype || api;
-        }
-        let n$ = Object.getOwnPropertyNames(api);
-        for (let i=0, n; (i<n$.length) && (n=n$[i]); i++) {
-          let pd = Object.getOwnPropertyDescriptor(api, n);
-          if (pd) {
-            Object.defineProperty(prototype, n, pd);
-          }
-        }
-        return prototype;
-      }
-
-      /**
-       * Copies props from a source object to a target object.
-       *
-       * Note, this method uses a simple `for...in` strategy for enumerating
-       * properties.  To ensure only `ownProperties` are copied from source
-       * to target and that accessor implementations are copied, use `extend`.
-       *
-       * @param {Object} target Target object to copy properties to.
-       * @param {Object} source Source object to copy properties from.
-       * @return {Object} Target object that was passed as first argument.
-       */
-      mixin(target, source) {
-        for (let i in source) {
-          target[i] = source[i];
-        }
-        return target;
-      }
-
-      /**
-       * Sets the prototype of an object.
-       *
-       * Note this method is provided as backward-compatible legacy API
-       * only.  It is not directly called by any Polymer features.
-       * @param {Object} object The object on which to set the prototype.
-       * @param {Object} prototype The prototype that will be set on the given
-       * `object`.
-       * @return {Object} Returns the given `object` with its prototype set
-       * to the given `prototype` object.
-       */
-      chainObject(object, prototype) {
-        if (object && prototype && object !== prototype) {
-          object.__proto__ = prototype;
-        }
-        return object;
-      }
-
-      /* **** Begin Template **** */
-
-      /**
-       * Calls `importNode` on the `content` of the `template` specified and
-       * returns a document fragment containing the imported content.
-       *
-       * @param {HTMLTemplateElement} template HTML template element to instance.
-       * @return {DocumentFragment} Document fragment containing the imported
-       *   template content.
-      */
-      instanceTemplate(template) {
-        let content = this.constructor._contentForTemplate(template);
-        let dom = /** @type {DocumentFragment} */
-          (document.importNode(content, true));
-        return dom;
-      }
-
-      /* **** Begin Events **** */
-
-      /**
-       * Dispatches a custom event with an optional detail value.
-       *
-       * @param {string} type Name of event type.
-       * @param {*=} detail Detail value containing event-specific
-       *   payload.
-       * @param {Object=} options Object specifying options.  These may include:
-       *  `bubbles` (boolean, defaults to `true`),
-       *  `cancelable` (boolean, defaults to false), and
-       *  `node` on which to fire the event (HTMLElement, defaults to `this`).
-       * @return {Event} The new event that was fired.
-       */
-      fire(type, detail, options) {
-        options = options || {};
-        detail = (detail === null || detail === undefined) ? {} : detail;
-        let event = new Event(type, {
-          bubbles: options.bubbles === undefined ? true : options.bubbles,
-          cancelable: Boolean(options.cancelable),
-          composed: options.composed === undefined ? true: options.composed
-        });
-        event.detail = detail;
-        let node = options.node || this;
-        node.dispatchEvent(event)
-        return event;
-      }
-
-      /**
-       * Convenience method to add an event listener on a given element,
-       * late bound to a named method on this element.
-       *
-       * @param {Element} node Element to add event listener to.
-       * @param {string} eventName Name of event to listen for.
-       * @param {string} methodName Name of handler method on `this` to call.
-       */
-      listen(node, eventName, methodName) {
-        node = node || this;
-        let hbl = this.__boundListeners ||
-          (this.__boundListeners = new WeakMap());
-        let bl = hbl.get(node);
-        if (!bl) {
-          bl = {};
-          hbl.set(node, bl);
-        }
-        let key = eventName + methodName;
-        if (!bl[key]) {
-          bl[key] = this._addMethodEventListenerToNode(
-            node, eventName, methodName, this);
-        }
-      }
-
-      /**
-       * Convenience method to remove an event listener from a given element,
-       * late bound to a named method on this element.
-       *
-       * @param {Element} node Element to remove event listener from.
-       * @param {string} eventName Name of event to stop listening to.
-       * @param {string} methodName Name of handler method on `this` to not call
-       anymore.
-       */
-      unlisten(node, eventName, methodName) {
-        node = node || this;
-        let bl = this.__boundListeners && this.__boundListeners.get(node);
-        let key = eventName + methodName;
-        let handler = bl && bl[key];
-        if (handler) {
-          this._removeEventListenerFromNode(node, eventName, handler);
-          bl[key] = null;
-        }
-      }
-
-      /**
-       * Override scrolling behavior to all direction, one direction, or none.
-       *
-       * Valid scroll directions:
-       *   - 'all': scroll in any direction
-       *   - 'x': scroll only in the 'x' direction
-       *   - 'y': scroll only in the 'y' direction
-       *   - 'none': disable scrolling for this node
-       *
-       * @param {string=} direction Direction to allow scrolling
-       * Defaults to `all`.
-       * @param {HTMLElement=} node Element to apply scroll direction setting.
-       * Defaults to `this`.
-       */
-      setScrollDirection(direction, node) {
-        Polymer.Gestures.setTouchAction(node || this, DIRECTION_MAP[direction] || 'auto');
-      }
-      /* **** End Events **** */
-
-      /**
-       * Convenience method to run `querySelector` on this local DOM scope.
-       *
-       * This function calls `Polymer.dom(this.root).querySelector(slctr)`.
-       *
-       * @param {string} slctr Selector to run on this local DOM scope
-       * @return {Element} Element found by the selector, or null if not found.
-       */
-      $$(slctr) {
-        return this.root.querySelector(slctr);
-      }
-
-      /**
-       * Return the element whose local dom within which this element
-       * is contained. This is a shorthand for
-       * `this.getRootNode().host`.
-       */
-      get domHost() {
-        let root = this.getRootNode();
-        return (root instanceof DocumentFragment) ? root.host : root;
-      }
-
-      /**
-       * Force this element to distribute its children to its local dom.
-       * This is necessary only when ShadyDOM is used and only in cases that
-       * are not automatically handled. For example,
-       * a user should call `distributeContent` if distribution has been
-       * invalidated due to an element being added or removed from the shadowRoot
-       * that contains an insertion point (<slot>) inside its subtree.
-       */
-      distributeContent() {
-        if (window.ShadyDOM && this.shadowRoot) {
-          this.shadowRoot.forceRender();
-        }
-      }
-
-      /**
-       * Returns a list of nodes that are the effective childNodes. The effective
-       * childNodes list is the same as the element's childNodes except that
-       * any `<content>` elements are replaced with the list of nodes distributed
-       * to the `<content>`, the result of its `getDistributedNodes` method.
-       *
-       * @return {Array<Node>} List of effctive child nodes.
-       */
-      getEffectiveChildNodes() {
-        return Polymer.dom(this).getEffectiveChildNodes();
-      }
-
-      /**
-       * Returns a list of nodes distributed within this element that match
-       * `selector`. These can be dom children or elements distributed to
-       * children that are insertion points.
-       * @param {string} selector Selector to run.
-       * @return {Array<Node>} List of distributed elements that match selector.
-       */
-      queryDistributedElements(selector) {
-        return Polymer.dom(this).queryDistributedElements(selector);
-      }
-
-      /**
-       * Returns a list of elements that are the effective children. The effective
-       * children list is the same as the element's children except that
-       * any `<content>` elements are replaced with the list of elements
-       * distributed to the `<content>`.
-       *
-       * @return {Array<Node>} List of effctive children.
-       */
-      getEffectiveChildren() {
-        let list = this.getEffectiveChildNodes();
-        return list.filter(function(n) {
-          return (n.nodeType === Node.ELEMENT_NODE);
-        });
-      }
-
-      /**
-       * Returns a string of text content that is the concatenation of the
-       * text content's of the element's effective childNodes (the elements
-       * returned by <a href="#getEffectiveChildNodes>getEffectiveChildNodes</a>.
-       *
-       * @return {string} List of effctive children.
-       */
-      getEffectiveTextContent() {
-        let cn = this.getEffectiveChildNodes();
-        let tc = [];
-        for (let i=0, c; (c = cn[i]); i++) {
-          if (c.nodeType !== Node.COMMENT_NODE) {
-            tc.push(c.textContent);
-          }
-        }
-        return tc.join('');
-      }
-
-      /**
-       * Returns the first effective childNode within this element that
-       * match `selector`. These can be dom child nodes or elements distributed
-       * to children that are insertion points.
-       * @param {string} selector Selector to run.
-       * @return {Object<Node>} First effective child node that matches selector.
-       */
-      queryEffectiveChildren(selector) {
-        let e$ = this.queryDistributedElements(selector);
-        return e$ && e$[0];
-      }
-
-      /**
-       * Returns a list of effective childNodes within this element that
-       * match `selector`. These can be dom child nodes or elements distributed
-       * to children that are insertion points.
-       * @param {string} selector Selector to run.
-       * @return {Array<Node>} List of effective child nodes that match selector.
-       */
-      queryAllEffectiveChildren(selector) {
-        return this.queryDistributedElements(selector);
-      }
-
-      /**
-       * Returns a list of nodes distributed to this element's `<slot>`.
-       *
-       * If this element contains more than one `<slot>` in its local DOM,
-       * an optional selector may be passed to choose the desired content.
-       *
-       * @param {string=} slctr CSS selector to choose the desired
-       *   `<slot>`.  Defaults to `content`.
-       * @return {Array<Node>} List of distributed nodes for the `<slot>`.
-       */
-      getContentChildNodes(slctr) {
-        let content = this.root.querySelector(slctr || 'slot');
-        return content ? Polymer.dom(content).getDistributedNodes() : [];
-      }
-
-      /**
-       * Returns a list of element children distributed to this element's
-       * `<slot>`.
-       *
-       * If this element contains more than one `<slot>` in its
-       * local DOM, an optional selector may be passed to choose the desired
-       * content.  This method differs from `getContentChildNodes` in that only
-       * elements are returned.
-       *
-       * @param {string=} slctr CSS selector to choose the desired
-       *   `<content>`.  Defaults to `content`.
-       * @return {Array<HTMLElement>} List of distributed nodes for the
-       *   `<slot>`.
-       */
-      getContentChildren(slctr) {
-        return this.getContentChildNodes(slctr).filter(function(n) {
-          return (n.nodeType === Node.ELEMENT_NODE);
-        });
-      }
-
-      /**
-       * Checks whether an element is in this element's light DOM tree.
-       *
-       * @param {?Node} node The element to be checked.
-       * @return {boolean} true if node is in this element's light DOM tree.
-       */
-      isLightDescendant(node) {
-        return this !== node && this.contains(node) &&
-            this.getRootNode() === node.getRootNode();
-      }
-
-      /**
-       * Checks whether an element is in this element's local DOM tree.
-       *
-       * @param {HTMLElement=} node The element to be checked.
-       * @return {boolean} true if node is in this element's local DOM tree.
-       */
-      isLocalDescendant(node) {
-        return this.root === node.getRootNode();
-      }
-
-      // NOTE: should now be handled by ShadyCss library.
-      scopeSubtree(container, shouldObserve) { // eslint-disable-line no-unused-vars
-      }
-
-      /**
-       * Returns the computed style value for the given property.
-       * @param {string} property The css property name.
-       * @return {string} Returns the computed css property value for the given
-       * `property`.
-       */
-      getComputedStyleValue(property) {
-        return styleInterface.getComputedStyleValue(this, property);
-      }
-
-      // debounce
-
-      /**
-       * Call `debounce` to collapse multiple requests for a named task into
-       * one invocation which is made after the wait time has elapsed with
-       * no new request.  If no wait time is given, the callback will be called
-       * at microtask timing (guaranteed before paint).
-       *
-       *     debouncedClickAction(e) {
-       *       // will not call `processClick` more than once per 100ms
-       *       this.debounce('click', function() {
-       *        this.processClick();
-       *       } 100);
-       *     }
-       *
-       * @param {string} jobName String to indentify the debounce job.
-       * @param {function()} callback Function that is called (with `this`
-       *   context) when the wait time elapses.
-       * @param {number} wait Optional wait time in milliseconds (ms) after the
-       *   last signal that must elapse before invoking `callback`
-       * @return {Object} Returns a debouncer object on which exists the
-       * following methods: `isActive()` returns true if the debouncer is
-       * active; `cancel()` cancels the debouncer if it is active;
-       * `flush()` immediately invokes the debounced callback if the debouncer
-       * is active.
-       */
-      debounce(jobName, callback, wait) {
-        this._debouncers = this._debouncers || {};
-        return this._debouncers[jobName] = Polymer.Debouncer.debounce(
-              this._debouncers[jobName]
-            , wait > 0 ? Polymer.Async.timeOut.after(wait) : Polymer.Async.microTask
-            , callback.bind(this));
-      }
-
-      /**
-       * Returns whether a named debouncer is active.
-       *
-       * @param {string} jobName The name of the debouncer started with `debounce`
-       * @return {boolean} Whether the debouncer is active (has not yet fired).
-       */
-      isDebouncerActive(jobName) {
-        this._debouncers = this._debouncers || {};
-        let debouncer = this._debouncers[jobName];
-        return !!(debouncer && debouncer.isActive());
-      }
-
-      /**
-       * Immediately calls the debouncer `callback` and inactivates it.
-       *
-       * @param {string} jobName The name of the debouncer started with `debounce`
-       */
-      flushDebouncer(jobName) {
-        this._debouncers = this._debouncers || {};
-        let debouncer = this._debouncers[jobName];
-        if (debouncer) {
-          debouncer.flush();
-        }
-      }
-
-      /**
-       * Cancels an active debouncer.  The `callback` will not be called.
-       *
-       * @param {string} jobName The name of the debouncer started with `debounce`
-       */
-      cancelDebouncer(jobName) {
-        this._debouncers = this._debouncers || {}
-        let debouncer = this._debouncers[jobName];
-        if (debouncer) {
-          debouncer.cancel();
-        }
-      }
-
-      /**
-       * Runs a callback function asyncronously.
-       *
-       * By default (if no waitTime is specified), async callbacks are run at
-       * microtask timing, which will occur before paint.
-       *
-       * @param {Function} callback The callback function to run, bound to `this`.
-       * @param {number=} waitTime Time to wait before calling the
-       *   `callback`.  If unspecified or 0, the callback will be run at microtask
-       *   timing (before paint).
-       * @return {number} Handle that may be used to cancel the async job.
-       */
-      async(callback, waitTime) {
-        return waitTime > 0 ? Polymer.Async.timeOut.run(callback.bind(this), waitTime) :
-            ~Polymer.Async.microTask.run(callback.bind(this));
-      }
-
-      /**
-       * Cancels an async operation started with `async`.
-       *
-       * @param {number} handle Handle returned from original `async` call to
-       *   cancel.
-       */
-      cancelAsync(handle) {
-        handle < 0 ? Polymer.Async.microTask.cancel(~handle) :
-            Polymer.Async.timeOut.cancel(handle);
-      }
-
-      // other
-
-      /**
-       * Convenience method for creating an element and configuring it.
-       *
-       * @param {string} tag HTML element tag to create.
-       * @param {Object} props Object of properties to configure on the
-       *    instance.
-       * @return {Element} Newly created and configured element.
-       */
-      create(tag, props) {
-        let elt = document.createElement(tag);
-        if (props) {
-          if (elt.setProperties) {
-            elt.setProperties(props);
-          } else {
-            for (let n in props) {
-              elt[n] = props[n];
-            }
-          }
-        }
-        return elt;
-      }
-
-      /**
-       * Convenience method for importing an HTML document imperatively.
-       *
-       * This method creates a new `<link rel="import">` element with
-       * the provided URL and appends it to the document to start loading.
-       * In the `onload` callback, the `import` property of the `link`
-       * element will contain the imported document contents.
-       *
-       * @param {string} href URL to document to load.
-       * @param {Function} onload Callback to notify when an import successfully
-       *   loaded.
-       * @param {Function} onerror Callback to notify when an import
-       *   unsuccessfully loaded.
-       * @param {boolean} optAsync True if the import should be loaded `async`.
-       *   Defaults to `false`.
-       * @return {HTMLLinkElement} The link element for the URL to be loaded.
-       */
-      importHref(href, onload, onerror, optAsync) { // eslint-disable-line no-unused-vars
-        let loadFn = onload ? onload.bind(this) : null;
-        let errorFn = onerror ? onerror.bind(this) : null;
-        return Polymer.importHref(href, loadFn, errorFn, optAsync);
-      }
-
-      /**
-       * Polyfill for Element.prototype.matches, which is sometimes still
-       * prefixed.
-       *
-       * @param {string} selector Selector to test.
-       * @param {Element=} node Element to test the selector against.
-       * @return {boolean} Whether the element matches the selector.
-       */
-      elementMatches(selector, node) {
-        return Polymer.dom.matchesSelector(node || this, selector);
-      }
-
-      /**
-       * Toggles an HTML attribute on or off.
-       *
-       * @param {string} name HTML attribute name
-       * @param {boolean=} bool Boolean to force the attribute on or off.
-       *    When unspecified, the state of the attribute will be reversed.
-       * @param {HTMLElement=} node Node to target.  Defaults to `this`.
-       */
-      toggleAttribute(name, bool, node) {
-        node = node || this;
-        if (arguments.length == 1) {
-          bool = !node.hasAttribute(name);
-        }
-        if (bool) {
-          node.setAttribute(name, '');
-        } else {
-          node.removeAttribute(name);
-        }
-      }
-
-
-      /**
-       * Toggles a CSS class on or off.
-       *
-       * @param {string} name CSS class name
-       * @param {boolean=} bool Boolean to force the class on or off.
-       *    When unspecified, the state of the class will be reversed.
-       * @param {HTMLElement=} node Node to target.  Defaults to `this`.
-       */
-      toggleClass(name, bool, node) {
-        node = node || this;
-        if (arguments.length == 1) {
-          bool = !node.classList.contains(name);
-        }
-        if (bool) {
-          node.classList.add(name);
-        } else {
-          node.classList.remove(name);
-        }
-      }
-
-      /**
-       * Cross-platform helper for setting an element's CSS `transform` property.
-       *
-       * @param {string} transformText Transform setting.
-       * @param {HTMLElement=} node Element to apply the transform to.
-       * Defaults to `this`
-       */
-      transform(transformText, node) {
-        node = node || this;
-        node.style.webkitTransform = transformText;
-        node.style.transform = transformText;
-      }
-
-      /**
-       * Cross-platform helper for setting an element's CSS `translate3d`
-       * property.
-       *
-       * @param {number} x X offset.
-       * @param {number} y Y offset.
-       * @param {number} z Z offset.
-       * @param {HTMLElement=} node Element to apply the transform to.
-       * Defaults to `this`.
-       */
-      translate3d(x, y, z, node) {
-        node = node || this;
-        this.transform('translate3d(' + x + ',' + y + ',' + z + ')', node);
-      }
-
-      /**
-       * Removes an item from an array, if it exists.
-       *
-       * If the array is specified by path, a change notification is
-       * generated, so that observers, data bindings and computed
-       * properties watching that path can update.
-       *
-       * If the array is passed directly, **no change
-       * notification is generated**.
-       *
-       * @param {string | !Array<number|string>} arrayOrPath Path to array from which to remove the item
-       *   (or the array itself).
-       * @param {*} item Item to remove.
-       * @return {Array} Array containing item removed.
-       */
-      arrayDelete(arrayOrPath, item) {
-        let index;
-        if (Array.isArray(arrayOrPath)) {
-          index = arrayOrPath.indexOf(item);
-          if (index >= 0) {
-            return arrayOrPath.splice(index, 1);
-          }
-        } else {
-          let arr = Polymer.Path.get(this, arrayOrPath);
-          index = arr.indexOf(item);
-          if (index >= 0) {
-            return this.splice(arrayOrPath, index, 1);
-          }
-        }
-        return null;
-      }
-
-      // logging
-
-      /**
-       * Facades `console.log`/`warn`/`error` as override point.
-       *
-       * @param {string} level One of 'log', 'warn', 'error'
-       * @param {Array} args Array of strings or objects to log
-       */
-      _logger(level, args) {
-        // accept ['foo', 'bar'] and [['foo', 'bar']]
-        if (Array.isArray(args) && args.length === 1) {
-          args = args[0];
-        }
-        switch(level) {
-          case 'log':
-          case 'warn':
-          case 'error':
-            console[level](...args);
-        }
-      }
-
-      /**
-       * Facades `console.log` as an override point.
-       *
-       * @param {...*} var_args Array of strings or objects to log
-       */
-      _log(...args) {
-        this._logger('log', args);
-      }
-
-      /**
-       * Facades `console.warn` as an override point.
-       *
-       * @param {...*} var_args Array of strings or objects to log
-       */
-      _warn(...args) {
-        this._logger('warn', args);
-      }
-
-      /**
-       * Facades `console.error` as an override point.
-       *
-       * @param {...*} var_args Array of strings or objects to log
-       */
-      _error(...args) {
-        this._logger('error', args)
-      }
-
-      /**
-       * Formats a message using the element type an a method name.
-       *
-       * @param {string} methodName Method name to associate with message
-       * @param {...*} var_args Array of strings or objects to log
-       * @return {string} String with formatting information for `console`
-       *   logging.
-       */
-      _logf(...args) {
-        return ['[%s::%s]', this.is, ...args];
-      }
-
-    }
-
-    return LegacyElement;
-
-  });
-
-})();
-</script>
diff --git a/src/main/resources/static/gltf-viewer/bower_components/polymer/lib/legacy/mutable-data-behavior.html b/src/main/resources/static/gltf-viewer/bower_components/polymer/lib/legacy/mutable-data-behavior.html
deleted file mode 100644 (file)
index 7a1d529..0000000
+++ /dev/null
@@ -1,150 +0,0 @@
-<!--
-@license
-Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
-This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
-The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
-The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
-Code distributed by Google as part of the polymer project is also
-subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
--->
-
-<link rel="import" href="../mixins/mutable-data.html">
-
-<script>
-(function() {
-  'use strict';
-
-  let mutablePropertyChange = Polymer.MutableData._mutablePropertyChange;
-
-  /**
-   * Legacy element behavior to skip strict dirty-checking for objects and arrays,
-   * (always consider them to be "dirty") for use on legacy API Polymer elements.
-   *
-   * By default, `Polymer.PropertyEffects` performs strict dirty checking on
-   * objects, which means that any deep modifications to an object or array will
-   * not be propagated unless "immutable" data patterns are used (i.e. all object
-   * references from the root to the mutation were changed).
-   *
-   * Polymer also provides a proprietary data mutation and path notification API
-   * (e.g. `notifyPath`, `set`, and array mutation API's) that allow efficient
-   * mutation and notification of deep changes in an object graph to all elements
-   * bound to the same object graph.
-   *
-   * In cases where neither immutable patterns nor the data mutation API can be
-   * used, applying this mixin will cause Polymer to skip dirty checking for
-   * objects and arrays (always consider them to be "dirty").  This allows a
-   * user to make a deep modification to a bound object graph, and then either
-   * simply re-set the object (e.g. `this.items = this.items`) or call `notifyPath`
-   * (e.g. `this.notifyPath('items')`) to update the tree.  Note that all
-   * elements that wish to be updated based on deep mutations must apply this
-   * mixin or otherwise skip strict dirty checking for objects/arrays.
-   *
-   * In order to make the dirty check strategy configurable, see
-   * `Polymer.OptionalMutableDataBehavior`.
-   *
-   * Note, the performance characteristics of propagating large object graphs
-   * will be worse as opposed to using strict dirty checking with immutable
-   * patterns or Polymer's path notification API.
-   *
-   * @polymerBehavior
-   * @memberof Polymer
-   * @summary Behavior to skip strict dirty-checking for objects and
-   *   arrays
-   */
-  Polymer.MutableDataBehavior = {
-
-    /**
-     * Overrides `Polymer.PropertyEffects` to provide option for skipping
-     * strict equality checking for Objects and Arrays.
-     *
-     * This method pulls the value to dirty check against from the `__dataTemp`
-     * cache (rather than the normal `__data` cache) for Objects.  Since the temp
-     * cache is cleared at the end of a turn, this implementation allows
-     * side-effects of deep object changes to be processed by re-setting the
-     * same object (using the temp cache as an in-turn backstop to prevent
-     * cycles due to 2-way notification).
-     *
-     * @param {string} property Property name
-     * @param {*} value New property value
-     * @param {*} old Previous property value
-     * @return {boolean} Whether the property should be considered a change
-     * @protected
-     */
-    _shouldPropertyChange(property, value, old) {
-      return mutablePropertyChange(this, property, value, old, true);
-    }
-  };
-
-  /**
-   * Legacy element behavior to add the optional ability to skip strict
-   * dirty-checking for objects and arrays (always consider them to be
-   * "dirty") by setting a `mutable-data` attribute on an element instance.
-   *
-   * By default, `Polymer.PropertyEffects` performs strict dirty checking on
-   * objects, which means that any deep modifications to an object or array will
-   * not be propagated unless "immutable" data patterns are used (i.e. all object
-   * references from the root to the mutation were changed).
-   *
-   * Polymer also provides a proprietary data mutation and path notification API
-   * (e.g. `notifyPath`, `set`, and array mutation API's) that allow efficient
-   * mutation and notification of deep changes in an object graph to all elements
-   * bound to the same object graph.
-   *
-   * In cases where neither immutable patterns nor the data mutation API can be
-   * used, applying this mixin will allow Polymer to skip dirty checking for
-   * objects and arrays (always consider them to be "dirty").  This allows a
-   * user to make a deep modification to a bound object graph, and then either
-   * simply re-set the object (e.g. `this.items = this.items`) or call `notifyPath`
-   * (e.g. `this.notifyPath('items')`) to update the tree.  Note that all
-   * elements that wish to be updated based on deep mutations must apply this
-   * mixin or otherwise skip strict dirty checking for objects/arrays.
-   *
-   * While this behavior adds the ability to forgo Object/Array dirty checking,
-   * the `mutableData` flag defaults to false and must be set on the instance.
-   *
-   * Note, the performance characteristics of propagating large object graphs
-   * will be worse by relying on `mutableData: true` as opposed to using
-   * strict dirty checking with immutable patterns or Polymer's path notification
-   * API.
-   *
-   * @polymerBehavior
-   * @memberof Polymer
-   * @summary Behavior to optionally skip strict dirty-checking for objects and
-   *   arrays
-   */
-  Polymer.OptionalMutableDataBehavior = {
-
-    properties: {
-      /**
-       * Instance-level flag for configuring the dirty-checking strategy
-       * for this element.  When true, Objects and Arrays will skip dirty
-       * checking, otherwise strict equality checking will be used.
-       */
-      mutableData: Boolean
-    },
-
-    /**
-     * Overrides `Polymer.PropertyEffects` to skip strict equality checking
-     * for Objects and Arrays.
-     *
-     * Pulls the value to dirty check against from the `__dataTemp` cache
-     * (rather than the normal `__data` cache) for Objects.  Since the temp
-     * cache is cleared at the end of a turn, this implementation allows
-     * side-effects of deep object changes to be processed by re-setting the
-     * same object (using the temp cache as an in-turn backstop to prevent
-     * cycles due to 2-way notification).
-     *
-     * @param {string} property Property name
-     * @param {*} value New property value
-     * @param {*} old Previous property value
-     * @return {boolean} Whether the property should be considered a change
-     * @protected
-     */
-    _shouldPropertyChange(property, value, old) {
-      return mutablePropertyChange(this, property, value, old, this.mutableData);
-    }
-  };
-
-})();
-
-</script>
diff --git a/src/main/resources/static/gltf-viewer/bower_components/polymer/lib/legacy/polymer-fn.html b/src/main/resources/static/gltf-viewer/bower_components/polymer/lib/legacy/polymer-fn.html
deleted file mode 100644 (file)
index 1a145c9..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-<!--
-@license
-Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
-This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
-The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
-The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
-Code distributed by Google as part of the polymer project is also
-subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
--->
-
-<link rel="import" href="class.html">
-
-<script>
-
-  (function() {
-    'use strict';
-
-    /**
-     * Legacy class factory and registration helper for defining Polymer
-     * elements.
-     *
-     * This method is equivalent to
-     * `customElements.define(info.is, Polymer.Class(info));`
-     *
-     * See `Polymer.Class` for details on valid legacy metadata format for `info`.
-     *
-     * @override
-     * @function Polymer
-     * @param {Object} info Object containing Polymer metadata and functions
-     *   to become class methods.
-     * @return {Polymer.LegacyElement} Generated class
-     */
-    window.Polymer._polymerFn = function(info) {
-      // if input is a `class` (aka a function with a prototype), use the prototype
-      // remember that the `constructor` will never be called
-      let klass;
-      if (typeof info === 'function') {
-        klass = info;
-      } else {
-        klass = Polymer.Class(info);
-      }
-      customElements.define(klass.is, klass);
-      return klass;
-    };
-
-  })();
-
-</script>
diff --git a/src/main/resources/static/gltf-viewer/bower_components/polymer/lib/legacy/polymer.dom.html b/src/main/resources/static/gltf-viewer/bower_components/polymer/lib/legacy/polymer.dom.html
deleted file mode 100644 (file)
index ae9ba4b..0000000
+++ /dev/null
@@ -1,336 +0,0 @@
-<!--
-@license
-Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
-This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
-The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
-The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
-Code distributed by Google as part of the polymer project is also
-subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
--->
-<link rel="import" href="../utils/boot.html">
-<link rel="import" href="../utils/flattened-nodes-observer.html">
-<link rel="import" href="../utils/flush.html">
-<script>
-(function() {
-  'use strict';
-
-  const p = Element.prototype;
-  const normalizedMatchesSelector = p.matches || p.matchesSelector ||
-    p.mozMatchesSelector || p.msMatchesSelector ||
-    p.oMatchesSelector || p.webkitMatchesSelector;
-
-  /**
-   * Cross-platform `element.matches` shim.
-   *
-   * @function matchesSelector
-   * @memberof Polymer.dom
-   * @param {Node} node Node to check selector against
-   * @param {string} selector Selector to match
-   * @return {boolean} True if node matched selector
-   */
-  const matchesSelector = function(node, selector) {
-    return normalizedMatchesSelector.call(node, selector);
-  }
-
-  /**
-   * Node API wrapper class returned from `Polymer.dom.(target)` when
-   * `target` is a `Node`.
-   */
-  class DomApi {
-
-    constructor(node) {
-      this.node = node;
-    }
-
-    /**
-     * Returns an instance of `Polymer.FlattenedNodesObserver` that
-     * listens for node changes on this element.
-     *
-     * @param {Function} callback Called when direct or distributed children
-     *   of this element changes
-     * @return {Polymer.FlattenedNodesObserver} Observer instance
-     */
-    observeNodes(callback) {
-      return new Polymer.FlattenedNodesObserver(this.node, callback);
-    }
-
-    /**
-     * Disconnects an observer previously created via `observeNodes`
-     *
-     * @param {Polymer.FlattenedNodesObserver} observerHandle Observer instance
-     *   to disconnect.
-     */
-    unobserveNodes(observerHandle) {
-      observerHandle.disconnect();
-    }
-
-    /**
-     * Provided as a backwards-compatible API only.  This method does nothing.
-     */
-    notifyObserver() {}
-
-    /**
-     * Returns true if the provided node is contained with this element's
-     * light-DOM children or shadow root, including any nested shadow roots
-     * of children therein.
-     *
-     * @param {Node} node Node to test
-     * @return {boolean} Returns true if the given `node` is contained within
-     *   this element's light or shadow DOM.
-     */
-    deepContains(node) {
-      if (this.node.contains(node)) {
-        return true;
-      }
-      let n = node;
-      let doc = node.ownerDocument;
-      // walk from node to `this` or `document`
-      while (n && n !== doc && n !== this.node) {
-        // use logical parentnode, or native ShadowRoot host
-        n = n.parentNode || n.host;
-      }
-      return n === this.node;
-    }
-
-    /**
-     * Returns the root node of this node.  Equivalent to `getRoodNode()`.
-     *
-     * @return {Node} Top most element in the dom tree in which the node
-     * exists. If the node is connected to a document this is either a
-     * shadowRoot or the document; otherwise, it may be the node
-     * itself or a node or document fragment containing it.
-     */
-    getOwnerRoot() {
-      return this.node.getRootNode();
-    }
-
-    /**
-     * For slot elements, returns the nodes assigned to the slot; otherwise
-     * an empty array. It is equivalent to `<slot>.addignedNodes({flatten:true})`.
-     *
-     * @return {Array<Node>} Array of assigned nodes
-     */
-    getDistributedNodes() {
-      return (this.node.localName === 'slot') ?
-        this.node.assignedNodes({flatten: true}) :
-        [];
-    }
-
-    /**
-     * Returns an array of all slots this element was distributed to.
-     *
-     * @return {Array<HTMLSlotElement>} Description
-     */
-    getDestinationInsertionPoints() {
-      let ip$ = [];
-      let n = this.node.assignedSlot;
-      while (n) {
-        ip$.push(n);
-        n = n.assignedSlot;
-      }
-      return ip$;
-    }
-
-    /**
-     * Calls `importNode` on the `ownerDocument` for this node.
-     *
-     * @param {Node} node Node to import
-     * @param {boolean} deep True if the node should be cloned deeply during
-     *   import
-     * @return {Node} Clone of given node imported to this owner document
-     */
-    importNode(node, deep) {
-      let doc = this.node instanceof Document ? this.node :
-        this.node.ownerDocument;
-      return doc.importNode(node, deep);
-    }
-
-    /**
-     * Returns a flattened list of all child nodes and nodes distributed
-     * to child slots.
-     *
-     * @return {type} Description
-     */
-    getEffectiveChildNodes() {
-      return Polymer.FlattenedNodesObserver.getFlattenedNodes(this.node);
-    }
-
-    /**
-     * Returns a filtered list of flattened child elements for this element based
-     * on the given selector.
-     *
-     * @param {string} selector Selector to filter nodes against
-     * @return {Array<HTMLElement>} List of flattened child elements
-     */
-    queryDistributedElements(selector) {
-      let c$ = this.getEffectiveChildNodes();
-      let list = [];
-      for (let i=0, l=c$.length, c; (i<l) && (c=c$[i]); i++) {
-        if ((c.nodeType === Node.ELEMENT_NODE) &&
-            matchesSelector(c, selector)) {
-          list.push(c);
-        }
-      }
-      return list;
-    }
-
-    /**
-     * For shadow roots, returns the currently focused element within this
-     * shadow root.
-     *
-     * @return {Node|undefined} Currently focused element
-     */
-    get activeElement() {
-      let node = this.node;
-      return node._activeElement !== undefined ? node._activeElement : node.activeElement;
-    }
-  }
-
-  function forwardMethods(proto, methods) {
-    for (let i=0; i < methods.length; i++) {
-      let method = methods[i];
-      proto[method] = function() {
-        return this.node[method].apply(this.node, arguments);
-      }
-    }
-  }
-
-  function forwardReadOnlyProperties(proto, properties) {
-    for (let i=0; i < properties.length; i++) {
-      let name = properties[i];
-      Object.defineProperty(proto, name, {
-        get: function() {
-          return this.node[name];
-        },
-        configurable: true
-      });
-    }
-  }
-
-  function forwardProperties(proto, properties) {
-    for (let i=0; i < properties.length; i++) {
-      let name = properties[i];
-      Object.defineProperty(proto, name, {
-        get: function() {
-          return this.node[name];
-        },
-        set: function(value) {
-          this.node[name] = value;
-        },
-        configurable: true
-      });
-    }
-  }
-
-  forwardMethods(DomApi.prototype, [
-    'cloneNode', 'appendChild', 'insertBefore', 'removeChild',
-    'replaceChild', 'setAttribute', 'removeAttribute',
-    'querySelector', 'querySelectorAll'
-  ]);
-
-  forwardReadOnlyProperties(DomApi.prototype, [
-    'parentNode', 'firstChild', 'lastChild',
-    'nextSibling', 'previousSibling', 'firstElementChild',
-    'lastElementChild', 'nextElementSibling', 'previousElementSibling',
-    'childNodes', 'children', 'classList'
-  ]);
-
-  forwardProperties(DomApi.prototype, [
-    'textContent', 'innerHTML'
-  ]);
-
-
-  /**
-   * Event API wrapper class returned from `Polymer.dom.(target)` when
-   * `target` is an `Event`.
-   */
-  class EventApi {
-    constructor(event) {
-      this.event = event;
-    }
-
-    /**
-     * Returns the first node on the `composedPath` of this event.
-     *
-     * @return {Node} The node this event was dispatched to
-     */
-    get rootTarget() {
-      return this.event.composedPath()[0];
-    }
-
-    /**
-     * Returns the local (re-targeted) target for this event.
-     *
-     * @return {Node} The local (re-targeted) target for this event.
-     */
-    get localTarget() {
-      return this.event.target;
-    }
-
-    /**
-     * Returns the `composedPath` for this event.
-     */
-    get path() {
-      return this.event.composedPath();
-    }
-  }
-
-  /**
-   * Legacy DOM and Event manipulation API wrapper factory used to abstract
-   * differences between native Shadow DOM and "Shady DOM" when polyfilling on
-   * older browsers.
-   *
-   * Note that in Polymer 2.x use of `Polymer.dom` is no longer required and
-   * in the majority of cases simply facades directly to the standard native
-   * API.
-   *
-   * @namespace
-   * @summary Legacy DOM and Event manipulation API wrapper factory used to
-   * abstract differences between native Shadow DOM and "Shady DOM."
-   * @memberof Polymer
-   * @param {Node|Event} obj Node or event to operate on
-   * @return {DomApi|EventApi} Wrapper providing either node API or event API
-   */
-  Polymer.dom = function(obj) {
-    obj = obj || document;
-    let ctor = obj instanceof Event ? EventApi : DomApi;
-    if (!obj.__domApi) {
-      obj.__domApi = new ctor(obj);
-    }
-    return obj.__domApi;
-  };
-
-  Polymer.dom.matchesSelector = matchesSelector;
-
-  /**
-   * Forces several classes of asynchronously queued tasks to flush:
-   * - Debouncers added via `Polymer.enqueueDebouncer`
-   * - ShadyDOM distribution
-   *
-   * This method facades to `Polymer.flush`.
-   *
-   * @memberof Polymer.dom
-   */
-  Polymer.dom.flush = Polymer.flush;
-
-  /**
-   * Adds a `Polymer.Debouncer` to a list of globally flushable tasks.
-   *
-   * This method facades to `Polymer.enqueueDebouncer`.
-   *
-   * @memberof Polymer.dom
-   * @param {Polymer.Debouncer} debouncer Debouncer to enqueue
-   */
-  Polymer.dom.addDebouncer = Polymer.enqueueDebouncer;
-
-  // expose BC settings.
-  let settings = Polymer.Settings || {};
-  settings.useShadow = !(window.ShadyDOM);
-  settings.useNativeCSSProperties =
-    Boolean(!window.ShadyCSS || window.ShadyCSS.nativeCss);
-  settings.useNativeCustomElements =
-    !(window.customElements.polyfillWrapFlushCallback);
-  Polymer.Settings = settings;
-
-})();
-</script>
diff --git a/src/main/resources/static/gltf-viewer/bower_components/polymer/lib/legacy/templatizer-behavior.html b/src/main/resources/static/gltf-viewer/bower_components/polymer/lib/legacy/templatizer-behavior.html
deleted file mode 100644 (file)
index 4f3a14a..0000000
+++ /dev/null
@@ -1,136 +0,0 @@
-<!--
-@license
-Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
-This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
-The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
-The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
-Code distributed by Google as part of the polymer project is also
-subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
--->
-
-<link rel="import" href="../utils/templatize.html">
-
-<script>
-  (function() {
-    'use strict';
-
-    /**
-     * The `Polymer.Templatizer` behavior adds methods to generate instances of
-     * templates that are each managed by an anonymous `Polymer.PropertyEffects`
-     * instance where data-bindings in the stamped template content are bound to
-     * accessors on itself.
-     *
-     * This behavior is provided in Polymer 2.x as a hybrid-element convenience
-     * only.  For non-hybrid usage, the `Polymer.Templatize` library
-     * should be used instead.
-     *
-     * Example:
-     *
-     *     // Get a template from somewhere, e.g. light DOM
-     *     let template = this.querySelector('template');
-     *     // Prepare the template
-     *     this.templatize(template);
-     *     // Instance the template with an initial data model
-     *     let instance = this.stamp({myProp: 'initial'});
-     *     // Insert the instance's DOM somewhere, e.g. light DOM
-     *     Polymer.dom(this).appendChild(instance.root);
-     *     // Changing a property on the instance will propagate to bindings
-     *     // in the template
-     *     instance.myProp = 'new value';
-     *
-     * Users of `Templatizer` may need to implement the following abstract
-     * API's to determine how properties and paths from the host should be
-     * forwarded into to instances:
-     *
-     *     _forwardHostPropV2: function(prop, value)
-     *
-     * Likewise, users may implement these additional abstract API's to determine
-     * how instance-specific properties that change on the instance should be
-     * forwarded out to the host, if necessary.
-     *
-     *     _notifyInstancePropV2: function(inst, prop, value)
-     *
-     * In order to determine which properties are instance-specific and require
-     * custom notification via `_notifyInstanceProp`, define an `_instanceProps`
-     * object containing keys for each instance prop, for example:
-     *
-     *     _instanceProps: {
-     *       item: true,
-     *       index: true
-     *     }
-     *
-     * Any properties used in the template that are not defined in _instanceProp
-     * will be forwarded out to the Templatize `owner` automatically.
-     *
-     * Users may also implement the following abstract function to show or
-     * hide any DOM generated using `stamp`:
-     *
-     *     _showHideChildren: function(shouldHide)
-     *
-     * Note that some callbacks are suffixed with `V2` in the Polymer 2.x behavior
-     * as the implementations will need to differ from the callbacks required
-     * by the 1.x Templatizer API due to changes in the `TemplateInstance` API
-     * between versions 1.x and 2.x.
-     *
-     * @polymerBehavior
-     * @memberof Polymer
-     */
-    let Templatizer = {
-
-      /**
-       * Generates an anonymous `TemplateInstance` class (stored as `this.ctor`)
-       * for the provided template.  This method should be called once per
-       * template to prepare an element for stamping the template, followed
-       * by `stamp` to create new instances of the template.
-       *
-       * @param {HTMLTemplateElement} template Template to prepare
-       * @param {boolean=} mutableData When `true`, the generated class will skip
-       *   strict dirty-checking for objects and arrays (always consider them to
-       *   be "dirty"). Defaults to false.
-       */
-      templatize(template, mutableData) {
-        this._templatizerTemplate = template;
-        this.ctor = Polymer.Templatize.templatize(template, this, {
-          mutableData: Boolean(mutableData),
-          parentModel: this._parentModel,
-          instanceProps: this._instanceProps,
-          forwardHostProp: this._forwardHostPropV2,
-          notifyInstanceProp: this._notifyInstancePropV2
-        });
-      },
-
-      /**
-       * Creates an instance of the template prepared by `templatize`.  The object
-       * returned is an instance of the anonymous class generated by `templatize`
-       * whose `root` property is a document fragment containing newly cloned
-       * template content, and which has property accessors corresponding to
-       * properties referenced in template bindings.
-       *
-       * @param {Object=} model Object containing initial property values to
-       *   populate into the template bindings.
-       * @return {TemplateInstanceBase} Returns the created instance of
-       * the template prepared by `templatize`.
-       */
-      stamp(model) {
-        return new this.ctor(model);
-      },
-
-      /**
-       * Returns the template "model" (`TemplateInstance`) associated with
-       * a given element, which serves as the binding scope for the template
-       * instance the element is contained in.  A template model should be used
-       * to manipulate data associated with this template instance.
-       *
-       * @param {HTMLElement} el Element for which to return a template model.
-       * @return {TemplateInstanceBase} Model representing the binding scope for
-       *   the element.
-       */
-      modelForElement(el) {
-        return Polymer.Templatize.modelForElement(this._templatizerTemplate, el);
-      }
-    };
-
-    Polymer.Templatizer = Templatizer;
-
-  })();
-</script>
diff --git a/src/main/resources/static/gltf-viewer/bower_components/polymer/lib/mixins/element-mixin.html b/src/main/resources/static/gltf-viewer/bower_components/polymer/lib/mixins/element-mixin.html
deleted file mode 100644 (file)
index 92b728d..0000000
+++ /dev/null
@@ -1,929 +0,0 @@
-<!--
-@license
-Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
-This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
-The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
-The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
-Code distributed by Google as part of the polymer project is also
-subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
--->
-
-<link rel="import" href="../utils/boot.html">
-<link rel="import" href="../utils/mixin.html">
-<link rel="import" href="../utils/case-map.html">
-<link rel="import" href="../utils/style-gather.html">
-<link rel="import" href="../utils/resolve-url.html">
-<link rel="import" href="../elements/dom-module.html">
-<link rel="import" href="property-effects.html">
-
-<script>
-(function() {
-  'use strict';
-  /**
-   * @typedef Object<string, {
-   *   value: *,
-   *   type: (Function | undefined),
-   *   readOnly: (boolean | undefined),
-   *   computed: (string | undefined),
-   *   reflectToAttribute: (boolean | undefined),
-   *   notify: (boolean | undefined),
-   *   observer: (string | undefined)
-   * }>)
-   */
-  let PolymerElementProperties; // eslint-disable-line no-unused-vars
-
-  /** @record */
-  let PolymerElementConstructor = function(){}; // eslint-disable-line no-unused-vars
-  /** @type {(string | undefined)} */
-  PolymerElementConstructor.is;
-  /** @type {(string | undefined)} */
-  PolymerElementConstructor.extends;
-  /** @type {(!PolymerElementProperties | undefined)} */
-  PolymerElementConstructor.properties;
-  /** @type {(!Array<string> | undefined)} */
-  PolymerElementConstructor.observers;
-  /** @type {(!HTMLTemplateElement | string | undefined)} */
-  PolymerElementConstructor.template;
-
-  /**
-   * Element class mixin that provides the core API for Polymer's meta-programming
-   * features including template stamping, data-binding, attribute deserialization,
-   * and property change observation.
-   *
-   * Subclassers may provide the following static getters to return metadata
-   * used to configure Polymer's features for the class:
-   *
-   * - `static get is()`: When the template is provided via a `dom-module`,
-   *   users should return the `dom-module` id from a static `is` getter.  If
-   *   no template is needed or the template is provided directly via the
-   *   `template` getter, there is no need to define `is` for the element.
-   *
-   * - `static get template()`: Users may provide the template directly (as
-   *   opposed to via `dom-module`) by implementing a static `template` getter.
-   *   The getter may return an `HTMLTemplateElement` or a string, which will
-   *   automatically be parsed into a template.
-   *
-   * - `static get properties()`: Should return an object describing
-   *   property-related metadata used by Polymer features (key: property name
-   *   value: object containing property metadata). Valid keys in per-property
-   *   metadata include:
-   *   - `type` (String|Number|Object|Array|...): Used by
-   *     `attributeChangedCallback` to determine how string-based attributes
-   *     are deserialized to JavaScript property values.
-   *   - `notify` (boolean): Causes a change in the property to fire a
-   *     non-bubbling event called `<property>-changed`. Elements that have
-   *     enabled two-way binding to the property use this event to observe changes.
-   *   - `readOnly` (boolean): Creates a getter for the property, but no setter.
-   *     To set a read-only property, use the private setter method
-   *     `_setProperty(property, value)`.
-   *   - `observer` (string): Observer method name that will be called when
-   *     the property changes. The arguments of the method are
-   *     `(value, previousValue)`.
-   *   - `computed` (string): String describing method and dependent properties
-   *     for computing the value of this property (e.g. `'computeFoo(bar, zot)'`).
-   *     Computed properties are read-only by default and can only be changed
-   *     via the return value of the computing method.
-   *
-   * - `static get observers()`: Array of strings describing multi-property
-   *   observer methods and their dependent properties (e.g.
-   *   `'observeABC(a, b, c)'`).
-   *
-   * The base class provides default implementations for the following standard
-   * custom element lifecycle callbacks; users may override these, but should
-   * call the super method to ensure
-   * - `constructor`: Run when the element is created or upgraded
-   * - `connectedCallback`: Run each time the element is connected to the
-   *   document
-   * - `disconnectedCallback`: Run each time the element is disconnected from
-   *   the document
-   * - `attributeChangedCallback`: Run each time an attribute in
-   *   `observedAttributes` is set or removed (note: this element's default
-   *   `observedAttributes` implementation will automatically return an array
-   *   of dash-cased attributes based on `properties`)
-   *
-   * @polymerMixin
-   * @mixes Polymer.PropertyEffects
-   * @memberof Polymer
-   * @property rootPath {string} Set to the value of `Polymer.rootPath`,
-   *   which defaults to the main document path
-   * @property importPath {string} Set to the value of the class's static
-   *   `importPath` property, which defaults to the path of this element's
-   *   `dom-module` (when `is` is used), but can be overridden for other
-   *   import strategies.
-   * @summary Element class mixin that provides the core API for Polymer's
-   * meta-programming features.
-   */
-  Polymer.ElementMixin = Polymer.dedupingMixin(base => {
-
-    /**
-     * @constructor
-     * @extends {base}
-     * @implements {Polymer_PropertyEffects}
-     */
-    const polymerElementBase = Polymer.PropertyEffects(base);
-
-    let caseMap = Polymer.CaseMap;
-
-    const DISABLED = 'disable-upgrade';
-
-    /**
-     * Returns the `properties` object specifically on `klass`. Use for:
-     * (1) super chain mixes togther to make `propertiesForClass` which is
-     * then used to make `observedAttributes`.
-     * (2) properties effects and observers are created from it at `finalize` time.
-     *
-     * @param {HTMLElement} klass Element class
-     * @return {Object} Object containing own properties for this class
-     * @private
-     */
-    function ownPropertiesForClass(klass) {
-      if (!klass.hasOwnProperty(
-        JSCompiler_renameProperty('__ownProperties', klass))) {
-        klass.__ownProperties =
-          klass.hasOwnProperty(JSCompiler_renameProperty('properties', klass)) ?
-          klass.properties : {};
-      }
-      return klass.__ownProperties;
-    }
-
-    /**
-     * Returns the `observers` array specifically on `klass`. Use for
-     * setting up observers.
-     *
-     * @param {HTMLElement} klass Element class
-     * @return {Array} Array containing own observers for this class
-     * @private
-     */
-    function ownObserversForClass(klass) {
-      if (!klass.hasOwnProperty(
-        JSCompiler_renameProperty('__ownObservers', klass))) {
-        klass.__ownObservers =
-          klass.hasOwnProperty(JSCompiler_renameProperty('observers', klass)) ?
-          klass.observers : [];
-      }
-      return klass.__ownObservers;
-    }
-
-    /**
-     * Mixes `props` into `flattenedProps` but upgrades shorthand type
-     * syntax to { type: Type}.
-     *
-     * @param {Object} flattenedProps Bag to collect flattened properties into
-     * @param {Object} props Bag of properties to add to `flattenedProps`
-     * @return {Objecg} The input `flattenedProps` bag
-     * @private
-     */
-    function flattenProperties(flattenedProps, props) {
-      for (let p in props) {
-        let o = props[p];
-        if (typeof o == 'function') {
-          o = { type: o };
-        }
-        flattenedProps[p] = o;
-      }
-      return flattenedProps;
-    }
-
-    /**
-     * Returns a flattened list of properties mixed together from the chain of all
-     * constructor's `config.properties`. This list is used to create
-     * (1) observedAttributes,
-     * (2) class property default values
-     *
-     * @param {HTMLElement} klass Element class
-     * @return {PolymerElementProperties} Flattened properties for this class
-     * @private
-     */
-    function propertiesForClass(klass) {
-      if (!klass.hasOwnProperty(
-        JSCompiler_renameProperty('__classProperties', klass))) {
-        klass.__classProperties =
-        flattenProperties({}, ownPropertiesForClass(klass));
-        let superCtor = Object.getPrototypeOf(klass.prototype).constructor;
-        if (superCtor.prototype instanceof PolymerElement) {
-          klass.__classProperties = Object.assign(
-            Object.create(propertiesForClass(superCtor)),
-            klass.__classProperties);
-        }
-      }
-      return klass.__classProperties;
-    }
-
-    /**
-     * Returns a list of properties with default values.
-     * This list is created as an optimization since it is a subset of
-     * the list returned from `propertiesForClass`.
-     * This list is used in `_initializeProperties` to set property defaults.
-     *
-     * @param {HTMLElement} klass Element class
-     * @return {PolymerElementProperties} Flattened properties for this class
-     *   that have default values
-     * @private
-     */
-    function propertyDefaultsForClass(klass) {
-      if (!klass.hasOwnProperty(
-        JSCompiler_renameProperty('__classPropertyDefaults', klass))) {
-        klass.__classPropertyDefaults = null;
-        let props = propertiesForClass(klass);
-        for (let p in props) {
-          let info = props[p];
-          if ('value' in info) {
-            klass.__classPropertyDefaults = klass.__classPropertyDefaults || {};
-            klass.__classPropertyDefaults[p] = info;
-          }
-        }
-      }
-      return klass.__classPropertyDefaults;
-    }
-
-    /**
-     * Returns true if a `klass` has finalized. Called in `ElementClass.finalize()`
-     * @param {HTMLElement} klass Element class
-     * @return {boolean} True if all metaprogramming for this class has been
-     *   completed
-     * @private
-     */
-    function hasClassFinalized(klass) {
-      return klass.hasOwnProperty(JSCompiler_renameProperty('__finalized', klass));
-    }
-
-    /**
-     * Called by `ElementClass.finalize()`. Ensures this `klass` and
-     * *all superclasses* are finalized by traversing the prototype chain
-     * and calling `klass.finalize()`.
-     *
-     * @param {HTMLElement} klass Element class
-     * @private
-     */
-    function finalizeClassAndSuper(klass) {
-      let proto = klass.prototype;
-      let superCtor = Object.getPrototypeOf(proto).constructor;
-      if (superCtor.prototype instanceof PolymerElement) {
-        superCtor.finalize();
-      }
-      finalizeClass(klass);
-    }
-
-    /**
-     * Configures a `klass` based on a staic `klass.config` object and
-     * a `template`. This includes creating accessors and effects
-     * for properties in `config` and the `template` as well as preparing the
-     * `template` for stamping.
-     *
-     * @param {HTMLElement} klass Element class
-     * @private
-     */
-    function finalizeClass(klass) {
-      klass.__finalized = true;
-      let proto = klass.prototype;
-      if (klass.hasOwnProperty(
-        JSCompiler_renameProperty('is', klass)) && klass.is) {
-        Polymer.telemetry.register(proto);
-      }
-      let props = ownPropertiesForClass(klass);
-      if (props) {
-        finalizeProperties(proto, props);
-      }
-      let observers = ownObserversForClass(klass);
-      if (observers) {
-        finalizeObservers(proto, observers, props);
-      }
-      // note: create "working" template that is finalized at instance time
-      let template = klass.template;
-      if (template) {
-        if (typeof template === 'string') {
-          let t = document.createElement('template');
-          t.innerHTML = template;
-          template = t;
-        } else {
-          template = template.cloneNode(true);
-        }
-        proto._template = template;
-      }
-    }
-
-    /**
-     * Configures a `proto` based on a `properties` object.
-     * Leverages `PropertyEffects` to create property accessors and effects
-     * supporting, observers, reflecting to attributes, change notification,
-     * computed properties, and read only properties.
-     * @param {HTMLElement} proto Element class prototype to add accessors
-     *    and effects to
-     * @param {Object} properties Flattened bag of property descriptors for
-     *    this class
-     * @private
-     */
-    function finalizeProperties(proto, properties) {
-      for (let p in properties) {
-        createPropertyFromConfig(proto, p, properties[p], properties);
-      }
-    }
-
-    /**
-     * Configures a `proto` based on a `observers` array.
-     * Leverages `PropertyEffects` to create observers.
-     * @param {HTMLElement} proto Element class prototype to add accessors
-     *   and effects to
-     * @param {Object} observers Flattened array of observer descriptors for
-     *   this class
-     * @param {Object} dynamicFns Object containing keys for any properties
-     *   that are functions and should trigger the effect when the function
-     *   reference is changed
-     * @private
-     */
-    function finalizeObservers(proto, observers, dynamicFns) {
-      for (let i=0; i < observers.length; i++) {
-        proto._createMethodObserver(observers[i], dynamicFns);
-      }
-    }
-
-    /**
-     * Creates effects for a property.
-     *
-     * Note, once a property has been set to
-     * `readOnly`, `computed`, `reflectToAttribute`, or `notify`
-     * these values may not be changed. For example, a subclass cannot
-     * alter these settings. However, additional `observers` may be added
-     * by subclasses.
-     *
-     * The info object should may contain property metadata as follows:
-     *
-     * * `type`: {function} type to which an attribute matching the property
-     * is deserialized. Note the property is camel-cased from a dash-cased
-     * attribute. For example, 'foo-bar' attribute is dersialized to a
-     * property named 'fooBar'.
-     *
-     * * `readOnly`: {boolean} creates a readOnly property and
-     * makes a private setter for the private of the form '_setFoo' for a
-     * property 'foo',
-     *
-     * * `computed`: {string} creates a computed property. A computed property
-     * also automatically is set to `readOnly: true`. The value is calculated
-     * by running a method and arguments parsed from the given string. For
-     * example 'compute(foo)' will compute a given property when the
-     * 'foo' property changes by executing the 'compute' method. This method
-     * must return the computed value.
-     *
-     * * `reflectToAttriute`: {boolean} If true, the property value is reflected
-     * to an attribute of the same name. Note, the attribute is dash-cased
-     * so a property named 'fooBar' is reflected as 'foo-bar'.
-     *
-     * * `notify`: {boolean} sends a non-bubbling notification event when
-     * the property changes. For example, a property named 'foo' sends an
-     * event named 'foo-changed' with `event.detail` set to the value of
-     * the property.
-     *
-     * * observer: {string} name of a method that runs when the property
-     * changes. The arguments of the method are (value, previousValue).
-     *
-     * Note: Users may want control over modifying property
-     * effects via subclassing. For example, a user might want to make a
-     * reflectToAttribute property not do so in a subclass. We've chosen to
-     * disable this because it leads to additional complication.
-     * For example, a readOnly effect generates a special setter. If a subclass
-     * disables the effect, the setter would fail unexpectedly.
-     * Based on feedback, we may want to try to make effects more malleable
-     * and/or provide an advanced api for manipulating them.
-     * Also consider adding warnings when an effect cannot be changed.
-     *
-     * @param {HTMLElement} proto Element class prototype to add accessors
-     *   and effects to
-     * @param {string} name Name of the property.
-     * @param {Object} info Info object from which to create property effects.
-     * Supported keys:
-     * @param {Object} allProps Flattened map of all properties defined in this
-     *   element (including inherited properties)
-     * @private
-     */
-    function createPropertyFromConfig(proto, name, info, allProps) {
-      // computed forces readOnly...
-      if (info.computed) {
-        info.readOnly = true;
-      }
-      // Note, since all computed properties are readOnly, this prevents
-      // adding additional computed property effects (which leads to a confusing
-      // setup where multiple triggers for setting a property)
-      // While we do have `hasComputedEffect` this is set on the property's
-      // dependencies rather than itself.
-      if (info.computed  && !proto._hasReadOnlyEffect(name)) {
-        proto._createComputedProperty(name, info.computed, allProps);
-      }
-      if (info.readOnly && !proto._hasReadOnlyEffect(name)) {
-        proto._createReadOnlyProperty(name, !info.computed);
-      }
-      if (info.reflectToAttribute && !proto._hasReflectEffect(name)) {
-        proto._createReflectedProperty(name);
-      }
-      if (info.notify && !proto._hasNotifyEffect(name)) {
-        proto._createNotifyingProperty(name);
-      }
-      // always add observer
-      if (info.observer) {
-        proto._createPropertyObserver(name, info.observer, allProps[info.observer]);
-      }
-    }
-
-    /**
-     * Configures an element `proto` to function with a given `template`.
-     * The element name `is` and extends `ext` must be specified for ShadyCSS
-     * style scoping.
-     *
-     * @param {HTMLElement} proto Element class prototype to add accessors
-     *   and effects to
-     * @param {HTMLTemplateElement} template Template to process and bind
-     * @param {string} baseURI URL against which to resolve urls in
-     *   style element cssText
-     * @param {string} is Tag name (or type extension name) for this element
-     * @param {string=} ext For type extensions, the tag name that was extended
-     * @private
-     */
-    function finalizeTemplate(proto, template, baseURI, is, ext) {
-      // support `include="module-name"`
-      let cssText =
-        Polymer.StyleGather.cssFromTemplate(template, baseURI) +
-        Polymer.StyleGather.cssFromModuleImports(is);
-      if (cssText) {
-        let style = document.createElement('style');
-        style.textContent = cssText;
-        template.content.insertBefore(style, template.content.firstChild);
-      }
-      if (window.ShadyCSS) {
-        window.ShadyCSS.prepareTemplate(template, is, ext);
-      }
-      proto._bindTemplate(template);
-    }
-
-    function flushPropertiesStub() {}
-
-    /**
-     * @polymerMixinClass
-     * @unrestricted
-     * @implements {Polymer_ElementMixin}
-     */
-    class PolymerElement extends polymerElementBase {
-
-      /**
-       * Standard Custom Elements V1 API.  The default implementation returns
-       * a list of dash-cased attributes based on a flattening of all properties
-       * declared in `static get properties()` for this element and any
-       * superclasses.
-       *
-       * @return {Array} Observed attribute list
-       */
-      static get observedAttributes() {
-        if (!this.hasOwnProperty(JSCompiler_renameProperty('__observedAttributes', this))) {
-          let list = [DISABLED];
-          let properties = propertiesForClass(this);
-          for (let prop in properties) {
-            list.push(Polymer.CaseMap.camelToDashCase(prop));
-          }
-          this.__observedAttributes = list;
-        }
-        return this.__observedAttributes;
-      }
-
-      /**
-       * Called automatically when the first element instance is created to
-       * ensure that class finalization work has been completed.
-       * May be called by users to eagerly perform class finalization work
-       * prior to the creation of the first element instance.
-       *
-       * Class finalization work generally includes meta-programming such as
-       * creating property accessors and any property effect metadata needed for
-       * the features used.
-       *
-       * @public
-       */
-      static finalize() {
-        if (!hasClassFinalized(this)) {
-          finalizeClassAndSuper(this);
-        }
-      }
-
-      /**
-       * Returns the template that will be stamped into this element's shadow root.
-       *
-       * If a `static get is()` getter is defined, the default implementation
-       * will return the first `<template>` in a `dom-module` whose `id`
-       * matches this element's `is`.
-       *
-       * Users may override this getter to return an arbitrary template
-       * (in which case the `is` getter is unnecessary). The template returned
-       * may be either an `HTMLTemplateElement` or a string that will be
-       * automatically parsed into a template.
-       *
-       * Note that when subclassing, if the super class overrode the default
-       * implementation and the subclass would like to provide an alternate
-       * template via a `dom-module`, it should override this getter and
-       * return `Polymer.DomModule.import(this.is, 'template')`.
-       *
-       * If a subclass would like to modify the super class template, it should
-       * clone it rather than modify it in place.  If the getter does expensive
-       * work such as cloning/modifying a template, it should memoize the
-       * template for maximum performance:
-       *
-       *   let memoizedTemplate;
-       *   class MySubClass extends MySuperClass {
-       *     static get template() {
-       *       if (!memoizedTemplate) {
-       *         memoizedTemplate = super.template.cloneNode(true);
-       *         let subContent = document.createElement('div');
-       *         subContent.textContent = 'This came from MySubClass';
-       *         memoizedTemplate.content.appendChild(subContent);
-       *       }
-       *       return memoizedTemplate;
-       *     }
-       *   }
-       *
-       * @return {HTMLTemplateElement|string} Template to be stamped
-       */
-      static get template() {
-        if (!this.hasOwnProperty(JSCompiler_renameProperty('_template', this))) {
-          this._template = Polymer.DomModule.import(this.is, 'template') ||
-            // note: implemented so a subclass can retrieve the super
-            // template; call the super impl this way so that `this` points
-            // to the superclass.
-            Object.getPrototypeOf(this.prototype).constructor.template;
-        }
-        return this._template;
-      }
-
-      /**
-       * Path matching the url from which the element was imported.
-       * This path is used to resolve url's in template style cssText.
-       * The `importPath` property is also set on element instances and can be
-       * used to create bindings relative to the import path.
-       * Defaults to the path matching the url containing a `dom-module` element
-       * matching this element's static `is` property.
-       * Note, this path should contain a trailing `/`.
-       *
-       * @return {string} The import path for this element class
-       */
-      static get importPath() {
-        if (!this.hasOwnProperty(JSCompiler_renameProperty('_importPath', this))) {
-            const module = Polymer.DomModule.import(this.is);
-            this._importPath = module ? module.assetpath : '' ||
-            Object.getPrototypeOf(this.prototype).constructor.importPath;
-        }
-        return this._importPath;
-      }
-
-      /**
-       * Overrides the default `Polymer.PropertyAccessors` to ensure class
-       * metaprogramming related to property accessors and effects has
-       * completed (calls `finalize`).
-       *
-       * It also initializes any property defaults provided via `value` in
-       * `properties` metadata.
-       *
-       * @override
-       */
-      _initializeProperties() {
-        Polymer.telemetry.instanceCount++;
-        hostStack.registerHost(this);
-        this.constructor.finalize();
-        const importPath = this.constructor.importPath;
-        // note: finalize template when we have access to `localName` to
-        // avoid dependence on `is` for polyfilling styling.
-        if (this._template && !this._template.__polymerFinalized) {
-          this._template.__polymerFinalized = true;
-          const baseURI =
-            importPath ? Polymer.ResolveUrl.resolveUrl(importPath) : '';
-          finalizeTemplate(this.__proto__, this._template, baseURI,
-            this.localName);
-        }
-        super._initializeProperties();
-        // set path defaults
-        this.rootPath = Polymer.rootPath;
-        this.importPath = importPath;
-        // apply property defaults...
-        let p$ = propertyDefaultsForClass(this.constructor);
-        if (!p$) {
-          return;
-        }
-        for (let p in p$) {
-          let info = p$[p];
-          // Don't set default value if there is already an own property, which
-          // happens when a `properties` property with default but no effects had
-          // a property set (e.g. bound) by its host before upgrade
-          if (!this.hasOwnProperty(p)) {
-            let value = typeof info.value == 'function' ?
-              info.value.call(this) :
-              info.value;
-            // Set via `_setProperty` if there is an accessor, to enable
-            // initializing readOnly property defaults
-            if (this._hasAccessor(p)) {
-              this._setPendingProperty(p, value, true);
-            } else {
-              this[p] = value;
-            }
-          }
-        }
-      }
-
-      /**
-       * Provides a default implementation of the standard Custom Elements
-       * `connectedCallback`.
-       *
-       * The default implementation enables the property effects system and
-       * flushes any pending properties, and updates shimmed CSS properties
-       * when using the ShadyCSS scoping/custom properties polyfill.
-       *
-       * @override
-       */
-      connectedCallback() {
-        if (window.ShadyCSS && this._template) {
-          window.ShadyCSS.styleElement(this);
-        }
-        if (!this.__dataInitialized) {
-          this._flushProperties();
-        }
-      }
-
-      /**
-       * Provides a default implementation of the standard Custom Elements
-       * `disconnectedCallback`.
-       *
-       * @override
-       */
-      disconnectedCallback() {}
-
-      /**
-       * Stamps the element template.
-       *
-       * @override
-       */
-      ready() {
-        if (this._template) {
-          hostStack.beginHosting(this);
-          this.root = this._stampTemplate(this._template);
-          hostStack.endHosting(this);
-          this.$ = this.root.$;
-        }
-        super.ready();
-      }
-
-      /**
-       * Implements `PropertyEffects`'s `_readyClients` call. Attaches
-       * element dom by calling `_attachDom` with the dom stamped from the
-       * element's template via `_stampTemplate`. Note that this allows
-       * client dom to be attached to the element prior to any observers
-       * running.
-       *
-       * @override
-       */
-      _readyClients() {
-        super._readyClients();
-        if (this._template) {
-          this.root = this._attachDom(this.root);
-        }
-      }
-
-
-      /**
-       * Attaches an element's stamped dom to itself. By default,
-       * this method creates a `shadowRoot` and adds the dom to it.
-       * However, this method may be overridden to allow an element
-       * to put its dom in another location.
-       *
-       * @throws {Error}
-       * @suppress {missingReturn}
-       * @param {NodeList} dom to attach to the element.
-       * @return {Node} node to which the dom has been attached.
-       */
-      _attachDom(dom) {
-        if (this.attachShadow) {
-          if (dom) {
-            if (!this.shadowRoot) {
-              this.attachShadow({mode: 'open'});
-            }
-            this.shadowRoot.appendChild(dom);
-            return this.shadowRoot;
-          }
-        } else {
-          throw new Error('ShadowDOM not available. ' +
-            // TODO(sorvell): move to compile-time conditional when supported
-          'Polymer.Element can create dom as children instead of in ' +
-          'ShadowDOM by setting `this.root = this;\` before \`ready\`.');
-        }
-      }
-
-      /**
-       * Provides a default implementation of the standard Custom Elements
-       * `attributeChangedCallback`.
-       *
-       * By default, attributes declared in `properties` metadata are
-       * deserialized using their `type` information to properties of the
-       * same name.  "Dash-cased" attributes are deserialzed to "camelCase"
-       * properties.
-       *
-       * @override
-       */
-      attributeChangedCallback(name, old, value) {
-        // process `disable-upgrade` specially:
-        // First we see `disable-upgrade` added and disable `_flushProperties`,
-        // then when it's removed, restore regular flushing and flush.
-        // This should only be allowed before "readying".
-        if (name === DISABLED && !this.__dataInitialized) {
-          if (value !== null) {
-            this.__flushProperties = this._flushProperties;
-            this._flushProperties = flushPropertiesStub;
-          } else {
-            this._flushProperties = this.__flushProperties;
-            this._flushProperties();
-          }
-        } else if (old !== value) {
-          let property = caseMap.dashToCamelCase(name);
-          let type = propertiesForClass(this.constructor)[property].type;
-          if (!this._hasReadOnlyEffect(property)) {
-            this._attributeToProperty(name, value, type);
-          }
-        }
-      }
-
-      /**
-       * When using the ShadyCSS scoping and custom property shim, causes all
-       * shimmed styles in this element (and its subtree) to be updated
-       * based on current custom property values.
-       *
-       * The optional parameter overrides inline custom property styles with an
-       * object of properties where the keys are CSS properties, and the values
-       * are strings.
-       *
-       * Example: `this.updateStyles({'--color': 'blue'})`
-       *
-       * These properties are retained unless a value of `null` is set.
-       *
-       * @param {Object=} properties Bag of custom property key/values to
-       *   apply to this element.
-       */
-      updateStyles(properties) {
-        if (window.ShadyCSS) {
-          window.ShadyCSS.styleSubtree(this, properties);
-        }
-      }
-
-      /**
-       * Rewrites a given URL relative to a base URL. The base URL defaults to
-       * the original location of the document containing the `dom-module` for
-       * this element. This method will return the same URL before and after
-       * bundling.
-       *
-       * @param {string} url URL to resolve.
-       * @param {string=} base Optional base URL to resolve against, defaults
-       * to the element's `importPath`
-       * @return {string} Rewritten URL relative to base
-       */
-      resolveUrl(url, base) {
-        if (!base && this.importPath) {
-          base = Polymer.ResolveUrl.resolveUrl(this.importPath);
-        }
-        return Polymer.ResolveUrl.resolveUrl(url, base);
-      }
-
-      /**
-       * Overrides `PropertyAccessors` to add map of dynamic functions on
-       * template info, for consumption by `PropertyEffects` template binding
-       * code. This map determines which method templates should have accessors
-       * created for them.
-       *
-       * @override
-       */
-      static _parseTemplateContent(template, templateInfo, nodeInfo) {
-        templateInfo.dynamicFns = templateInfo.dynamicFns || propertiesForClass(this);
-        return super._parseTemplateContent(template, templateInfo, nodeInfo);
-      }
-
-    }
-
-    return PolymerElement;
-  });
-
-  /**
-   * Helper api for enqueing client dom created by a host element.
-   *
-   * By default elements are flushed via `_flushProperties` when
-   * `connectedCallback` is called. Elements attach their client dom to
-   * themselves at `ready` time which results from this first flush.
-   * This provides an ordering guarantee that the client dom an element
-   * creates is flushed before the element itself (i.e. client `ready`
-   * fires before host `ready`).
-   *
-   * However, if `_flushProperties` is called *before* an element is connected,
-   * as for example `Templatize` does, this ordering guarantee cannot be
-   * satisfied because no elements are connected. (Note: Bound elements that
-   * receive data do become enqueued clients and are properly ordered but
-   * unbound elements are not.)
-   *
-   * To maintain the desired "client before host" ordering guarantee for this
-   * case we rely on the "host stack. Client nodes registers themselves with
-   * the creating host element when created. This ensures that all client dom
-   * is readied in the proper order, maintaining the desired guarantee.
-   *
-   * @private
-   */
-  let hostStack = {
-
-    stack: [],
-
-    registerHost(inst) {
-      if (this.stack.length) {
-        let host = this.stack[this.stack.length-1];
-        host._enqueueClient(inst);
-      }
-    },
-
-    beginHosting(inst) {
-      this.stack.push(inst);
-    },
-
-    endHosting(inst) {
-      let stackLen = this.stack.length;
-      if (stackLen && this.stack[stackLen-1] == inst) {
-        this.stack.pop();
-      }
-    }
-
-  }
-
-  /**
-   * Provides basic tracking of element definitions (registrations) and
-   * instance counts.
-   *
-   * @namespace
-   * @summary Provides basic tracking of element definitions (registrations) and
-   * instance counts.
-   */
-  Polymer.telemetry = {
-    /**
-     * Total number of Polymer element instances created.
-     * @type {number}
-     */
-    instanceCount: 0,
-    /**
-     * Array of Polymer element classes that have been finalized.
-     * @type {Array<Polymer.Element>}
-     */
-    registrations: [],
-    /**
-     * @param {HTMLElement} prototype Element prototype to log
-     * @private
-     */
-    _regLog: function(prototype) {
-      console.log('[' + prototype.is + ']: registered')
-    },
-    /**
-     * Registers a class prototype for telemetry purposes.
-     * @param {HTMLElement} prototype Element prototype to register
-     * @protected
-     */
-    register: function(prototype) {
-      this.registrations.push(prototype);
-      Polymer.log && this._regLog(prototype);
-    },
-    /**
-     * Logs all elements registered with an `is` to the console.
-     * @public
-     */
-    dumpRegistrations: function() {
-      this.registrations.forEach(this._regLog);
-    }
-  };
-
-  /**
-   * When using the ShadyCSS scoping and custom property shim, causes all
-   * shimmed `styles` (via `custom-style`) in the document (and its subtree)
-   * to be updated based on current custom property values.
-   *
-   * The optional parameter overrides inline custom property styles with an
-   * object of properties where the keys are CSS properties, and the values
-   * are strings.
-   *
-   * Example: `Polymer.updateStyles({'--color': 'blue'})`
-   *
-   * These properties are retained unless a value of `null` is set.
-   *
-   * @param {Object=} props Bag of custom property key/values to
-   *   apply to the document.
-   */
-  Polymer.updateStyles = function(props) {
-    if (window.ShadyCSS) {
-      window.ShadyCSS.styleDocument(props);
-    }
-  };
-
-  /**
-   * Globally settable property that is automatically assigned to
-   * `Polymer.ElementMixin` instances, useful for binding in templates to
-   * make URL's relative to an application's root.  Defaults to the main
-   * document URL, but can be overridden by users.  It may be useful to set
-   * `Polymer.rootPath` to provide a stable application mount path when
-   * using client side routing.
-   *
-   * @memberof Polymer
-   */
-  Polymer.rootPath = Polymer.rootPath ||
-    Polymer.ResolveUrl.pathFromUrl(document.baseURI || window.location.href);
-
-})();
-</script>
diff --git a/src/main/resources/static/gltf-viewer/bower_components/polymer/lib/mixins/gesture-event-listeners.html b/src/main/resources/static/gltf-viewer/bower_components/polymer/lib/mixins/gesture-event-listeners.html
deleted file mode 100644 (file)
index dcf163d..0000000
+++ /dev/null
@@ -1,61 +0,0 @@
-<!--
-@license
-Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
-This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
-The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
-The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
-Code distributed by Google as part of the polymer project is also
-subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
--->
-<link rel="import" href="../utils/boot.html">
-<link rel="import" href="../utils/gestures.html">
-
-<script>
-(function() {
-
-  'use strict';
-
-  const gestures = Polymer.Gestures;
-
-  /**
-   * Element class mixin that provides API for adding Polymer's cross-platform
-   * gesture events to nodes.
-   *
-   * The API is designed to be compatible with override points implemented
-   * in `Polymer.TemplateStamp` such that declarative event listeners in
-   * templates will support gesture events when this mixin is applied along with
-   * `Polymer.TemplateStamp`.
-   *
-   * @polymerMixin
-   * @memberof Polymer
-   * @summary Element class mixin that provides API for adding Polymer's cross-platform
-   * gesture events to nodes
-   */
-  Polymer.GestureEventListeners = Polymer.dedupingMixin(superClass => {
-
-    /**
-     * @polymerMixinClass
-     * @implements {Polymer_GestureEventListeners}
-     */
-    class GestureEventListeners extends superClass {
-
-      _addEventListenerToNode(node, eventName, handler) {
-        if (!gestures.addListener(node, eventName, handler)) {
-          super._addEventListenerToNode(node, eventName, handler);
-        }
-      }
-
-      _removeEventListenerFromNode(node, eventName, handler) {
-        if (!gestures.removeListener(node, eventName, handler)) {
-          super._removeEventListenerFromNode(node, eventName, handler);
-        }
-      }
-
-    }
-
-    return GestureEventListeners;
-
-  });
-
-})();
-</script>
diff --git a/src/main/resources/static/gltf-viewer/bower_components/polymer/lib/mixins/mutable-data.html b/src/main/resources/static/gltf-viewer/bower_components/polymer/lib/mixins/mutable-data.html
deleted file mode 100644 (file)
index 9cb6493..0000000
+++ /dev/null
@@ -1,194 +0,0 @@
-<!--
-@license
-Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
-This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
-The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
-The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
-Code distributed by Google as part of the polymer project is also
-subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
--->
-
-<link rel="import" href="../utils/mixin.html">
-
-<script>
-(function() {
-  'use strict';
-
-  // Common implementation for mixin & behavior
-  function mutablePropertyChange(inst, property, value, old, mutableData) {
-    let isObject;
-    if (mutableData) {
-      isObject = (typeof value === 'object' && value !== null);
-      // Pull `old` for Objects from temp cache, but treat `null` as a primitive
-      if (isObject) {
-        old = inst.__dataTemp[property];
-      }
-    }
-    // Strict equality check, but return false for NaN===NaN
-    let shouldChange = (old !== value && (old === old || value === value));
-    // Objects are stored in temporary cache (cleared at end of
-    // turn), which is used for dirty-checking
-    if (isObject && shouldChange) {
-      inst.__dataTemp[property] = value;
-    }
-    return shouldChange;
-  }
-
-  /**
-   * Element class mixin to skip strict dirty-checking for objects and arrays
-   * (always consider them to be "dirty"), for use on elements utilizing
-   * `Polymer.PropertyEffects`
-   *
-   * By default, `Polymer.PropertyEffects` performs strict dirty checking on
-   * objects, which means that any deep modifications to an object or array will
-   * not be propagated unless "immutable" data patterns are used (i.e. all object
-   * references from the root to the mutation were changed).
-   *
-   * Polymer also provides a proprietary data mutation and path notification API
-   * (e.g. `notifyPath`, `set`, and array mutation API's) that allow efficient
-   * mutation and notification of deep changes in an object graph to all elements
-   * bound to the same object graph.
-   *
-   * In cases where neither immutable patterns nor the data mutation API can be
-   * used, applying this mixin will cause Polymer to skip dirty checking for
-   * objects and arrays (always consider them to be "dirty").  This allows a
-   * user to make a deep modification to a bound object graph, and then either
-   * simply re-set the object (e.g. `this.items = this.items`) or call `notifyPath`
-   * (e.g. `this.notifyPath('items')`) to update the tree.  Note that all
-   * elements that wish to be updated based on deep mutations must apply this
-   * mixin or otherwise skip strict dirty checking for objects/arrays.
-   *
-   * In order to make the dirty check strategy configurable, see
-   * `Polymer.OptionalMutableData`.
-   *
-   * Note, the performance characteristics of propagating large object graphs
-   * will be worse as opposed to using strict dirty checking with immutable
-   * patterns or Polymer's path notification API.
-   *
-   * @polymerMixin
-   * @memberof Polymer
-   * @summary Element class mixin to skip strict dirty-checking for objects
-   *   and arrays
-   */
-  Polymer.MutableData = Polymer.dedupingMixin(superClass => {
-
-    /**
-     * @polymerMixinClass
-     * @implements {Polymer_MutableData}
-     */
-    class MutableData extends superClass {
-      /**
-       * Overrides `Polymer.PropertyEffects` to provide option for skipping
-       * strict equality checking for Objects and Arrays.
-       *
-       * This method pulls the value to dirty check against from the `__dataTemp`
-       * cache (rather than the normal `__data` cache) for Objects.  Since the temp
-       * cache is cleared at the end of a turn, this implementation allows
-       * side-effects of deep object changes to be processed by re-setting the
-       * same object (using the temp cache as an in-turn backstop to prevent
-       * cycles due to 2-way notification).
-       *
-       * @param {string} property Property name
-       * @param {*} value New property value
-       * @param {*} old Previous property value
-       * @return {boolean} Whether the property should be considered a change
-       * @protected
-       */
-      _shouldPropertyChange(property, value, old) {
-        return mutablePropertyChange(this, property, value, old, true);
-      }
-
-    }
-
-    return MutableData;
-
-  });
-
-  /**
-   * Element class mixin to add the optional ability to skip strict
-   * dirty-checking for objects and arrays (always consider them to be
-   * "dirty") by setting a `mutable-data` attribute on an element instance.
-   *
-   * By default, `Polymer.PropertyEffects` performs strict dirty checking on
-   * objects, which means that any deep modifications to an object or array will
-   * not be propagated unless "immutable" data patterns are used (i.e. all object
-   * references from the root to the mutation were changed).
-   *
-   * Polymer also provides a proprietary data mutation and path notification API
-   * (e.g. `notifyPath`, `set`, and array mutation API's) that allow efficient
-   * mutation and notification of deep changes in an object graph to all elements
-   * bound to the same object graph.
-   *
-   * In cases where neither immutable patterns nor the data mutation API can be
-   * used, applying this mixin will allow Polymer to skip dirty checking for
-   * objects and arrays (always consider them to be "dirty").  This allows a
-   * user to make a deep modification to a bound object graph, and then either
-   * simply re-set the object (e.g. `this.items = this.items`) or call `notifyPath`
-   * (e.g. `this.notifyPath('items')`) to update the tree.  Note that all
-   * elements that wish to be updated based on deep mutations must apply this
-   * mixin or otherwise skip strict dirty checking for objects/arrays.
-   *
-   * While this mixin adds the ability to forgo Object/Array dirty checking,
-   * the `mutableData` flag defaults to false and must be set on the instance.
-   *
-   * Note, the performance characteristics of propagating large object graphs
-   * will be worse by relying on `mutableData: true` as opposed to using
-   * strict dirty checking with immutable patterns or Polymer's path notification
-   * API.
-   *
-   * @polymerMixin
-   * @memberof Polymer
-   * @summary Element class mixin to optionally skip strict dirty-checking
-   *   for objects and arrays
-   */
-  Polymer.OptionalMutableData = Polymer.dedupingMixin(superClass => {
-
-    /**
-     * @polymerMixinClass
-     * @implements {Polymer_OptionalMutableData}
-     */
-    class OptionalMutableData extends superClass {
-
-      static get properties() {
-        return {
-          /**
-           * Instance-level flag for configuring the dirty-checking strategy
-           * for this element.  When true, Objects and Arrays will skip dirty
-           * checking, otherwise strict equality checking will be used.
-           */
-          mutableData: Boolean
-        };
-      }
-
-      /**
-       * Overrides `Polymer.PropertyEffects` to provide option for skipping
-       * strict equality checking for Objects and Arrays.
-       *
-       * When `this.mutableData` is true on this instance, this method
-       * pulls the value to dirty check against from the `__dataTemp` cache
-       * (rather than the normal `__data` cache) for Objects.  Since the temp
-       * cache is cleared at the end of a turn, this implementation allows
-       * side-effects of deep object changes to be processed by re-setting the
-       * same object (using the temp cache as an in-turn backstop to prevent
-       * cycles due to 2-way notification).
-       *
-       * @param {string} property Property name
-       * @param {*} value New property value
-       * @param {*} old Previous property value
-       * @return {boolean} Whether the property should be considered a change
-       * @protected
-       */
-      _shouldPropertyChange(property, value, old) {
-        return mutablePropertyChange(this, property, value, old, this.mutableData);
-      }
-    }
-
-    return OptionalMutableData;
-
-  });
-
-  // Export for use by legacy behavior
-  Polymer.MutableData._mutablePropertyChange = mutablePropertyChange;
-
-})();
-</script>
diff --git a/src/main/resources/static/gltf-viewer/bower_components/polymer/lib/mixins/property-accessors.html b/src/main/resources/static/gltf-viewer/bower_components/polymer/lib/mixins/property-accessors.html
deleted file mode 100644 (file)
index a586f31..0000000
+++ /dev/null
@@ -1,576 +0,0 @@
-<!--
-@license
-Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
-This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
-The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
-The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
-Code distributed by Google as part of the polymer project is also
-subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
--->
-
-<link rel="import" href="../utils/boot.html">
-<link rel="import" href="../utils/mixin.html">
-<link rel="import" href="../utils/case-map.html">
-<link rel="import" href="../utils/async.html">
-
-<script>
-(function() {
-
-  'use strict';
-
-  let caseMap = Polymer.CaseMap;
-
-  let microtask = Polymer.Async.microTask;
-
-  // Save map of native properties; this forms a blacklist or properties
-  // that won't have their values "saved" by `saveAccessorValue`, since
-  // reading from an HTMLElement accessor from the context of a prototype throws
-  const nativeProperties = {};
-  let proto = HTMLElement.prototype;
-  while (proto) {
-    let props = Object.getOwnPropertyNames(proto);
-    for (let i=0; i<props.length; i++) {
-      nativeProperties[props[i]] = true;
-    }
-    proto = Object.getPrototypeOf(proto);
-  }
-
-  /**
-   * Used to save the value of a property that will be overridden with
-   * an accessor. If the `model` is a prototype, the values will be saved
-   * in `__dataProto`, and it's up to the user (or downstream mixin) to
-   * decide how/when to set these values back into the accessors.
-   * If `model` is already an instance (it has a `__data` property), then
-   * the value will be set as a pending property, meaning the user should
-   * call `_invalidateProperties` or `_flushProperties` to take effect
-   *
-   * @param {Object} model Prototype or instance
-   * @param {string} property Name of property
-   * @private
-   */
-  function saveAccessorValue(model, property) {
-    // Don't read/store value for any native properties since they could throw
-    if (!nativeProperties[property]) {
-      let value = model[property];
-      if (value !== undefined) {
-        if (model.__data) {
-          // Adding accessor to instance; update the property
-          // It is the user's responsibility to call _flushProperties
-          model._setPendingProperty(property, value);
-        } else {
-          // Adding accessor to proto; save proto's value for instance-time use
-          if (!model.__dataProto) {
-            model.__dataProto = {};
-          } else if (!model.hasOwnProperty(JSCompiler_renameProperty('__dataProto', model))) {
-            model.__dataProto = Object.create(model.__dataProto);
-          }
-          model.__dataProto[property] = value;
-        }
-      }
-    }
-  }
-
-  /**
-   * Element class mixin that provides basic meta-programming for creating one
-   * or more property accessors (getter/setter pair) that enqueue an async
-   * (batched) `_propertiesChanged` callback.
-   *
-   * For basic usage of this mixin, simply declare attributes to observe via
-   * the standard `static get observedAttributes()`, implement `_propertiesChanged`
-   * on the class, and then call `MyClass.createPropertiesForAttributes()` once
-   * on the class to generate property accessors for each observed attribute
-   * prior to instancing.  Last, call `this._flushProperties()` once to enable
-   * the accessors.
-   *
-   * Any `observedAttributes` will automatically be
-   * deserialized via `attributeChangedCallback` and set to the associated
-   * property using `dash-case`-to-`camelCase` convention.
-   *
-   * @polymerMixin
-   * @memberof Polymer
-   * @summary Element class mixin for reacting to property changes from
-   *   generated property accessors.
-   */
-  Polymer.PropertyAccessors = Polymer.dedupingMixin(superClass => {
-
-    /**
-     * @polymerMixinClass
-     * @implements {Polymer_PropertyAccessors}
-     * @unrestricted
-     */
-    class PropertyAccessors extends superClass {
-
-      /**
-       * Generates property accessors for all attributes in the standard
-       * static `observedAttributes` array.
-       *
-       * Attribute names are mapped to property names using the `dash-case` to
-       * `camelCase` convention
-       *
-       */
-      static createPropertiesForAttributes() {
-        let a$ = this.observedAttributes;
-        for (let i=0; i < a$.length; i++) {
-          this.prototype._createPropertyAccessor(caseMap.dashToCamelCase(a$[i]));
-        }
-      }
-
-      constructor() {
-        super();
-        this._initializeProperties();
-      }
-
-      attributeChangedCallback(name, old, value) {
-        if (old !== value) {
-          this._attributeToProperty(name, value);
-        }
-      }
-
-      /**
-       * Initializes the local storage for property accessors.
-       *
-       * Provided as an override point for performing any setup work prior
-       * to initializing the property accessor system.
-       *
-       * @protected
-       */
-      _initializeProperties() {
-        this.__serializing = false;
-        this.__dataCounter = 0;
-        this.__dataInitialized = false;
-        this.__dataInvalid = false;
-        // initialize data with prototype values saved when creating accessors
-        this.__data = {};
-        this.__dataPending = null;
-        this.__dataOld = null;
-        if (this.__dataProto) {
-          this._initializeProtoProperties(this.__dataProto);
-          this.__dataProto = null;
-        }
-        // Capture instance properties; these will be set into accessors
-        // during first flush. Don't set them here, since we want
-        // these to overwrite defaults/constructor assignments
-        for (let p in this.__dataHasAccessor) {
-          if (this.hasOwnProperty(p)) {
-            this.__dataInstanceProps = this.__dataInstanceProps || {};
-            this.__dataInstanceProps[p] = this[p];
-            delete this[p];
-          }
-        }
-      }
-
-      /**
-       * Called at instance time with bag of properties that were overwritten
-       * by accessors on the prototype when accessors were created.
-       *
-       * The default implementation sets these properties back into the
-       * setter at instance time.  This method is provided as an override
-       * point for customizing or providing more efficient initialization.
-       *
-       * @param {Object} props Bag of property values that were overwritten
-       *   when creating property accessors.
-       * @protected
-       */
-      _initializeProtoProperties(props) {
-        for (let p in props) {
-          this._setProperty(p, props[p]);
-        }
-      }
-
-      /**
-       * Called at ready time with bag of instance properties that overwrote
-       * accessors when the element upgraded.
-       *
-       * The default implementation sets these properties back into the
-       * setter at ready time.  This method is provided as an override
-       * point for customizing or providing more efficient initialization.
-       *
-       * @param {Object} props Bag of property values that were overwritten
-       *   when creating property accessors.
-       * @protected
-       */
-      _initializeInstanceProperties(props) {
-        Object.assign(this, props);
-      }
-
-      /**
-       * Ensures the element has the given attribute. If it does not,
-       * assigns the given value to the attribute.
-       *
-       *
-       * @param {string} attribute Name of attribute to ensure is set.
-       * @param {string} value of the attribute.
-       */
-      _ensureAttribute(attribute, value) {
-        if (!this.hasAttribute(attribute)) {
-          this._valueToNodeAttribute(this, value, attribute);
-        }
-      }
-
-      /**
-       * Deserializes an attribute to its associated property.
-       *
-       * This method calls the `_deserializeValue` method to convert the string to
-       * a typed value.
-       *
-       * @param {string} attribute Name of attribute to deserialize.
-       * @param {string} value of the attribute.
-       * @param {*} type type to deserialize to.
-       */
-      _attributeToProperty(attribute, value, type) {
-        // Don't deserialize back to property if currently reflecting
-        if (!this.__serializing) {
-          let property = caseMap.dashToCamelCase(attribute);
-          this[property] = this._deserializeValue(value, type);
-        }
-      }
-
-      /**
-       * Serializes a property to its associated attribute.
-       *
-       * @param {string} property Property name to reflect.
-       * @param {string=} attribute Attribute name to reflect.
-       * @param {*=} value Property value to refect.
-       */
-      _propertyToAttribute(property, attribute, value) {
-        this.__serializing = true;
-        value = (arguments.length < 3) ? this[property] : value;
-        this._valueToNodeAttribute(this, value,
-          attribute || caseMap.camelToDashCase(property));
-        this.__serializing = false;
-      }
-
-      /**
-       * Sets a typed value to an HTML attribute on a node.
-       *
-       * This method calls the `_serializeValue` method to convert the typed
-       * value to a string.  If the `_serializeValue` method returns `undefined`,
-       * the attribute will be removed (this is the default for boolean
-       * type `false`).
-       *
-       * @param {Element} node Element to set attribute to.
-       * @param {*} value Value to serialize.
-       * @param {string} attribute Attribute name to serialize to.
-       */
-      _valueToNodeAttribute(node, value, attribute) {
-        let str = this._serializeValue(value);
-        if (str === undefined) {
-          node.removeAttribute(attribute);
-        } else {
-          node.setAttribute(attribute, str);
-        }
-      }
-
-      /**
-       * Converts a typed JavaScript value to a string.
-       *
-       * This method is called by Polymer when setting JS property values to
-       * HTML attributes.  Users may override this method on Polymer element
-       * prototypes to provide serialization for custom types.
-       *
-       * @param {*} value Property value to serialize.
-       * @return {string | undefined} String serialized from the provided property value.
-       */
-      _serializeValue(value) {
-        /* eslint-disable no-fallthrough */
-        switch (typeof value) {
-          case 'boolean':
-            return value ? '' : undefined;
-
-          case 'object':
-            if (value instanceof Date) {
-              return value.toString();
-            } else if (value) {
-              try {
-                return JSON.stringify(value);
-              } catch(x) {
-                return '';
-              }
-            }
-
-          default:
-            return value != null ? value.toString() : undefined;
-        }
-      }
-
-      /**
-       * Converts a string to a typed JavaScript value.
-       *
-       * This method is called by Polymer when reading HTML attribute values to
-       * JS properties.  Users may override this method on Polymer element
-       * prototypes to provide deserialization for custom `type`s.  Note,
-       * the `type` argument is the value of the `type` field provided in the
-       * `properties` configuration object for a given property, and is
-       * by convention the constructor for the type to deserialize.
-       *
-       * Note: The return value of `undefined` is used as a sentinel value to
-       * indicate the attribute should be removed.
-       *
-       * @param {string} value Attribute value to deserialize.
-       * @param {*} type Type to deserialize the string to.
-       * @return {*} Typed value deserialized from the provided string.
-       */
-      _deserializeValue(value, type) {
-        /**
-         * @type {*}
-         */
-        let outValue;
-        switch (type) {
-          case Number:
-            outValue = Number(value);
-            break;
-
-          case Boolean:
-            outValue = (value !== null);
-            break;
-
-          case Object:
-            try {
-              outValue = JSON.parse(value);
-            } catch(x) {
-              // allow non-JSON literals like Strings and Numbers
-            }
-            break;
-
-          case Array:
-            try {
-              outValue = JSON.parse(value);
-            } catch(x) {
-              outValue = null;
-              console.warn(`Polymer::Attributes: couldn't decode Array as JSON: ${value}`);
-            }
-            break;
-
-          case Date:
-            outValue = new Date(value);
-            break;
-
-          case String:
-          default:
-            outValue = value;
-            break;
-        }
-
-        return outValue;
-      }
-      /* eslint-enable no-fallthrough */
-
-      /**
-       * Creates a setter/getter pair for the named property with its own
-       * local storage.  The getter returns the value in the local storage,
-       * and the setter calls `_setProperty`, which updates the local storage
-       * for the property and enqueues a `_propertiesChanged` callback.
-       *
-       * This method may be called on a prototype or an instance.  Calling
-       * this method may overwrite a property value that already exists on
-       * the prototype/instance by creating the accessor.  When calling on
-       * a prototype, any overwritten values are saved in `__dataProto`,
-       * and it is up to the subclasser to decide how/when to set those
-       * properties back into the accessor.  When calling on an instance,
-       * the overwritten value is set via `_setPendingProperty`, and the
-       * user should call `_invalidateProperties` or `_flushProperties`
-       * for the values to take effect.
-       *
-       * @param {string} property Name of the property
-       * @param {boolean=} readOnly When true, no setter is created; the
-       *   protected `_setProperty` function must be used to set the property
-       * @protected
-       */
-      _createPropertyAccessor(property, readOnly) {
-        if (!this.hasOwnProperty('__dataHasAccessor')) {
-          this.__dataHasAccessor = Object.assign({}, this.__dataHasAccessor);
-        }
-        if (!this.__dataHasAccessor[property]) {
-          this.__dataHasAccessor[property] = true;
-          saveAccessorValue(this, property);
-          Object.defineProperty(this, property, {
-            get: function() {
-              return this.__data[property];
-            },
-            set: readOnly ? function() { } : function(value) {
-              this._setProperty(property, value);
-            }
-          });
-        }
-      }
-
-      /**
-       * Returns true if this library created an accessor for the given property.
-       *
-       * @param {string} property Property name
-       * @return {boolean} True if an accessor was created
-       */
-      _hasAccessor(property) {
-        return this.__dataHasAccessor && this.__dataHasAccessor[property];
-      }
-
-      /**
-       * Updates the local storage for a property (via `_setPendingProperty`)
-       * and enqueues a `_proeprtiesChanged` callback.
-       *
-       * @param {string} property Name of the property
-       * @param {*} value Value to set
-       * @protected
-       */
-      _setProperty(property, value) {
-        if (this._setPendingProperty(property, value)) {
-          this._invalidateProperties();
-        }
-      }
-
-      /**
-       * Updates the local storage for a property, records the previous value,
-       * and adds it to the set of "pending changes" that will be passed to the
-       * `_propertiesChanged` callback.  This method does not enqueue the
-       * `_propertiesChanged` callback.
-       *
-       * @param {string} property Name of the property
-       * @param {*} value Value to set
-       * @return {boolean} Returns true if the property changed
-       * @protected
-       */
-      _setPendingProperty(property, value) {
-        let old = this.__data[property];
-        if (this._shouldPropertyChange(property, value, old)) {
-          if (!this.__dataPending) {
-            this.__dataPending = {};
-            this.__dataOld = {};
-          }
-          // Ensure old is captured from the last turn
-          if (!(property in this.__dataOld)) {
-            this.__dataOld[property] = old;
-          }
-          this.__data[property] = value;
-          this.__dataPending[property] = value;
-          return true;
-        }
-      }
-
-      /**
-       * Returns true if the specified property has a pending change.
-       *
-       * @param {string} prop Property name
-       * @return {boolean} True if property has a pending change
-       * @protected
-       */
-      _isPropertyPending(prop) {
-        return this.__dataPending && (prop in this.__dataPending);
-      }
-
-      /**
-       * Marks the properties as invalid, and enqueues an async
-       * `_propertiesChanged` callback.
-       *
-       * @protected
-       */
-      _invalidateProperties() {
-        if (!this.__dataInvalid && this.__dataInitialized) {
-          this.__dataInvalid = true;
-          microtask.run(() => {
-            if (this.__dataInvalid) {
-              this.__dataInvalid = false;
-              this._flushProperties();
-            }
-          });
-        }
-      }
-
-      /**
-       * Calls the `_propertiesChanged` callback with the current set of
-       * pending changes (and old values recorded when pending changes were
-       * set), and resets the pending set of changes.
-       *
-       * Note that this method must be called once to enable the property
-       * accessors system.  For elements, generally `connectedCallback`
-       * is a normal spot to do so.
-       *
-       * @protected
-       */
-      _flushProperties() {
-        if (!this.__dataInitialized) {
-          this.ready()
-        } else if (this.__dataPending) {
-          let changedProps = this.__dataPending;
-          this.__dataPending = null;
-          this.__dataCounter++;
-          this._propertiesChanged(this.__data, changedProps, this.__dataOld);
-          this.__dataCounter--;
-        }
-      }
-
-      /**
-       * Lifecycle callback called the first time properties are being flushed.
-       * Prior to `ready`, all property sets through accessors are queued and
-       * their effects are flushed after this method returns.
-       *
-       * Users may override this function to implement behavior that is
-       * dependent on the element having its properties initialized, e.g.
-       * from defaults (initialized from `constructor`, `_initializeProperties`),
-       * `attributeChangedCallback`, or values propagated from host e.g. via
-       * bindings.  `super.ready()` must be called to ensure the data system
-       * becomes enabled.
-       *
-       * @public
-       */
-      ready() {
-        // Update instance properties that shadowed proto accessors; these take
-        // priority over any defaults set in constructor or attributeChangedCallback
-        if (this.__dataInstanceProps) {
-          this._initializeInstanceProperties(this.__dataInstanceProps);
-          this.__dataInstanceProps = null;
-        }
-        this.__dataInitialized = true;
-        // Run normal flush
-        this._flushProperties();
-      }
-
-      /**
-       * Callback called when any properties with accessors created via
-       * `_createPropertyAccessor` have been set.
-       *
-       * @param {Object} currentProps Bag of all current accessor values
-       * @param {Object} changedProps Bag of properties changed since the last
-       *   call to `_propertiesChanged`
-       * @param {Object} oldProps Bag of previous values for each property
-       *   in `changedProps`
-       * @protected
-       */
-      _propertiesChanged(currentProps, changedProps, oldProps) { // eslint-disable-line no-unused-vars
-      }
-
-      /**
-       * Method called to determine whether a property value should be
-       * considered as a change and cause the `_propertiesChanged` callback
-       * to be enqueued.
-       *
-       * The default implementation returns `true` for primitive types if a
-       * strict equality check fails, and returns `true` for all Object/Arrays.
-       * The method always returns false for `NaN`.
-       *
-       * Override this method to e.g. provide stricter checking for
-       * Objects/Arrays when using immutable patterns.
-       *
-       * @param {string} property Property name
-       * @param {*} value New property value
-       * @param {*} old Previous property value
-       * @return {boolean} Whether the property should be considered a change
-       *   and enqueue a `_proeprtiesChanged` callback
-       * @protected
-       */
-      _shouldPropertyChange(property, value, old) {
-        return (
-          // Strict equality check
-          (old !== value &&
-           // This ensures (old==NaN, value==NaN) always returns false
-           (old === old || value === value))
-        );
-      }
-
-    }
-
-    return PropertyAccessors;
-
-  });
-
-})();
-</script>
diff --git a/src/main/resources/static/gltf-viewer/bower_components/polymer/lib/mixins/property-effects.html b/src/main/resources/static/gltf-viewer/bower_components/polymer/lib/mixins/property-effects.html
deleted file mode 100644 (file)
index 5be94f0..0000000
+++ /dev/null
@@ -1,2384 +0,0 @@
-<!--
-@license
-Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
-This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
-The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
-The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
-Code distributed by Google as part of the polymer project is also
-subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
--->
-
-
-<link rel="import" href="../utils/boot.html">
-<link rel="import" href="../utils/mixin.html">
-<link rel="import" href="../utils/path.html">
-<!-- for notify, reflect -->
-<link rel="import" href="../utils/case-map.html">
-<link rel="import" href="property-accessors.html">
-<!-- for annotated effects -->
-<link rel="import" href="template-stamp.html">
-
-
-<script>
-(function() {
-
-  'use strict';
-
-  /** @const {Object} */
-  const CaseMap = Polymer.CaseMap;
-
-  // Monotonically increasing unique ID used for de-duping effects triggered
-  // from multiple properties in the same turn
-  let dedupeId = 0;
-
-  // Property effect types; effects are stored on the prototype using these keys
-  const TYPES = {
-    COMPUTE: '__computeEffects',
-    REFLECT: '__reflectEffects',
-    NOTIFY: '__notifyEffects',
-    PROPAGATE: '__propagateEffects',
-    OBSERVE: '__observeEffects',
-    READ_ONLY: '__readOnly'
-  }
-
-  /**
-   * Ensures that the model has an own-property map of effects for the given type.
-   * The model may be a prototype or an instance.
-   *
-   * Property effects are stored as arrays of effects by property in a map,
-   * by named type on the model. e.g.
-   *
-   *   __computeEffects: {
-   *     foo: [ ... ],
-   *     bar: [ ... ]
-   *   }
-   *
-   * If the model does not yet have an effect map for the type, one is created
-   * and returned.  If it does, but it is not an own property (i.e. the
-   * prototype had effects), the the map is deeply cloned and the copy is
-   * set on the model and returned, ready for new effects to be added.
-   *
-   * @param {Object} model Prototype or instance
-   * @param {string} type Property effect type
-   * @return {Object} The own-property map of effects for the given type
-   * @private
-   */
-  function ensureOwnEffectMap(model, type) {
-    let effects = model[type];
-    if (!effects) {
-      effects = model[type] = {};
-    } else if (!model.hasOwnProperty(type)) {
-      effects = model[type] = Object.create(model[type]);
-      for (let p in effects) {
-        let protoFx = effects[p];
-        let instFx = effects[p] = Array(protoFx.length);
-        for (let i=0; i<protoFx.length; i++) {
-          instFx[i] = protoFx[i];
-        }
-      }
-    }
-    return effects;
-  }
-
-  // -- effects ----------------------------------------------
-
-  /**
-   * Runs all effects of a given type for the given set of property changes
-   * on an instance.
-   *
-   * @param {Object} inst The instance with effects to run
-   * @param {Object} effects Object map of property-to-Array of effects
-   * @param {Object} props Bag of current property changes
-   * @param {Object=} oldProps Bag of previous values for changed properties
-   * @param {boolean=} hasPaths True with `props` contains one or more paths
-   * @param {*=} extraArgs Additional metadata to pass to effect function
-   * @return {boolean} True if an effect ran for this property
-   * @private
-   */
-  function runEffects(inst, effects, props, oldProps, hasPaths, extraArgs) {
-    if (effects) {
-      let ran = false;
-      let id = dedupeId++;
-      for (let prop in props) {
-        if (runEffectsForProperty(inst, effects, id, prop, props, oldProps, hasPaths, extraArgs)) {
-          ran = true;
-        }
-      }
-      return ran;
-    }
-    return false;
-  }
-
-  /**
-   * Runs a list of effects for a given property.
-   *
-   * @param {Object} inst The instance with effects to run
-   * @param {Object} effects Object map of property-to-Array of effects
-   * @param {number} dedupeId Counter used for de-duping effects
-   * @param {string} prop Name of changed property
-   * @param {*} props Changed properties
-   * @param {*} oldProps Old properties
-   * @param {boolean=} hasPaths True with `props` contains one or more paths
-   * @param {*=} extraArgs Additional metadata to pass to effect function
-   * @return {boolean} True if an effect ran for this property
-   * @private
-   */
-  function runEffectsForProperty(inst, effects, dedupeId, prop, props, oldProps, hasPaths, extraArgs) {
-    let ran = false;
-    let rootProperty = hasPaths ? Polymer.Path.root(prop) : prop;
-    let fxs = effects[rootProperty];
-    if (fxs) {
-      for (let i=0, l=fxs.length, fx; (i<l) && (fx=fxs[i]); i++) {
-        if ((!fx.info || fx.info.lastRun !== dedupeId) &&
-            (!hasPaths || pathMatchesTrigger(prop, fx.trigger))) {
-          if (fx.info) {
-            fx.info.lastRun = dedupeId;
-          }
-          fx.fn(inst, prop, props, oldProps, fx.info, hasPaths, extraArgs);
-          ran = true;
-        }
-      }
-    }
-    return ran;
-  }
-
-  /**
-   * Determines whether a property/path that has changed matches the trigger
-   * criteria for an effect.  A trigger is a descriptor with the following
-   * structure, which matches the descriptors returned from `parseArg`.
-   * e.g. for `foo.bar.*`:
-   * ```
-   * trigger: {
-   *   name: 'a.b',
-   *   structured: true,
-   *   wildcard: true
-   * }
-   * ```
-   * If no trigger is given, the path is deemed to match.
-   *
-   * @param {string} path Path or property that changed
-   * @param {Object} trigger Descriptor
-   * @return {boolean} Whether the path matched the trigger
-   */
-  function pathMatchesTrigger(path, trigger) {
-    if (trigger) {
-      let triggerPath = trigger.name;
-      return (triggerPath == path) ||
-        (trigger.structured && Polymer.Path.isAncestor(triggerPath, path)) ||
-        (trigger.wildcard && Polymer.Path.isDescendant(triggerPath, path));
-    } else {
-      return true;
-    }
-  }
-
-  /**
-   * Implements the "observer" effect.
-   *
-   * Calls the method with `info.methodName` on the instance, passing the
-   * new and old values.
-   *
-   * @param {Object} inst The instance the effect will be run on
-   * @param {string} property Name of property
-   * @param {Object} props Bag of current property changes
-   * @param {Object} oldProps Bag of previous values for changed properties
-   * @param {Object} info Effect metadata
-   * @private
-   */
-  function runObserverEffect(inst, property, props, oldProps, info) {
-    let fn = inst[info.methodName];
-    let changedProp = info.property;
-    if (fn) {
-      fn.call(inst, inst.__data[changedProp], oldProps[changedProp]);
-    } else {
-      console.warn('observer method `' + info.methodName + '` not defined');
-    }
-  }
-
-  /**
-   * Runs "notify" effects for a set of changed properties.
-   *
-   * This method differs from the generic `runEffects` method in that it
-   * will dispatch path notification events in the case that the property
-   * changed was a path and the root property for that path didn't have a
-   * "notify" effect.  This is to maintain 1.0 behavior that did not require
-   * `notify: true` to ensure object sub-property notifications were
-   * sent.
-   *
-   * @param {Element} inst The instance with effects to run
-   * @param {Object} notifyProps Bag of properties to notify
-   * @param {Object} props Bag of current property changes
-   * @param {Object} oldProps Bag of previous values for changed properties
-   * @param {boolean} hasPaths True with `props` contains one or more paths
-   * @private
-   */
-  function runNotifyEffects(inst, notifyProps, props, oldProps, hasPaths) {
-    // Notify
-    let fxs = inst.__notifyEffects;
-    let notified;
-    let id = dedupeId++;
-    // Try normal notify effects; if none, fall back to try path notification
-    for (let prop in notifyProps) {
-      if (notifyProps[prop]) {
-        if (fxs && runEffectsForProperty(inst, fxs, id, prop, props, oldProps, hasPaths)) {
-          notified = true;
-        } else if (hasPaths && notifyPath(inst, prop, props)) {
-          notified = true;
-        }
-      }
-    }
-    // Flush host if we actually notified and host was batching
-    let host;
-    if (notified && (host = inst.__dataHost) && host._flushProperties) {
-      host._flushProperties();
-    }
-  }
-
-  /**
-   * Dispatches {property}-changed events with path information in the detail
-   * object to indicate a sub-path of the property was changed.
-   *
-   * @param {Element} inst The element from which to fire the event
-   * @param {string} path The path that was changed
-   * @param {Object} props Bag of current property changes
-   * @return {boolean} Returns true if the path was notified
-   * @private
-   */
-  function notifyPath(inst, path, props) {
-    let rootProperty = Polymer.Path.root(path);
-    if (rootProperty !== path) {
-      let eventName = Polymer.CaseMap.camelToDashCase(rootProperty) + '-changed';
-      dispatchNotifyEvent(inst, eventName, props[path], path);
-      return true;
-    }
-  }
-
-  /**
-   * Dispatches {property}-changed events to indicate a property (or path)
-   * changed.
-   *
-   * @param {Element} inst The element from which to fire the event
-   * @param {string} eventName The name of the event to send ('{property}-changed')
-   * @param {*} value The value of the changed property
-   * @param {string | null | undefined} path If a sub-path of this property changed, the path
-   *   that changed (optional).
-   * @private
-   */
-  function dispatchNotifyEvent(inst, eventName, value, path) {
-    let detail = {
-      value: value,
-      queueProperty: true
-    };
-    if (path) {
-      detail.path = path;
-    }
-    inst.dispatchEvent(new CustomEvent(eventName, { detail }));
-  }
-
-  /**
-   * Implements the "notify" effect.
-   *
-   * Dispatches a non-bubbling event named `info.eventName` on the instance
-   * with a detail object containing the new `value`.
-   *
-   * @param {Element} inst The instance the effect will be run on
-   * @param {string} property Name of property
-   * @param {Object} props Bag of current property changes
-   * @param {Object} oldProps Bag of previous values for changed properties
-   * @param {Object} info Effect metadata
-   * @param {boolean} hasPaths True with `props` contains one or more paths
-   * @private
-   */
-  function runNotifyEffect(inst, property, props, oldProps, info, hasPaths) {
-    let rootProperty = hasPaths ? Polymer.Path.root(property) : property;
-    let path = rootProperty != property ? property : null;
-    let value = path ? Polymer.Path.get(inst, path) : inst.__data[property];
-    if (path && value === undefined) {
-      value = props[property];  // specifically for .splices
-    }
-    dispatchNotifyEvent(inst, info.eventName, value, path);
-  }
-
-  /**
-   * Handler function for 2-way notification events. Receives context
-   * information captured in the `addNotifyListener` closure from the
-   * `__notifyListeners` metadata.
-   *
-   * Sets the value of the notified property to the host property or path.  If
-   * the event contained path information, translate that path to the host
-   * scope's name for that path first.
-   *
-   * @param {Event} event Notification event (e.g. '<property>-changed')
-   * @param {Object} inst Host element instance handling the notification event
-   * @param {string} fromProp Child element property that was bound
-   * @param {string} toPath Host property/path that was bound
-   * @param {boolean} negate Whether the binding was negated
-   * @private
-   */
-  function handleNotification(event, inst, fromProp, toPath, negate) {
-    let value;
-    let detail = event.detail;
-    let fromPath = detail && detail.path;
-    if (fromPath) {
-      toPath = Polymer.Path.translate(fromProp, toPath, fromPath);
-      value = detail && detail.value;
-    } else {
-      value = event.target[fromProp];
-    }
-    value = negate ? !value : value;
-    if (!inst.__readOnly || !inst.__readOnly[toPath]) {
-      if (inst._setPendingPropertyOrPath(toPath, value, true, Boolean(fromPath))
-        && (!detail || !detail.queueProperty)) {
-        inst._invalidateProperties();
-      }
-    }
-  }
-
-  /**
-   * Implements the "reflect" effect.
-   *
-   * Sets the attribute named `info.attrName` to the given property value.
-   *
-   * @param {Object} inst The instance the effect will be run on
-   * @param {string} property Name of property
-   * @param {Object} props Bag of current property changes
-   * @param {Object} oldProps Bag of previous values for changed properties
-   * @param {Object} info Effect metadata
-   * @private
-   */
-  function runReflectEffect(inst, property, props, oldProps, info) {
-    let value = inst.__data[property];
-    if (Polymer.sanitizeDOMValue) {
-      value = Polymer.sanitizeDOMValue(value, info.attrName, 'attribute', inst);
-    }
-    inst._propertyToAttribute(property, info.attrName, value);
-  }
-
-  /**
-   * Runs "computed" effects for a set of changed properties.
-   *
-   * This method differs from the generic `runEffects` method in that it
-   * continues to run computed effects based on the output of each pass until
-   * there are no more newly computed properties.  This ensures that all
-   * properties that will be computed by the initial set of changes are
-   * computed before other effects (binding propagation, observers, and notify)
-   * run.
-   *
-   * @param {Element} inst The instance the effect will be run on
-   * @param {Object} changedProps Bag of changed properties
-   * @param {Object} oldProps Bag of previous values for changed properties
-   * @param {boolean} hasPaths True with `props` contains one or more paths
-   * @private
-   */
-  function runComputedEffects(inst, changedProps, oldProps, hasPaths) {
-    let computeEffects = inst.__computeEffects;
-    if (computeEffects) {
-      let inputProps = changedProps;
-      while (runEffects(inst, computeEffects, inputProps, oldProps, hasPaths)) {
-        Object.assign(oldProps, inst.__dataOld);
-        Object.assign(changedProps, inst.__dataPending);
-        inputProps = inst.__dataPending;
-        inst.__dataPending = null;
-      }
-    }
-  }
-
-  /**
-   * Implements the "computed property" effect by running the method with the
-   * values of the arguments specified in the `info` object and setting the
-   * return value to the computed property specified.
-   *
-   * @param {Object} inst The instance the effect will be run on
-   * @param {string} property Name of property
-   * @param {Object} props Bag of current property changes
-   * @param {Object} oldProps Bag of previous values for changed properties
-   * @param {Object} info Effect metadata
-   * @private
-   */
-  function runComputedEffect(inst, property, props, oldProps, info) {
-    let result = runMethodEffect(inst, property, props, oldProps, info);
-    let computedProp = info.methodInfo;
-    if (inst.__dataHasAccessor && inst.__dataHasAccessor[computedProp]) {
-      inst._setPendingProperty(computedProp, result, true);
-    } else {
-      inst[computedProp] = result;
-    }
-  }
-
-  /**
-   * Computes path changes based on path links set up using the `linkPaths`
-   * API.
-   *
-   * @param {Element} inst The instance whose props are changing
-   * @param {string} path Path that has changed
-   * @param {*} value Value of changed path
-   * @private
-   */
-  function computeLinkedPaths(inst, path, value) {
-    let links = inst.__dataLinkedPaths;
-    if (links) {
-      let link;
-      for (let a in links) {
-        let b = links[a];
-        if (Polymer.Path.isDescendant(a, path)) {
-          link = Polymer.Path.translate(a, b, path);
-          inst._setPendingPropertyOrPath(link, value, true, true);
-        } else if (Polymer.Path.isDescendant(b, path)) {
-          link = Polymer.Path.translate(b, a, path);
-          inst._setPendingPropertyOrPath(link, value, true, true);
-        }
-      }
-    }
-  }
-
-  // -- bindings ----------------------------------------------
-
-  /**
-   * Adds binding metadata to the current `nodeInfo`, and binding effects
-   * for all part dependencies to `templateInfo`.
-   *
-   * @param {Function} constructor Class that `_parseTemplate` is currently
-   *   running on
-   * @param {Object} templateInfo Template metadata for current template
-   * @param {Object} nodeInfo Node metadata for current template node
-   * @param {string} kind Binding kind, either 'property', 'attribute', or 'text'
-   * @param {string} target Target property name
-   * @param {Array<Object>} parts Array of binding part metadata
-   * @param {string} literal Literal text surrounding binding parts (specified
-   *   only for 'property' bindings, since these must be initialized as part
-   *   of boot-up)
-   * @private
-   */
-  function addBinding(constructor, templateInfo, nodeInfo, kind, target, parts, literal) {
-    // Create binding metadata and add to nodeInfo
-    nodeInfo.bindings = nodeInfo.bindings || [];
-    let binding = { kind, target, parts, literal, isCompound: (parts.length !== 1) };
-    nodeInfo.bindings.push(binding);
-    // Add listener info to binding metadata
-    if (shouldAddListener(binding)) {
-      let {event, negate} = binding.parts[0];
-      binding.listenerEvent = event || (CaseMap.camelToDashCase(target) + '-changed');
-      binding.listenerNegate = negate;
-    }
-    // Add "propagate" property effects to templateInfo
-    let index = templateInfo.nodeInfoList.length;
-    for (let i=0; i<binding.parts.length; i++) {
-      let part = binding.parts[i];
-      part.compoundIndex = i;
-      addEffectForBindingPart(constructor, templateInfo, binding, part, index);
-    }
-  }
-
-  /**
-   * Adds property effects to the given `templateInfo` for the given binding
-   * part.
-   *
-   * @param {Function} constructor Class that `_parseTemplate` is currently
-   *   running on
-   * @param {Object} templateInfo Template metadata for current template
-   * @param {Object} binding Binding metadata
-   * @param {Object} part Binding part metadata
-   * @param {number} index Index into `nodeInfoList` for this node
-   */
-  function addEffectForBindingPart(constructor, templateInfo, binding, part, index) {
-    if (!part.literal) {
-      if (binding.kind === 'attribute' && binding.target[0] === '-') {
-        console.warn('Cannot set attribute ' + binding.target +
-          ' because "-" is not a valid attribute starting character');
-      } else {
-        let dependencies = part.dependencies;
-        let info = { index, binding, part, evaluator: constructor };
-        for (let j=0; j<dependencies.length; j++) {
-          let trigger = dependencies[j];
-          if (typeof trigger == 'string') {
-            trigger = parseArg(trigger);
-            trigger.wildcard = true;
-          }
-          constructor._addTemplatePropertyEffect(templateInfo, trigger.rootProperty, {
-            fn: runBindingEffect,
-            info, trigger
-          });
-        }
-      }
-    }
-  }
-
-  /**
-   * Implements the "binding" (property/path binding) effect.
-   *
-   * Note that binding syntax is overridable via `_parseBindings` and
-   * `_evaluateBindings`.  This method will call `_evaluateBinding` for any
-   * non-literal parts returned from `_parseBindings`.  However,
-   * there is no support for _path_ bindings via custom binding parts,
-   * as this is specific to Polymer's path binding syntax.
-   *
-   * @param {Element} inst The instance the effect will be run on
-   * @param {string} path Name of property
-   * @param {Object} props Bag of current property changes
-   * @param {Object} oldProps Bag of previous values for changed properties
-   * @param {Object} info Effect metadata
-   * @param {boolean} hasPaths True with `props` contains one or more paths
-   * @param {Array} nodeList List of nodes associated with `nodeInfoList` template
-   *   metadata
-   * @private
-   */
-  function runBindingEffect(inst, path, props, oldProps, info, hasPaths, nodeList) {
-    let node = nodeList[info.index];
-    let binding = info.binding;
-    let part = info.part;
-    // Subpath notification: transform path and set to client
-    // e.g.: foo="{{obj.sub}}", path: 'obj.sub.prop', set 'foo.prop'=obj.sub.prop
-    if (hasPaths && part.source && (path.length > part.source.length) &&
-        (binding.kind == 'property') && !binding.isCompound &&
-        node.__dataHasAccessor && node.__dataHasAccessor[binding.target]) {
-      let value = props[path];
-      path = Polymer.Path.translate(part.source, binding.target, path);
-      if (node._setPendingPropertyOrPath(path, value, false, true)) {
-        inst._enqueueClient(node);
-      }
-    } else {
-      let value = info.evaluator._evaluateBinding(inst, part, path, props, oldProps, hasPaths);
-      // Propagate value to child
-      applyBindingValue(inst, node, binding, part, value);
-    }
-  }
-
-  /**
-   * Sets the value for an "binding" (binding) effect to a node,
-   * either as a property or attribute.
-   *
-   * @param {Object} inst The instance owning the binding effect
-   * @param {Node} node Target node for binding
-   * @param {Object} binding Binding metadata
-   * @param {Object} part Binding part metadata
-   * @param {*} value Value to set
-   * @private
-   */
-  function applyBindingValue(inst, node, binding, part, value) {
-    value = computeBindingValue(node, value, binding, part);
-    if (Polymer.sanitizeDOMValue) {
-      value = Polymer.sanitizeDOMValue(value, binding.target, binding.kind, node);
-    }
-    if (binding.kind == 'attribute') {
-      // Attribute binding
-      inst._valueToNodeAttribute(node, value, binding.target);
-    } else {
-      // Property binding
-      let prop = binding.target;
-      if (node.__dataHasAccessor && node.__dataHasAccessor[prop]) {
-        if (!node.__readOnly || !node.__readOnly[prop]) {
-          if (node._setPendingProperty(prop, value)) {
-            inst._enqueueClient(node);
-          }
-        }
-      } else  {
-        inst._setUnmanagedPropertyToNode(node, prop, value);
-      }
-    }
-  }
-
-  /**
-   * Transforms an "binding" effect value based on compound & negation
-   * effect metadata, as well as handling for special-case properties
-   *
-   * @param {Node} node Node the value will be set to
-   * @param {*} value Value to set
-   * @param {Object} binding Binding metadata
-   * @param {Object} part Binding part metadata
-   * @return {*} Transformed value to set
-   * @private
-   */
-  function computeBindingValue(node, value, binding, part) {
-    if (binding.isCompound) {
-      let storage = node.__dataCompoundStorage[binding.target];
-      storage[part.compoundIndex] = value;
-      value = storage.join('');
-    }
-    if (binding.kind !== 'attribute') {
-      // Some browsers serialize `undefined` to `"undefined"`
-      if (binding.target === 'textContent' ||
-          (node.localName == 'input' && binding.target == 'value')) {
-        value = value == undefined ? '' : value;
-      }
-    }
-    return value;
-  }
-
-  /**
-   * Returns true if a binding's metadata meets all the requirements to allow
-   * 2-way binding, and therefore a <property>-changed event listener should be
-   * added:
-   * - used curly braces
-   * - is a property (not attribute) binding
-   * - is not a textContent binding
-   * - is not compound
-   *
-   * @param {Object} binding Binding metadata
-   * @return {boolean} True if 2-way listener should be added
-   * @private
-   */
-  function shouldAddListener(binding) {
-    return binding.target &&
-           binding.kind != 'attribute' &&
-           binding.kind != 'text' &&
-           !binding.isCompound &&
-           binding.parts[0].mode === '{';
-  }
-
-  /**
-   * Setup compound binding storage structures, notify listeners, and dataHost
-   * references onto the bound nodeList.
-   *
-   * @param {Object} inst Instance that bas been previously bound
-   * @param {Object} templateInfo Template metadata
-   * @private
-   */
-  function setupBindings(inst, templateInfo) {
-    // Setup compound storage, dataHost, and notify listeners
-    let {nodeList, nodeInfoList} = templateInfo;
-    if (nodeInfoList.length) {
-      for (let i=0; i < nodeInfoList.length; i++) {
-        let info = nodeInfoList[i];
-        let node = nodeList[i];
-        let bindings = info.bindings;
-        if (bindings) {
-          for (let i=0; i<bindings.length; i++) {
-            let binding = bindings[i];
-            setupCompoundStorage(node, binding);
-            addNotifyListener(node, inst, binding);
-          }
-        }
-        node.__dataHost = inst;
-      }
-    }
-  }
-
-  /**
-   * Initializes `__dataCompoundStorage` local storage on a bound node with
-   * initial literal data for compound bindings, and sets the joined
-   * literal parts to the bound property.
-   *
-   * When changes to compound parts occur, they are first set into the compound
-   * storage array for that property, and then the array is joined to result in
-   * the final value set to the property/attribute.
-   *
-   * @param {Node} node Bound node to initialize
-   * @param {Object} binding Binding metadata
-   * @private
-   */
-  function setupCompoundStorage(node, binding) {
-    if (binding.isCompound) {
-      // Create compound storage map
-      let storage = node.__dataCompoundStorage ||
-        (node.__dataCompoundStorage = {});
-      let parts = binding.parts;
-      // Copy literals from parts into storage for this binding
-      let literals = new Array(parts.length);
-      for (let j=0; j<parts.length; j++) {
-        literals[j] = parts[j].literal;
-      }
-      let target = binding.target;
-      storage[target] = literals;
-      // Configure properties with their literal parts
-      if (binding.literal && binding.kind == 'property') {
-        node[target] = binding.literal;
-      }
-    }
-  }
-
-  /**
-   * Adds a 2-way binding notification event listener to the node specified
-   *
-   * @param {Object} node Child element to add listener to
-   * @param {Object} inst Host element instance to handle notification event
-   * @param {Object} binding Binding metadata
-   * @private
-   */
-  function addNotifyListener(node, inst, binding) {
-    if (binding.listenerEvent) {
-      let part = binding.parts[0];
-      node.addEventListener(binding.listenerEvent, function(e) {
-        handleNotification(e, inst, binding.target, part.source, part.negate);
-      });
-    }
-  }
-
-  // -- for method-based effects (complexObserver & computed) --------------
-
-  /**
-   * Adds property effects for each argument in the method signature (and
-   * optionally, for the method name if `dynamic` is true) that calls the
-   * provided effect function.
-   *
-   * @param {Element | Object} model Prototype or instance
-   * @param {Object} sig Method signature metadata
-   * @param {string} type Type of property effect to add
-   * @param {Function} effectFn Function to run when arguments change
-   * @param {*=} methodInfo Effect-specific information to be included in
-   *   method effect metadata
-   * @param {Object=} dynamicFns Map indicating whether method names should
-   *   be included as a dependency to the effect. Note, defaults to true
-   *   if the signature is statci (sig.static is true).
-   * @private
-   */
-  function createMethodEffect(model, sig, type, effectFn, methodInfo, dynamicFns) {
-    let dynamicFn = sig.static || dynamicFns && dynamicFns[sig.methodName];
-    let info = {
-      methodName: sig.methodName,
-      args: sig.args,
-      methodInfo,
-      dynamicFn
-    };
-    for (let i=0, arg; (i<sig.args.length) && (arg=sig.args[i]); i++) {
-      if (!arg.literal) {
-        model._addPropertyEffect(arg.rootProperty, type, {
-          fn: effectFn, info: info, trigger: arg
-        });
-      }
-    }
-    if (dynamicFn) {
-      model._addPropertyEffect(sig.methodName, type, {
-        fn: effectFn, info: info
-      });
-    }
-  }
-
-  /**
-   * Calls a method with arguments marshaled from properties on the instance
-   * based on the method signature contained in the effect metadata.
-   *
-   * Multi-property observers, computed properties, and inline computing
-   * functions call this function to invoke the method, then use the return
-   * value accordingly.
-   *
-   * @param {Object} inst The instance the effect will be run on
-   * @param {string} property Name of property
-   * @param {Object} props Bag of current property changes
-   * @param {Object} oldProps Bag of previous values for changed properties
-   * @param {Object} info Effect metadata
-   * @return {*} Returns the return value from the method invocation
-   * @private
-   */
-  function runMethodEffect(inst, property, props, oldProps, info) {
-    // Instances can optionally have a _methodHost which allows redirecting where
-    // to find methods. Currently used by `templatize`.
-    let context = inst._methodHost || inst;
-    let fn = context[info.methodName];
-    if (fn) {
-      let args = marshalArgs(inst.__data, info.args, property, props);
-      return fn.apply(context, args);
-    } else if (!info.dynamicFn) {
-      console.warn('method `' + info.methodName + '` not defined');
-    }
-  }
-
-  const emptyArray = [];
-
-  // Regular expressions used for binding
-  const IDENT  = '(?:' + '[a-zA-Z_$][\\w.:$\\-*]*' + ')';
-  const NUMBER = '(?:' + '[-+]?[0-9]*\\.?[0-9]+(?:[eE][-+]?[0-9]+)?' + ')';
-  const SQUOTE_STRING = '(?:' + '\'(?:[^\'\\\\]|\\\\.)*\'' + ')';
-  const DQUOTE_STRING = '(?:' + '"(?:[^"\\\\]|\\\\.)*"' + ')';
-  const STRING = '(?:' + SQUOTE_STRING + '|' + DQUOTE_STRING + ')';
-  const ARGUMENT = '(?:' + IDENT + '|' + NUMBER + '|' +  STRING + '\\s*' + ')';
-  const ARGUMENTS = '(?:' + ARGUMENT + '(?:,\\s*' + ARGUMENT + ')*' + ')';
-  const ARGUMENT_LIST = '(?:' + '\\(\\s*' +
-                                '(?:' + ARGUMENTS + '?' + ')' +
-                              '\\)\\s*' + ')';
-  const BINDING = '(' + IDENT + '\\s*' + ARGUMENT_LIST + '?' + ')'; // Group 3
-  const OPEN_BRACKET = '(\\[\\[|{{)' + '\\s*';
-  const CLOSE_BRACKET = '(?:]]|}})';
-  const NEGATE = '(?:(!)\\s*)?'; // Group 2
-  const EXPRESSION = OPEN_BRACKET + NEGATE + BINDING + CLOSE_BRACKET;
-  const bindingRegex = new RegExp(EXPRESSION, "g");
-
-  function literalFromParts(parts) {
-    let s = '';
-    for (let i=0; i<parts.length; i++) {
-      let literal = parts[i].literal;
-      s += literal || '';
-    }
-    return s;
-  }
-
-  /**
-   * Parses an expression string for a method signature, and returns a metadata
-   * describing the method in terms of `methodName`, `static` (whether all the
-   * arguments are literals), and an array of `args`
-   *
-   * @param {string} expression The expression to parse
-   * @return {?Object} The method metadata object if a method expression was
-   *   found, otherwise `undefined`
-   * @private
-   */
-  function parseMethod(expression) {
-    // tries to match valid javascript property names
-    let m = expression.match(/([^\s]+?)\(([\s\S]*)\)/);
-    if (m) {
-      let methodName = m[1];
-      let sig = { methodName, static: true };
-      if (m[2].trim()) {
-        // replace escaped commas with comma entity, split on un-escaped commas
-        let args = m[2].replace(/\\,/g, '&comma;').split(',');
-        return parseArgs(args, sig);
-      } else {
-        sig.args = emptyArray;
-        return sig;
-      }
-    }
-    return null;
-  }
-
-  /**
-   * Parses an array of arguments and sets the `args` property of the supplied
-   * signature metadata object. Sets the `static` property to false if any
-   * argument is a non-literal.
-   *
-   * @param {Array<string>} argList Array of argument names
-   * @param {Object} sig Method signature metadata object
-   * @return {Object} The updated signature metadata object
-   * @private
-   */
-  function parseArgs(argList, sig) {
-    sig.args = argList.map(function(rawArg) {
-      let arg = parseArg(rawArg);
-      if (!arg.literal) {
-        sig.static = false;
-      }
-      return arg;
-    }, this);
-    return sig;
-  }
-
-  /**
-   * Parses an individual argument, and returns an argument metadata object
-   * with the following fields:
-   *
-   *   {
-   *     value: 'prop',        // property/path or literal value
-   *     literal: false,       // whether argument is a literal
-   *     structured: false,    // whether the property is a path
-   *     rootProperty: 'prop', // the root property of the path
-   *     wildcard: false       // whether the argument was a wildcard '.*' path
-   *   }
-   *
-   * @param {string} rawArg The string value of the argument
-   * @return {Object} Argument metadata object
-   * @private
-   */
-  function parseArg(rawArg) {
-    // clean up whitespace
-    let arg = rawArg.trim()
-      // replace comma entity with comma
-      .replace(/&comma;/g, ',')
-      // repair extra escape sequences; note only commas strictly need
-      // escaping, but we allow any other char to be escaped since its
-      // likely users will do this
-      .replace(/\\(.)/g, '\$1')
-      ;
-    // basic argument descriptor
-    let a = {
-      name: arg
-    };
-    // detect literal value (must be String or Number)
-    let fc = arg[0];
-    if (fc === '-') {
-      fc = arg[1];
-    }
-    if (fc >= '0' && fc <= '9') {
-      fc = '#';
-    }
-    switch(fc) {
-      case "'":
-      case '"':
-        a.value = arg.slice(1, -1);
-        a.literal = true;
-        break;
-      case '#':
-        a.value = Number(arg);
-        a.literal = true;
-        break;
-    }
-    // if not literal, look for structured path
-    if (!a.literal) {
-      a.rootProperty = Polymer.Path.root(arg);
-      // detect structured path (has dots)
-      a.structured = Polymer.Path.isPath(arg);
-      if (a.structured) {
-        a.wildcard = (arg.slice(-2) == '.*');
-        if (a.wildcard) {
-          a.name = arg.slice(0, -2);
-        }
-      }
-    }
-    return a;
-  }
-
-  /**
-   * Gather the argument values for a method specified in the provided array
-   * of argument metadata.
-   *
-   * The `path` and `value` arguments are used to fill in wildcard descriptor
-   * when the method is being called as a result of a path notification.
-   *
-   * @param {Object} data Instance data storage object to read properties from
-   * @param {Array<Object>} args Array of argument metadata
-   * @param {string} path Property/path name that triggered the method effect
-   * @param {Object} props Bag of current property changes
-   * @return {Array<*>} Array of argument values
-   * @private
-   */
-  function marshalArgs(data, args, path, props) {
-    let values = [];
-    for (let i=0, l=args.length; i<l; i++) {
-      let arg = args[i];
-      let name = arg.name;
-      let v;
-      if (arg.literal) {
-        v = arg.value;
-      } else {
-        if (arg.structured) {
-          v = Polymer.Path.get(data, name);
-          // when data is not stored e.g. `splices`
-          if (v === undefined) {
-            v = props[name];
-          }
-        } else {
-          v = data[name];
-        }
-      }
-      if (arg.wildcard) {
-        // Only send the actual path changed info if the change that
-        // caused the observer to run matched the wildcard
-        let baseChanged = (name.indexOf(path + '.') === 0);
-        let matches = (path.indexOf(name) === 0 && !baseChanged);
-        values[i] = {
-          path: matches ? path : name,
-          value: matches ? props[path] : v,
-          base: v
-        };
-      } else {
-        values[i] = v;
-      }
-    }
-    return values;
-  }
-
-  // data api
-
-  /**
-   * Sends array splice notifications (`.splices` and `.length`)
-   *
-   * Note: this implementation only accepts normalized paths
-   *
-   * @param {Element} inst Instance to send notifications to
-   * @param {Array} array The array the mutations occurred on
-   * @param {string} path The path to the array that was mutated
-   * @param {Array} splices Array of splice records
-   * @private
-   */
-  function notifySplices(inst, array, path, splices) {
-    let splicesPath = path + '.splices';
-    inst.notifyPath(splicesPath, { indexSplices: splices });
-    inst.notifyPath(path + '.length', array.length);
-    // Null here to allow potentially large splice records to be GC'ed.
-    inst.__data[splicesPath] = {indexSplices: null};
-  }
-
-  /**
-   * Creates a splice record and sends an array splice notification for
-   * the described mutation
-   *
-   * Note: this implementation only accepts normalized paths
-   *
-   * @param {Element} inst Instance to send notifications to
-   * @param {Array} array The array the mutations occurred on
-   * @param {string} path The path to the array that was mutated
-   * @param {number} index Index at which the array mutation occurred
-   * @param {number} addedCount Number of added items
-   * @param {Array} removed Array of removed items
-   * @private
-   */
-  function notifySplice(inst, array, path, index, addedCount, removed) {
-    notifySplices(inst, array, path, [{
-      index: index,
-      addedCount: addedCount,
-      removed: removed,
-      object: array,
-      type: 'splice'
-    }]);
-  }
-
-  /**
-   * Returns an upper-cased version of the string.
-   *
-   * @param {string} name String to uppercase
-   * @return {string} Uppercased string
-   * @private
-   */
-  function upper(name) {
-    return name[0].toUpperCase() + name.substring(1);
-  }
-
-  /**
-   * Element class mixin that provides meta-programming for Polymer's template
-   * binding and data observation (collectively, "property effects") system.
-   *
-   * This mixin uses provides the following key methods for adding property effects
-   * to this element:
-   * - `_createPropertyObserver`
-   * - `_createMethodObserver`
-   * - `_createNotifyingProperty`
-   * - `_createReadOnlyProperty`
-   * - `_createReflectedProperty`
-   * - `_createComputedProperty`
-   * - `_bindTemplate`
-   *
-   * Each method creates one or more property accessors, along with metadata
-   * used by this mixin's implementation of `_propertiesChanged` to perform
-   * the property effects.  These methods may be called on element instances,
-   * but are designed to be called on element prototypes such that the work to
-   * set up accessors and effect metadata are done once per element class.
-   *
-   * Note that this mixin overrides several `PropertyAccessors` methods, in
-   * many cases to maintain guarantees provided by the Polymer 1.x features;
-   * notably it changes property accessors to be synchronous by default
-   * whereas the default when using `PropertyAccessors` standalone is to be
-   * async by default.
-   *
-   * @polymerMixin
-   * @mixes Polymer.TemplateStamp
-   * @mixes Polymer.PropertyAccessors
-   * @memberof Polymer
-   * @summary Element class mixin that provides meta-programming for Polymer's
-   * template binding and data observation system.
-   */
-  Polymer.PropertyEffects = Polymer.dedupingMixin(superClass => {
-
-    /**
-     * @constructor
-     * @extends {superClass}
-     * @implements {Polymer_PropertyAccessors}
-     * @implements {Polymer_TemplateStamp}
-     */
-    const propertyEffectsBase = Polymer.TemplateStamp(Polymer.PropertyAccessors(superClass));
-
-    /**
-     * @polymerMixinClass
-     * @unrestricted
-     * @implements {Polymer_PropertyEffects}
-     */
-    class PropertyEffects extends propertyEffectsBase {
-
-      get PROPERTY_EFFECT_TYPES() {
-        return TYPES;
-      }
-
-      /**
-       * Overrides `Polymer.PropertyAccessors` implementation to initialize
-       * additional property-effect related properties.
-       *
-       * @override
-       */
-      _initializeProperties() {
-        super._initializeProperties();
-        this.__dataClientsInitialized = false;
-        this.__dataPendingClients = null;
-        this.__dataToNotify = null;
-        this.__dataLinkedPaths = null;
-        this.__dataHasPaths = false;
-        // May be set on instance prior to upgrade
-        this.__dataCompoundStorage = this.__dataCompoundStorage || null;
-        this.__dataHost = this.__dataHost || null;
-        this.__dataTemp = {};
-      }
-
-      /**
-       * Overrides `Polymer.PropertyAccessors` implementation to provide a
-       * more efficient implementation of initializing properties from
-       * the prototype on the instance.
-       *
-       * @override
-       */
-      _initializeProtoProperties(props) {
-        this.__data = Object.create(props);
-        this.__dataPending = Object.create(props);
-        this.__dataOld = {};
-      }
-
-      /**
-       * Overrides `Polymer.PropertyAccessors` implementation to avoid setting
-       * `_setProperty`'s `shouldNotify: true`.
-       *
-       * @override
-       */
-      _initializeInstanceProperties(props) {
-        let readOnly = this.__readOnly;
-        for (let prop in props) {
-          if (!readOnly || !readOnly[prop]) {
-            this.__dataPending = this.__dataPending || {};
-            this.__dataOld = this.__dataOld || {};
-            this.__data[prop] = this.__dataPending[prop] = props[prop];
-          }
-        }
-      }
-
-      // Prototype setup ----------------------------------------
-
-      /**
-       * Ensures an accessor exists for the specified property, and adds
-       * to a list of "property effects" that will run when the accessor for
-       * the specified property is set.  Effects are grouped by "type", which
-       * roughly corresponds to a phase in effect processing.  The effect
-       * metadata should be in the following form:
-       *
-       *   {
-       *     fn: effectFunction, // Reference to function to call to perform effect
-       *     info: { ... }       // Effect metadata passed to function
-       *     trigger: {          // Optional triggering metadata; if not provided
-       *       name: string      // the property is treated as a wildcard
-       *       structured: boolean
-       *       wildcard: boolean
-       *     }
-       *   }
-       *
-       * Effects are called from `_propertiesChanged` in the following order by
-       * type:
-       *
-       * 1. COMPUTE
-       * 2. PROPAGATE
-       * 3. REFLECT
-       * 4. OBSERVE
-       * 5. NOTIFY
-       *
-       * Effect functions are called with the following signature:
-       *
-       *   effectFunction(inst, path, props, oldProps, info, hasPaths)
-       *
-       * This method may be called either on the prototype of a class
-       * using the PropertyEffects mixin (for best performance), or on
-       * an instance to add dynamic effects.  When called on an instance or
-       * subclass of a class that has already had property effects added to
-       * its prototype, the property effect lists will be cloned and added as
-       * own properties of the caller.
-       *
-       * @param {string} property Property that should trigger the effect
-       * @param {string} type Effect type, from this.PROPERTY_EFFECT_TYPES
-       * @param {Object=} effect Effect metadata object
-       * @protected
-       */
-      _addPropertyEffect(property, type, effect) {
-        this._createPropertyAccessor(property, type == TYPES.READ_ONLY);
-        // effects are accumulated into arrays per property based on type
-        let effects = ensureOwnEffectMap(this, type)[property];
-        if (!effects) {
-          effects = this[type][property] = [];
-        }
-        effects.push(effect);
-      }
-
-      /**
-       * Removes the given property effect.
-       *
-       * @param {string} property Property the effect was associated with
-       * @param {string} type Effect type, from this.PROPERTY_EFFECT_TYPES
-       * @param {Object=} effect Effect metadata object to remove
-       */
-      _removePropertyEffect(property, type, effect) {
-        let effects = ensureOwnEffectMap(this, type)[property];
-        let idx = effects.indexOf(effect);
-        if (idx >= 0) {
-          effects.splice(idx, 1);
-        }
-      }
-
-      /**
-       * Returns whether the current prototype/instance has a property effect
-       * of a certain type.
-       *
-       * @param {string} property Property name
-       * @param {string=} type Effect type, from this.PROPERTY_EFFECT_TYPES
-       * @return {boolean} True if the prototype/instance has an effect of this type
-       * @protected
-       */
-      _hasPropertyEffect(property, type) {
-        let effects = this[type];
-        return Boolean(effects && effects[property]);
-      }
-
-      /**
-       * Returns whether the current prototype/instance has a "read only"
-       * accessor for the given property.
-       *
-       * @param {string} property Property name
-       * @return {boolean} True if the prototype/instance has an effect of this type
-       * @protected
-       */
-      _hasReadOnlyEffect(property) {
-        return this._hasPropertyEffect(property, TYPES.READ_ONLY);
-      }
-
-      /**
-       * Returns whether the current prototype/instance has a "notify"
-       * property effect for the given property.
-       *
-       * @param {string} property Property name
-       * @return {boolean} True if the prototype/instance has an effect of this type
-       * @protected
-       */
-      _hasNotifyEffect(property) {
-        return this._hasPropertyEffect(property, TYPES.NOTIFY);
-      }
-
-      /**
-       * Returns whether the current prototype/instance has a "reflect to attribute"
-       * property effect for the given property.
-       *
-       * @param {string} property Property name
-       * @return {boolean} True if the prototype/instance has an effect of this type
-       * @protected
-       */
-      _hasReflectEffect(property) {
-        return this._hasPropertyEffect(property, TYPES.REFLECT);
-      }
-
-      /**
-       * Returns whether the current prototype/instance has a "computed"
-       * property effect for the given property.
-       *
-       * @param {string} property Property name
-       * @return {boolean} True if the prototype/instance has an effect of this type
-       * @protected
-       */
-      _hasComputedEffect(property) {
-        return this._hasPropertyEffect(property, TYPES.COMPUTE);
-      }
-
-      // Runtime ----------------------------------------
-
-      /**
-       * Sets a pending property or path.  If the root property of the path in
-       * question had no accessor, the path is set, otherwise it is enqueued
-       * via `_setPendingProperty`.
-       *
-       * This function isolates relatively expensive functionality necessary
-       * for the public API (`set`, `setProperties`, `notifyPath`, and property
-       * change listeners via {{...}} bindings), such that it is only done
-       * when paths enter the system, and not at every propagation step.  It
-       * also sets a `__dataHasPaths` flag on the instance which is used to
-       * fast-path slower path-matching code in the property effects host paths.
-       *
-       * `path` can be a path string or array of path parts as accepted by the
-       * public API.
-       *
-       * @param {string | !Array<number|string>} path Path to set
-       * @param {*} value Value to set
-       * @param {boolean=} shouldNotify Set to true if this change should
-       *  cause a property notification event dispatch
-       * @param {boolean=} isPathNotification If the path being set is a path
-       *   notification of an already changed value, as opposed to a request
-       *   to set and notify the change.  In the latter `false` case, a dirty
-       *   check is performed and then the value is set to the path before
-       *   enqueuing the pending property change.
-       * @return {boolean} Returns true if the property/path was enqueued in
-       *   the pending changes bag.
-       * @protected
-       */
-      _setPendingPropertyOrPath(path, value, shouldNotify, isPathNotification) {
-        if (isPathNotification ||
-            Polymer.Path.root(Array.isArray(path) ? path[0] : path) !== path) {
-          // Dirty check changes being set to a path against the actual object,
-          // since this is the entry point for paths into the system; from here
-          // the only dirty checks are against the `__dataTemp` cache to prevent
-          // duplicate work in the same turn only. Note, if this was a notification
-          // of a change already set to a path (isPathNotification: true),
-          // we always let the change through and skip the `set` since it was
-          // already dirty checked at the point of entry and the underlying
-          // object has already been updated
-          if (!isPathNotification) {
-            let old = Polymer.Path.get(this, path);
-            path = /** @type {string} */ (Polymer.Path.set(this, path, value));
-            // Use property-accessor's simpler dirty check
-            if (!path || !super._shouldPropertyChange(path, value, old)) {
-              return false;
-            }
-          }
-          this.__dataHasPaths = true;
-          if (this._setPendingProperty(path, value, shouldNotify)) {
-            computeLinkedPaths(this, path, value);
-            return true;
-          }
-        } else {
-          if (this.__dataHasAccessor && this.__dataHasAccessor[path]) {
-            return this._setPendingProperty(path, value, shouldNotify);
-          } else {
-            this[path] = value;
-          }
-        }
-        return false;
-      }
-
-      /**
-       * Applies a value to a non-Polymer element/node's property.
-       *
-       * The implementation makes a best-effort at binding interop:
-       * Some native element properties have side-effects when
-       * re-setting the same value (e.g. setting <input>.value resets the
-       * cursor position), so we do a dirty-check before setting the value.
-       * However, for better interop with non-Polymer custom elements that
-       * accept objects, we explicitly re-set object changes coming from the
-       * Polymer world (which may include deep object changes without the
-       * top reference changing), erring on the side of providing more
-       * information.
-       *
-       * Users may override this method to provide alternate approaches.
-       *
-       * @param {Node} node The node to set a property on
-       * @param {string} prop The property to set
-       * @param {*} value The value to set
-       * @protected
-       */
-      _setUnmanagedPropertyToNode(node, prop, value) {
-        // It is a judgment call that resetting primitives is
-        // "bad" and resettings objects is also "good"; alternatively we could
-        // implement a whitelist of tag & property values that should never
-        // be reset (e.g. <input>.value && <select>.value)
-        if (value !== node[prop] || typeof value == 'object') {
-          node[prop] = value;
-        }
-      }
-
-      /**
-       * Overrides the `PropertyAccessors` implementation to introduce special
-       * dirty check logic depending on the property & value being set:
-       *
-       * 1. Any value set to a path (e.g. 'obj.prop': 42 or 'obj.prop': {...})
-       *    Stored in `__dataTemp`, dirty checked against `__dataTemp`
-       * 2. Object set to simple property (e.g. 'prop': {...})
-       *    Stored in `__dataTemp` and `__data`, dirty checked against
-       *    `__dataTemp` by default implementation of `_shouldPropertyChange`
-       * 3. Primitive value set to simple property (e.g. 'prop': 42)
-       *    Stored in `__data`, dirty checked against `__data`
-       *
-       * The dirty-check is important to prevent cycles due to two-way
-       * notification, but paths and objects are only dirty checked against any
-       * previous value set during this turn via a "temporary cache" that is
-       * cleared when the last `_propertiesChaged` exits. This is so:
-       * a. any cached array paths (e.g. 'array.3.prop') may be invalidated
-       *    due to array mutations like shift/unshift/splice; this is fine
-       *    since path changes are dirty-checked at user entry points like `set`
-       * b. dirty-checking for objects only lasts one turn to allow the user
-       *    to mutate the object in-place and re-set it with the same identity
-       *    and have all sub-properties re-propagated in a subsequent turn.
-       *
-       * The temp cache is not necessarily sufficient to prevent invalid array
-       * paths, since a splice can happen during the same turn (with pathological
-       * user code); we could introduce a "fixup" for temporarily cached array
-       * paths if needed: https://github.com/Polymer/polymer/issues/4227
-       *
-       * @override
-       */
-      _setPendingProperty(property, value, shouldNotify) {
-        let isPath = this.__dataHasPaths && Polymer.Path.isPath(property);
-        let prevProps = isPath ? this.__dataTemp : this.__data;
-        if (this._shouldPropertyChange(property, value, prevProps[property])) {
-          if (!this.__dataPending) {
-            this.__dataPending = {};
-            this.__dataOld = {};
-          }
-          // Ensure old is captured from the last turn
-          if (!(property in this.__dataOld)) {
-            this.__dataOld[property] = this.__data[property];
-          }
-          // Paths are stored in temporary cache (cleared at end of turn),
-          // which is used for dirty-checking, all others stored in __data
-          if (isPath) {
-            this.__dataTemp[property] = value;
-          } else {
-            this.__data[property] = value;
-          }
-          // All changes go into pending property bag, passed to _propertiesChanged
-          this.__dataPending[property] = value;
-          // Track properties that should notify separately
-          if (isPath || (this.__notifyEffects && this.__notifyEffects[property])) {
-            this.__dataToNotify = this.__dataToNotify || {};
-            this.__dataToNotify[property] = shouldNotify;
-          }
-          return true;
-        }
-      }
-
-      /**
-       * Overrides base implementation to ensure all accessors set `shouldNotify`
-       * to true, for per-property notification tracking.
-       *
-       * @override
-       */
-      _setProperty(property, value) {
-        if (this._setPendingProperty(property, value, true)) {
-          this._invalidateProperties();
-        }
-      }
-
-      /**
-       * Overrides `PropertyAccessor`'s default async queuing of
-       * `_propertiesChanged`: if `__dataInitialized` is false (has not yet been
-       * manually flushed), the function no-ops; otherwise flushes
-       * `_propertiesChanged` synchronously.
-       *
-       * @override
-       */
-      _invalidateProperties() {
-        if (this.__dataInitialized) {
-          this._flushProperties();
-        }
-      }
-
-      /**
-       * Enqueues the given client on a list of pending clients, whose
-       * pending property changes can later be flushed via a call to
-       * `_flushClients`.
-       *
-       * @param {Object} client PropertyEffects client to enqueue
-       * @protected
-       */
-      _enqueueClient(client) {
-        this.__dataPendingClients = this.__dataPendingClients || [];
-        if (client !== this) {
-          this.__dataPendingClients.push(client);
-        }
-      }
-
-      /**
-       * Flushes any clients previously enqueued via `_enqueueClient`, causing
-       * their `_flushProperties` method to run.
-       *
-       * @protected
-       */
-      _flushClients() {
-        if (!this.__dataClientsInitialized) {
-          this._readyClients();
-        }
-        // Flush all clients
-        let clients = this.__dataPendingClients;
-        if (clients) {
-          this.__dataPendingClients = null;
-          for (let i=0; i < clients.length; i++) {
-            let client = clients[i];
-            if (!client.__dataInitialized || client.__dataPending) {
-              client._flushProperties();
-            }
-          }
-        }
-      }
-
-      /**
-       * Sets a bag of property changes to this instance, and
-       * synchronously processes all effects of the properties as a batch.
-       *
-       * Property names must be simple properties, not paths.  Batched
-       * path propagation is not supported.
-       *
-       * @param {Object} props Bag of one or more key-value pairs whose key is
-       *   a property and value is the new value to set for that property.
-       * @param {boolean=} setReadOnly When true, any private values set in
-       *   `props` will be set. By default, `setProperties` will not set
-       *   `readOnly: true` root properties.
-       * @public
-       */
-      setProperties(props, setReadOnly) {
-        for (let path in props) {
-          if (setReadOnly || !this.__readOnly || !this.__readOnly[path]) {
-            //TODO(kschaaf): explicitly disallow paths in setProperty?
-            // wildcard observers currently only pass the first changed path
-            // in the `info` object, and you could do some odd things batching
-            // paths, e.g. {'foo.bar': {...}, 'foo': null}
-            this._setPendingPropertyOrPath(path, props[path], true);
-          }
-        }
-        this._invalidateProperties();
-      }
-
-      /**
-       * Overrides `PropertyAccessors` to call `_readyClients` callback
-       * if it was not called as a result of flushing properties.
-       *
-       * @override
-       */
-      ready() {
-        super.ready();
-        if (!this.__dataClientsInitialized) {
-          this._readyClients();
-        }
-      }
-
-      /**
-       * Perform any initial setup on client dom. Called before the first
-       * `_flushProperties` call on client dom and before any element
-       * observers are called.
-       *
-       * @protected
-       */
-      _readyClients() {
-        this.__dataClientsInitialized = true;
-      }
-
-      /**
-       * Implements `PropertyAccessors`'s properties changed callback.
-       *
-       * Runs each class of effects for the batch of changed properties in
-       * a specific order (compute, propagate, reflect, observe, notify).
-       *
-       * @override
-       */
-      _propertiesChanged(currentProps, changedProps, oldProps) {
-        // ----------------------------
-        // let c = Object.getOwnPropertyNames(changedProps || {});
-        // window.debug && console.group(this.localName + '#' + this.id + ': ' + c);
-        // if (window.debug) { debugger; }
-        // ----------------------------
-        let hasPaths = this.__dataHasPaths;
-        this.__dataHasPaths = false;
-        // Compute properties
-        runComputedEffects(this, changedProps, oldProps, hasPaths);
-        // Clear notify properties prior to possible reentry (propagate, observe),
-        // but after computing effects have a chance to add to them
-        let notifyProps = this.__dataToNotify;
-        this.__dataToNotify = null;
-        // Propagate properties to clients
-        this._propagatePropertyChanges(changedProps, oldProps, hasPaths);
-        // Flush clients
-        this._flushClients();
-        // Reflect properties
-        runEffects(this, this.__reflectEffects, changedProps, oldProps, hasPaths);
-        // Observe properties
-        runEffects(this, this.__observeEffects, changedProps, oldProps, hasPaths);
-        // Notify properties to host
-        if (notifyProps) {
-          runNotifyEffects(this, notifyProps, changedProps, oldProps, hasPaths);
-        }
-        // Clear temporary cache at end of turn
-        if (this.__dataCounter == 1) {
-          this.__dataTemp = {};
-        }
-        // ----------------------------
-        // window.debug && console.groupEnd(this.localName + '#' + this.id + ': ' + c);
-        // ----------------------------
-      }
-
-      /**
-       * Called to propagate any property changes to stamped template nodes
-       * managed by this element.
-       *
-       * @param {Object} changedProps Bag of changed properties
-       * @param {Object} oldProps Bag of previous values for changed properties
-       * @param {boolean} hasPaths True with `props` contains one or more paths
-       * @protected
-       */
-      _propagatePropertyChanges(changedProps, oldProps, hasPaths) {
-        if (this.__propagateEffects) {
-          runEffects(this, this.__propagateEffects, changedProps, oldProps, hasPaths);
-        }
-        let templateInfo = this.__templateInfo;
-        while (templateInfo) {
-          runEffects(this, templateInfo.propertyEffects, changedProps, oldProps,
-            hasPaths, templateInfo.nodeList);
-          templateInfo = templateInfo.nextTemplateInfo;
-        }
-      }
-
-      /**
-       * Aliases one data path as another, such that path notifications from one
-       * are routed to the other.
-       *
-       * @param {string | !Array<string|number>} to Target path to link.
-       * @param {string | !Array<string|number>} from Source path to link.
-       * @public
-       */
-      linkPaths(to, from) {
-        to = Polymer.Path.normalize(to);
-        from = Polymer.Path.normalize(from);
-        this.__dataLinkedPaths = this.__dataLinkedPaths || {};
-        this.__dataLinkedPaths[to] = from;
-      }
-
-      /**
-       * Removes a data path alias previously established with `_linkPaths`.
-       *
-       * Note, the path to unlink should be the target (`to`) used when
-       * linking the paths.
-       *
-       * @param {string | !Array<string|number>} path Target path to unlink.
-       * @public
-       */
-      unlinkPaths(path) {
-        path = Polymer.Path.normalize(path);
-        if (this.__dataLinkedPaths) {
-          delete this.__dataLinkedPaths[path];
-        }
-      }
-
-      /**
-       * Notify that an array has changed.
-       *
-       * Example:
-       *
-       *     this.items = [ {name: 'Jim'}, {name: 'Todd'}, {name: 'Bill'} ];
-       *     ...
-       *     this.items.splice(1, 1, {name: 'Sam'});
-       *     this.items.push({name: 'Bob'});
-       *     this.notifySplices('items', [
-       *       { index: 1, removed: [{name: 'Todd'}], addedCount: 1, obect: this.items, type: 'splice' },
-       *       { index: 3, removed: [], addedCount: 1, object: this.items, type: 'splice'}
-       *     ]);
-       *
-       * @param {string} path Path that should be notified.
-       * @param {Array} splices Array of splice records indicating ordered
-       *   changes that occurred to the array. Each record should have the
-       *   following fields:
-       *    * index: index at which the change occurred
-       *    * removed: array of items that were removed from this index
-       *    * addedCount: number of new items added at this index
-       *    * object: a reference to the array in question
-       *    * type: the string literal 'splice'
-       *
-       *   Note that splice records _must_ be normalized such that they are
-       *   reported in index order (raw results from `Object.observe` are not
-       *   ordered and must be normalized/merged before notifying).
-       * @public
-      */
-      notifySplices(path, splices) {
-        let info = {};
-        let array = /** @type {Array} */(Polymer.Path.get(this, path, info));
-        notifySplices(this, array, info.path, splices);
-      }
-
-      /**
-       * Convenience method for reading a value from a path.
-       *
-       * Note, if any part in the path is undefined, this method returns
-       * `undefined` (this method does not throw when dereferencing undefined
-       * paths).
-       *
-       * @param {(string|!Array<(string|number)>)} path Path to the value
-       *   to read.  The path may be specified as a string (e.g. `foo.bar.baz`)
-       *   or an array of path parts (e.g. `['foo.bar', 'baz']`).  Note that
-       *   bracketed expressions are not supported; string-based path parts
-       *   *must* be separated by dots.  Note that when dereferencing array
-       *   indices, the index may be used as a dotted part directly
-       *   (e.g. `users.12.name` or `['users', 12, 'name']`).
-       * @param {Object=} root Root object from which the path is evaluated.
-       * @return {*} Value at the path, or `undefined` if any part of the path
-       *   is undefined.
-       * @public
-       */
-      get(path, root) {
-        return Polymer.Path.get(root || this, path);
-      }
-
-      /**
-       * Convenience method for setting a value to a path and notifying any
-       * elements bound to the same path.
-       *
-       * Note, if any part in the path except for the last is undefined,
-       * this method does nothing (this method does not throw when
-       * dereferencing undefined paths).
-       *
-       * @param {(string|!Array<(string|number)>)} path Path to the value
-       *   to write.  The path may be specified as a string (e.g. `'foo.bar.baz'`)
-       *   or an array of path parts (e.g. `['foo.bar', 'baz']`).  Note that
-       *   bracketed expressions are not supported; string-based path parts
-       *   *must* be separated by dots.  Note that when dereferencing array
-       *   indices, the index may be used as a dotted part directly
-       *   (e.g. `'users.12.name'` or `['users', 12, 'name']`).
-       * @param {*} value Value to set at the specified path.
-       * @param {Object=} root Root object from which the path is evaluated.
-       *   When specified, no notification will occur.
-       * @public
-      */
-      set(path, value, root) {
-        if (root) {
-          Polymer.Path.set(root, path, value);
-        } else {
-          if (!this.__readOnly || !this.__readOnly[/** @type {string} */(path)]) {
-            if (this._setPendingPropertyOrPath(path, value, true)) {
-              this._invalidateProperties();
-            }
-          }
-        }
-      }
-
-      /**
-       * Adds items onto the end of the array at the path specified.
-       *
-       * The arguments after `path` and return value match that of
-       * `Array.prototype.push`.
-       *
-       * This method notifies other paths to the same array that a
-       * splice occurred to the array.
-       *
-       * @param {string} path Path to array.
-       * @param {...*} items Items to push onto array
-       * @return {number} New length of the array.
-       * @public
-       */
-      push(path, ...items) {
-        let info = {};
-        let array = /** @type {Array}*/(Polymer.Path.get(this, path, info));
-        let len = array.length;
-        let ret = array.push(...items);
-        if (items.length) {
-          notifySplice(this, array, info.path, len, items.length, []);
-        }
-        return ret;
-      }
-
-      /**
-       * Removes an item from the end of array at the path specified.
-       *
-       * The arguments after `path` and return value match that of
-       * `Array.prototype.pop`.
-       *
-       * This method notifies other paths to the same array that a
-       * splice occurred to the array.
-       *
-       * @param {string} path Path to array.
-       * @return {*} Item that was removed.
-       * @public
-       */
-      pop(path) {
-        let info = {};
-        let array = /** @type {Array} */(Polymer.Path.get(this, path, info));
-        let hadLength = Boolean(array.length);
-        let ret = array.pop();
-        if (hadLength) {
-          notifySplice(this, array, info.path, array.length, 0, [ret]);
-        }
-        return ret;
-      }
-
-      /**
-       * Starting from the start index specified, removes 0 or more items
-       * from the array and inserts 0 or more new items in their place.
-       *
-       * The arguments after `path` and return value match that of
-       * `Array.prototype.splice`.
-       *
-       * This method notifies other paths to the same array that a
-       * splice occurred to the array.
-       *
-       * @param {string} path Path to array.
-       * @param {number} start Index from which to start removing/inserting.
-       * @param {number} deleteCount Number of items to remove.
-       * @param {...*} items Items to insert into array.
-       * @return {Array} Array of removed items.
-       * @public
-       */
-      splice(path, start, deleteCount, ...items) {
-        let info = {};
-        let array = /** @type {Array} */(Polymer.Path.get(this, path, info));
-        // Normalize fancy native splice handling of crazy start values
-        if (start < 0) {
-          start = array.length - Math.floor(-start);
-        } else {
-          start = Math.floor(start);
-        }
-        if (!start) {
-          start = 0;
-        }
-        let ret = array.splice(start, deleteCount, ...items);
-        if (items.length || ret.length) {
-          notifySplice(this, array, info.path, start, items.length, ret);
-        }
-        return ret;
-      }
-
-      /**
-       * Removes an item from the beginning of array at the path specified.
-       *
-       * The arguments after `path` and return value match that of
-       * `Array.prototype.pop`.
-       *
-       * This method notifies other paths to the same array that a
-       * splice occurred to the array.
-       *
-       * @param {string} path Path to array.
-       * @return {*} Item that was removed.
-       * @public
-       */
-      shift(path) {
-        let info = {};
-        let array = /** @type {Array} */(Polymer.Path.get(this, path, info));
-        let hadLength = Boolean(array.length);
-        let ret = array.shift();
-        if (hadLength) {
-          notifySplice(this, array, info.path, 0, 0, [ret]);
-        }
-        return ret;
-      }
-
-      /**
-       * Adds items onto the beginning of the array at the path specified.
-       *
-       * The arguments after `path` and return value match that of
-       * `Array.prototype.push`.
-       *
-       * This method notifies other paths to the same array that a
-       * splice occurred to the array.
-       *
-       * @param {string} path Path to array.
-       * @param {...*} items Items to insert info array
-       * @return {number} New length of the array.
-       * @public
-       */
-      unshift(path, ...items) {
-        let info = {};
-        let array = /** @type {Array} */(Polymer.Path.get(this, path, info));
-        let ret = array.unshift(...items);
-        if (items.length) {
-          notifySplice(this, array, info.path, 0, items.length, []);
-        }
-        return ret;
-      }
-
-      /**
-       * Notify that a path has changed.
-       *
-       * Example:
-       *
-       *     this.item.user.name = 'Bob';
-       *     this.notifyPath('item.user.name');
-       *
-       * @param {string} path Path that should be notified.
-       * @param {*=} value Value at the path (optional).
-       * @public
-      */
-      notifyPath(path, value) {
-        /** @type {string} */
-        let propPath;
-        if (arguments.length == 1) {
-          // Get value if not supplied
-          let info = {};
-          value = Polymer.Path.get(this, path, info);
-          propPath = info.path;
-        } else if (Array.isArray(path)) {
-          // Normalize path if needed
-          propPath = Polymer.Path.normalize(path);
-        } else {
-          propPath = /** @type{string} */(path);
-        }
-        if (this._setPendingPropertyOrPath(propPath, value, true, true)) {
-          this._invalidateProperties();
-        }
-      }
-
-      /**
-       * Creates a read-only accessor for the given property.
-       *
-       * To set the property, use the protected `_setProperty` API.
-       * To create a custom protected setter (e.g. `_setMyProp()` for
-       * property `myProp`), pass `true` for `protectedSetter`.
-       *
-       * Note, if the property will have other property effects, this method
-       * should be called first, before adding other effects.
-       *
-       * @param {string} property Property name
-       * @param {boolean=} protectedSetter Creates a custom protected setter
-       *   when `true`.
-       * @protected
-       */
-      _createReadOnlyProperty(property, protectedSetter) {
-        this._addPropertyEffect(property, TYPES.READ_ONLY);
-        if (protectedSetter) {
-          this['_set' + upper(property)] = function(value) {
-            this._setProperty(property, value);
-          }
-        }
-      }
-
-      /**
-       * Creates a single-property observer for the given property.
-       *
-       * @param {string} property Property name
-       * @param {string} methodName Name of observer method to call
-       * @param {boolean=} dynamicFn Whether the method name should be included as
-       *   a dependency to the effect.
-       * @protected
-       */
-      _createPropertyObserver(property, methodName, dynamicFn) {
-        let info = { property, methodName };
-        this._addPropertyEffect(property, TYPES.OBSERVE, {
-          fn: runObserverEffect, info, trigger: {name: property}
-        });
-        if (dynamicFn) {
-          this._addPropertyEffect(methodName, TYPES.OBSERVE, {
-            fn: runObserverEffect, info, trigger: {name: methodName}
-          });
-        }
-      }
-
-      /**
-       * Creates a multi-property "method observer" based on the provided
-       * expression, which should be a string in the form of a normal Javascript
-       * function signature: `'methodName(arg1, [..., argn])'`.  Each argument
-       * should correspond to a property or path in the context of this
-       * prototype (or instance), or may be a literal string or number.
-       *
-       * @param {string} expression Method expression
-       * @param {Object=} dynamicFns Map indicating whether method names should
-       *   be included as a dependency to the effect.
-       * @protected
-       */
-      _createMethodObserver(expression, dynamicFns) {
-        let sig = parseMethod(expression);
-        if (!sig) {
-          throw new Error("Malformed observer expression '" + expression + "'");
-        }
-        createMethodEffect(this, sig, TYPES.OBSERVE, runMethodEffect, null, dynamicFns);
-      }
-
-      /**
-       * Causes the setter for the given property to dispatch `<property>-changed`
-       * events to notify of changes to the property.
-       *
-       * @param {string} property Property name
-       * @protected
-       */
-      _createNotifyingProperty(property) {
-        this._addPropertyEffect(property, TYPES.NOTIFY, {
-          fn: runNotifyEffect,
-          info: {
-            eventName: CaseMap.camelToDashCase(property) + '-changed',
-            property: property
-          }
-        });
-      }
-
-      /**
-       * Causes the setter for the given property to reflect the property value
-       * to a (dash-cased) attribute of the same name.
-       *
-       * @param {string} property Property name
-       * @protected
-       */
-      _createReflectedProperty(property) {
-        let attr = CaseMap.camelToDashCase(property);
-        if (attr[0] === '-') {
-          console.warn('Property ' + property + ' cannot be reflected to attribute ' +
-            attr + ' because "-" is not a valid starting attribute name. Use a lowercase first letter for the property thisead.');
-        } else {
-          this._addPropertyEffect(property, TYPES.REFLECT, {
-            fn: runReflectEffect,
-            info: {
-              attrName: attr
-            }
-          });
-        }
-      }
-
-      /**
-       * Creates a computed property whose value is set to the result of the
-       * method described by the given `expression` each time one or more
-       * arguments to the method changes.  The expression should be a string
-       * in the form of a normal Javascript function signature:
-       * `'methodName(arg1, [..., argn])'`
-       *
-       * @param {string} property Name of computed property to set
-       * @param {string} expression Method expression
-       * @param {Object=} dynamicFns Map indicating whether method names should
-       *   be included as a dependency to the effect.
-       * @protected
-       */
-      _createComputedProperty(property, expression, dynamicFns) {
-        let sig = parseMethod(expression);
-        if (!sig) {
-          throw new Error("Malformed computed expression '" + expression + "'");
-        }
-        createMethodEffect(this, sig, TYPES.COMPUTE, runComputedEffect, property, dynamicFns);
-      }
-
-      // -- binding ----------------------------------------------
-
-      /**
-       * Parses the provided template to ensure binding effects are created
-       * for them, and then ensures property accessors are created for any
-       * dependent properties in the template.  Binding effects for bound
-       * templates are stored in a linked list on the instance so that
-       * templates can be efficiently stamped and unstamped.
-       *
-       * This method may be called on the prototype (for prototypical template
-       * binding, to avoid creating accessors every instance) once per prototype,
-       * and will be called with `runtimeBinding: true` by `_stampTemplate` to
-       * create and link an instance of the template metadata associated with a
-       * particular stamping.
-       *
-       * @param {HTMLTemplateElement} template Template containing binding
-       *   bindings
-       * @param {boolean=} instanceBinding When false (default), performs
-       *   "prototypical" binding of the template and overwrites any previously
-       *   bound template for the class. When true (as passed from
-       *   `_stampTemplate`), the template info is instanced and linked into
-       *   the list of bound templates.
-       * @return {Object} Template metadata object; for `runtimeBinding`,
-       *   this is an instance of the prototypical template info
-       * @protected
-       */
-      _bindTemplate(template, instanceBinding) {
-        let templateInfo = this.constructor._parseTemplate(template);
-        let wasPreBound = this.__templateInfo == templateInfo;
-        // Optimization: since this is called twice for proto-bound templates,
-        // don't attempt to recreate accessors if this template was pre-bound
-        if (!wasPreBound) {
-          for (let prop in templateInfo.propertyEffects) {
-            this._createPropertyAccessor(prop);
-          }
-        }
-        if (instanceBinding) {
-          // For instance-time binding, create instance of template metadata
-          // and link into list of templates if necessary
-          templateInfo = Object.create(templateInfo);
-          templateInfo.wasPreBound = wasPreBound;
-          if (!wasPreBound && this.__templateInfo) {
-            templateInfo.nextTemplateInfo = this.__templateInfo;
-            this.__templateInfo.previousTemplateInfo = templateInfo;
-          }
-        }
-        return this.__templateInfo = templateInfo;
-      }
-
-      /**
-       * Adds a property effect to the given template metadata, which is run
-       * at the "propagate" stage of `_propertiesChanged` when the template
-       * has been bound to the element via `_bindTemplate`.
-       *
-       * The `effect` object should match the format in `_addPropertyEffect`.
-       *
-       * @param {Object} templateInfo Template metadata to add effect to
-       * @param {string} prop Property that should trigger the effect
-       * @param {Object=} effect Effect metadata object
-       * @protected
-       */
-      static _addTemplatePropertyEffect(templateInfo, prop, effect) {
-        let hostProps = templateInfo.hostProps = templateInfo.hostProps || {};
-        hostProps[prop] = true;
-        let effects = templateInfo.propertyEffects = templateInfo.propertyEffects || {};
-        let propEffects = effects[prop] = effects[prop] || [];
-        propEffects.push(effect);
-      }
-
-      /**
-       * Stamps the provided template and performs instance-time setup for
-       * Polymer template features, including data bindings, declarative event
-       * listeners, and the `this.$` map of `id`'s to nodes.  A document fragment
-       * is returned containing the stamped DOM, ready for insertion into the
-       * DOM.
-       *
-       * This method may be called more than once; however note that due to
-       * `shadycss` polyfill limitations, only styles from templates prepared
-       * using `ShadyCSS.prepareTemplate` will be correctly polyfilled (scoped
-       * to the shadow root and support CSS custom properties), and note that
-       * `ShadyCSS.prepareTemplate` may only be called once per element. As such,
-       * any styles required by in runtime-stamped templates must be included
-       * in the main element template.
-       *
-       * @param {HTMLTemplateElement} template Template to stamp
-       * @return {DocumentFragment} Cloned template content
-       * @protected
-       */
-      _stampTemplate(template) {
-        let dom = super._stampTemplate(template);
-        let templateInfo = this._bindTemplate(template, true);
-        // Add template-instance-specific data to instanced templateInfo
-        templateInfo.nodeList = dom.nodeList;
-        // Capture child nodes to allow unstamping of non-prototypical templates
-        if (!templateInfo.wasPreBound) {
-          let nodes = templateInfo.childNodes = [];
-          for (let n=dom.firstChild; n; n=n.nextSibling) {
-            nodes.push(n);
-          }
-        }
-        dom.templateInfo = templateInfo;
-        // Setup compound storage, 2-way listeners, and dataHost for bindings
-        setupBindings(this, templateInfo);
-        // Flush properties into template nodes if already booted
-        if (this.__dataInitialized) {
-          runEffects(this, templateInfo.propertyEffects, this.__data, null,
-            false, templateInfo.nodeList);
-        }
-        return dom;
-      }
-
-      /**
-       * Removes and unbinds the nodes previously contained in the provided
-       * DocumentFragment returned from `_stampTemplate`.
-       *
-       * @param {DocumentFragment} dom DocumentFragment previously returned
-       *   from `_stampTemplate` associated with the nodes to be removed
-       * @protected
-       */
-      _removeBoundDom(dom) {
-        // Unlink template info
-        let templateInfo = dom.templateInfo;
-        if (templateInfo.previousTemplateInfo) {
-          templateInfo.previousTemplateInfo.nextTemplateInfo =
-            templateInfo.nextTemplateInfo;
-        }
-        if (templateInfo.nextTemplateInfo) {
-          templateInfo.nextTemplateInfo.previousTemplateInfo =
-            templateInfo.previousTemplateInfo;
-        }
-        // Remove stamped nodes
-        let nodes = templateInfo.childNodes;
-        for (let i=0; i<nodes.length; i++) {
-          let node = nodes[i];
-          node.parentNode.removeChild(node);
-        }
-      }
-
-      /**
-       * Overrides default `TemplateStamp` implementation to add support for
-       * parsing bindings from `TextNode`'s' `textContent`.  A `bindings`
-       * array is added to `nodeInfo` and populated with binding metadata
-       * with information capturing the binding target, and a `parts` array
-       * with one or more metadata objects capturing the source(s) of the
-       * binding.
-       *
-       * @override
-       * @param {Node} node Node to parse
-       * @param {Object} templateInfo Template metadata for current template
-       * @param {Object} nodeInfo Node metadata for current template node
-       * @return {boolean} `true` if the visited node added node-specific
-       *   metadata to `nodeInfo`
-       * @protected
-       */
-      static _parseTemplateNode(node, templateInfo, nodeInfo) {
-        let noted = super._parseTemplateNode(node, templateInfo, nodeInfo);
-        if (node.nodeType === Node.TEXT_NODE) {
-          let parts = this._parseBindings(node.textContent, templateInfo);
-          if (parts) {
-            // Initialize the textContent with any literal parts
-            // NOTE: default to a space here so the textNode remains; some browsers
-            // (IE) evacipate an empty textNode following cloneNode/importNode.
-            node.textContent = literalFromParts(parts) || ' ';
-            addBinding(this, templateInfo, nodeInfo, 'text', 'textContent', parts);
-            noted = true;
-          }
-        }
-        return noted;
-      }
-
-      /**
-       * Overrides default `TemplateStamp` implementation to add support for
-       * parsing bindings from attributes.  A `bindings`
-       * array is added to `nodeInfo` and populated with binding metadata
-       * with information capturing the binding target, and a `parts` array
-       * with one or more metadata objects capturing the source(s) of the
-       * binding.
-       *
-       * @override
-       * @param {Node} node Node to parse
-       * @param {Object} templateInfo Template metadata for current template
-       * @param {Object} nodeInfo Node metadata for current template node
-       * @return {boolean} `true` if the visited node added node-specific
-       *   metadata to `nodeInfo`
-       * @protected
-       */
-      static _parseTemplateNodeAttribute(node, templateInfo, nodeInfo, name, value) {
-        let parts = this._parseBindings(value, templateInfo);
-        if (parts) {
-          // Attribute or property
-          let origName = name;
-          let kind = 'property';
-          if (name[name.length-1] == '$') {
-            name = name.slice(0, -1);
-            kind = 'attribute';
-          }
-          // Initialize attribute bindings with any literal parts
-          let literal = literalFromParts(parts);
-          if (literal && kind == 'attribute') {
-            node.setAttribute(name, literal);
-          }
-          // Clear attribute before removing, since IE won't allow removing
-          // `value` attribute if it previously had a value (can't
-          // unconditionally set '' before removing since attributes with `$`
-          // can't be set using setAttribute)
-          if (node.localName === 'input' && origName === 'value') {
-            node.setAttribute(origName, '');
-          }
-          // Remove annotation
-          node.removeAttribute(origName);
-          // Case hackery: attributes are lower-case, but bind targets
-          // (properties) are case sensitive. Gambit is to map dash-case to
-          // camel-case: `foo-bar` becomes `fooBar`.
-          // Attribute bindings are excepted.
-          if (kind === 'property') {
-            name = Polymer.CaseMap.dashToCamelCase(name);
-          }
-          addBinding(this, templateInfo, nodeInfo, kind, name, parts, literal);
-          return true;
-        } else {
-          return super._parseTemplateNodeAttribute(node, templateInfo, nodeInfo, name, value);
-        }
-      }
-
-      /**
-       * Overrides default `TemplateStamp` implementation to add support for
-       * binding the properties that a nested template depends on to the template
-       * as `_host_<property>`.
-       *
-       * @override
-       * @param {Node} node Node to parse
-       * @param {Object} templateInfo Template metadata for current template
-       * @param {Object} nodeInfo Node metadata for current template node
-       * @return {boolean} `true` if the visited node added node-specific
-       *   metadata to `nodeInfo`
-       * @protected
-       */
-      static _parseTemplateNestedTemplate(node, templateInfo, nodeInfo) {
-        let noted = super._parseTemplateNestedTemplate(node, templateInfo, nodeInfo);
-        // Merge host props into outer template and add bindings
-        let hostProps = nodeInfo.templateInfo.hostProps;
-        let mode = '{';
-        for (let source in hostProps) {
-          let parts = [{ mode, source, dependencies: [source] }];
-          addBinding(this, templateInfo, nodeInfo, 'property', '_host_' + source, parts);
-        }
-        return noted;
-      }
-
-      /**
-       * Called to parse text in a template (either attribute values or
-       * textContent) into binding metadata.
-       *
-       * Any overrides of this method should return an array of binding part
-       * metadata  representing one or more bindings found in the provided text
-       * and any "literal" text in between.  Any non-literal parts will be passed
-       * to `_evaluateBinding` when any dependencies change.  The only required
-       * fields of each "part" in the returned array are as follows:
-       *
-       * - `dependencies` - Array containing trigger metadata for each property
-       *   that should trigger the binding to update
-       * - `literal` - String containing text if the part represents a literal;
-       *   in this case no `dependencies` are needed
-       *
-       * Additional metadata for use by `_evaluateBinding` may be provided in
-       * each part object as needed.
-       *
-       * The default implementation handles the following types of bindings
-       * (one or more may be intermixed with literal strings):
-       * - Property binding: `[[prop]]`
-       * - Path binding: `[[object.prop]]`
-       * - Negated property or path bindings: `[[!prop]]` or `[[!object.prop]]`
-       * - Two-way property or path bindings (supports negation):
-       *   `{{prop}}`, `{{object.prop}}`, `{{!prop}}` or `{{!object.prop}}`
-       * - Inline computed method (supports negation):
-       *   `[[compute(a, 'literal', b)]]`, `[[!compute(a, 'literal', b)]]`
-       *
-       * @param {string} text Text to parse from attribute or textContent
-       * @param {Object} templateInfo Current template metadata
-       * @return {Array<Object>} Array of binding part metadata
-       * @protected
-       */
-      static _parseBindings(text, templateInfo) {
-        let parts = [];
-        let lastIndex = 0;
-        let m;
-        // Example: "literal1{{prop}}literal2[[!compute(foo,bar)]]final"
-        // Regex matches:
-        //        Iteration 1:  Iteration 2:
-        // m[1]: '{{'          '[['
-        // m[2]: ''            '!'
-        // m[3]: 'prop'        'compute(foo,bar)'
-        while ((m = bindingRegex.exec(text)) !== null) {
-          // Add literal part
-          if (m.index > lastIndex) {
-            parts.push({literal: text.slice(lastIndex, m.index)});
-          }
-          // Add binding part
-          let mode = m[1][0];
-          let negate = Boolean(m[2]);
-          let source = m[3].trim();
-          let customEvent, notifyEvent, colon;
-          if (mode == '{' && (colon = source.indexOf('::')) > 0) {
-            notifyEvent = source.substring(colon + 2);
-            source = source.substring(0, colon);
-            customEvent = true;
-          }
-          let signature = parseMethod(source);
-          let dependencies = [];
-          if (signature) {
-            // Inline computed function
-            let {args, methodName} = signature;
-            for (let i=0; i<args.length; i++) {
-              let arg = args[i];
-              if (!arg.literal) {
-                dependencies.push(arg);
-              }
-            }
-            let dynamicFns = templateInfo.dynamicFns;
-            if (dynamicFns && dynamicFns[methodName] || signature.static) {
-              dependencies.push(methodName);
-            }
-          } else {
-            // Property or path
-            dependencies.push(source);
-          }
-          parts.push({
-            source, mode, negate, customEvent, signature, dependencies,
-            event: notifyEvent
-          });
-          lastIndex = bindingRegex.lastIndex;
-        }
-        // Add a final literal part
-        if (lastIndex && lastIndex < text.length) {
-          let literal = text.substring(lastIndex);
-          if (literal) {
-            parts.push({
-              literal: literal
-            });
-          }
-        }
-        if (parts.length) {
-          return parts;
-        }
-      }
-
-      /**
-       * Called to evaluate a previously parsed binding part based on a set of
-       * one or more changed dependencies.
-       *
-       * @param {HTMLElement} inst Element that should be used as scope for
-       *   binding dependencies
-       * @param {Object} part Binding part metadata
-       * @param {string} path Property/path that triggered this effect
-       * @param {Object} props Bag of current property changes
-       * @param {Object} oldProps Bag of previous values for changed properties
-       * @param {boolean} hasPaths True with `props` contains one or more paths
-       * @return {*} Value the binding part evaluated to
-       * @protected
-       */
-      static _evaluateBinding(inst, part, path, props, oldProps, hasPaths) {
-        let value;
-        if (part.signature) {
-          value = runMethodEffect(inst, path, props, oldProps, part.signature);
-        } else if (path != part.source) {
-          value = Polymer.Path.get(inst, part.source);
-        } else {
-          if (hasPaths && Polymer.Path.isPath(path)) {
-            value = Polymer.Path.get(inst, path);
-          } else {
-            value = inst.__data[path];
-          }
-        }
-        if (part.negate) {
-          value = !value;
-        }
-        return value;
-      }
-
-    }
-
-    return PropertyEffects;
-  });
-
-})();
-</script>
diff --git a/src/main/resources/static/gltf-viewer/bower_components/polymer/lib/mixins/template-stamp.html b/src/main/resources/static/gltf-viewer/bower_components/polymer/lib/mixins/template-stamp.html
deleted file mode 100644 (file)
index af17ee3..0000000
+++ /dev/null
@@ -1,477 +0,0 @@
-<!--
-@license
-Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
-This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
-The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
-The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
-Code distributed by Google as part of the polymer project is also
-subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
--->
-
-<link rel="import" href="../utils/boot.html">
-<link rel="import" href="../utils/mixin.html">
-
-<script>
-(function() {
-
-  'use strict';
-
-  // 1.x backwards-compatible auto-wrapper for template type extensions
-  // This is a clear layering violation and gives favored-nation status to
-  // dom-if and dom-repeat templates.  This is a conceit we're choosing to keep
-  // a.) to ease 1.x backwards-compatibility due to loss of `is`, and
-  // b.) to maintain if/repeat capability in parser-constrained elements
-  //     (e.g. table, select) in lieu of native CE type extensions without
-  //     massive new invention in this space (e.g. directive system)
-  const templateExtensions = {
-    'dom-if': true,
-    'dom-repeat': true
-  };
-  function wrapTemplateExtension(node) {
-    let is = node.getAttribute('is');
-    if (is && templateExtensions[is]) {
-      let t = node;
-      t.removeAttribute('is');
-      node = t.ownerDocument.createElement(is);
-      t.parentNode.replaceChild(node, t);
-      node.appendChild(t);
-      while(t.attributes.length) {
-        node.setAttribute(t.attributes[0].name, t.attributes[0].value);
-        t.removeAttribute(t.attributes[0].name);
-      }
-    }
-    return node;
-  }
-
-  function findTemplateNode(root, nodeInfo) {
-    // recursively ascend tree until we hit root
-    let parent = nodeInfo.parentInfo && findTemplateNode(root, nodeInfo.parentInfo);
-    // unwind the stack, returning the indexed node at each level
-    if (parent) {
-      // note: marginally faster than indexing via childNodes
-      // (http://jsperf.com/childnodes-lookup)
-      for (let n=parent.firstChild, i=0; n; n=n.nextSibling) {
-        if (nodeInfo.parentIndex === i++) {
-          return n;
-        }
-      }
-    } else {
-      return root;
-    }
-  }
-
-  // construct `$` map (from id annotations)
-  function applyIdToMap(inst, map, node, nodeInfo) {
-    if (nodeInfo.id) {
-      map[nodeInfo.id] = node;
-    }
-  }
-
-  // install event listeners (from event annotations)
-  function applyEventListener(inst, node, nodeInfo) {
-    if (nodeInfo.events && nodeInfo.events.length) {
-      for (let j=0, e$=nodeInfo.events, e; (j<e$.length) && (e=e$[j]); j++) {
-        inst._addMethodEventListenerToNode(node, e.name, e.value, inst);
-      }
-    }
-  }
-
-  // push configuration references at configure time
-  function applyTemplateContent(inst, node, nodeInfo) {
-    if (nodeInfo.templateInfo) {
-      node._templateInfo = nodeInfo.templateInfo;
-    }
-  }
-
-  function createNodeEventHandler(context, eventName, methodName) {
-    // Instances can optionally have a _methodHost which allows redirecting where
-    // to find methods. Currently used by `templatize`.
-    context = context._methodHost || context;
-    let handler = function(e) {
-      if (context[methodName]) {
-        context[methodName](e, e.detail);
-      } else {
-        console.warn('listener method `' + methodName + '` not defined');
-      }
-    };
-    return handler;
-  }
-
-  /**
-   * Element mixin that provides basic template parsing and stamping, including
-   * the following template-related features for stamped templates:
-   *
-   * - Declarative event listeners (`on-eventname="listener"`)
-   * - Map of node id's to stamped node instances (`this.$.id`)
-   * - Nested template content caching/removal and re-installation (performance
-   *   optimization)
-   *
-   * @polymerMixin
-   * @memberof Polymer
-   * @summary Element class mixin that provides basic template parsing and stamping
-   */
-  Polymer.TemplateStamp = Polymer.dedupingMixin(superClass => {
-
-    /**
-     * @polymerMixinClass
-     * @implements {Polymer_TemplateStamp}
-     */
-    class TemplateStamp extends superClass {
-
-      _initializeProperties() {
-        super._initializeProperties();
-        this.$ = null;
-      }
-
-      /**
-       * Scans a template to produce template metadata.
-       *
-       * Template-specific metadata are stored in the object returned, and node-
-       * specific metadata are stored in objects in its flattened `nodeInfoList`
-       * array.  Only nodes in the template that were parsed as nodes of
-       * interest contain an object in `nodeInfoList`.  Each `nodeInfo` object
-       * contains an `index` (`childNodes` index in parent) and optionally
-       * `parent`, which points to node info of its parent (including its index).
-       *
-       * The template metadata object returned from this method has the following
-       * structure (many fields optional):
-       *
-       *   {
-       *     // Flattened list of node metadata (for nodes that generated metadata)
-       *     nodeInfoList: [
-       *       {
-       *         // `id` attribute for any nodes with id's for generating `$` map
-       *         id: '<id>',
-       *         // `on-event="handler"` metadata
-       *         events: [
-       *           {
-       *             name: '<name>'
-       *             value: '<handler name>'
-       *           }, ...
-       *         ],
-       *         // Notes when the template contained a `<slot>` for shady DOM
-       *         // optimization purposes
-       *         hasInsertionPoint: <boolean>,
-       *         // For nested <template> nodes, nested template metadata
-       *         templateInfo: <nested template metadata>,
-       *         // Metadata to allow efficient retrieval of instanced node
-       *         // corresponding to this metadata
-       *         parentInfo: <reference to parent nodeInfo>,
-       *         parentIndex: <integer index in parent's `childNodes` collection>
-       *         infoIndex: <integer index of this `nodeInfo` in `templateInfo.nodeInfoList`
-       *       },
-       *       ...
-       *     ],
-       *     // When true, the template had the `strip-whitespace` attribute
-       *     // or was nested in a template with that setting
-       *     stripWhitespace: <boolean>
-       *     // For nested templates, nested template content is moved into
-       *     // a document fragment stored here; this is an optimization to
-       *     // avoid the cost of nested template cloning
-       *     content: <DocumentFragment>
-       *   }
-       *
-       * This method kicks off a recursive treewalk as follows:
-       *
-       *    _parseTemplate <---------------------+
-       *      _parseTemplateContent              |
-       *        _parseTemplateNode  <------------|--+
-       *          _parseTemplateNestedTemplate --+  |
-       *          _parseTemplateChildNodes ---------+
-       *          _parseTemplateNodeAttributes
-       *            _parseTemplateNodeAttribute
-       *
-       * These methods may be overridden to add custom metadata about templates
-       * to either `templateInfo` or `nodeInfo`.
-       *
-       * Note that this method may be destructive to the template, in that
-       * e.g. event annotations may be removed after being noted in the
-       * template metadata.
-       *
-       * @param {HTMLTemplateElement} template Template to parse
-       * @param {Object=} outerTemplateInfo Template metadata from the outer
-       *   template, for parsing nested templates
-       * @return {Object} Parsed template metadata
-       */
-      static _parseTemplate(template, outerTemplateInfo) {
-        // since a template may be re-used, memo-ize metadata
-        if (!template._templateInfo) {
-          let templateInfo = template._templateInfo = {};
-          templateInfo.nodeInfoList = [];
-          templateInfo.stripWhiteSpace =
-            (outerTemplateInfo && outerTemplateInfo.stripWhiteSpace) ||
-            template.hasAttribute('strip-whitespace');
-          this._parseTemplateContent(template, templateInfo, {parent: null});
-        }
-        return template._templateInfo;
-      }
-
-      static _parseTemplateContent(template, templateInfo, nodeInfo) {
-        return this._parseTemplateNode(template.content, templateInfo, nodeInfo);
-      }
-
-      /**
-       * Parses template node and adds template and node metadata based on
-       * the current node, and its `childNodes` and `attributes`.
-       *
-       * This method may be overridden to add custom node or template specific
-       * metadata based on this node.
-       *
-       * @param {Node} node Node to parse
-       * @param {Object} templateInfo Template metadata for current template
-       * @param {Object} nodeInfo Node metadata for current template.
-       * @return {boolean} `true` if the visited node added node-specific
-       *   metadata to `nodeInfo`
-       */
-      static _parseTemplateNode(node, templateInfo, nodeInfo) {
-        let noted;
-        if (node.localName == 'template' && !node.hasAttribute('preserve-content')) {
-          noted = this._parseTemplateNestedTemplate(node, templateInfo, nodeInfo) || noted;
-        } else if (node.localName === 'slot') {
-          // For ShadyDom optimization, indicating there is an insertion point
-          templateInfo.hasInsertionPoint = true;
-        }
-        if (node.firstChild) {
-          noted = this._parseTemplateChildNodes(node, templateInfo, nodeInfo) || noted;
-        }
-        if (node.hasAttributes && node.hasAttributes()) {
-          noted = this._parseTemplateNodeAttributes(node, templateInfo, nodeInfo) || noted;
-        }
-        return noted;
-      }
-
-      /**
-       * Parses template child nodes for the given root node.
-       *
-       * This method also wraps whitelisted legacy template extensions
-       * (`is="dom-if"` and `is="dom-repeat"`) with their equivalent element
-       * wrappers, collapses text nodes, and strips whitespace from the template
-       * if the `templateInfo.stripWhitespace` setting was provided.
-       *
-       * @param {Node} root Root node whose `childNodes` will be parsed
-       * @param {Object} templateInfo Template metadata for current template
-       * @param {Object} nodeInfo Node metadata for current template.
-       */
-      static _parseTemplateChildNodes(root, templateInfo, nodeInfo) {
-        for (let node=root.firstChild, parentIndex=0, next; node; node=next) {
-          // Wrap templates
-          if (node.localName == 'template') {
-            node = wrapTemplateExtension(node);
-          }
-          // collapse adjacent textNodes: fixes an IE issue that can cause
-          // text nodes to be inexplicably split =(
-          // note that root.normalize() should work but does not so we do this
-          // manually.
-          next = node.nextSibling;
-          if (node.nodeType === Node.TEXT_NODE) {
-            let n = next;
-            while (n && (n.nodeType === Node.TEXT_NODE)) {
-              node.textContent += n.textContent;
-              next = n.nextSibling;
-              root.removeChild(n);
-              n = next;
-            }
-            // optionally strip whitespace
-            if (templateInfo.stripWhiteSpace && !node.textContent.trim()) {
-              root.removeChild(node);
-              continue;
-            }
-          }
-          let childInfo = { parentIndex, parentInfo: nodeInfo };
-          if (this._parseTemplateNode(node, templateInfo, childInfo)) {
-            childInfo.infoIndex = templateInfo.nodeInfoList.push(childInfo) - 1;
-          }
-          parentIndex++;
-        }
-      }
-
-      /**
-       * Parses template content for the given nested `<template>`.
-       *
-       * Nested template info is stored as `templateInfo` in the current node's
-       * `nodeInfo`. `template.content` is removed and stored in `templateInfo`.
-       * It will then be the responsibility of the host to set it back to the
-       * template and for users stamping nested templates to use the
-       * `_contentForTemplate` method to retrieve the content for this template
-       * (an optimization to avoid the cost of cloning nested template content).
-       *
-       * @param {HTMLTemplateElement} node Node to parse (a <template>)
-       * @param {Object} outerTemplateInfo Template metadata for current template
-       *   that includes the template `node`
-       * @param {Object} nodeInfo Node metadata for current template.
-       * @return {boolean} `true` if the visited node added node-specific
-       *   metadata to `nodeInfo`
-       */
-      static _parseTemplateNestedTemplate(node, outerTemplateInfo, nodeInfo) {
-        let templateInfo = this._parseTemplate(node, outerTemplateInfo);
-        let content = templateInfo.content =
-          node.content.ownerDocument.createDocumentFragment();
-        content.appendChild(node.content);
-        nodeInfo.templateInfo = templateInfo;
-        return true;
-      }
-
-      /**
-       * Parses template node attributes and adds node metadata to `nodeInfo`
-       * for nodes of interest.
-       *
-       * @param {Node} node Node to parse
-       * @param {Object} templateInfo Template metadata for current template
-       * @param {Object} nodeInfo Node metadata for current template.
-       * @return {boolean} `true` if the visited node added node-specific
-       *   metadata to `nodeInfo`
-       */
-      static _parseTemplateNodeAttributes(node, templateInfo, nodeInfo) {
-        // Make copy of original attribute list, since the order may change
-        // as attributes are added and removed
-        let noted;
-        let attrs = Array.from(node.attributes);
-        for (let i=attrs.length-1, a; (a=attrs[i]); i--) {
-          noted = this._parseTemplateNodeAttribute(node, templateInfo, nodeInfo, a.name, a.value) || noted;
-        }
-        return noted;
-      }
-
-      /**
-       * Parses a single template node attribute and adds node metadata to
-       * `nodeInfo` for attributes of interest.
-       *
-       * This implementation adds metadata for `on-event="handler"` attributes
-       * and `id` attributes.
-       *
-       * @param {Node} node Node to parse
-       * @param {Object} templateInfo Template metadata for current template
-       * @param {Object} nodeInfo Node metadata for current template.
-       * @param {string} name Attribute name
-       * @param {*} value Attribute value
-       * @return {boolean} `true` if the visited node added node-specific
-       *   metadata to `nodeInfo`
-       */
-      static _parseTemplateNodeAttribute(node, templateInfo, nodeInfo, name, value) {
-        // events (on-*)
-        if (name.slice(0, 3) === 'on-') {
-          node.removeAttribute(name);
-          nodeInfo.events = nodeInfo.events || [];
-          nodeInfo.events.push({
-            name: name.slice(3),
-            value
-          });
-          return true;
-        }
-        // static id
-        else if (name === 'id') {
-          nodeInfo.id = value;
-          return true;
-        }
-      }
-
-      /**
-       * Returns the `content` document fragment for a given template.
-       *
-       * For nested templates, Polymer performs an optimization to cache nested
-       * template content to avoid the cost of cloning deeply nested templates.
-       * This method retrieves the cached content for a given template.
-       *
-       * @param {HTMLTemplateElement} template Template to retrieve `content` for
-       * @return {DocumentFragment} Content fragment
-       */
-      static _contentForTemplate(template) {
-        let templateInfo = template.__templateInfo;
-        return (templateInfo && templateInfo.content) || template.content;
-      }
-
-      /**
-       * Clones the provided template content and returns a document fragment
-       * containing the cloned dom.
-       *
-       * The template is parsed (once and memoized) using this library's
-       * template parsing features, and provides the following value-added
-       * features:
-       * * Adds declarative event listeners for `on-event="handler"` attributes
-       * * Generates an "id map" for all nodes with id's under `$` on returned
-       *   document fragment
-       * * Passes template info including `content` back to templates as
-       *   `_templateInfo` (a performance optimization to avoid deep template
-       *   cloning)
-       *
-       * Note that the memoized template parsing process is destructive to the
-       * template: attributes for bindings and declarative event listeners are
-       * removed after being noted in notes, and any nested <template>.content
-       * is removed and stored in notes as well.
-       *
-       * @param {HTMLTemplateElement} template Template to stamp
-       * @return {DocumentFragment} Cloned template content
-       */
-      _stampTemplate(template) {
-        // Polyfill support: bootstrap the template if it has not already been
-        if (template && !template.content &&
-            window.HTMLTemplateElement && HTMLTemplateElement.decorate) {
-          HTMLTemplateElement.decorate(template);
-        }
-        let templateInfo = this.constructor._parseTemplate(template);
-        let nodeInfo = templateInfo.nodeInfoList;
-        let content = templateInfo.content || template.content;
-        let dom = document.importNode(content, true);
-        // NOTE: ShadyDom optimization indicating there is an insertion point
-        dom.__noInsertionPoint = !templateInfo.hasInsertionPoint;
-        let nodes = dom.nodeList = new Array(nodeInfo.length);
-        dom.$ = {};
-        for (let i=0, l=nodeInfo.length, info; (i<l) && (info=nodeInfo[i]); i++) {
-          let node = nodes[i] = findTemplateNode(dom, info);
-          applyIdToMap(this, dom.$, node, info);
-          applyTemplateContent(this, node, info);
-          applyEventListener(this, node, info);
-        }
-        return dom;
-      }
-
-      /**
-       * Adds an event listener by method name for the event provided.
-       *
-       * This method generates a handler function that looks up the method
-       * name at handling time.
-       *
-       * @param {Node} node Node to add listener on
-       * @param {string} eventName Name of event
-       * @param {string} methodName Name of method
-       * @param {*=} context Context the method will be called on (defaults
-       *   to `node`)
-       * @return {Function} Generated handler function
-       */
-      _addMethodEventListenerToNode(node, eventName, methodName, context) {
-        context = context || node;
-        let handler = createNodeEventHandler(context, eventName, methodName);
-        this._addEventListenerToNode(node, eventName, handler);
-        return handler;
-      }
-
-      /**
-       * Override point for adding custom or simulated event handling.
-       *
-       * @param {Node} node Node to add event listener to
-       * @param {string} eventName Name of event
-       * @param {Function} handler Listener function to add
-       */
-      _addEventListenerToNode(node, eventName, handler) {
-        node.addEventListener(eventName, handler);
-      }
-
-      /**
-       * Override point for adding custom or simulated event handling.
-       *
-       * @param {Node} node Node to remove event listener from
-       * @param {string} eventName Name of event
-       * @param {Function} handler Listener function to remove
-       */
-      _removeEventListenerFromNode(node, eventName, handler) {
-        node.removeEventListener(eventName, handler);
-      }
-
-    }
-
-    return TemplateStamp;
-
-  });
-
-})();
-</script>
diff --git a/src/main/resources/static/gltf-viewer/bower_components/polymer/lib/utils/array-splice.html b/src/main/resources/static/gltf-viewer/bower_components/polymer/lib/utils/array-splice.html
deleted file mode 100644 (file)
index 9008ebf..0000000
+++ /dev/null
@@ -1,321 +0,0 @@
-<!--
-@license
-Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
-This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
-The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
-The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
-Code distributed by Google as part of the polymer project is also
-subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
--->
-<link rel="import" href="boot.html">
-<script>
-(function() {
-
-  'use strict';
-
-  function newSplice(index, removed, addedCount) {
-    return {
-      index: index,
-      removed: removed,
-      addedCount: addedCount
-    };
-  }
-
-  const EDIT_LEAVE = 0;
-  const EDIT_UPDATE = 1;
-  const EDIT_ADD = 2;
-  const EDIT_DELETE = 3;
-
-  const ArraySplice = {
-
-    // Note: This function is *based* on the computation of the Levenshtein
-    // "edit" distance. The one change is that "updates" are treated as two
-    // edits - not one. With Array splices, an update is really a delete
-    // followed by an add. By retaining this, we optimize for "keeping" the
-    // maximum array items in the original array. For example:
-    //
-    //   'xxxx123' -> '123yyyy'
-    //
-    // With 1-edit updates, the shortest path would be just to update all seven
-    // characters. With 2-edit updates, we delete 4, leave 3, and add 4. This
-    // leaves the substring '123' intact.
-    calcEditDistances(current, currentStart, currentEnd,
-                                old, oldStart, oldEnd) {
-      // "Deletion" columns
-      let rowCount = oldEnd - oldStart + 1;
-      let columnCount = currentEnd - currentStart + 1;
-      let distances = new Array(rowCount);
-
-      // "Addition" rows. Initialize null column.
-      for (let i = 0; i < rowCount; i++) {
-        distances[i] = new Array(columnCount);
-        distances[i][0] = i;
-      }
-
-      // Initialize null row
-      for (let j = 0; j < columnCount; j++)
-        distances[0][j] = j;
-
-      for (let i = 1; i < rowCount; i++) {
-        for (let j = 1; j < columnCount; j++) {
-          if (this.equals(current[currentStart + j - 1], old[oldStart + i - 1]))
-            distances[i][j] = distances[i - 1][j - 1];
-          else {
-            let north = distances[i - 1][j] + 1;
-            let west = distances[i][j - 1] + 1;
-            distances[i][j] = north < west ? north : west;
-          }
-        }
-      }
-
-      return distances;
-    },
-
-    // This starts at the final weight, and walks "backward" by finding
-    // the minimum previous weight recursively until the origin of the weight
-    // matrix.
-    spliceOperationsFromEditDistances(distances) {
-      let i = distances.length - 1;
-      let j = distances[0].length - 1;
-      let current = distances[i][j];
-      let edits = [];
-      while (i > 0 || j > 0) {
-        if (i == 0) {
-          edits.push(EDIT_ADD);
-          j--;
-          continue;
-        }
-        if (j == 0) {
-          edits.push(EDIT_DELETE);
-          i--;
-          continue;
-        }
-        let northWest = distances[i - 1][j - 1];
-        let west = distances[i - 1][j];
-        let north = distances[i][j - 1];
-
-        let min;
-        if (west < north)
-          min = west < northWest ? west : northWest;
-        else
-          min = north < northWest ? north : northWest;
-
-        if (min == northWest) {
-          if (northWest == current) {
-            edits.push(EDIT_LEAVE);
-          } else {
-            edits.push(EDIT_UPDATE);
-            current = northWest;
-          }
-          i--;
-          j--;
-        } else if (min == west) {
-          edits.push(EDIT_DELETE);
-          i--;
-          current = west;
-        } else {
-          edits.push(EDIT_ADD);
-          j--;
-          current = north;
-        }
-      }
-
-      edits.reverse();
-      return edits;
-    },
-
-    /**
-     * Splice Projection functions:
-     *
-     * A splice map is a representation of how a previous array of items
-     * was transformed into a new array of items. Conceptually it is a list of
-     * tuples of
-     *
-     *   <index, removed, addedCount>
-     *
-     * which are kept in ascending index order of. The tuple represents that at
-     * the |index|, |removed| sequence of items were removed, and counting forward
-     * from |index|, |addedCount| items were added.
-     */
-
-    /**
-     * Lacking individual splice mutation information, the minimal set of
-     * splices can be synthesized given the previous state and final state of an
-     * array. The basic approach is to calculate the edit distance matrix and
-     * choose the shortest path through it.
-     *
-     * Complexity: O(l * p)
-     *   l: The length of the current array
-     *   p: The length of the old array
-     *
-     * @param {Array} current The current "changed" array for which to
-     * calculate splices.
-     * @param {number} currentStart Starting index in the `current` array for
-     * which splices are calculated.
-     * @param {number} currentEnd Ending index in the `current` array for
-     * which splices are calculated.
-     * @param {Array} old The original "unchanged" array to compare `current`
-     * against to determine splices.
-     * @param {number} oldStart Starting index in the `old` array for
-     * which splices are calculated.
-     * @param {number} oldEnd Ending index in the `old` array for
-     * which splices are calculated.
-     * @return {Array} Returns an array of splice record objects. Each of these
-     * contains: `index` the location where the splice occurred; `removed`
-     * the array of removed items from this location; `addedCount` the number
-     * of items added at this location.
-     */
-    calcSplices(current, currentStart, currentEnd,
-                          old, oldStart, oldEnd) {
-      let prefixCount = 0;
-      let suffixCount = 0;
-      let splice;
-
-      let minLength = Math.min(currentEnd - currentStart, oldEnd - oldStart);
-      if (currentStart == 0 && oldStart == 0)
-        prefixCount = this.sharedPrefix(current, old, minLength);
-
-      if (currentEnd == current.length && oldEnd == old.length)
-        suffixCount = this.sharedSuffix(current, old, minLength - prefixCount);
-
-      currentStart += prefixCount;
-      oldStart += prefixCount;
-      currentEnd -= suffixCount;
-      oldEnd -= suffixCount;
-
-      if (currentEnd - currentStart == 0 && oldEnd - oldStart == 0)
-        return [];
-
-      if (currentStart == currentEnd) {
-        splice = newSplice(currentStart, [], 0);
-        while (oldStart < oldEnd)
-          splice.removed.push(old[oldStart++]);
-
-        return [ splice ];
-      } else if (oldStart == oldEnd)
-        return [ newSplice(currentStart, [], currentEnd - currentStart) ];
-
-      let ops = this.spliceOperationsFromEditDistances(
-          this.calcEditDistances(current, currentStart, currentEnd,
-                                 old, oldStart, oldEnd));
-
-      splice = undefined;
-      let splices = [];
-      let index = currentStart;
-      let oldIndex = oldStart;
-      for (let i = 0; i < ops.length; i++) {
-        switch(ops[i]) {
-          case EDIT_LEAVE:
-            if (splice) {
-              splices.push(splice);
-              splice = undefined;
-            }
-
-            index++;
-            oldIndex++;
-            break;
-          case EDIT_UPDATE:
-            if (!splice)
-              splice = newSplice(index, [], 0);
-
-            splice.addedCount++;
-            index++;
-
-            splice.removed.push(old[oldIndex]);
-            oldIndex++;
-            break;
-          case EDIT_ADD:
-            if (!splice)
-              splice = newSplice(index, [], 0);
-
-            splice.addedCount++;
-            index++;
-            break;
-          case EDIT_DELETE:
-            if (!splice)
-              splice = newSplice(index, [], 0);
-
-            splice.removed.push(old[oldIndex]);
-            oldIndex++;
-            break;
-        }
-      }
-
-      if (splice) {
-        splices.push(splice);
-      }
-      return splices;
-    },
-
-    sharedPrefix(current, old, searchLength) {
-      for (let i = 0; i < searchLength; i++)
-        if (!this.equals(current[i], old[i]))
-          return i;
-      return searchLength;
-    },
-
-    sharedSuffix(current, old, searchLength) {
-      let index1 = current.length;
-      let index2 = old.length;
-      let count = 0;
-      while (count < searchLength && this.equals(current[--index1], old[--index2]))
-        count++;
-
-      return count;
-    },
-
-    calculateSplices(current, previous) {
-      return this.calcSplices(current, 0, current.length, previous, 0,
-                              previous.length);
-    },
-
-    equals(currentValue, previousValue) {
-      return currentValue === previousValue;
-    }
-
-  };
-
-  /**
-   * @namespace
-   * @memberof Polymer
-   * @summary Module that provides utilities for diffing arrays.
-   */
-  Polymer.ArraySplice = {
-    /**
-     * Returns an array of splice records indicating the minimum edits required
-     * to transform the `previous` array into the `current` array.
-     *
-     * Splice records are ordered by index and contain the following fields:
-     * - `index`: index where edit started
-     * - `removed`: array of removed items from this index
-     * - `addedCount`: number of items added at this index
-     *
-     * This function is based on the Levenshtein "minimum edit distance"
-     * algorithm. Note that updates are treated as removal followed by addition.
-     *
-     * The worst-case time complexity of this algorithm is `O(l * p)`
-     *   l: The length of the current array
-     *   p: The length of the previous array
-     *
-     * However, the worst-case complexity is reduced by an `O(n)` optimization
-     * to detect any shared prefix & suffix between the two arrays and only
-     * perform the more expensive minimum edit distance calculation over the
-     * non-shared portions of the arrays.
-     *
-     * @memberof Polymer.ArraySplice
-     * @param {Array} current The "changed" array for which splices will be
-     * calculated.
-     * @param {Array} previous The "unchanged" original array to compare
-     * `current` against to determine the splices.
-     * @return {Array} Returns an array of splice record objects. Each of these
-     * contains: `index` the location where the splice occurred; `removed`
-     * the array of removed items from this location; `addedCount` the number
-     * of items added at this location.
-     */
-    calculateSplices(current, previous) {
-      return ArraySplice.calculateSplices(current, previous);
-    }
-  }
-
-})();
-</script>
\ No newline at end of file
diff --git a/src/main/resources/static/gltf-viewer/bower_components/polymer/lib/utils/async.html b/src/main/resources/static/gltf-viewer/bower_components/polymer/lib/utils/async.html
deleted file mode 100644 (file)
index 19293dd..0000000
+++ /dev/null
@@ -1,203 +0,0 @@
-<!--
-@license
-Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
-This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
-The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
-The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
-Code distributed by Google as part of the polymer project is also
-subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
--->
-<link rel="import" href="boot.html">
-
-<script>
-(function() {
-
-  'use strict';
-
-  /** @typedef {{run: function(function(), number=):number, cancel: function(number)}} */
-  let AsyncInterface; // eslint-disable-line no-unused-vars
-
-  // Microtask implemented using Mutation Observer
-  let microtaskCurrHandle = 0;
-  let microtaskLastHandle = 0;
-  let microtaskCallbacks = [];
-  let microtaskNodeContent = 0;
-  let microtaskNode = document.createTextNode('');
-  new window.MutationObserver(microtaskFlush).observe(microtaskNode, {characterData: true});
-
-  function microtaskFlush() {
-    const len = microtaskCallbacks.length;
-    for (let i = 0; i < len; i++) {
-      let cb = microtaskCallbacks[i];
-      if (cb) {
-        try {
-          cb();
-        } catch (e) {
-          setTimeout(() => { throw e });
-        }
-      }
-    }
-    microtaskCallbacks.splice(0, len);
-    microtaskLastHandle += len;
-  }
-
-  /**
-   * Module that provides a number of strategies for enqueuing asynchronous
-   * tasks.  Each sub-module provides a standard `run(fn)` interface that returns a
-   * handle, and a `cancel(handle)` interface for canceling async tasks before
-   * they run.
-   *
-   * @namespace
-   * @memberof Polymer
-   * @summary Module that provides a number of strategies for enqueuing asynchronous
-   * tasks.
-   */
-  Polymer.Async = {
-
-    /**
-     * Async interface wrapper around `setTimeout`.
-     *
-     * @namespace
-     * @memberof Polymer.Async
-     * @summary Async interface wrapper around `setTimeout`.
-     */
-    timeOut: {
-      /**
-       * Returns a sub-module with the async interface providing the provided
-       * delay.
-       *
-       * @memberof Polymer.Async.timeOut
-       * @param {number} delay Time to wait before calling callbacks in ms
-       * @return {AsyncInterface} An async timeout interface
-       */
-      after(delay) {
-        return  {
-          run(fn) { return setTimeout(fn, delay) },
-          cancel: window.clearTimeout.bind(window)
-        }
-      },
-      /**
-       * Enqueues a function called in the next task.
-       *
-       * @memberof Polymer.Async.timeOut
-       * @param {Function} fn Callback to run
-       * @return {number} Handle used for canceling task
-       */
-      run: window.setTimeout.bind(window),
-      /**
-       * Cancels a previously enqueued `timeOut` callback.
-       *
-       * @memberof Polymer.Async.timeOut
-       * @param {number} handle Handle returned from `run` of callback to cancel
-       */
-      cancel: window.clearTimeout.bind(window)
-    },
-
-    /**
-     * Async interface wrapper around `requestAnimationFrame`.
-     *
-     * @namespace
-     * @memberof Polymer.Async
-     * @summary Async interface wrapper around `requestAnimationFrame`.
-     */
-    animationFrame: {
-      /**
-       * Enqueues a function called at `requestAnimationFrame` timing.
-       *
-       * @memberof Polymer.Async.timeOut
-       * @param {Function} fn Callback to run
-       * @return {number} Handle used for canceling task
-       */
-      run: window.requestAnimationFrame.bind(window),
-      /**
-       * Cancels a previously enqueued `animationFrame` callback.
-       *
-       * @memberof Polymer.Async.timeOut
-       * @param {number} handle Handle returned from `run` of callback to cancel
-       */
-      cancel: window.cancelAnimationFrame.bind(window)
-    },
-
-    /**
-     * Async interface wrapper around `requestIdleCallback`.  Falls back to
-     * `setTimeout` on browsers that do not support `requestIdleCallback`.
-     *
-     * @namespace
-     * @memberof Polymer.Async
-     * @summary Async interface wrapper around `requestIdleCallback`.
-     */
-    idlePeriod: {
-      /**
-       * Enqueues a function called at `requestIdleCallback` timing.
-       *
-       * @memberof Polymer.Async.timeOut
-       * @param {function(IdleDeadline)} fn Callback to run
-       * @return {number} Handle used for canceling task
-       */
-      run(fn) {
-        return window.requestIdleCallback ?
-          window.requestIdleCallback(fn) :
-          window.setTimeout(fn, 16);
-      },
-      /**
-       * Cancels a previously enqueued `idlePeriod` callback.
-       *
-       * @memberof Polymer.Async.timeOut
-       * @param {number} handle Handle returned from `run` of callback to cancel
-       */
-      cancel(handle) {
-        window.cancelIdleCallback ?
-          window.cancelIdleCallback(handle) :
-          window.clearTimeout(handle);
-      }
-    },
-
-    /**
-     * Async interface for enqueueing callbacks that run at microtask timing.
-     *
-     * Note that microtask timing is achieved via a single `MutationObserver`,
-     * and thus callbacks enqueued with this API will all run in a single
-     * batch, and not interleaved with other microtasks such as promises.
-     * Promises are avoided as an implementation choice for the time being
-     * due to Safari bugs that cause Promises to lack microtask guarantees.
-     *
-     * @namespace
-     * @memberof Polymer.Async
-     * @summary Async interface for enqueueing callbacks that run at microtask
-     *   timing.
-     */
-    microTask: {
-
-      /**
-       * Enqueues a function called at microtask timing.
-       *
-       * @memberof Polymer.Async.timeOut
-       * @param {Function} callback Callback to run
-       * @return {*} Handle used for canceling task
-       */
-      run(callback) {
-        microtaskNode.textContent = microtaskNodeContent++;
-        microtaskCallbacks.push(callback);
-        return microtaskCurrHandle++;
-      },
-
-      /**
-       * Cancels a previously enqueued `microTask` callback.
-       *
-       * @param {number} handle Handle returned from `run` of callback to cancel
-       */
-      cancel(handle) {
-        const idx = handle - microtaskLastHandle;
-        if (idx >= 0) {
-          if (!microtaskCallbacks[idx]) {
-            throw new Error('invalid async handle: ' + handle);
-          }
-          microtaskCallbacks[idx] = null;
-        }
-      }
-
-    }
-  };
-
-})();
-</script>
diff --git a/src/main/resources/static/gltf-viewer/bower_components/polymer/lib/utils/boot.html b/src/main/resources/static/gltf-viewer/bower_components/polymer/lib/utils/boot.html
deleted file mode 100644 (file)
index aefae13..0000000
+++ /dev/null
@@ -1,60 +0,0 @@
-<!--
-@license
-Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
-This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
-The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
-The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
-Code distributed by Google as part of the polymer project is also
-subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
--->
-<script>
-(function() {
-  'use strict';
-
-  const userPolymer = window.Polymer;
-
-  /**
-   * @namespace Polymer
-   * @summary Polymer is a lightweight library built on top of the web
-   * standards-based Web Components API's, and makes it easy to build your
-   * own custom HTML elements.
-   * @param {Object} info Prototype for the custom element. It must contain
-   * an `is` property to specify the element name. Other properties populate
-   * the element prototype. The `properties`, `observers`, `hostAttributes`,
-   * and `listeners` properties are processed to create element features.
-   * @return {Object} Returns a custom element class for the given provided
-   * prototype `info` object. The name of the element if given by `info.is`.
-   */
-  window.Polymer = function(info) {
-    return window.Polymer._polymerFn(info);
-  }
-
-  // support user settings on the Polymer object
-  if (userPolymer) {
-    Object.assign(Polymer, userPolymer);
-  }
-
-  // To be plugged by legacy implementation if loaded
-  /**
-   * @param {Object} info Prototype for the custom element. It must contain
-   * an `is` property to specify the element name. Other properties populate
-   * the element prototype. The `properties`, `observers`, `hostAttributes`,
-   * and `listeners` properties are processed to create element features.
-   */
-  window.Polymer._polymerFn = function(info) { // eslint-disable-line no-unused-vars
-    throw new Error('Load polymer.html to use the Polymer() function.');
-  }
-  window.Polymer.version = '2.0-preview';
-
-  /* eslint-disable no-unused-vars */
-  /*
-  When using Closure Compiler, JSCompiler_renameProperty(property, object) is replaced by the munged name for object[property]
-  We cannot alias this function, so we have to use a small shim that has the same behavior when not compiling.
-  */
-  window.JSCompiler_renameProperty = function(prop, obj) {
-    return prop;
-  }
-  /* eslint-enable */
-
-})();
-</script>
diff --git a/src/main/resources/static/gltf-viewer/bower_components/polymer/lib/utils/case-map.html b/src/main/resources/static/gltf-viewer/bower_components/polymer/lib/utils/case-map.html
deleted file mode 100644 (file)
index b1b44cd..0000000
+++ /dev/null
@@ -1,64 +0,0 @@
-<!--
-@license
-Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
-This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
-The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
-The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
-Code distributed by Google as part of the polymer project is also
-subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
--->
-<link rel="import" href="boot.html">
-<script>
-(function() {
-  'use strict';
-
-  const caseMap = {};
-  const DASH_TO_CAMEL = /-[a-z]/g;
-  const CAMEL_TO_DASH = /([A-Z])/g;
-
-  /**
-   * Module with utilities for converting between "dash-case" and "camelCase"
-   * identifiers.
-   *
-   * @namespace
-   * @memberof Polymer
-   * @summary Module that provides utilities for converting between "dash-case"
-   *   and "camelCase".
-   */
-  const CaseMap = {
-
-    /**
-     * Converts "dash-case" identifier (e.g. `foo-bar-baz`) to "camelCase"
-     * (e.g. `fooBarBaz`).
-     *
-     * @memberof Polymer.CaseMap
-     * @param {string} dash Dash-case identifier
-     * @return {string} Camel-case representation of the identifier
-     */
-    dashToCamelCase(dash) {
-      return caseMap[dash] || (
-        caseMap[dash] = dash.indexOf('-') < 0 ? dash : dash.replace(DASH_TO_CAMEL,
-          (m) => m[1].toUpperCase()
-        )
-      );
-    },
-
-    /**
-     * Converts "camelCase" identifier (e.g. `fooBarBaz`) to "dash-case"
-     * (e.g. `foo-bar-baz`).
-     *
-     * @memberof Polymer.CaseMap
-     * @param {string} camel Camel-case identifier
-     * @return {string} Dash-case representation of the identifier
-     */
-    camelToDashCase(camel) {
-      return caseMap[camel] || (
-        caseMap[camel] = camel.replace(CAMEL_TO_DASH, '-$1').toLowerCase()
-      );
-    }
-
-  };
-
-  Polymer.CaseMap = CaseMap;
-})();
-</script>
diff --git a/src/main/resources/static/gltf-viewer/bower_components/polymer/lib/utils/debounce.html b/src/main/resources/static/gltf-viewer/bower_components/polymer/lib/utils/debounce.html
deleted file mode 100644 (file)
index dc8f66a..0000000
+++ /dev/null
@@ -1,94 +0,0 @@
-<!--
-@license
-Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
-This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
-The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
-The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
-Code distributed by Google as part of the polymer project is also
-subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
--->
-<link rel="import" href="boot.html">
-<link rel="import" href="mixin.html">
-<link rel="import" href="async.html">
-
-<script>
-(function() {
-  'use strict';
-
-  /** @typedef {{run: function(function(), number=):number, cancel: function(number)}} */
-  let AsyncModule; // eslint-disable-line no-unused-vars
-
-  class Debouncer {
-    constructor() {
-      this._asyncModule = null;
-      this._callback = null;
-      this._timer = null;
-    }
-    /**
-     * Sets the scheduler; that is, a module with the Async interface,
-     * a callback and optional arguments to be passed to the run function
-     * from the async module.
-     *
-     * @param {!AsyncModule} asyncModule Object with Async interface.
-     * @param {function()} callback Callback to run.
-     */
-    setConfig(asyncModule, callback) {
-      this._asyncModule = asyncModule;
-      this._callback = callback;
-      this._timer = this._asyncModule.run(() => {
-        this._timer = null;
-        this._callback()
-      });
-    }
-    /**
-     * Cancels an active debouncer and returns a reference to itself.
-     */
-    cancel() {
-      if (this.isActive()) {
-        this._asyncModule.cancel(this._timer);
-        this._timer = null;
-      }
-    }
-    /**
-     * Flushes an active debouncer and returns a reference to itself.
-     */
-    flush() {
-      if (this.isActive()) {
-        this.cancel();
-        this._callback();
-      }
-    }
-    /**
-     * Returns true if the debouncer is active.
-     *
-     * @return {boolean} True if active.
-     */
-    isActive() {
-      return this._timer != null;
-    }
-  /**
-   * Creates a debouncer if no debouncer is passed as a parameter
-   * or it cancels an active debouncer otherwise.
-   *
-   * @param {Polymer.Debouncer?} debouncer Debouncer object.
-   * @param {!AsyncModule} asyncModule Object with Async interface
-   * @param {function()} callback Callback to run.
-   * @return {!Debouncer} Returns a debouncer object.
-   */
-    static debounce(debouncer, asyncModule, callback) {
-      if (debouncer instanceof Debouncer) {
-        debouncer.cancel();
-      } else {
-        debouncer = new Debouncer();
-      }
-      debouncer.setConfig(asyncModule, callback);
-      return debouncer;
-    }
-  }
-
-  /**
-   * @memberof Polymer
-   */
-  Polymer.Debouncer = Debouncer;
-})();
-</script>
diff --git a/src/main/resources/static/gltf-viewer/bower_components/polymer/lib/utils/flattened-nodes-observer.html b/src/main/resources/static/gltf-viewer/bower_components/polymer/lib/utils/flattened-nodes-observer.html
deleted file mode 100644 (file)
index c1f75d0..0000000
+++ /dev/null
@@ -1,242 +0,0 @@
-<!--
-@license
-Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
-This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
-The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
-The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
-Code distributed by Google as part of the polymer project is also
-subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
--->
-<link rel="import" href="../utils/boot.html">
-<link rel="import" href="../utils/array-splice.html">
-<link rel="import" href="../utils/async.html">
-<script>
-(function() {
-  'use strict';
-
-  function isSlot(node) {
-    return (node.localName === 'slot');
-  }
-
-  /**
-   * Class that listens for changes (additions or removals) to
-   * "flattened nodes" on a given `node`. The list of flattened nodes consists
-   * of a node's children and, for any children that are <slot> elements,
-   * the expanded flattened list of `assignedNodes`.
-   * For example, if the observed node has children `<a></a><slot></slot><b></b>`
-   * and the `<slot>` has one `<div>` assigned to it, then the flattened
-   * nodes list is `<a></a><div></div><b></b>`. If the `<slot>` has other
-   * `<slot>` elements assigned to it, these are flattened as well.
-   *
-   * The provided `callback` is called whenever any change to this list
-   * of flattened nodes occurs, where an addition or removal of a node is
-   * considered a change. The `callback` is called with one argument, an object
-   * containing an array of any `addedNodes` and `removedNodes`.
-   *
-   * Note: the callback is called asynchronous to any changes
-   * at a microtask checkpoint. This is because observation is performed using
-   * `MutationObserver` and the `<slot> element's `slotchange` event which
-   * are asynchronous.
-   *
-   * @memberof Polymer
-   * @param {Node} target Node on which to listen for changes.
-   * @param {Function} callback Function called when there are additions
-   * or removals from the target's list of flattened nodes.
-   * @summary Class that listens for changes (additions or removals) to
-   * "flattened nodes" on a given `node`.
-   */
-  class FlattenedNodesObserver {
-
-    /**
-     * Returns the list of flattened nodes for the given `node`.
-     * This list consists of a node's children and, for any children
-     * that are <slot> elements, the expanded flattened list of `assignedNodes`.
-     * For example, if the observed node has children `<a></a><slot></slot><b></b>`
-     * and the `<slot>` has one `<div>` assigned to it, then the flattened
-     * nodes list is `<a></a><div></div><b></b>`. If the `<slot>` has other
-     * `<slot>` elements assigned to it, these are flattened as well.
-     *
-     * @param {Node} node The node for which to return the list of flattened nodes.
-     * @return {Array} The list of flattened nodes for the given `node`.
-    */
-    static getFlattenedNodes(node) {
-      if (isSlot(node)) {
-        return node.assignedNodes({flatten: true});
-      } else {
-        return Array.from(node.childNodes).map(node => {
-          if (isSlot(node)) {
-            return node.assignedNodes({flatten: true});
-          } else {
-            return [node];
-          }
-        }).reduce((a, b) => a.concat(b), []);
-      }
-    }
-
-    constructor(target, callback) {
-      /** @type {MutationObserver} */
-      this._shadyChildrenObserver = null;
-      /** @type {MutationObserver} */
-      this._nativeChildrenObserver = null;
-      this._connected = false;
-      this._target = target;
-      this.callback = callback;
-      this._effectiveNodes = [];
-      this._observer = null;
-      this._scheduled = false;
-      this._boundSchedule = () => {
-        this._schedule();
-      }
-      this.connect();
-      this._schedule();
-    }
-
-    /**
-     * Activates an observer. This method is automatically called when
-     * a `FlattenedNodesObserver` is created. It should only be called to
-     * re-activate an observer that has been deactivated via the `disconnect` method.
-     */
-    connect() {
-      if (isSlot(this._target)) {
-        this._listenSlots([this._target]);
-      } else {
-        this._listenSlots(this._target.children);
-        if (window.ShadyDOM) {
-          this._shadyChildrenObserver =
-            ShadyDOM.observeChildren(this._target, (mutations) => {
-              this._processMutations(mutations);
-            });
-        } else {
-          this._nativeChildrenObserver =
-            new MutationObserver((mutations) => {
-              this._processMutations(mutations);
-            });
-          this._nativeChildrenObserver.observe(this._target, {childList: true});
-        }
-      }
-      this._connected = true;
-    }
-
-    /**
-     * Deactivates the flattened nodes observer. After calling this method
-     * the observer callback will not be called when changes to flattened nodes
-     * occur. The `connect` method may be subsequently called to reactivate
-     * the observer.
-     */
-    disconnect() {
-      if (isSlot(this._target)) {
-        this._unlistenSlots([this._target]);
-      } else {
-        this._unlistenSlots(this._target.children);
-        if (window.ShadyDOM && this._shadyChildrenObserver) {
-          ShadyDOM.unobserveChildren(this._shadyChildrenObserver);
-          this._shadyChildrenObserver = null;
-        } else if (this._nativeChildrenObserver) {
-          this._nativeChildrenObserver.disconnect();
-          this._nativeChildrenObserver = null;
-        }
-      }
-      this._connected = false;
-    }
-
-    _schedule() {
-      if (!this._scheduled) {
-        this._scheduled = true;
-        Polymer.Async.microTask.run(() => this.flush());
-      }
-    }
-
-    _processMutations(mutations) {
-      this._processSlotMutations(mutations);
-      this.flush();
-    }
-
-    _processSlotMutations(mutations) {
-      if (mutations) {
-        for (let i=0; i < mutations.length; i++) {
-          let mutation = mutations[i];
-          if (mutation.addedNodes) {
-            this._listenSlots(mutation.addedNodes);
-          }
-          if (mutation.removedNodes) {
-            this._unlistenSlots(mutation.removedNodes);
-          }
-        }
-      }
-    }
-
-    /**
-     * Flushes the observer causing any pending changes to be immediately
-     * delivered the observer callback. By default these changes are delivered
-     * asynchronously at the next microtask checkpoint.
-     *
-     * @return {boolean} Returns true if any pending changes caused the observer
-     * callback to run.
-     */
-    flush() {
-      if (!this._connected) {
-        return;
-      }
-      if (window.ShadyDOM) {
-        ShadyDOM.flush();
-      }
-      if (this._nativeChildrenObserver) {
-        this._processSlotMutations(this._nativeChildrenObserver.takeRecords());
-      } else if (this.shadyChildrenObserver) {
-        this._processSlotMutations(this._shadyChildrenObserver.takeRecords());
-      }
-      this._scheduled = false;
-      let info = {
-        target: this._target,
-        addedNodes: [],
-        removedNodes: []
-      };
-      let newNodes = this.constructor.getFlattenedNodes(this._target);
-      let splices = Polymer.ArraySplice.calculateSplices(newNodes,
-        this._effectiveNodes);
-      // process removals
-      for (let i=0, s; (i<splices.length) && (s=splices[i]); i++) {
-        for (let j=0, n; (j < s.removed.length) && (n=s.removed[j]); j++) {
-          info.removedNodes.push(n);
-        }
-      }
-      // process adds
-      for (let i=0, s; (i<splices.length) && (s=splices[i]); i++) {
-        for (let j=s.index; j < s.index + s.addedCount; j++) {
-          info.addedNodes.push(newNodes[j]);
-        }
-      }
-      // update cache
-      this._effectiveNodes = newNodes;
-      let didFlush = false;
-      if (info.addedNodes.length || info.removedNodes.length) {
-        didFlush = true;
-        this.callback.call(this._target, info);
-      }
-      return didFlush;
-    }
-
-    _listenSlots(nodeList) {
-      for (let i=0; i < nodeList.length; i++) {
-        let n = nodeList[i];
-        if (isSlot(n)) {
-          n.addEventListener('slotchange', this._boundSchedule);
-        }
-      }
-    }
-
-    _unlistenSlots(nodeList) {
-      for (let i=0; i < nodeList.length; i++) {
-        let n = nodeList[i];
-        if (isSlot(n)) {
-          n.removeEventListener('slotchange', this._boundSchedule);
-        }
-      }
-    }
-
-  }
-
-  Polymer.FlattenedNodesObserver = FlattenedNodesObserver;
-
-})();
-</script>
diff --git a/src/main/resources/static/gltf-viewer/bower_components/polymer/lib/utils/flush.html b/src/main/resources/static/gltf-viewer/bower_components/polymer/lib/utils/flush.html
deleted file mode 100644 (file)
index 0e3384b..0000000
+++ /dev/null
@@ -1,60 +0,0 @@
-<!--
-@license
-Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
-This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
-The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
-The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
-Code distributed by Google as part of the polymer project is also
-subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
--->
-<link rel="import" href="boot.html">
-<script>
-(function() {
-  'use strict';
-
-  let debouncerQueue = [];
-
-  /**
-   * Adds a `Polymer.Debouncer` to a list of globally flushable tasks.
-   *
-   * @memberof Polymer
-   * @param {Polymer.Debouncer} debouncer Debouncer to enqueue
-   */
-  Polymer.enqueueDebouncer = function(debouncer) {
-    debouncerQueue.push(debouncer);
-  }
-
-  function flushDebouncers() {
-    const didFlush = Boolean(debouncerQueue.length);
-    while (debouncerQueue.length) {
-      try {
-        debouncerQueue.shift().flush();
-      } catch(e) {
-        setTimeout(() => {
-          throw e;
-        });
-      }
-    }
-    return didFlush;
-  }
-
-  /**
-   * Forces several classes of asynchronously queued tasks to flush:
-   * - Debouncers added via `enqueueDebouncer`
-   * - ShadyDOM distribution
-   *
-   * @memberof Polymer
-   */
-  Polymer.flush = function() {
-    let shadyDOM, debouncers;
-    do {
-      shadyDOM = window.ShadyDOM && ShadyDOM.flush();
-      if (window.ShadyCSS && window.ShadyCSS.ScopingShim) {
-        window.ShadyCSS.ScopingShim.flush();
-      }
-      debouncers = flushDebouncers();
-    } while (shadyDOM || debouncers);
-  }
-
-})();
-</script>
diff --git a/src/main/resources/static/gltf-viewer/bower_components/polymer/lib/utils/gestures.html b/src/main/resources/static/gltf-viewer/bower_components/polymer/lib/utils/gestures.html
deleted file mode 100644 (file)
index 4ee65c3..0000000
+++ /dev/null
@@ -1,853 +0,0 @@
-<!--
-@license
-Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
-This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
-The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
-The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
-Code distributed by Google as part of the polymer project is also
-subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
--->
-<link rel="import" href="boot.html">
-<link rel="import" href="async.html">
-<link rel="import" href="debounce.html">
-
-<script>
-(function() {
-
-  'use strict';
-
-  // detect native touch action support
-  let HAS_NATIVE_TA = typeof document.head.style.touchAction === 'string';
-  let GESTURE_KEY = '__polymerGestures';
-  let HANDLED_OBJ = '__polymerGesturesHandled';
-  let TOUCH_ACTION = '__polymerGesturesTouchAction';
-  // radius for tap and track
-  let TAP_DISTANCE = 25;
-  let TRACK_DISTANCE = 5;
-  // number of last N track positions to keep
-  let TRACK_LENGTH = 2;
-
-  // Disabling "mouse" handlers for 2500ms is enough
-  let MOUSE_TIMEOUT = 2500;
-  let MOUSE_EVENTS = ['mousedown', 'mousemove', 'mouseup', 'click'];
-  // an array of bitmask values for mapping MouseEvent.which to MouseEvent.buttons
-  let MOUSE_WHICH_TO_BUTTONS = [0, 1, 4, 2];
-  let MOUSE_HAS_BUTTONS = (function() {
-    try {
-      return new MouseEvent('test', {buttons: 1}).buttons === 1;
-    } catch (e) {
-      return false;
-    }
-  })();
-
-  /* eslint no-empty: ["error", { "allowEmptyCatch": true }] */
-  // check for passive event listeners
-  let SUPPORTS_PASSIVE = false;
-  (function() {
-    try {
-      let opts = Object.defineProperty({}, 'passive', {get: function() {SUPPORTS_PASSIVE = true;}})
-      window.addEventListener('test', null, opts);
-      window.removeEventListener('test', null, opts);
-    } catch(e) {}
-  })();
-
-  // Check for touch-only devices
-  let IS_TOUCH_ONLY = navigator.userAgent.match(/iP(?:[oa]d|hone)|Android/);
-
-  // touch will make synthetic mouse events
-  // `preventDefault` on touchend will cancel them,
-  // but this breaks `<input>` focus and link clicks
-  // disable mouse handlers for MOUSE_TIMEOUT ms after
-  // a touchend to ignore synthetic mouse events
-  let mouseCanceller = function(mouseEvent) {
-    // Check for sourceCapabilities, used to distinguish synthetic events
-    // if mouseEvent did not come from a device that fires touch events,
-    // it was made by a real mouse and should be counted
-    // http://wicg.github.io/InputDeviceCapabilities/#dom-inputdevicecapabilities-firestouchevents
-    let sc = mouseEvent.sourceCapabilities;
-    if (sc && !sc.firesTouchEvents) {
-      return;
-    }
-    // skip synthetic mouse events
-    mouseEvent[HANDLED_OBJ] = {skip: true};
-    // disable "ghost clicks"
-    if (mouseEvent.type === 'click') {
-      let path = mouseEvent.composedPath && mouseEvent.composedPath();
-      if (path) {
-        for (let i = 0; i < path.length; i++) {
-          if (path[i] === POINTERSTATE.mouse.target) {
-            return;
-          }
-        }
-      }
-      mouseEvent.preventDefault();
-      mouseEvent.stopPropagation();
-    }
-  };
-
-  /**
-   * @param {boolean=} setup True to add, false to remove.
-   */
-  function setupTeardownMouseCanceller(setup) {
-    let events = IS_TOUCH_ONLY ? ['click'] : MOUSE_EVENTS;
-    for (let i = 0, en; i < events.length; i++) {
-      en = events[i];
-      if (setup) {
-        document.addEventListener(en, mouseCanceller, true);
-      } else {
-        document.removeEventListener(en, mouseCanceller, true);
-      }
-    }
-  }
-
-  function ignoreMouse(e) {
-    if (!POINTERSTATE.mouse.mouseIgnoreJob) {
-      setupTeardownMouseCanceller(true);
-    }
-    let unset = function() {
-      setupTeardownMouseCanceller();
-      POINTERSTATE.mouse.target = null;
-      POINTERSTATE.mouse.mouseIgnoreJob = null;
-    };
-    POINTERSTATE.mouse.target = e.composedPath()[0];
-    POINTERSTATE.mouse.mouseIgnoreJob = Polymer.Debouncer.debounce(
-          POINTERSTATE.mouse.mouseIgnoreJob
-        , Polymer.Async.timeOut.after(MOUSE_TIMEOUT)
-        , unset);
-  }
-
-  function hasLeftMouseButton(ev) {
-    let type = ev.type;
-    // exit early if the event is not a mouse event
-    if (MOUSE_EVENTS.indexOf(type) === -1) {
-      return false;
-    }
-    // ev.button is not reliable for mousemove (0 is overloaded as both left button and no buttons)
-    // instead we use ev.buttons (bitmask of buttons) or fall back to ev.which (deprecated, 0 for no buttons, 1 for left button)
-    if (type === 'mousemove') {
-      // allow undefined for testing events
-      let buttons = ev.buttons === undefined ? 1 : ev.buttons;
-      if ((ev instanceof window.MouseEvent) && !MOUSE_HAS_BUTTONS) {
-        buttons = MOUSE_WHICH_TO_BUTTONS[ev.which] || 0;
-      }
-      // buttons is a bitmask, check that the left button bit is set (1)
-      return Boolean(buttons & 1);
-    } else {
-      // allow undefined for testing events
-      let button = ev.button === undefined ? 0 : ev.button;
-      // ev.button is 0 in mousedown/mouseup/click for left button activation
-      return button === 0;
-    }
-  }
-
-  function isSyntheticClick(ev) {
-    if (ev.type === 'click') {
-      // ev.detail is 0 for HTMLElement.click in most browsers
-      if (ev.detail === 0) {
-        return true;
-      }
-      // in the worst case, check that the x/y position of the click is within
-      // the bounding box of the target of the event
-      // Thanks IE 10 >:(
-      let t = Gestures._findOriginalTarget(ev);
-      // make sure the target of the event is an element so we can use getBoundingClientRect,
-      // if not, just assume it is a synthetic click
-      if (t.nodeType !== Node.ELEMENT_NODE) {
-        return true;
-      }
-      let bcr = t.getBoundingClientRect();
-      // use page x/y to account for scrolling
-      let x = ev.pageX, y = ev.pageY;
-      // ev is a synthetic click if the position is outside the bounding box of the target
-      return !((x >= bcr.left && x <= bcr.right) && (y >= bcr.top && y <= bcr.bottom));
-    }
-    return false;
-  }
-
-  let POINTERSTATE = {
-    mouse: {
-      target: null,
-      mouseIgnoreJob: null
-    },
-    touch: {
-      x: 0,
-      y: 0,
-      id: -1,
-      scrollDecided: false
-    }
-  };
-
-  function firstTouchAction(ev) {
-    let ta = 'auto';
-    let path = ev.composedPath && ev.composedPath();
-    if (path) {
-      for (let i = 0, n; i < path.length; i++) {
-        n = path[i];
-        if (n[TOUCH_ACTION]) {
-          ta = n[TOUCH_ACTION];
-          break;
-        }
-      }
-    }
-    return ta;
-  }
-
-  function trackDocument(stateObj, movefn, upfn) {
-    stateObj.movefn = movefn;
-    stateObj.upfn = upfn;
-    document.addEventListener('mousemove', movefn);
-    document.addEventListener('mouseup', upfn);
-  }
-
-  function untrackDocument(stateObj) {
-    document.removeEventListener('mousemove', stateObj.movefn);
-    document.removeEventListener('mouseup', stateObj.upfn);
-    stateObj.movefn = null;
-    stateObj.upfn = null;
-  }
-
-  // use a document-wide touchend listener to start the ghost-click prevention mechanism
-  // Use passive event listeners, if supported, to not affect scrolling performance
-  document.addEventListener('touchend', ignoreMouse, SUPPORTS_PASSIVE ? {passive: true} : false);
-
-  /**
-   * Module for adding listeners to a node for the following normalized
-   * cross-platform "gesture" events:
-   * - `down` - mouse or touch went down
-   * - `up` - mouse or touch went up
-   * - `tap` - mouse click or finger tap
-   * - `track` - mouse drag or touch move
-   *
-   * @namespace
-   * @memberof Polymer
-   * @summary Module for adding cross-platform gesture event listeners.
-   */
-  const Gestures = {
-    gestures: {},
-    recognizers: [],
-
-    /**
-     * Finds the element rendered on the screen at the provided coordinates.
-     *
-     * Similar to `document.elementFromPoint`, but pierces through
-     * shadow roots.
-     *
-     * @memberof Polymer.Gestures
-     * @param {number} x Horizontal pixel coordinate
-     * @param {number} y Vertical pixel coordinate
-     * @return {HTMLElement} Returns the deepest shadowRoot inclusive element
-     * found at the screen position given.
-     */
-    deepTargetFind: function(x, y) {
-      let node = document.elementFromPoint(x, y);
-      let next = node;
-      // this code path is only taken when native ShadowDOM is used
-      // if there is a shadowroot, it may have a node at x/y
-      // if there is not a shadowroot, exit the loop
-      while (next && next.shadowRoot && !window.ShadyDOM) {
-        // if there is a node at x/y in the shadowroot, look deeper
-        let oldNext = next;
-        next = next.shadowRoot.elementFromPoint(x, y);
-        // on Safari, elementFromPoint may return the shadowRoot host
-        if (oldNext === next) {
-          break;
-        }
-        if (next) {
-          node = next;
-        }
-      }
-      return node;
-    },
-    /**
-     * a cheaper check than ev.composedPath()[0];
-     *
-     * @private
-     * @param {Event} ev Event.
-     * @return {HTMLElement} Returns the event target.
-     */
-    _findOriginalTarget: function(ev) {
-      // shadowdom
-      if (ev.composedPath) {
-        return ev.composedPath()[0];
-      }
-      // shadydom
-      return ev.target;
-    },
-
-    /**
-     * @private
-     * @param {Event} ev Event.
-     */
-    _handleNative: function(ev) {
-      let handled;
-      let type = ev.type;
-      let node = ev.currentTarget;
-      let gobj = node[GESTURE_KEY];
-      if (!gobj) {
-        return;
-      }
-      let gs = gobj[type];
-      if (!gs) {
-        return;
-      }
-      if (!ev[HANDLED_OBJ]) {
-        ev[HANDLED_OBJ] = {};
-        if (type.slice(0, 5) === 'touch') {
-          let t = ev.changedTouches[0];
-          if (type === 'touchstart') {
-            // only handle the first finger
-            if (ev.touches.length === 1) {
-              POINTERSTATE.touch.id = t.identifier;
-            }
-          }
-          if (POINTERSTATE.touch.id !== t.identifier) {
-            return;
-          }
-          if (!HAS_NATIVE_TA) {
-            if (type === 'touchstart' || type === 'touchmove') {
-              Gestures._handleTouchAction(ev);
-            }
-          }
-        }
-      }
-      handled = ev[HANDLED_OBJ];
-      // used to ignore synthetic mouse events
-      if (handled.skip) {
-        return;
-      }
-      let recognizers = Gestures.recognizers;
-      // reset recognizer state
-      for (let i = 0, r; i < recognizers.length; i++) {
-        r = recognizers[i];
-        if (gs[r.name] && !handled[r.name]) {
-          if (r.flow && r.flow.start.indexOf(ev.type) > -1 && r.reset) {
-            r.reset();
-          }
-        }
-      }
-      // enforce gesture recognizer order
-      for (let i = 0, r; i < recognizers.length; i++) {
-        r = recognizers[i];
-        if (gs[r.name] && !handled[r.name]) {
-          handled[r.name] = true;
-          r[type](ev);
-        }
-      }
-    },
-
-    /**
-     * @private
-     * @param {Event} ev Event.
-     */
-    _handleTouchAction: function(ev) {
-      let t = ev.changedTouches[0];
-      let type = ev.type;
-      if (type === 'touchstart') {
-        POINTERSTATE.touch.x = t.clientX;
-        POINTERSTATE.touch.y = t.clientY;
-        POINTERSTATE.touch.scrollDecided = false;
-      } else if (type === 'touchmove') {
-        if (POINTERSTATE.touch.scrollDecided) {
-          return;
-        }
-        POINTERSTATE.touch.scrollDecided = true;
-        let ta = firstTouchAction(ev);
-        let prevent = false;
-        let dx = Math.abs(POINTERSTATE.touch.x - t.clientX);
-        let dy = Math.abs(POINTERSTATE.touch.y - t.clientY);
-        if (!ev.cancelable) {
-          // scrolling is happening
-        } else if (ta === 'none') {
-          prevent = true;
-        } else if (ta === 'pan-x') {
-          prevent = dy > dx;
-        } else if (ta === 'pan-y') {
-          prevent = dx > dy;
-        }
-        if (prevent) {
-          ev.preventDefault();
-        } else {
-          Gestures.prevent('track');
-        }
-      }
-    },
-
-    /**
-     * Adds an event listener to a node for the given gesture type.
-     *
-     * @memberof Polymer.Gestures
-     * @param {Node} node Node to add listener on
-     * @param {string} evType Gesture type: `down`, `up`, `track`, or `tap`
-     * @param {Function} handler Event listener function to call
-     * @return {boolean} Returns true if a gesture event listener was added.
-     */
-    addListener: function(node, evType, handler) {
-      if (this.gestures[evType]) {
-        this._add(node, evType, handler);
-        return true;
-      }
-    },
-
-    /**
-     * Removes an event listener from a node for the given gesture type.
-     *
-     * @memberof Polymer.Gestures
-     * @param {Node} node Node to remove listener from
-     * @param {string} evType Gesture type: `down`, `up`, `track`, or `tap`
-     * @param {Function} handler Event listener function previously passed to
-     *  `addListener`.
-     * @return {boolean} Returns true if a gesture event listener was removed.
-     */
-    removeListener: function(node, evType, handler) {
-      if (this.gestures[evType]) {
-        this._remove(node, evType, handler);
-        return true;
-      }
-    },
-
-    /**
-     * automate the event listeners for the native events
-     *
-     * @private
-     * @param {HTMLElement} node Node on which to add the event.
-     * @param {string} evType Event type to add.
-     * @param {function} handler Event handler function.
-     */
-    _add: function(node, evType, handler) {
-      let recognizer = this.gestures[evType];
-      let deps = recognizer.deps;
-      let name = recognizer.name;
-      let gobj = node[GESTURE_KEY];
-      if (!gobj) {
-        node[GESTURE_KEY] = gobj = {};
-      }
-      for (let i = 0, dep, gd; i < deps.length; i++) {
-        dep = deps[i];
-        // don't add mouse handlers on iOS because they cause gray selection overlays
-        if (IS_TOUCH_ONLY && MOUSE_EVENTS.indexOf(dep) > -1 && dep !== 'click') {
-          continue;
-        }
-        gd = gobj[dep];
-        if (!gd) {
-          gobj[dep] = gd = {_count: 0};
-        }
-        if (gd._count === 0) {
-          node.addEventListener(dep, this._handleNative);
-        }
-        gd[name] = (gd[name] || 0) + 1;
-        gd._count = (gd._count || 0) + 1;
-      }
-      node.addEventListener(evType, handler);
-      if (recognizer.touchAction) {
-        this.setTouchAction(node, recognizer.touchAction);
-      }
-    },
-
-    /**
-     * automate event listener removal for native events
-     *
-     * @private
-     * @param {HTMLElement} node Node on which to remove the event.
-     * @param {string} evType Event type to remove.
-     * @param {function} handler Event handler function.
-     */
-    _remove: function(node, evType, handler) {
-      let recognizer = this.gestures[evType];
-      let deps = recognizer.deps;
-      let name = recognizer.name;
-      let gobj = node[GESTURE_KEY];
-      if (gobj) {
-        for (let i = 0, dep, gd; i < deps.length; i++) {
-          dep = deps[i];
-          gd = gobj[dep];
-          if (gd && gd[name]) {
-            gd[name] = (gd[name] || 1) - 1;
-            gd._count = (gd._count || 1) - 1;
-            if (gd._count === 0) {
-              node.removeEventListener(dep, this._handleNative);
-            }
-          }
-        }
-      }
-      node.removeEventListener(evType, handler);
-    },
-
-    /**
-     * Registers a new gesture event recognizer for adding new custom
-     * gesture event types.
-     *
-     * @memberof Polymer.Gestures
-     * @param {Object} recog Gesture recognizer descriptor
-     */
-    register: function(recog) {
-      this.recognizers.push(recog);
-      for (let i = 0; i < recog.emits.length; i++) {
-        this.gestures[recog.emits[i]] = recog;
-      }
-    },
-
-    /**
-     * @private
-     * @param {string} evName Event name.
-     * @return {Object} Returns the gesture for the given event name.
-     */
-    _findRecognizerByEvent: function(evName) {
-      for (let i = 0, r; i < this.recognizers.length; i++) {
-        r = this.recognizers[i];
-        for (let j = 0, n; j < r.emits.length; j++) {
-          n = r.emits[j];
-          if (n === evName) {
-            return r;
-          }
-        }
-      }
-      return null;
-    },
-
-    /**
-     * Sets scrolling direction on node.
-     *
-     * This value is checked on first move, thus it should be called prior to
-     * adding event listeners.
-     *
-     * @memberof Polymer.Gestures
-     * @param {Node} node Node to set touch action setting on
-     * @param {string} value Touch action value
-     */
-    setTouchAction: function(node, value) {
-      if (HAS_NATIVE_TA) {
-        node.style.touchAction = value;
-      }
-      node[TOUCH_ACTION] = value;
-    },
-
-    /**
-     * Dispatches an event on the `target` element of `type` with the given
-     * `detail`.
-     * @private
-     * @param {HTMLElement} target The element on which to fire an event.
-     * @param {string} type The type of event to fire.
-     * @param {Object=} detail The detail object to populate on the event.
-     */
-    _fire: function(target, type, detail) {
-      let ev = new Event(type, { bubbles: true, cancelable: true, composed: true });
-      ev.detail = detail;
-      target.dispatchEvent(ev);
-      // forward `preventDefault` in a clean way
-      if (ev.defaultPrevented) {
-        let preventer = detail.preventer || detail.sourceEvent;
-        if (preventer && preventer.preventDefault) {
-          preventer.preventDefault();
-        }
-      }
-    },
-
-    /**
-     * Prevents the dispatch and default action of the given event name.
-     *
-     * @memberof Polymer.Gestures
-     * @param {string} evName Event name.
-     */
-    prevent: function(evName) {
-      let recognizer = this._findRecognizerByEvent(evName);
-      if (recognizer.info) {
-        recognizer.info.prevent = true;
-      }
-    },
-
-    /**
-     * Reset the 2500ms timeout on processing mouse input after detecting touch input.
-     *
-     * Touch inputs create synthesized mouse inputs anywhere from 0 to 2000ms after the touch.
-     * This method should only be called during testing with simulated touch inputs.
-     * Calling this method in production may cause duplicate taps or other Gestures.
-     *
-     * @memberof Polymer.Gestures
-     */
-    resetMouseCanceller: function() {
-      if (POINTERSTATE.mouse.mouseIgnoreJob) {
-        POINTERSTATE.mouse.mouseIgnoreJob.flush();
-      }
-    }
-  };
-
-  Gestures.register({
-    name: 'downup',
-    deps: ['mousedown', 'touchstart', 'touchend'],
-    flow: {
-      start: ['mousedown', 'touchstart'],
-      end: ['mouseup', 'touchend']
-    },
-    emits: ['down', 'up'],
-
-    info: {
-      movefn: null,
-      upfn: null
-    },
-
-    reset: function() {
-      untrackDocument(this.info);
-    },
-
-    mousedown: function(e) {
-      if (!hasLeftMouseButton(e)) {
-        return;
-      }
-      let t = Gestures._findOriginalTarget(e);
-      let self = this;
-      let movefn = function movefn(e) {
-        if (!hasLeftMouseButton(e)) {
-          self._fire('up', t, e);
-          untrackDocument(self.info);
-        }
-      };
-      let upfn = function upfn(e) {
-        if (hasLeftMouseButton(e)) {
-          self._fire('up', t, e);
-        }
-        untrackDocument(self.info);
-      };
-      trackDocument(this.info, movefn, upfn);
-      this._fire('down', t, e);
-    },
-    touchstart: function(e) {
-      this._fire('down', Gestures._findOriginalTarget(e), e.changedTouches[0], e);
-    },
-    touchend: function(e) {
-      this._fire('up', Gestures._findOriginalTarget(e), e.changedTouches[0], e);
-    },
-    _fire: function(type, target, event, preventer) {
-      Gestures._fire(target, type, {
-        x: event.clientX,
-        y: event.clientY,
-        sourceEvent: event,
-        preventer: preventer,
-        prevent: function(e) {
-          return Gestures.prevent(e);
-        }
-      });
-    }
-  });
-
-  Gestures.register({
-    name: 'track',
-    touchAction: 'none',
-    deps: ['mousedown', 'touchstart', 'touchmove', 'touchend'],
-    flow: {
-      start: ['mousedown', 'touchstart'],
-      end: ['mouseup', 'touchend']
-    },
-    emits: ['track'],
-
-    info: {
-      x: 0,
-      y: 0,
-      state: 'start',
-      started: false,
-      moves: [],
-      addMove: function(move) {
-        if (this.moves.length > TRACK_LENGTH) {
-          this.moves.shift();
-        }
-        this.moves.push(move);
-      },
-      movefn: null,
-      upfn: null,
-      prevent: false
-    },
-
-    reset: function() {
-      this.info.state = 'start';
-      this.info.started = false;
-      this.info.moves = [];
-      this.info.x = 0;
-      this.info.y = 0;
-      this.info.prevent = false;
-      untrackDocument(this.info);
-    },
-
-    hasMovedEnough: function(x, y) {
-      if (this.info.prevent) {
-        return false;
-      }
-      if (this.info.started) {
-        return true;
-      }
-      let dx = Math.abs(this.info.x - x);
-      let dy = Math.abs(this.info.y - y);
-      return (dx >= TRACK_DISTANCE || dy >= TRACK_DISTANCE);
-    },
-
-    mousedown: function(e) {
-      if (!hasLeftMouseButton(e)) {
-        return;
-      }
-      let t = Gestures._findOriginalTarget(e);
-      let self = this;
-      let movefn = function movefn(e) {
-        let x = e.clientX, y = e.clientY;
-        if (self.hasMovedEnough(x, y)) {
-          // first move is 'start', subsequent moves are 'move', mouseup is 'end'
-          self.info.state = self.info.started ? (e.type === 'mouseup' ? 'end' : 'track') : 'start';
-          if (self.info.state === 'start') {
-            // if and only if tracking, always prevent tap
-            Gestures.prevent('tap');
-          }
-          self.info.addMove({x: x, y: y});
-          if (!hasLeftMouseButton(e)) {
-            // always _fire "end"
-            self.info.state = 'end';
-            untrackDocument(self.info);
-          }
-          self._fire(t, e);
-          self.info.started = true;
-        }
-      };
-      let upfn = function upfn(e) {
-        if (self.info.started) {
-          movefn(e);
-        }
-
-        // remove the temporary listeners
-        untrackDocument(self.info);
-      };
-      // add temporary document listeners as mouse retargets
-      trackDocument(this.info, movefn, upfn);
-      this.info.x = e.clientX;
-      this.info.y = e.clientY;
-    },
-
-    touchstart: function(e) {
-      let ct = e.changedTouches[0];
-      this.info.x = ct.clientX;
-      this.info.y = ct.clientY;
-    },
-
-    touchmove: function(e) {
-      let t = Gestures._findOriginalTarget(e);
-      let ct = e.changedTouches[0];
-      let x = ct.clientX, y = ct.clientY;
-      if (this.hasMovedEnough(x, y)) {
-        if (this.info.state === 'start') {
-          // if and only if tracking, always prevent tap
-          Gestures.prevent('tap');
-        }
-        this.info.addMove({x: x, y: y});
-        this._fire(t, ct);
-        this.info.state = 'track';
-        this.info.started = true;
-      }
-    },
-
-    touchend: function(e) {
-      let t = Gestures._findOriginalTarget(e);
-      let ct = e.changedTouches[0];
-      // only trackend if track was started and not aborted
-      if (this.info.started) {
-        // reset started state on up
-        this.info.state = 'end';
-        this.info.addMove({x: ct.clientX, y: ct.clientY});
-        this._fire(t, ct, e);
-      }
-    },
-
-    _fire: function(target, touch) {
-      let secondlast = this.info.moves[this.info.moves.length - 2];
-      let lastmove = this.info.moves[this.info.moves.length - 1];
-      let dx = lastmove.x - this.info.x;
-      let dy = lastmove.y - this.info.y;
-      let ddx, ddy = 0;
-      if (secondlast) {
-        ddx = lastmove.x - secondlast.x;
-        ddy = lastmove.y - secondlast.y;
-      }
-      return Gestures._fire(target, 'track', {
-        state: this.info.state,
-        x: touch.clientX,
-        y: touch.clientY,
-        dx: dx,
-        dy: dy,
-        ddx: ddx,
-        ddy: ddy,
-        sourceEvent: touch,
-        hover: function() {
-          return Gestures.deepTargetFind(touch.clientX, touch.clientY);
-        }
-      });
-    }
-
-  });
-
-  Gestures.register({
-    name: 'tap',
-    deps: ['mousedown', 'click', 'touchstart', 'touchend'],
-    flow: {
-      start: ['mousedown', 'touchstart'],
-      end: ['click', 'touchend']
-    },
-    emits: ['tap'],
-    info: {
-      x: NaN,
-      y: NaN,
-      prevent: false
-    },
-    reset: function() {
-      this.info.x = NaN;
-      this.info.y = NaN;
-      this.info.prevent = false;
-    },
-    save: function(e) {
-      this.info.x = e.clientX;
-      this.info.y = e.clientY;
-    },
-
-    mousedown: function(e) {
-      if (hasLeftMouseButton(e)) {
-        this.save(e);
-      }
-    },
-    click: function(e) {
-      if (hasLeftMouseButton(e)) {
-        this.forward(e);
-      }
-    },
-
-    touchstart: function(e) {
-      this.save(e.changedTouches[0], e);
-    },
-    touchend: function(e) {
-      this.forward(e.changedTouches[0], e);
-    },
-
-    forward: function(e, preventer) {
-      let dx = Math.abs(e.clientX - this.info.x);
-      let dy = Math.abs(e.clientY - this.info.y);
-      let t = Gestures._findOriginalTarget(e);
-      // dx,dy can be NaN if `click` has been simulated and there was no `down` for `start`
-      if (isNaN(dx) || isNaN(dy) || (dx <= TAP_DISTANCE && dy <= TAP_DISTANCE) || isSyntheticClick(e)) {
-        // prevent taps from being generated if an event has canceled them
-        if (!this.info.prevent) {
-          Gestures._fire(t, 'tap', {
-            x: e.clientX,
-            y: e.clientY,
-            sourceEvent: e,
-            preventer: preventer
-          });
-        }
-      }
-    }
-  });
-
-  /** @deprecated */
-  Gestures.findOriginalTarget = Gestures._findOriginalTarget;
-
-  /** @deprecated */
-  Gestures.add = Gestures.addListener;
-
-  /** @deprecated */
-  Gestures.remove = Gestures.removeListener;
-
-  Polymer.Gestures = Gestures;
-
-})();
-</script>
diff --git a/src/main/resources/static/gltf-viewer/bower_components/polymer/lib/utils/import-href.html b/src/main/resources/static/gltf-viewer/bower_components/polymer/lib/utils/import-href.html
deleted file mode 100644 (file)
index 77933a4..0000000
+++ /dev/null
@@ -1,107 +0,0 @@
-<!--
-@license
-Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
-This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
-The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
-The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
-Code distributed by Google as part of the polymer project is also
-subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
--->
-
-<link rel="import" href="boot.html">
-
-<script>
-
-(function() {
-
-  'use strict';
-
-  // run a callback when HTMLImports are ready or immediately if
-  // this api is not available.
-  function whenImportsReady(cb) {
-    if (window.HTMLImports) {
-      HTMLImports.whenReady(cb);
-    } else {
-      cb();
-    }
-  }
-
-  /**
-   * Convenience method for importing an HTML document imperatively.
-   *
-   * This method creates a new `<link rel="import">` element with
-   * the provided URL and appends it to the document to start loading.
-   * In the `onload` callback, the `import` property of the `link`
-   * element will contain the imported document contents.
-   *
-   * @memberof Polymer
-   * @param {string} href URL to document to load.
-   * @param {Function=} onload Callback to notify when an import successfully
-   *   loaded.
-   * @param {Function=} onerror Callback to notify when an import
-   *   unsuccessfully loaded.
-   * @param {boolean=} optAsync True if the import should be loaded `async`.
-   *   Defaults to `false`.
-   * @return {HTMLLinkElement} The link element for the URL to be loaded.
-   */
-  Polymer.importHref = function(href, onload, onerror, optAsync) {
-    let link =
-      document.head.querySelector('link[href="' + href + '"][import-href]');
-    if (!link) {
-      link = document.createElement('link');
-      link.rel = 'import';
-      link.href = href;
-      link.setAttribute('import-href', '');
-    }
-    // always ensure link has `async` attribute if user specified one,
-    // even if it was previously not async. This is considered less confusing.
-    if (optAsync) {
-      link.setAttribute('async', '');
-    }
-    // NOTE: the link may now be in 3 states: (1) pending insertion,
-    // (2) inflight, (3) already laoded. In each case, we need to add
-    // event listeners to process callbacks.
-    let cleanup = function() {
-      link.removeEventListener('load', loadListener);
-      link.removeEventListener('error', errorListener);
-    }
-    let loadListener = function(event) {
-      cleanup();
-      // In case of a successful load, cache the load event on the link so
-      // that it can be used to short-circuit this method in the future when
-      // it is called with the same href param.
-      link.__dynamicImportLoaded = true;
-      if (onload) {
-        whenImportsReady(() => {
-          onload(event);
-        });
-      }
-    };
-    let errorListener = function(event) {
-      cleanup();
-      // In case of an error, remove the link from the document so that it
-      // will be automatically created again the next time `importHref` is
-      // called.
-      if (link.parentNode) {
-        link.parentNode.removeChild(link);
-      }
-      if (onerror) {
-        whenImportsReady(() => {
-          onerror(event);
-        });
-      }
-    };
-    link.addEventListener('load', loadListener);
-    link.addEventListener('error', errorListener);
-    if (link.parentNode == null) {
-      document.head.appendChild(link);
-    // if the link already loaded, dispatch a fake load event
-    // so that listeners are called and get a proper event argument.
-    } else if (link.__dynamicImportLoaded) {
-      link.dispatchEvent(new Event('load'));
-    }
-    return link;
-  };
-
-})();
-</script>
diff --git a/src/main/resources/static/gltf-viewer/bower_components/polymer/lib/utils/mixin.html b/src/main/resources/static/gltf-viewer/bower_components/polymer/lib/utils/mixin.html
deleted file mode 100644 (file)
index 12a4ebb..0000000
+++ /dev/null
@@ -1,76 +0,0 @@
-<!--
-@license
-Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
-This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
-The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
-The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
-Code distributed by Google as part of the polymer project is also
-subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
--->
-
-<link rel="import" href="boot.html">
-
-<script>
-
-(function() {
-
-  'use strict';
-
-  // unique global id for deduping mixins.
-  let dedupeId = 0;
-
-  /**
-   * Given a mixin producing function, memoize applications of mixin to base
-   * @private
-   * @param {Function} mixin Mixin for which to create a caching mixin.
-   * @return {Function} Returns a mixin which when applied multiple times to the
-   * same base will always return the same extended class.
-   */
-  function cachingMixin(mixin) {
-    return function(base) {
-      if (!mixin.__mixinApplications) {
-        mixin.__mixinApplications = new WeakMap();
-      }
-      let map = mixin.__mixinApplications;
-      let application = map.get(base);
-      if (!application) {
-        application = mixin(base);
-        map.set(base, application);
-      }
-      return application;
-    };
-  }
-
-  /**
-   * Wraps an ES6 class expression mixin such that the mixin is only applied
-   * if it has not already been applied its base argument.  Also memoizes mixin
-   * applications.
-   *
-   * @memberof Polymer
-   * @param {Function} mixin ES6 class expression mixin to wrap
-   * @return {Function} Wrapped mixin that deduplicates and memoizes
-   *   mixin applications to base
-   */
-  Polymer.dedupingMixin = function(mixin) {
-    mixin = cachingMixin(mixin);
-    // maintain a unique id for each mixin
-    mixin.__dedupeId = ++dedupeId;
-    return function(base) {
-      let baseSet = base.__mixinSet;
-      if (baseSet && baseSet[mixin.__dedupeId]) {
-        return base;
-      }
-      let extended = mixin(base);
-      // copy inherited mixin set from the extended class, or the base class
-      // NOTE: we avoid use of Set here because some browser (IE11)
-      // cannot extend a base Set via the constructor.
-      extended.__mixinSet =
-        Object.create(extended.__mixinSet || baseSet || null);
-      extended.__mixinSet[mixin.__dedupeId] = true;
-      return extended;
-    }
-  };
-
-})();
-
-</script>
diff --git a/src/main/resources/static/gltf-viewer/bower_components/polymer/lib/utils/path.html b/src/main/resources/static/gltf-viewer/bower_components/polymer/lib/utils/path.html
deleted file mode 100644 (file)
index 2dfe894..0000000
+++ /dev/null
@@ -1,274 +0,0 @@
-<!--
-@license
-Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
-This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
-The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
-The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
-Code distributed by Google as part of the polymer project is also
-subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
--->
-
-<link rel="import" href="boot.html">
-
-<script>
-(function() {
-  'use strict';
-
-  /**
-   * Module with utilities for manipulating structured data path strings.
-   *
-   * @namespace
-   * @memberof Polymer
-   * @summary Module with utilities for manipulating structured data path strings.
-   */
-  const Path = {
-
-    /**
-     * Returns true if the given string is a structured data path (has dots).
-     *
-     * Example:
-     *
-     * ```
-     * Polymer.Path.isPath('foo.bar.baz') // true
-     * Polymer.Path.isPath('foo')         // false
-     * ```
-     *
-     * @memberof Polymer.Path
-     * @param {string} path Path string
-     * @return {boolean} True if the string contained one or more dots
-     */
-    isPath: function(path) {
-      return path.indexOf('.') >= 0;
-    },
-
-    /**
-     * Returns the root property name for the given path.
-     *
-     * Example:
-     *
-     * ```
-     * Polymer.Path.root('foo.bar.baz') // 'foo'
-     * Polymer.Path.root('foo')         // 'foo'
-     * ```
-     *
-     * @memberof Polymer.Path
-     * @param {string} path Path string
-     * @return {string} Root property name
-     */
-    root: function(path) {
-      let dotIndex = path.indexOf('.');
-      if (dotIndex === -1) {
-        return path;
-      }
-      return path.slice(0, dotIndex);
-    },
-
-    /**
-     * Given `base` is `foo.bar`, `foo` is an ancestor, `foo.bar` is not
-     * Returns true if the given path is an ancestor of the base path.
-     *
-     * Example:
-     *
-     * ```
-     * Polymer.Path.isAncestor('foo.bar', 'foo')         // true
-     * Polymer.Path.isAncestor('foo.bar', 'foo.bar')     // false
-     * Polymer.Path.isAncestor('foo.bar', 'foo.bar.baz') // false
-     * ```
-     *
-     * @memberof Polymer.Path
-     * @param {string} base Path string to test against.
-     * @param {string} path Path string to test.
-     * @return {boolean} True if `path` is an ancestor of `base`.
-     */
-    isAncestor: function(base, path) {
-      //     base.startsWith(path + '.');
-      return base.indexOf(path + '.') === 0;
-    },
-
-    /**
-     * Given `base` is `foo.bar`, `foo.bar.baz` is an descendant
-     *
-     * Example:
-     *
-     * ```
-     * Polymer.Path.isDescendant('foo.bar', 'foo.bar.baz') // true
-     * Polymer.Path.isDescendant('foo.bar', 'foo.bar')     // false
-     * Polymer.Path.isDescendant('foo.bar', 'foo')         // false
-     * ```
-     *
-     * @memberof Polymer.Path
-     * @param {string} base Path string to test against.
-     * @param {string} path Path string to test.
-     * @return {boolean} True if `path` is a descendant of `base`.
-     */
-    isDescendant: function(base, path) {
-      //     path.startsWith(base + '.');
-      return path.indexOf(base + '.') === 0;
-    },
-
-    /**
-     * Replaces a previous base path with a new base path, preserving the
-     * remainder of the path.
-     *
-     * User must ensure `path` has a prefix of `base`.
-     *
-     * Example:
-     *
-     * ```
-     * Polymer.Path.translate('foo.bar', 'zot' 'foo.bar.baz') // 'zot.baz'
-     * ```
-     *
-     * @memberof Polymer.Path
-     * @param {string} base Current base string to remove
-     * @param {string} newBase New base string to replace with
-     * @param {string} path Path to translate
-     * @return {string} Translated string
-     */
-    translate: function(base, newBase, path) {
-      return newBase + path.slice(base.length);
-    },
-
-    matches: function(base, path) {
-      return (base === path) ||
-             this.isAncestor(base, path) ||
-             this.isDescendant(base, path);
-    },
-
-    /**
-     * Converts array-based paths to flattened path.  String-based paths
-     * are returned as-is.
-     *
-     * Example:
-     *
-     * ```
-     * Polymer.Path.normalize(['foo.bar', 0, 'baz'])  // 'foo.bar.0.baz'
-     * Polymer.Path.normalize('foo.bar.0.baz')        // 'foo.bar.0.baz'
-     * ```
-     *
-     * @memberof Polymer.Path
-     * @param {string | !Array<string|number>} path Input path
-     * @return {string} Flattened path
-     */
-    normalize: function(path) {
-      if (Array.isArray(path)) {
-        let parts = [];
-        for (let i=0; i<path.length; i++) {
-          let args = path[i].toString().split('.');
-          for (let j=0; j<args.length; j++) {
-            parts.push(args[j]);
-          }
-        }
-        return parts.join('.');
-      } else {
-        return path;
-      }
-    },
-
-    /**
-     * Splits a path into an array of property names. Accepts either arrays
-     * of path parts or strings.
-     *
-     * Example:
-     *
-     * ```
-     * Polymer.Path.split(['foo.bar', 0, 'baz'])  // ['foo', 'bar', '0', 'baz']
-     * Polymer.Path.split('foo.bar.0.baz')        // ['foo', 'bar', '0', 'baz']
-     * ```
-     *
-     * @memberof Polymer.Path
-     * @param {string | !Array<string|number>} path Input path
-     * @return {!Array<string>} Array of path parts
-     */
-    split: function(path) {
-      if (Array.isArray(path)) {
-        return this.normalize(path).split('.');
-      }
-      return path.toString().split('.');
-    },
-
-    /**
-     * Reads a value from a path.  If any sub-property in the path is `undefined`,
-     * this method returns `undefined` (will never throw.
-     *
-     * @memberof Polymer.Path
-     * @param {Object} root Object from which to dereference path from
-     * @param {string | !Array<string|number>} path Path to read
-     * @param {Object=} info If an object is provided to `info`, the normalized
-     *  (flattened) path will be set to `info.path`.
-     * @return {*} Value at path, or `undefined` if the path could not be
-     *  fully dereferenced.
-     */
-    get: function(root, path, info) {
-      let prop = root;
-      let parts = this.split(path);
-      // Loop over path parts[0..n-1] and dereference
-      for (let i=0; i<parts.length; i++) {
-        if (!prop) {
-          return;
-        }
-        let part = parts[i];
-        prop = prop[part];
-      }
-      if (info) {
-        info.path = parts.join('.');
-      }
-      return prop;
-    },
-
-    /**
-     * Sets a value to a path.  If any sub-property in the path is `undefined`,
-     * this method will no-op.
-     *
-     * @memberof Polymer.Path
-     * @param {Object} root Object from which to dereference path from
-     * @param {string | !Array<string|number>} path Path to set
-     * @param {*} value Value to set to path
-     * @return {string | undefined} The normalized version of the input path
-     */
-    set: function(root, path, value) {
-      let prop = root;
-      let parts = this.split(path);
-      let last = parts[parts.length-1];
-      if (parts.length > 1) {
-        // Loop over path parts[0..n-2] and dereference
-        for (let i=0; i<parts.length-1; i++) {
-          let part = parts[i];
-          prop = prop[part];
-          if (!prop) {
-            return;
-          }
-        }
-        // Set value to object at end of path
-        prop[last] = value;
-      } else {
-        // Simple property set
-        prop[path] = value;
-      }
-      return parts.join('.');
-    }
-
-  };
-
-  /**
-   * Returns true if the given string is a structured data path (has dots).
-   *
-   * This function is deprecated.  Use `Polymer.Path.isPath` instead.
-   *
-   * Example:
-   *
-   * ```
-   * Polymer.Path.isDeep('foo.bar.baz') // true
-   * Polymer.Path.isDeep('foo')         // false
-   * ```
-   *
-   * @deprecated
-   * @memberof Polymer.Path
-   * @param {string} path Path string
-   * @return {boolean} True if the string contained one or more dots
-   */
-  Path.isDeep = Path.isPath;
-
-  Polymer.Path = Path;
-
-})();
-</script>
diff --git a/src/main/resources/static/gltf-viewer/bower_components/polymer/lib/utils/render-status.html b/src/main/resources/static/gltf-viewer/bower_components/polymer/lib/utils/render-status.html
deleted file mode 100644 (file)
index ca7175a..0000000
+++ /dev/null
@@ -1,130 +0,0 @@
-<!--
-@license
-Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
-This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
-The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
-The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
-Code distributed by Google as part of the polymer project is also
-subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
--->
-<link rel="import" href="boot.html">
-
-<script>
-(function() {
-
-  'use strict';
-
-  let scheduled = false;
-  let beforeRenderQueue = [];
-  let afterRenderQueue = [];
-
-  function schedule() {
-    scheduled = true;
-    // before next render
-    requestAnimationFrame(function() {
-      scheduled = false;
-      flushQueue(beforeRenderQueue);
-      // after the render
-      setTimeout(function() {
-        runQueue(afterRenderQueue);
-      });
-    });
-  }
-
-  function flushQueue(queue) {
-    while (queue.length) {
-      callMethod(queue.shift());
-    }
-  }
-
-  function runQueue(queue) {
-    for (let i=0, l=queue.length; i < l; i++) {
-      callMethod(queue.shift());
-    }
-  }
-
-  function callMethod(info) {
-    const context = info[0];
-    const callback = info[1];
-    const args = info[2];
-    try {
-      callback.apply(context, args);
-    } catch(e) {
-      setTimeout(() => {
-        throw e;
-      })
-    }
-  }
-
-  function flush() {
-    while (beforeRenderQueue.length || afterRenderQueue.length) {
-      flushQueue(beforeRenderQueue);
-      flushQueue(afterRenderQueue);
-    }
-    scheduled = false;
-  }
-
-  /**
-   * Module for scheduling flushable pre-render and post-render tasks.
-   *
-   * @namespace
-   * @memberof Polymer
-   * @summary Module for scheduling flushable pre-render and post-render tasks.
-   */
-  Polymer.RenderStatus = {
-
-    /**
-     * Enqueues a callback which will be run before the next render, at
-     * `requestAnimationFrame` timing.
-     *
-     * This method is useful for enqueuing work that requires DOM measurement,
-     * since measurement may not be reliable in custom element callbacks before
-     * the first render, as well as for batching measurement tasks in general.
-     *
-     * Tasks in this queue may be flushed by calling `Polymer.RenderStatus.flush()`.
-     *
-     * @memberof Polymer.RenderStatus
-     * @param {*} context Context object the callback function will be bound to
-     * @param {function()} callback Callback function
-     * @param {Array} args An array of arguments to call the callback function with
-     */
-    beforeNextRender: function(context, callback, args) {
-      if (!scheduled) {
-        schedule();
-      }
-      beforeRenderQueue.push([context, callback, args]);
-    },
-
-    /**
-     * Enqueues a callback which will be run after the next render, equivalent
-     * to one task (`setTimeout`) after the next `requestAnimationFrame`.
-     *
-     * This method is useful for tuning the first-render performance of an
-     * element or application by deferring non-critical work until after the
-     * first paint.  Typical non-render-critical work may include adding UI
-     * event listeners and aria attributes.
-     *
-     * @memberof Polymer.RenderStatus
-     * @param {*} context Context object the callback function will be bound to
-     * @param {function()} callback Callback function
-     * @param {Array} args An array of arguments to call the callback function with
-     */
-    afterNextRender: function(context, callback, args) {
-      if (!scheduled) {
-        schedule();
-      }
-      afterRenderQueue.push([context, callback, args]);
-    },
-
-    /**
-     * Flushes all `beforeNextRender` tasks, followed by all `afterNextRender`
-     * tasks.
-     *
-     * @memberof Polymer.RenderStatus
-     */
-    flush: flush
-
-  };
-
-})();
-</script>
diff --git a/src/main/resources/static/gltf-viewer/bower_components/polymer/lib/utils/resolve-url.html b/src/main/resources/static/gltf-viewer/bower_components/polymer/lib/utils/resolve-url.html
deleted file mode 100644 (file)
index 7bffd13..0000000
+++ /dev/null
@@ -1,108 +0,0 @@
-<!--
-@license
-Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
-This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
-The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
-The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
-Code distributed by Google as part of the polymer project is also
-subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
--->
-<link rel="import" href="boot.html">
-
-<script>
-
-  (function() {
-    'use strict';
-
-    let CSS_URL_RX = /(url\()([^)]*)(\))/g;
-    let ABS_URL = /(^\/)|(^#)|(^[\w-\d]*:)/;
-    let workingURL;
-    let resolveDoc;
-    /**
-     * Resolves the given URL against the provided `baseUri'.
-     *
-     * @memberof Polymer.ResolveUrl
-     * @param {string} url Input URL to resolve
-     * @param {string} baseURI Base URI to resolve the URL against
-     * @return {string} resolved URL
-     */
-    function resolveUrl(url, baseURI) {
-      if (url && ABS_URL.test(url)) {
-        return url;
-      }
-      // Lazy feature detection.
-      if (workingURL === undefined) {
-        workingURL = false;
-        try {
-          const u = new URL('b', 'http://a');
-          u.pathname = 'c%20d';
-          workingURL = (u.href === 'http://a/c%20d');
-        } catch (e) {
-          // silently fail
-        }
-      }
-      if (!baseURI) {
-        baseURI = document.baseURI || window.location.href;
-      }
-      if (workingURL) {
-        return (new URL(url, baseURI)).href;
-      }
-      // Fallback to creating an anchor into a disconnected document.
-      if (!resolveDoc) {
-        resolveDoc = document.implementation.createHTMLDocument('temp');
-        resolveDoc.base = resolveDoc.createElement('base');
-        resolveDoc.head.appendChild(resolveDoc.base);
-        resolveDoc.anchor = resolveDoc.createElement('a');
-        resolveDoc.body.appendChild(resolveDoc.anchor);
-      }
-      resolveDoc.base.href = baseURI;
-      resolveDoc.anchor.href = url;
-      return resolveDoc.anchor.href || url;
-
-    }
-
-    /**
-     * Resolves any relative URL's in the given CSS text against the provided
-     * `ownerDocument`'s `baseURI`.
-     *
-     * @memberof Polymer.ResolveUrl
-     * @param {string} cssText CSS text to process
-     * @param {string} baseURI Base URI to resolve the URL against
-     * @return {string} Processed CSS text with resolved URL's
-     */
-    function resolveCss(cssText, baseURI) {
-      return cssText.replace(CSS_URL_RX, function(m, pre, url, post) {
-        return pre + '\'' +
-          resolveUrl(url.replace(/["']/g, ''), baseURI) +
-          '\'' + post;
-      });
-    }
-
-    /**
-     * Returns a path from a given `url`. The path includes the trailing
-     * `/` from the url.
-     *
-     * @memberof Polymer.ResolveUrl
-     * @param {string} url Input URL to transform
-     * @return {string} resolved path
-     */
-    function pathFromUrl(url) {
-      return url.substring(0, url.lastIndexOf('/') + 1);
-    }
-
-    /**
-     * Module with utilities for resolving relative URL's.
-     *
-     * @namespace
-     * @memberof Polymer
-     * @summary Module with utilities for resolving relative URL's.
-     */
-    Polymer.ResolveUrl = {
-      resolveCss: resolveCss,
-      resolveUrl: resolveUrl,
-      pathFromUrl: pathFromUrl
-    };
-
-  })();
-
-</script>
diff --git a/src/main/resources/static/gltf-viewer/bower_components/polymer/lib/utils/style-gather.html b/src/main/resources/static/gltf-viewer/bower_components/polymer/lib/utils/style-gather.html
deleted file mode 100644 (file)
index e18a347..0000000
+++ /dev/null
@@ -1,146 +0,0 @@
-<!--
-@license
-Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
-This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
-The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
-The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
-Code distributed by Google as part of the polymer project is also
-subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
--->
-<link rel="import" href="resolve-url.html">
-<script>
-(function() {
-  'use strict';
-
-  const MODULE_STYLE_LINK_SELECTOR = 'link[rel=import][type~=css]';
-  const INCLUDE_ATTR = 'include';
-
-  function importModule(moduleId) {
-    if (!Polymer.DomModule) {
-      return null;
-    }
-    return Polymer.DomModule.import(moduleId);
-  }
-
-  /**
-   * Module with utilities for collection CSS text from `<templates>`, external
-   * stylesheets, and `dom-module`s.
-   *
-   * @namespace
-   * @memberof Polymer
-   * @summary Module with utilities for collection CSS text from various sources.
-   */
-  const StyleGather = {
-
-    /**
-     * Returns CSS text of styles in a space-separated list of `dom-module`s.
-     *
-     * @memberof Polymer.StyleGather
-     * @param {string} moduleIds List of dom-module id's within which to
-     * search for css.
-     * @return {string} Concatenated CSS content from specified `dom-module`s
-     */
-    cssFromModules(moduleIds) {
-      let modules = moduleIds.trim().split(' ');
-      let cssText = '';
-      for (let i=0; i < modules.length; i++) {
-        cssText += this.cssFromModule(modules[i]);
-      }
-      return cssText;
-    },
-
-    /**
-     * Returns CSS text of styles in a given `dom-module`.  CSS in a `dom-module`
-     * can come either from `<style>`s within the first `<template>`, or else
-     * from one or more `<link rel="import" type="css">` links outside the
-     * template.
-     *
-     * Any `<styles>` processed are removed from their original location.
-     *
-     * @memberof Polymer.StyleGather
-     * @param {string} moduleId dom-module id to gather styles from
-     * @return {string} Concatenated CSS content from specified `dom-module`
-     */
-    cssFromModule(moduleId) {
-      let m = importModule(moduleId);
-      if (m && m._cssText === undefined) {
-        let cssText = '';
-        // include css from the first template in the module
-        let t = m.querySelector('template');
-        if (t) {
-          cssText += this.cssFromTemplate(t, m.assetpath);
-        }
-        // module imports: <link rel="import" type="css">
-        cssText += this.cssFromModuleImports(moduleId);
-        m._cssText = cssText || null;
-      }
-      if (!m) {
-        console.warn('Could not find style data in module named', moduleId);
-      }
-      return m && m._cssText || '';
-    },
-
-    /**
-     * Returns CSS text of `<styles>` within a given template.
-     *
-     * Any `<styles>` processed are removed from their original location.
-     *
-     * @memberof Polymer.StyleGather
-     * @param {HTMLTemplateElement} template Template to gather styles from
-     * @param {string} baseURI Base URI to resolve the URL against
-     * @return {string} Concatenated CSS content from specified template
-     */
-    cssFromTemplate(template, baseURI) {
-      let cssText = '';
-      // if element is a template, get content from its .content
-      let e$ = template.content.querySelectorAll('style');
-      for (let i=0; i < e$.length; i++) {
-        let e = e$[i];
-        // support style sharing by allowing styles to "include"
-        // other dom-modules that contain styling
-        let include = e.getAttribute(INCLUDE_ATTR);
-        if (include) {
-          cssText += this.cssFromModules(include);
-        }
-        e.parentNode.removeChild(e);
-        cssText += baseURI ?
-          Polymer.ResolveUrl.resolveCss(e.textContent, baseURI) : e.textContent;
-      }
-      return cssText;
-    },
-
-    /**
-     * Returns CSS text from stylsheets loaded via `<link rel="import" type="css">`
-     * links within the specified `dom-module`.
-     *
-     * @memberof Polymer.StyleGather
-     * @param {string} moduleId Id of `dom-module` to gather CSS from
-     * @return {string} Concatenated CSS content from links in specified `dom-module`
-     */
-    cssFromModuleImports(moduleId) {
-      let cssText = '';
-      let m = importModule(moduleId);
-      if (!m) {
-        return cssText;
-      }
-      let p$ = m.querySelectorAll(MODULE_STYLE_LINK_SELECTOR);
-      for (let i=0; i < p$.length; i++) {
-        let p = p$[i];
-        if (p.import) {
-          let importDoc = p.import;
-          // NOTE: polyfill affordance.
-          // under the HTMLImports polyfill, there will be no 'body',
-          // but the import pseudo-doc can be used directly.
-          let container = importDoc.body ? importDoc.body : importDoc;
-          cssText +=
-            Polymer.ResolveUrl.resolveCss(container.textContent,
-              importDoc.baseURI);
-        }
-      }
-      return cssText;
-    }
-  };
-
-  Polymer.StyleGather = StyleGather;
-})();
-</script>
diff --git a/src/main/resources/static/gltf-viewer/bower_components/polymer/lib/utils/templatize.html b/src/main/resources/static/gltf-viewer/bower_components/polymer/lib/utils/templatize.html
deleted file mode 100644 (file)
index 456c015..0000000
+++ /dev/null
@@ -1,473 +0,0 @@
-<!--
-@license
-Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
-This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
-The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
-The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
-Code distributed by Google as part of the polymer project is also
-subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
--->
-
-<link rel="import" href="boot.html">
-<link rel="import" href="../mixins/property-effects.html">
-<link rel="import" href="../mixins/mutable-data.html">
-
-<script>
-  (function() {
-    'use strict';
-
-    // Base class for HTMLTemplateElement extension that has property effects
-    // machinery for propagating host properties to children. This is an ES5
-    // class only because Babel (incorrectly) requires super() in the class
-    // constructor even though no `this` is used and it returns an instance.
-    let newInstance = null;
-    function HTMLTemplateElementExtension() { return newInstance; }
-    HTMLTemplateElementExtension.prototype = Object.create(HTMLTemplateElement.prototype, {
-      constructor: {
-        value: HTMLTemplateElementExtension,
-        writable: true
-      }
-    });
-    const DataTemplate = Polymer.PropertyEffects(HTMLTemplateElementExtension);
-    const MutableDataTemplate = Polymer.MutableData(DataTemplate);
-
-    // Applies a DataTemplate subclass to a <template> instance
-    function upgradeTemplate(template, constructor) {
-      newInstance = template;
-      Object.setPrototypeOf(template, constructor.prototype);
-      new constructor();
-      newInstance = null;
-    }
-
-    // Base class for TemplateInstance's
-    /**
-     * @constructor
-     * @implements {Polymer_PropertyEffects}
-     */
-    const base = Polymer.PropertyEffects(class {});
-    class TemplateInstanceBase extends base {
-      constructor(props) {
-        super();
-        this._configureProperties(props);
-        this.root = this._stampTemplate(this.__dataHost);
-        // Save list of stamped children
-        let children = this.children = [];
-        for (let n = this.root.firstChild; n; n=n.nextSibling) {
-          children.push(n);
-          n.__templatizeInstance = this;
-        }
-        if (this.__templatizeOwner.__hideTemplateChildren__) {
-          this._showHideChildren(true);
-        }
-        // Flush props only when props are passed if instance props exist
-        // or when there isn't instance props.
-        let options = this.__templatizeOptions;
-        if ((props && options.instanceProps) || !options.instanceProps) {
-          this._flushProperties();
-        }
-      }
-      /**
-       * Configure the given `props` by calling `_setPendingProperty`. Also
-       * sets any properties stored in `__hostProps`.
-       * @private
-       * @param {Object} props Object of property name-value pairs to set.
-       */
-      _configureProperties(props) {
-        let options = this.__templatizeOptions;
-        if (props) {
-          for (let iprop in options.instanceProps) {
-            if (iprop in props) {
-              this._setPendingProperty(iprop, props[iprop]);
-            }
-          }
-        }
-        for (let hprop in this.__hostProps) {
-          this._setPendingProperty(hprop, this.__dataHost['_host_' + hprop]);
-        }
-      }
-      /**
-       * Forwards a host property to this instance.  This method should be
-       * called on instances from the `options.forwardHostProp` callback
-       * to propagate changes of host properties to each instance.
-       *
-       * Note this method enqueues the change, which are flushed as a batch.
-       *
-       * @param {string} prop Property or path name
-       * @param {*} value Value of the property to forward
-       */
-      forwardHostProp(prop, value) {
-        if (this._setPendingPropertyOrPath(prop, value, false, true)) {
-          this.__dataHost._enqueueClient(this);
-        }
-      }
-      /**
-       * @override
-       */
-      _addEventListenerToNode(node, eventName, handler) {
-        if (this._methodHost && this.__templatizeOptions.parentModel) {
-          // If this instance should be considered a parent model, decorate
-          // events this template instance as `model`
-          this._methodHost._addEventListenerToNode(node, eventName, (e) => {
-            e.model = this;
-            handler(e);
-          });
-        } else {
-          // Otherwise delegate to the template's host (which could be)
-          // another template instance
-          let templateHost = this.__dataHost.__dataHost;
-          if (templateHost) {
-            templateHost._addEventListenerToNode(node, eventName, handler);
-          }
-        }
-      }
-      /**
-       * Shows or hides the template instance top level child elements. For
-       * text nodes, `textContent` is removed while "hidden" and replaced when
-       * "shown."
-       * @param {boolean} hide Set to true to hide the children;
-       * set to false to show them.
-       * @protected
-       */
-      _showHideChildren(hide) {
-        let c = this.children;
-        for (let i=0; i<c.length; i++) {
-          let n = c[i];
-          // Ignore non-changes
-          if (Boolean(hide) != Boolean(n.__hideTemplateChildren__)) {
-            if (n.nodeType === Node.TEXT_NODE) {
-              if (hide) {
-                n.__polymerTextContent__ = n.textContent;
-                n.textContent = '';
-              } else {
-                n.textContent = n.__polymerTextContent__;
-              }
-            } else if (n.style) {
-              if (hide) {
-                n.__polymerDisplay__ = n.style.display;
-                n.style.display = 'none';
-              } else {
-                n.style.display = n.__polymerDisplay__;
-              }
-            }
-          }
-          n.__hideTemplateChildren__ = hide;
-          if (n._showHideChildren) {
-            n._showHideChildren(hide);
-          }
-        }
-      }
-      /**
-       * Overrides default property-effects implementation to intercept
-       * textContent bindings while children are "hidden" and cache in
-       * private storage for later retrieval.
-       *
-       * @override
-       */
-      _setUnmanagedPropertyToNode(node, prop, value) {
-        if (node.__hideTemplateChildren__ &&
-            node.nodeType == Node.TEXT_NODE && prop == 'textContent') {
-          node.__polymerTextContent__ = value;
-        } else {
-          super._setUnmanagedPropertyToNode(node, prop, value);
-        }
-      }
-      /**
-       * Find the parent model of this template instance.  The parent model
-       * is either another templatize instance that had option `parentModel: true`,
-       * or else the host element.
-       *
-       * @return {Polymer.PropertyEffectsInterface} The parent model of this instance
-       */
-      get parentModel() {
-        let model = this.__parentModel;
-        if (!model) {
-          let options;
-          model = this
-          do {
-            // A template instance's `__dataHost` is a <template>
-            // `model.__dataHost.__dataHost` is the template's host
-            model = model.__dataHost.__dataHost;
-          } while ((options = model.__templatizeOptions) && !options.parentModel)
-          this.__parentModel = model;
-        }
-        return model;
-      }
-    }
-
-    const MutableTemplateInstanceBase = Polymer.MutableData(TemplateInstanceBase);
-
-    function findMethodHost(template) {
-      // Technically this should be the owner of the outermost template.
-      // In shadow dom, this is always getRootNode().host, but we can
-      // approximate this via cooperation with our dataHost always setting
-      // `_methodHost` as long as there were bindings (or id's) on this
-      // instance causing it to get a dataHost.
-      let templateHost = template.__dataHost;
-      return templateHost && templateHost._methodHost || templateHost;
-    }
-
-    function createTemplatizerClass(template, templateInfo, options) {
-      // Anonymous class created by the templatize
-      /**
-       * @unrestricted
-       */
-      let base = options.mutableData ?
-        MutableTemplateInstanceBase : TemplateInstanceBase;
-      let klass = class extends base { }
-      klass.prototype.__templatizeOptions = options;
-      klass.prototype._bindTemplate(template);
-      addNotifyEffects(klass, template, templateInfo, options);
-      return klass;
-    }
-
-    function addPropagateEffects(template, templateInfo, options) {
-      let userForwardHostProp = options.forwardHostProp;
-      if (userForwardHostProp) {
-        // Provide data API and property effects on memoized template class
-        let klass = templateInfo.templatizeTemplateClass;
-        if (!klass) {
-          let base = options.mutableData ? MutableDataTemplate : DataTemplate;
-          klass = templateInfo.templatizeTemplateClass =
-            class TemplatizedTemplate extends base {}
-          // Add template - >instances effects
-          // and host <- template effects
-          let hostProps = templateInfo.hostProps;
-          for (let prop in hostProps) {
-            klass.prototype._addPropertyEffect('_host_' + prop,
-              klass.prototype.PROPERTY_EFFECT_TYPES.PROPAGATE,
-              {fn: createForwardHostPropEffect(prop, userForwardHostProp)});
-            klass.prototype._createNotifyingProperty('_host_' + prop);
-          }
-        }
-        upgradeTemplate(template, klass);
-        // Mix any pre-bound data into __data; no need to flush this to
-        // instances since they pull from the template at instance-time
-        if (template.__dataProto) {
-          // Note, generally `__dataProto` could be chained, but it's guaranteed
-          // to not be since this is a vanilla template we just added effects to
-          Object.assign(template.__data, template.__dataProto);
-        }
-        // Clear any pending data for performance
-        template.__dataTemp = {};
-        template.__dataPending = null;
-        template.__dataOld = null;
-        template._flushProperties();
-      }
-    }
-
-    function createForwardHostPropEffect(hostProp, userForwardHostProp) {
-      return function forwardHostProp(template, prop, props) {
-        userForwardHostProp.call(template.__templatizeOwner,
-          prop.substring('_host_'.length), props[prop]);
-      }
-    }
-
-    function addNotifyEffects(klass, template, templateInfo, options) {
-      let hostProps = templateInfo.hostProps || {};
-      for (let iprop in options.instanceProps) {
-        delete hostProps[iprop];
-        let userNotifyInstanceProp = options.notifyInstanceProp;
-        if (userNotifyInstanceProp) {
-          klass.prototype._addPropertyEffect(iprop,
-            klass.prototype.PROPERTY_EFFECT_TYPES.NOTIFY,
-            {fn: createNotifyInstancePropEffect(iprop, userNotifyInstanceProp)});
-        }
-      }
-      if (options.forwardHostProp && template.__dataHost) {
-        for (let hprop in hostProps) {
-          klass.prototype._addPropertyEffect(hprop,
-            klass.prototype.PROPERTY_EFFECT_TYPES.NOTIFY,
-            {fn: createNotifyHostPropEffect()})
-        }
-      }
-    }
-
-    function createNotifyInstancePropEffect(instProp, userNotifyInstanceProp) {
-      return function notifyInstanceProp(inst, prop, props) {
-        userNotifyInstanceProp.call(inst.__templatizeOwner,
-          inst, prop, props[prop]);
-      }
-    }
-
-    function createNotifyHostPropEffect() {
-      return function notifyHostProp(inst, prop, props) {
-        inst.__dataHost._setPendingPropertyOrPath('_host_' + prop, props[prop], true, true);
-      }
-    }
-
-    /**
-     * Module for preparing and stamping instances of templates that utilize
-     * Polymer's data-binding and declarative event listener features.
-     *
-     * Example:
-     *
-     *     // Get a template from somewhere, e.g. light DOM
-     *     let template = this.querySelector('template');
-     *     // Prepare the template
-     *     let TemplateClass = Polymer.Templatize.templatize(template);
-     *     // Instance the template with an initial data model
-     *     let instance = new TemplateClass({myProp: 'initial'});
-     *     // Insert the instance's DOM somewhere, e.g. element's shadow DOM
-     *     this.shadowRoot.appendChild(instance.root);
-     *     // Changing a property on the instance will propagate to bindings
-     *     // in the template
-     *     instance.myProp = 'new value';
-     *
-     * The `options` dictionary passed to `templatize` allows for customizing
-     * features of the generated template class, including how outer-scope host
-     * properties should be forwarded into template instances, how any instance
-     * properties added into the template's scope should be notified out to
-     * the host, and whether the instance should be decorated as a "parent model"
-     * of any event handlers.
-     *
-     *     // Customze property forwarding and event model decoration
-     *     let TemplateClass = Polymer.Tempaltize.templatize(template, this, {
-     *       parentModel: true,
-     *       instanceProps: {...},
-     *       forwardHostProp(property, value) {...},
-     *       notifyInstanceProp(instance, property, value) {...},
-     *     });
-     *
-     *
-     * @namespace
-     * @memberof Polymer
-     * @summary Module for preparing and stamping instances of templates
-     *   utilizing Polymer templating features.
-     */
-    const Templatize = {
-
-      /**
-       * Returns an anonymous `Polymer.PropertyEffects` class bound to the
-       * `<template>` provided.  Instancing the class will result in the
-       * template being stamped into document fragment stored as the instance's
-       * `root` property, after which it can be appended to the DOM.
-       *
-       * Templates may utilize all Polymer data-binding features as well as
-       * declarative event listeners.  Event listeners and inline computing
-       * functions in the template will be called on the host of the template.
-       *
-       * The constructor returned takes a single argument dictionary of initial
-       * property values to propagate into template bindings.  Additionally
-       * host properties can be forwarded in, and instance properties can be
-       * notified out by providing optional callbacks in the `options` dictionary.
-       *
-       * Valid configuration in `options` are as follows:
-       *
-       * - `forwardHostProp(property, value)`: Called when a property referenced
-       *   in the template changed on the template's host. As this library does
-       *   not retain references to templates instanced by the user, it is the
-       *   templatize owner's responsibility to forward host property changes into
-       *   user-stamped instances.  The `instance.forwardHostProp(property, value)`
-       *    method on the generated class should be called to forward host
-       *   properties into the template to prevent unnecessary property-changed
-       *   notifications. Any properties referenced in the template that are not
-       *   defined in `instanceProps` will be notified up to the template's host
-       *   automatically.
-       * - `instanceProps`: Dictionary of property names that will be added
-       *   to the instance by the templatize owner.  These properties shadow any
-       *   host properties, and changes within the template to these properties
-       *   will result in `notifyInstanceProp` being called.
-       * - `mutableData`: When `true`, the generated class will skip strict
-       *   dirty-checking for objects and arrays (always consider them to be
-       *   "dirty").
-       * - `notifyInstanceProp(instance, property, value)`: Called when
-       *   an instance property changes.  Users may choose to call `notifyPath`
-       *   on e.g. the owner to notify the change.
-       * - `parentModel`: When `true`, events handled by declarative event listeners
-       *   (`on-event="handler"`) will be decorated with a `model` property pointing
-       *   to the template instance that stamped it.  It will also be returned
-       *   from `instance.parentModel` in cases where template instance nesting
-       *   causes an inner model to shadow an outer model.
-       *
-       * Note that the class returned from `templatize` is generated only once
-       * for a given `<template>` using `options` from the first call for that
-       * template, and the cached class is returned for all subsequent calls to
-       * `templatize` for that template.  As such, `options` callbacks should not
-       * close over owner-specific properties since only the first `options` is
-       * used; rather, callbacks are called bound to the `owner`, and so context
-       * needed from the callbacks (such as references to `instances` stamped)
-       * should be stored on the `owner` such that they can be retrieved via `this`.
-       *
-       * @memberof Polymer.Templatize
-       * @param {HTMLTemplateElement} template Template to templatize
-       * @param {*} owner Owner of the template instances; any optional callbacks
-       *   will be bound to this owner.
-       * @param {*=} options Options dictionary (see summary for details)
-       * @return {TemplateInstanceBase} Generated class bound to the template
-       *   provided
-       */
-      templatize(template, owner, options) {
-        options = options || {};
-        if (template.__templatizeOwner) {
-          throw new Error('A <template> can only be templatized once');
-        }
-        template.__templatizeOwner = owner;
-        let templateInfo = owner.constructor._parseTemplate(template);
-        // Get memoized base class for the prototypical template, which
-        // includes property effects for binding template & forwarding
-        let baseClass = templateInfo.templatizeInstanceClass;
-        if (!baseClass) {
-          baseClass = createTemplatizerClass(template, templateInfo, options);
-          templateInfo.templatizeInstanceClass = baseClass;
-        }
-        // Host property forwarding must be installed onto template instance
-        addPropagateEffects(template, templateInfo, options);
-        // Subclass base class and add reference for this specific template
-        let klass = class TemplateInstance extends baseClass {};
-        klass.prototype._methodHost = findMethodHost(template);
-        klass.prototype.__dataHost = template;
-        klass.prototype.__templatizeOwner = owner;
-        klass.prototype.__hostProps = templateInfo.hostProps;
-        return klass;
-      },
-
-      /**
-       * Returns the template "model" associated with a given element, which
-       * serves as the binding scope for the template instance the element is
-       * contained in. A template model is an instance of
-       * `TemplateInstanceBase`, and should be used to manipulate data
-       * associated with this template instance.
-       *
-       * Example:
-       *
-       *   let model = modelForElement(el);
-       *   if (model.index < 10) {
-       *     model.set('item.checked', true);
-       *   }
-       *
-       * @memberof Polymer.Templatize
-       * @param {HTMLTemplateElement} template The model will be returned for
-       *   elements stamped from this template
-       * @param {HTMLElement} el Element for which to return a template model.
-       * @return {TemplateInstanceBase} Template instance representing the
-       *   binding scope for the element
-       */
-      modelForElement(template, el) {
-        let model;
-        while (el) {
-          // An element with a __templatizeInstance marks the top boundary
-          // of a scope; walk up until we find one, and then ensure that
-          // its __dataHost matches `this`, meaning this dom-repeat stamped it
-          if ((model = el.__templatizeInstance)) {
-            // Found an element stamped by another template; keep walking up
-            // from its __dataHost
-            if (model.__dataHost != template) {
-              el = model.__dataHost;
-            } else {
-              return model;
-            }
-          } else {
-            // Still in a template scope, keep going up until
-            // a __templatizeInstance is found
-            el = el.parentNode;
-          }
-        }
-        return null;
-      }
-    }
-
-    Polymer.Templatize = Templatize;
-
-  })();
-
-</script>
diff --git a/src/main/resources/static/gltf-viewer/bower_components/polymer/lib/utils/unresolved.html b/src/main/resources/static/gltf-viewer/bower_components/polymer/lib/utils/unresolved.html
deleted file mode 100644 (file)
index 6c8752a..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-<!--
-@license
-Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
-This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
-The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
-The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
-Code distributed by Google as part of the polymer project is also
-subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
--->
-<script>
-(function() {
-  'use strict';
-
-  // unresolved
-
-  function resolve() {
-    document.body.removeAttribute('unresolved');
-  }
-
-  if (window.WebComponents) {
-    window.addEventListener('WebComponentsReady', resolve);
-  } else {
-    if (document.readyState === 'interactive' || document.readyState === 'complete') {
-      resolve();
-    } else {
-      window.addEventListener('DOMContentLoaded', resolve);
-    }
-  }
-
-})();
-</script>
diff --git a/src/main/resources/static/gltf-viewer/bower_components/polymer/polymer-element.html b/src/main/resources/static/gltf-viewer/bower_components/polymer/polymer-element.html
deleted file mode 100644 (file)
index 1dac595..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-<!--
-@license
-Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
-This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
-The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
-The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
-Code distributed by Google as part of the polymer project is also
-subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
--->
-<link rel="import" href="lib/mixins/element-mixin.html">
-<script>
-(function() {
-  'use strict';
-
-  /**
-   * Base class that provides the core API for Polymer's meta-programming
-   * features including template stamping, data-binding, attribute deserialization,
-   * and property change observation.
-   *
-   * @polymerElement
-   * @memberof Polymer
-   * @constructor
-   * @implements {Polymer_ElementMixin}
-   * @extends HTMLElement
-   * @mixes Polymer.ElementMixin
-   * @summary Custom element base class that provides the core API for Polymer's
-   *   key meta-programming features including template stamping, data-binding,
-   *   attribute deserialization, and property change observation
-   */
-  const Element = Polymer.ElementMixin(HTMLElement);
-  Polymer.Element = Element;
-})();
-</script>
\ No newline at end of file
diff --git a/src/main/resources/static/gltf-viewer/bower_components/polymer/polymer.html b/src/main/resources/static/gltf-viewer/bower_components/polymer/polymer.html
deleted file mode 100644 (file)
index 0331373..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-<!--
-@license
-Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
-This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
-The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
-The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
-Code distributed by Google as part of the polymer project is also
-subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
--->
-<link rel="import" href="lib/legacy/legacy-element-mixin.html">
-<link rel="import" href="lib/legacy/polymer-fn.html">
-<!-- template elements -->
-<link rel="import" href="lib/legacy/templatizer-behavior.html">
-<link rel="import" href="lib/elements/dom-bind.html">
-<link rel="import" href="lib/elements/dom-repeat.html">
-<link rel="import" href="lib/elements/dom-if.html">
-<link rel="import" href="lib/elements/array-selector.html">
-<!-- custom-style -->
-<link rel="import" href="lib/elements/custom-style.html">
-<!-- bc behaviors -->
-<link rel="import" href="lib/legacy/mutable-data-behavior.html">
-<script>
-  // bc
-  Polymer.Base = Polymer.LegacyElementMixin(HTMLElement).prototype;
-</script>
diff --git a/src/main/resources/static/gltf-viewer/bower_components/shadycss/apply-shim.html b/src/main/resources/static/gltf-viewer/bower_components/shadycss/apply-shim.html
deleted file mode 100644 (file)
index d344ec3..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-<!--
-@license
-Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
-This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
-The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
-The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
-Code distributed by Google as part of the polymer project is also
-subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
--->
-<script src="apply-shim.min.js"></script>
diff --git a/src/main/resources/static/gltf-viewer/bower_components/shadycss/apply-shim.min.js b/src/main/resources/static/gltf-viewer/bower_components/shadycss/apply-shim.min.js
deleted file mode 100644 (file)
index 7fec2ff..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-(function(){
-/*
-
-Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
-This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
-The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
-The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
-Code distributed by Google as part of the polymer project is also
-subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
-*/
-'use strict';var l={};function m(){this.end=this.start=0;this.rules=this.parent=this.previous=null;this.cssText=this.parsedCssText="";this.atRule=!1;this.type=0;this.parsedSelector=this.selector=this.keyframesName=""}
-function p(a){a=a.replace(aa,"").replace(ba,"");var b=q,c=a,d=new m;d.start=0;d.end=c.length;for(var e=d,f=0,h=c.length;f<h;f++)if("{"===c[f]){e.rules||(e.rules=[]);var g=e,k=g.rules[g.rules.length-1]||null,e=new m;e.start=f+1;e.parent=g;e.previous=k;g.rules.push(e)}else"}"===c[f]&&(e.end=f+1,e=e.parent||d);return b(d,a)}
-function q(a,b){var c=b.substring(a.start,a.end-1);a.parsedCssText=a.cssText=c.trim();a.parent&&((c=b.substring(a.previous?a.previous.end:a.parent.start,a.start-1),c=ca(c),c=c.replace(r," "),c=c.substring(c.lastIndexOf(";")+1),c=a.parsedSelector=a.selector=c.trim(),a.atRule=!c.indexOf("@"),a.atRule)?c.indexOf("@media")?c.match(da)&&(a.type=u,a.keyframesName=a.selector.split(r).pop()):a.type=t:a.type=c.indexOf("--")?v:y);if(c=a.rules)for(var d=0,e=c.length,f;d<e&&(f=c[d]);d++)q(f,b);return a}
-function ca(a){return a.replace(/\\([0-9a-f]{1,6})\s/gi,function(a,c){a=c;for(c=6-a.length;c--;)a="0"+a;return"\\"+a})}
-function z(a,b,c){c=void 0===c?"":c;var d="";if(a.cssText||a.rules){var e=a.rules,f;if(f=e)f=e[0],f=!(f&&f.selector&&0===f.selector.indexOf("--"));if(f){f=0;for(var h=e.length,g;f<h&&(g=e[f]);f++)d=z(g,b,d)}else b?b=a.cssText:(b=a.cssText,b=b.replace(ea,"").replace(fa,""),b=b.replace(ga,"").replace(ha,"")),(d=b.trim())&&(d="  "+d+"\n")}d&&(a.selector&&(c+=a.selector+" {\n"),c+=d,a.selector&&(c+="}\n\n"));return c}
-var v=1,u=7,t=4,y=1E3,aa=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//gim,ba=/@import[^;]*;/gim,ea=/(?:^[^;\-\s}]+)?--[^;{}]*?:[^{};]*?(?:[;\n]|$)/gim,fa=/(?:^[^;\-\s}]+)?--[^;{}]*?:[^{};]*?{[^}]*?}(?:[;\n]|$)?/gim,ga=/@apply\s*\(?[^);]*\)?\s*(?:[;\n]|$)?/gim,ha=/[^;:]*?:[^;]*?var\([^;]*\)(?:[;\n]|$)?/gim,da=/^@[^\s]*keyframes/,r=/\s+/g;var ia=Promise.resolve();function ja(a){if(a=l[a])a._applyShimCurrentVersion=a._applyShimCurrentVersion||0,a._applyShimValidatingVersion=a._applyShimValidatingVersion||0,a._applyShimNextVersion=(a._applyShimNextVersion||0)+1}function A(a){return a._applyShimCurrentVersion===a._applyShimNextVersion}function ka(a){a._applyShimValidatingVersion=a._applyShimNextVersion;a.a||(a.a=!0,ia.then(function(){a._applyShimCurrentVersion=a._applyShimNextVersion;a.a=!1}))};var B=/(?:^|[;\s{]\s*)(--[\w-]*?)\s*:\s*(?:([^;{]*)|{([^}]*)})(?:(?=[;\s}])|$)/gi,C=/(?:^|\W+)@apply\s*\(?([^);\n]*)\)?/gi,la=/@media[^(]*(\([^)]*\))/;var D=!(window.ShadyDOM&&window.ShadyDOM.inUse),E=!navigator.userAgent.match("AppleWebKit/601")&&window.CSS&&CSS.supports&&CSS.supports("box-shadow","0 0 0 var(--foo)");function F(a){a&&(E=E&&!a.nativeCss&&!a.shimcssproperties,D=D&&!a.nativeShadow&&!a.shimshadow)}window.ShadyCSS?F(window.ShadyCSS):window.WebComponents&&F(window.WebComponents.flags);var ma=D,G=E;function H(a){if(!a)return"";"string"===typeof a&&(a=p(a));return z(a,G)}function I(a){!a.__cssRules&&a.textContent&&(a.__cssRules=p(a.textContent));return a.__cssRules||null}function J(a,b,c,d){if(a){var e=!1,f=a.type;if(d&&f===t){var h=a.selector.match(la);h&&(window.matchMedia(h[1]).matches||(e=!0))}f===v?b(a):c&&f===u?c(a):f===y&&(e=!0);if((a=a.rules)&&!e)for(var e=0,f=a.length,g;e<f&&(g=a[e]);e++)J(g,b,c,d)}}
-function K(a,b){var c=a.indexOf("var(");if(-1===c)return b(a,"","","");var d;a:{var e=0;d=c+3;for(var f=a.length;d<f;d++)if("("===a[d])e++;else if(")"===a[d]&&!--e)break a;d=-1}e=a.substring(c+4,d);c=a.substring(0,c);a=K(a.substring(d+1),b);d=e.indexOf(",");return-1===d?b(c,e.trim(),"",a):b(c,e.substring(0,d).trim(),e.substring(d+1).trim(),a)};var na=/;\s*/m,oa=/^\s*(initial)|(inherit)\s*$/;function L(){this.a={}}L.prototype.set=function(a,b){a=a.trim();this.a[a]={h:b,i:{}}};L.prototype.get=function(a){a=a.trim();return this.a[a]||null};var M=null;function N(){this.b=this.c=null;this.a=new L}N.prototype.o=function(a){a=C.test(a)||B.test(a);C.lastIndex=0;B.lastIndex=0;return a};N.prototype.m=function(a,b){a=a.content.querySelector("style");var c=null;a&&(c=this.j(a,b));return c};
-N.prototype.j=function(a,b){b=void 0===b?"":b;var c=I(a);this.l(c,b);a.textContent=H(c);return c};N.prototype.f=function(a){var b=this,c=I(a);J(c,function(a){":root"===a.selector&&(a.selector="html");b.g(a)});a.textContent=H(c);return c};N.prototype.l=function(a,b){var c=this;this.c=b;J(a,function(a){c.g(a)});this.c=null};N.prototype.g=function(a){a.cssText=pa(this,a.parsedCssText);":root"===a.selector&&(a.selector=":host > *")};
-function pa(a,b){b=b.replace(B,function(b,d,e,f){return qa(a,b,d,e,f)});return O(a,b)}function O(a,b){for(var c;c=C.exec(b);){var d=c[0],e=c[1];c=c.index;var f=b.slice(0,c+d.indexOf("@apply"));b=b.slice(c+d.length);var h=P(a,f),g,k,d=void 0;g=a;var e=e.replace(na,""),n=[];k=g.a.get(e);k||(g.a.set(e,{}),k=g.a.get(e));if(k)for(d in g.c&&(k.i[g.c]=!0),k.h)g=h&&h[d],k=[d,": var(",e,"_-_",d],g&&k.push(",",g),k.push(")"),n.push(k.join(""));d=n.join("; ");b=""+f+d+b;C.lastIndex=c+d.length}return b}
-function P(a,b){b=b.split(";");for(var c,d,e={},f=0,h;f<b.length;f++)if(c=b[f])if(h=c.split(":"),1<h.length){c=h[0].trim();var g=a;d=c;h=h.slice(1).join(":");var k=oa.exec(h);k&&(k[1]?(g.b||(g.b=document.createElement("meta"),g.b.setAttribute("apply-shim-measure",""),g.b.style.all="initial",document.head.appendChild(g.b)),d=window.getComputedStyle(g.b).getPropertyValue(d)):d="apply-shim-inherit",h=d);d=h;e[c]=d}return e}function ra(a,b){if(M)for(var c in b.i)c!==a.c&&M(c)}
-function qa(a,b,c,d,e){d&&K(d,function(b,c){c&&a.a.get(c)&&(e="@apply "+c+";")});if(!e)return b;var f=O(a,e),h=b.slice(0,b.indexOf("--")),g=f=P(a,f),k=a.a.get(c),n=k&&k.h;n?g=Object.assign(Object.create(n),f):a.a.set(c,g);var X=[],w,x,Y=!1;for(w in g)x=f[w],void 0===x&&(x="initial"),!n||w in n||(Y=!0),X.push(""+c+"_-_"+w+": "+x);Y&&ra(a,k);k&&(k.h=g);d&&(h=b+";"+h);return""+h+X.join("; ")+";"}N.prototype.detectMixin=N.prototype.o;N.prototype.transformStyle=N.prototype.j;
-N.prototype.transformCustomStyle=N.prototype.f;N.prototype.transformRules=N.prototype.l;N.prototype.transformRule=N.prototype.g;N.prototype.transformTemplate=N.prototype.m;N.prototype._separator="_-_";Object.defineProperty(N.prototype,"invalidCallback",{get:function(){return M},set:function(a){M=a}});var Q=null,R=window.HTMLImports&&window.HTMLImports.whenReady||null,S;function sa(a){requestAnimationFrame(function(){R?R(a):(Q||(Q=new Promise(function(a){S=a}),"complete"===document.readyState?S():document.addEventListener("readystatechange",function(){"complete"===document.readyState&&S()})),Q.then(function(){a&&a()}))})};var T=new N;function U(){var a=this;this.a=null;this.b=!1;sa(function(){V(a)});T.invalidCallback=ja}function V(a){a.b||(a.a=window.ShadyCSS.CustomStyleInterface,a.a&&(a.a.transformCallback=function(a){T.f(a)},a.a.validateCallback=function(){requestAnimationFrame(function(){a.a.enqueued&&W(a)})}),a.b=!0)}U.prototype.prepareTemplate=function(a,b){V(this);l[b]=a;b=T.m(a,b);a._styleAst=b};
-function W(a){V(a);if(a.a){var b=a.a.processStyles();if(a.a.enqueued){for(var c=0;c<b.length;c++){var d=a.a.getStyleForCustomStyle(b[c]);d&&T.f(d)}a.a.enqueued=!1}}}U.prototype.styleSubtree=function(a,b){V(this);if(b)for(var c in b)null===c?a.style.removeProperty(c):a.style.setProperty(c,b[c]);if(a.shadowRoot)for(this.styleElement(a),a=a.shadowRoot.children||a.shadowRoot.childNodes,b=0;b<a.length;b++)this.styleSubtree(a[b]);else for(a=a.children||a.childNodes,b=0;b<a.length;b++)this.styleSubtree(a[b])};
-U.prototype.styleElement=function(a){V(this);var b=a.localName,c;b?-1<b.indexOf("-")?c=b:c=a.getAttribute&&a.getAttribute("is")||"":c=a.is;if((b=l[c])&&!A(b)){if(A(b)||b._applyShimValidatingVersion!==b._applyShimNextVersion)this.prepareTemplate(b,c),ka(b);if(a=a.shadowRoot)if(a=a.querySelector("style"))a.__cssRules=b._styleAst,a.textContent=H(b._styleAst)}};U.prototype.styleDocument=function(a){V(this);this.styleSubtree(document.body,a)};
-if(!window.ShadyCSS||!window.ShadyCSS.ScopingShim){var Z=new U,ta=window.ShadyCSS&&window.ShadyCSS.CustomStyleInterface;window.ShadyCSS={prepareTemplate:function(a,b){W(Z);Z.prepareTemplate(a,b)},styleSubtree:function(a,b){W(Z);Z.styleSubtree(a,b)},styleElement:function(a){W(Z);Z.styleElement(a)},styleDocument:function(a){W(Z);Z.styleDocument(a)},getComputedStyleValue:function(a,b){return(a=window.getComputedStyle(a).getPropertyValue(b))?a.trim():""},nativeCss:G,nativeShadow:ma};ta&&(window.ShadyCSS.CustomStyleInterface=
-ta)}window.ShadyCSS.ApplyShim=T;
-}).call(self);
-
-//# sourceMappingURL=apply-shim.min.js.map
diff --git a/src/main/resources/static/gltf-viewer/bower_components/shadycss/apply-shim.min.js.map b/src/main/resources/static/gltf-viewer/bower_components/shadycss/apply-shim.min.js.map
deleted file mode 100644 (file)
index e510883..0000000
+++ /dev/null
@@ -1 +0,0 @@
-{"version":3,"sources":["src/template-map.js","src/css-parse.js","src/apply-shim-utils.js","src/common-regex.js","src/style-settings.js","src/style-util.js","src/apply-shim.js","src/document-wait.js","entrypoints/apply-shim.js","src/common-utils.js"],"names":["templateMap","constructor","StyleNode","parse$$module$$src$css_parse","parse","text","replace","RX$$module$$src$css_parse.comments","RX$$module$$src$css_parse.port","parseCss","root","length","n","i","l","OPEN_BRACE","p","previous","push","CLOSE_BRACE","parseCss$$module$$src$css_parse","node","t","substring","trim","ss","_expandUnicodeEscapes","RX$$module$$src$css_parse.multipleSpaces","lastIndexOf","s","indexOf","AT_START","MEDIA_START","match","RX$$module$$src$css_parse.keyframesRule","types$$module$$src$css_parse.KEYFRAMES_RULE","split","pop","types$$module$$src$css_parse.MEDIA_RULE","VAR_START","types$$module$$src$css_parse.STYLE_RULE","types$$module$$src$css_parse.MIXIN_RULE","r$","r","_expandUnicodeEscapes$$module$$src$css_parse","code","repeat","stringify$$module$$src$css_parse","stringify","preserveProperties","cssText","rules","RX$$module$$src$css_parse.customProp","RX$$module$$src$css_parse.mixinProp","RX$$module$$src$css_parse.mixinApply","RX$$module$$src$css_parse.varApply","STYLE_RULE","KEYFRAMES_RULE","MEDIA_RULE","MIXIN_RULE","comments","port","customProp","mixinProp","mixinApply","varApply","keyframesRule","multipleSpaces","promise","Promise","resolve","invalidate$$module$$src$apply_shim_utils","invalidate","elementName","template","templateIsValid$$module$$src$apply_shim_utils","templateIsValid","startValidatingTemplate$$module$$src$apply_shim_utils","startValidatingTemplate","_validating","then","VAR_ASSIGN","MIXIN_MATCH","MEDIA_MATCH","nativeShadow","window","nativeCssVariables","navigator","userAgent","CSS","supports","parseSettings$$module$$src$style_settings","parseSettings","settings","ShadyCSS","module$$src$style_settings.nativeShadow","module$$src$style_settings.nativeCssVariables","toCssText$$module$$src$style_util","toCssText","rulesForStyle$$module$$src$style_util","rulesForStyle","style","textContent","forEachRule$$module$$src$style_util","forEachRule","styleRuleCallback","keyframesRuleCallback","onlyActiveRules","skipRules","type","matchMedia","matches","processVariableAndFallback$$module$$src$style_util","processVariableAndFallback","str","callback","start","end","level","inner","prefix","suffix","comma","value","fallback","APPLY_NAME_CLEAN","INITIAL_INHERIT","MixinMap","_map","set","name","props","properties","dependants","get","invalidCallback","ApplyShim","_measureElement","_currentElement","detectMixin","has","test","lastIndex","transformTemplate","content","querySelector","ast","transformStyle","transformRules","transformCustomStyle","rule","transformRule","transformCssText","matchText","propertyName","valueProperty","valueMixin","_produceCssProperties","_consumeCssProperties","m","exec","mixinName","idx","index","textBeforeApply","slice","textAfterApply","defaults","_cssTextToMap","f","parts","_atApplyToCssProperties","vars","mixinEntry","fallbacks","MIXIN_VAR_SEP","join","replacement","property","out","sp","_replaceInitialOrInherit","document","createElement","setAttribute","all","head","appendChild","getComputedStyle","getPropertyValue","_invalidateMixinEntry","mixinAsProperties","combinedProps","mixinValues","oldProps","Object","assign","create","v","needToInvalidate","undefined","prototype","defineProperty","cb","readyPromise","whenReady","resolveFn","documentWait$$module$$src$document_wait","documentWait","requestAnimationFrame","readyState","addEventListener","applyShim","ApplyShimInterface","customStyleInterface","booted","ensure","CustomStyleInterface","flushCustomStyles","prepareTemplate","styles","cs","styleSubtree","element","removeProperty","setProperty","shadowRoot","styleElement","shadowChildren","children","childNodes","localName","is","getAttribute","styleDocument","body","ScopingShim","applyShimInterface","getComputedStyleValue","nativeCss"],"mappings":"A;;;;;;;;;;aAeA,IAAMA,EAAc,E,CCIlBC,QADIC,EACO,EAAG,CAIZ,IAAA,IAAA,CAFA,IAAA,MAEA,CAFgB,CAQhB,KAAA,MAAA,CAFA,IAAA,OAEA,CAJA,IAAA,SAIA,CAJmB,IAQnB,KAAA,QAAA,CAFA,IAAA,cAEA,CAFwB,EAIxB,KAAA,OAAA,CAAiB,CAAA,CAEjB,KAAA,KAAA,CAAe,CAMf,KAAA,eAAA,CAFA,IAAA,SAEA,CAJA,IAAA,cAIA,CAJwB,EApBZ;AAmCTC,QAASC,EAAK,CAACC,CAAD,CAAO,CAC1BA,CAAA,CAAaA,CAUNC,QAAA,CAAgBC,EAAhB,CAA6B,EAA7B,CAAAD,QAAA,CAAyCE,EAAzC,CAAkD,EAAlD,CATAC,KAAAA,EAAAA,CAAAA,CAAaJ,EAAAA,CAAbI,CAkBHC,EAAO,IAAIR,CACfQ,EAAA,MAAA,CAAgB,CAChBA,EAAA,IAAA,CAAcL,CAAAM,OAEd,KADA,IAAIC,EAAIF,CAAR,CACSG,EAAI,CADb,CACgBC,EAAIT,CAAAM,OAApB,CAAiCE,CAAjC,CAAqCC,CAArC,CAAwCD,CAAA,EAAxC,CACE,GAuKeE,GAvKf,GAAIV,CAAA,CAAKQ,CAAL,CAAJ,CAA4B,CACrBD,CAAA,MAAL,GACEA,CAAA,MADF,CACe,EADf,CAGA,KAAII,EAAIJ,CAAR,CACIK,EAAWD,CAAA,MAAA,CAAWA,CAAA,MAAAL,OAAX,CAA+B,CAA/B,CAAXM,EAAgD,IADpD,CAEAL,EAAI,IAAIV,CACRU,EAAA,MAAA,CAAaC,CAAb,CAAiB,CACjBD,EAAA,OAAA,CAAcI,CACdJ,EAAA,SAAA,CAAgBK,CAChBD,EAAA,MAAAE,KAAA,CAAgBN,CAAhB,CAV0B,CAA5B,IAwKgBO,GA7JT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,CAAAmB,CAAA,CACAA,EAAAH,cAAA,CAAiCtG,CAAjC,CAFwB,CA/BV,CAyChB0G,sBAAAA,QAAqB,CAACf,CAAD,CAAU7C,CAAV,CAAoB,CACvC,MClJJ,CADMvD,CACN,CADctC,MAAAuG,iBAAA,CDmJmBmC,CCnJnB,CAAAlC,iBAAA,CDmJ4BX,CCnJ5B,CACd,EAGSvD,CAAAnG,KAAA,EAHT,CACS,EDgJkC,CAzCzB,CA4ChBuN,UAAW/I,CA5CK,CA6ChBZ,aAAcW,EA7CE,CAgDd0H,GAAJ,GACEpI,MAAAS,SAAA2H,qBADF;AACyCA,EADzC,CApDoD,CAyDtDpI,MAAAS,SAAA0C,UAAA,CAA4B4E","file":"apply-shim.min.js","sourcesContent":["/**\n@license\nCopyright (c) 2017 The Polymer Project Authors. All rights reserved.\nThis code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt\nThe complete set of authors may be found at http://polymer.github.io/AUTHORS.txt\nThe complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt\nCode distributed by Google as part of the polymer project is also\nsubject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt\n*/\n\n'use strict';\n\n/**\n * @const {!Object<string, !HTMLTemplateElement>}\n */\nconst templateMap = {};\nexport default templateMap;\n","/**\n@license\nCopyright (c) 2017 The Polymer Project Authors. All rights reserved.\nThis code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt\nThe complete set of authors may be found at http://polymer.github.io/AUTHORS.txt\nThe complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt\nCode distributed by Google as part of the polymer project is also\nsubject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt\n*/\n\n/*\nExtremely simple css parser. Intended to be not more than what we need\nand definitely not necessarily correct =).\n*/\n\n'use strict';\n\n/** @unrestricted */\nclass StyleNode {\n  constructor() {\n    /** @type {number} */\n    this['start'] = 0;\n    /** @type {number} */\n    this['end'] = 0;\n    /** @type {StyleNode} */\n    this['previous'] = null;\n    /** @type {StyleNode} */\n    this['parent'] = null;\n    /** @type {Array<StyleNode>} */\n    this['rules'] = null;\n    /** @type {string} */\n    this['parsedCssText'] = '';\n    /** @type {string} */\n    this['cssText'] = '';\n    /** @type {boolean} */\n    this['atRule'] = false;\n    /** @type {number} */\n    this['type'] = 0;\n    /** @type {string} */\n    this['keyframesName'] = '';\n    /** @type {string} */\n    this['selector'] = '';\n    /** @type {string} */\n    this['parsedSelector'] = '';\n  }\n}\n\nexport {StyleNode}\n\n// given a string of css, return a simple rule tree\n/**\n * @param {string} text\n * @return {StyleNode}\n */\nexport function parse(text) {\n  text = clean(text);\n  return parseCss(lex(text), text);\n}\n\n// remove stuff we don't care about that may hinder parsing\n/**\n * @param {string} cssText\n * @return {string}\n */\nfunction clean(cssText) {\n  return cssText.replace(RX.comments, '').replace(RX.port, '');\n}\n\n// super simple {...} lexer that returns a node tree\n/**\n * @param {string} text\n * @return {StyleNode}\n */\nfunction lex(text) {\n  let root = new StyleNode();\n  root['start'] = 0;\n  root['end'] = text.length\n  let n = root;\n  for (let i = 0, l = text.length; i < l; i++) {\n    if (text[i] === OPEN_BRACE) {\n      if (!n['rules']) {\n        n['rules'] = [];\n      }\n      let p = n;\n      let previous = p['rules'][p['rules'].length - 1] || null;\n      n = new StyleNode();\n      n['start'] = i + 1;\n      n['parent'] = p;\n      n['previous'] = previous;\n      p['rules'].push(n);\n    } else if (text[i] === CLOSE_BRACE) {\n      n['end'] = i + 1;\n      n = n['parent'] || root;\n    }\n  }\n  return root;\n}\n\n// add selectors/cssText to node tree\n/**\n * @param {StyleNode} node\n * @param {string} text\n * @return {StyleNode}\n */\nfunction parseCss(node, text) {\n  let t = text.substring(node['start'], node['end'] - 1);\n  node['parsedCssText'] = node['cssText'] = t.trim();\n  if (node['parent']) {\n    let ss = node['previous'] ? node['previous']['end'] : node['parent']['start'];\n    t = text.substring(ss, node['start'] - 1);\n    t = _expandUnicodeEscapes(t);\n    t = t.replace(RX.multipleSpaces, ' ');\n    // TODO(sorvell): ad hoc; make selector include only after last ;\n    // helps with mixin syntax\n    t = t.substring(t.lastIndexOf(';') + 1);\n    let s = node['parsedSelector'] = node['selector'] = t.trim();\n    node['atRule'] = (s.indexOf(AT_START) === 0);\n    // note, support a subset of rule types...\n    if (node['atRule']) {\n      if (s.indexOf(MEDIA_START) === 0) {\n        node['type'] = types.MEDIA_RULE;\n      } else if (s.match(RX.keyframesRule)) {\n        node['type'] = types.KEYFRAMES_RULE;\n        node['keyframesName'] =\n          node['selector'].split(RX.multipleSpaces).pop();\n      }\n    } else {\n      if (s.indexOf(VAR_START) === 0) {\n        node['type'] = types.MIXIN_RULE;\n      } else {\n        node['type'] = types.STYLE_RULE;\n      }\n    }\n  }\n  let r$ = node['rules'];\n  if (r$) {\n    for (let i = 0, l = r$.length, r;\n      (i < l) && (r = r$[i]); i++) {\n      parseCss(r, text);\n    }\n  }\n  return node;\n}\n\n/**\n * conversion of sort unicode escapes with spaces like `\\33 ` (and longer) into\n * expanded form that doesn't require trailing space `\\000033`\n * @param {string} s\n * @return {string}\n */\nfunction _expandUnicodeEscapes(s) {\n  return s.replace(/\\\\([0-9a-f]{1,6})\\s/gi, function() {\n    let code = arguments[1],\n      repeat = 6 - code.length;\n    while (repeat--) {\n      code = '0' + code;\n    }\n    return '\\\\' + code;\n  });\n}\n\n/**\n * stringify parsed css.\n * @param {StyleNode} node\n * @param {boolean=} preserveProperties\n * @param {string=} text\n * @return {string}\n */\nexport function stringify(node, preserveProperties, text = '') {\n  // calc rule cssText\n  let cssText = '';\n  if (node['cssText'] || node['rules']) {\n    let r$ = node['rules'];\n    if (r$ && !_hasMixinRules(r$)) {\n      for (let i = 0, l = r$.length, r;\n        (i < l) && (r = r$[i]); i++) {\n        cssText = stringify(r, preserveProperties, cssText);\n      }\n    } else {\n      cssText = preserveProperties ? node['cssText'] :\n        removeCustomProps(node['cssText']);\n      cssText = cssText.trim();\n      if (cssText) {\n        cssText = '  ' + cssText + '\\n';\n      }\n    }\n  }\n  // emit rule if there is cssText\n  if (cssText) {\n    if (node['selector']) {\n      text += node['selector'] + ' ' + OPEN_BRACE + '\\n';\n    }\n    text += cssText;\n    if (node['selector']) {\n      text += CLOSE_BRACE + '\\n\\n';\n    }\n  }\n  return text;\n}\n\n/**\n * @param {Array<StyleNode>} rules\n * @return {boolean}\n */\nfunction _hasMixinRules(rules) {\n  let r = rules[0];\n  return Boolean(r) && Boolean(r['selector']) && r['selector'].indexOf(VAR_START) === 0;\n}\n\n/**\n * @param {string} cssText\n * @return {string}\n */\nfunction removeCustomProps(cssText) {\n  cssText = removeCustomPropAssignment(cssText);\n  return removeCustomPropApply(cssText);\n}\n\n/**\n * @param {string} cssText\n * @return {string}\n */\nexport function removeCustomPropAssignment(cssText) {\n  return cssText\n    .replace(RX.customProp, '')\n    .replace(RX.mixinProp, '');\n}\n\n/**\n * @param {string} cssText\n * @return {string}\n */\nfunction removeCustomPropApply(cssText) {\n  return cssText\n    .replace(RX.mixinApply, '')\n    .replace(RX.varApply, '');\n}\n\n/** @enum {number} */\nexport const types = {\n  STYLE_RULE: 1,\n  KEYFRAMES_RULE: 7,\n  MEDIA_RULE: 4,\n  MIXIN_RULE: 1000\n}\n\nconst OPEN_BRACE = '{';\nconst CLOSE_BRACE = '}';\n\n// helper regexp's\nconst RX = {\n  comments: /\\/\\*[^*]*\\*+([^/*][^*]*\\*+)*\\//gim,\n  port: /@import[^;]*;/gim,\n  customProp: /(?:^[^;\\-\\s}]+)?--[^;{}]*?:[^{};]*?(?:[;\\n]|$)/gim,\n  mixinProp: /(?:^[^;\\-\\s}]+)?--[^;{}]*?:[^{};]*?{[^}]*?}(?:[;\\n]|$)?/gim,\n  mixinApply: /@apply\\s*\\(?[^);]*\\)?\\s*(?:[;\\n]|$)?/gim,\n  varApply: /[^;:]*?:[^;]*?var\\([^;]*\\)(?:[;\\n]|$)?/gim,\n  keyframesRule: /^@[^\\s]*keyframes/,\n  multipleSpaces: /\\s+/g\n}\n\nconst VAR_START = '--';\nconst MEDIA_START = '@media';\nconst AT_START = '@';\n","/**\n@license\nCopyright (c) 2017 The Polymer Project Authors. All rights reserved.\nThis code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt\nThe complete set of authors may be found at http://polymer.github.io/AUTHORS.txt\nThe complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt\nCode distributed by Google as part of the polymer project is also\nsubject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt\n*/\n\n'use strict';\nimport templateMap from './template-map'\nimport {StyleNode} from './css-parse' // eslint-disable-line no-unused-vars\n\n/*\n * Utilities for handling invalidating apply-shim mixins for a given template.\n *\n * The invalidation strategy involves keeping track of the \"current\" version of a template's mixins, and updating that count when a mixin is invalidated.\n * The template\n */\n\n/** @const {string} */\nconst CURRENT_VERSION = '_applyShimCurrentVersion';\n\n/** @const {string} */\nconst NEXT_VERSION = '_applyShimNextVersion';\n\n/** @const {string} */\nconst VALIDATING_VERSION = '_applyShimValidatingVersion';\n\n/**\n * @const {Promise<void>}\n */\nconst promise = Promise.resolve();\n\n/**\n * @param {string} elementName\n */\nexport function invalidate(elementName){\n  let template = templateMap[elementName];\n  if (template) {\n    invalidateTemplate(template);\n  }\n}\n\n/**\n * This function can be called multiple times to mark a template invalid\n * and signal that the style inside must be regenerated.\n *\n * Use `startValidatingTemplate` to begin an asynchronous validation cycle.\n * During that cycle, call `templateIsValidating` to see if the template must\n * be revalidated\n * @param {HTMLTemplateElement} template\n */\nexport function invalidateTemplate(template) {\n  // default the current version to 0\n  template[CURRENT_VERSION] = template[CURRENT_VERSION] || 0;\n  // ensure the \"validating for\" flag exists\n  template[VALIDATING_VERSION] = template[VALIDATING_VERSION] || 0;\n  // increment the next version\n  template[NEXT_VERSION] = (template[NEXT_VERSION] || 0) + 1;\n}\n\n/**\n * @param {string} elementName\n * @return {boolean}\n */\nexport function isValid(elementName) {\n  let template = templateMap[elementName];\n  if (template) {\n    return templateIsValid(template);\n  }\n  return true;\n}\n\n/**\n * @param {HTMLTemplateElement} template\n * @return {boolean}\n */\nexport function templateIsValid(template) {\n  return template[CURRENT_VERSION] === template[NEXT_VERSION];\n}\n\n/**\n * @param {string} elementName\n * @return {boolean}\n */\nexport function isValidating(elementName) {\n  let template = templateMap[elementName];\n  if (template) {\n    return templateIsValidating(template);\n  }\n  return false;\n}\n\n/**\n * Returns true if the template is currently invalid and `startValidating` has been called since the last invalidation.\n * If false, the template must be validated.\n * @param {HTMLTemplateElement} template\n * @return {boolean}\n */\nexport function templateIsValidating(template) {\n  return !templateIsValid(template) && template[VALIDATING_VERSION] === template[NEXT_VERSION];\n}\n\n/**\n * the template is marked as `validating` for one microtask so that all instances\n * found in the tree crawl of `applyStyle` will update themselves,\n * but the template will only be updated once.\n * @param {string} elementName\n*/\nexport function startValidating(elementName) {\n  let template = templateMap[elementName];\n  startValidatingTemplate(template);\n}\n\n/**\n * Begin an asynchronous invalidation cycle.\n * This should be called after every validation of a template\n *\n * After one microtask, the template will be marked as valid until the next call to `invalidateTemplate`\n * @param {HTMLTemplateElement} template\n */\nexport function startValidatingTemplate(template) {\n  // remember that the current \"next version\" is the reason for this validation cycle\n  template[VALIDATING_VERSION] = template[NEXT_VERSION];\n  // however, there only needs to be one async task to clear the counters\n  if (!template._validating) {\n    template._validating = true;\n    promise.then(function() {\n      // sync the current version to let future invalidations cause a refresh cycle\n      template[CURRENT_VERSION] = template[NEXT_VERSION];\n      template._validating = false;\n    });\n  }\n}\n\n/**\n * @return {boolean}\n */\nexport function elementsAreInvalid() {\n  for (let elementName in templateMap) {\n    let template = templateMap[elementName];\n    if (!templateIsValid(template)) {\n      return true;\n    }\n  }\n  return false;\n}","/**\n@license\nCopyright (c) 2017 The Polymer Project Authors. All rights reserved.\nThis code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt\nThe complete set of authors may be found at http://polymer.github.io/AUTHORS.txt\nThe complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt\nCode distributed by Google as part of the polymer project is also\nsubject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt\n*/\n\nexport const VAR_ASSIGN = /(?:^|[;\\s{]\\s*)(--[\\w-]*?)\\s*:\\s*(?:([^;{]*)|{([^}]*)})(?:(?=[;\\s}])|$)/gi;\nexport const MIXIN_MATCH = /(?:^|\\W+)@apply\\s*\\(?([^);\\n]*)\\)?/gi;\nexport const VAR_CONSUMED = /(--[\\w-]+)\\s*([:,;)]|$)/gi;\nexport const ANIMATION_MATCH = /(animation\\s*:)|(animation-name\\s*:)/;\nexport const MEDIA_MATCH = /@media[^(]*(\\([^)]*\\))/;\nexport const IS_VAR = /^--/;\nexport const BRACKETED = /\\{[^}]*\\}/g;\nexport const HOST_PREFIX = '(?:^|[^.#[:])';\nexport const HOST_SUFFIX = '($|[.:[\\\\s>+~])';","/**\n@license\nCopyright (c) 2017 The Polymer Project Authors. All rights reserved.\nThis code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt\nThe complete set of authors may be found at http://polymer.github.io/AUTHORS.txt\nThe complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt\nCode distributed by Google as part of the polymer project is also\nsubject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt\n*/\n\n'use strict';\n\nexport let nativeShadow = !(window['ShadyDOM'] && window['ShadyDOM']['inUse']);\n// chrome 49 has semi-working css vars, check if box-shadow works\n// safari 9.1 has a recalc bug: https://bugs.webkit.org/show_bug.cgi?id=155782\nexport let nativeCssVariables = (!navigator.userAgent.match('AppleWebKit/601') &&\nwindow.CSS && CSS.supports && CSS.supports('box-shadow', '0 0 0 var(--foo)'));\n\n/**\n * @param {ShadyCSSOptions | ShadyCSSInterface | undefined} settings\n */\nfunction parseSettings(settings) {\n  if (settings) {\n    nativeCssVariables = nativeCssVariables && !settings['nativeCss'] && !settings['shimcssproperties'];\n    nativeShadow = nativeShadow && !settings['nativeShadow'] && !settings['shimshadow'];\n  }\n}\n\nif (window.ShadyCSS) {\n  parseSettings(window.ShadyCSS);\n} else if (window['WebComponents']) {\n  parseSettings(window['WebComponents']['flags']);\n}\n","/**\n@license\nCopyright (c) 2017 The Polymer Project Authors. All rights reserved.\nThis code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt\nThe complete set of authors may be found at http://polymer.github.io/AUTHORS.txt\nThe complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt\nCode distributed by Google as part of the polymer project is also\nsubject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt\n*/\n\n'use strict';\n\nimport {nativeShadow, nativeCssVariables} from './style-settings'\nimport {parse, stringify, types, StyleNode} from './css-parse' // eslint-disable-line no-unused-vars\nimport {MEDIA_MATCH} from './common-regex';\n\n/**\n * @param {string|StyleNode} rules\n * @param {function(StyleNode)=} callback\n * @return {string}\n */\nexport function toCssText (rules, callback) {\n  if (!rules) {\n    return '';\n  }\n  if (typeof rules === 'string') {\n    rules = parse(rules);\n  }\n  if (callback) {\n    forEachRule(rules, callback);\n  }\n  return stringify(rules, nativeCssVariables);\n}\n\n/**\n * @param {HTMLStyleElement} style\n * @return {StyleNode}\n */\nexport function rulesForStyle(style) {\n  if (!style['__cssRules'] && style.textContent) {\n    style['__cssRules'] = parse(style.textContent);\n  }\n  return style['__cssRules'] || null;\n}\n\n// Tests if a rule is a keyframes selector, which looks almost exactly\n// like a normal selector but is not (it has nothing to do with scoping\n// for example).\n/**\n * @param {StyleNode} rule\n * @return {boolean}\n */\nexport function isKeyframesSelector(rule) {\n  return Boolean(rule['parent']) &&\n  rule['parent']['type'] === types.KEYFRAMES_RULE;\n}\n\n/**\n * @param {StyleNode} node\n * @param {Function=} styleRuleCallback\n * @param {Function=} keyframesRuleCallback\n * @param {boolean=} onlyActiveRules\n */\nexport function forEachRule(node, styleRuleCallback, keyframesRuleCallback, onlyActiveRules) {\n  if (!node) {\n    return;\n  }\n  let skipRules = false;\n  let type = node['type'];\n  if (onlyActiveRules) {\n    if (type === types.MEDIA_RULE) {\n      let matchMedia = node['selector'].match(MEDIA_MATCH);\n      if (matchMedia) {\n        // if rule is a non matching @media rule, skip subrules\n        if (!window.matchMedia(matchMedia[1]).matches) {\n          skipRules = true;\n        }\n      }\n    }\n  }\n  if (type === types.STYLE_RULE) {\n    styleRuleCallback(node);\n  } else if (keyframesRuleCallback &&\n    type === types.KEYFRAMES_RULE) {\n    keyframesRuleCallback(node);\n  } else if (type === types.MIXIN_RULE) {\n    skipRules = true;\n  }\n  let r$ = node['rules'];\n  if (r$ && !skipRules) {\n    for (let i=0, l=r$.length, r; (i<l) && (r=r$[i]); i++) {\n      forEachRule(r, styleRuleCallback, keyframesRuleCallback, onlyActiveRules);\n    }\n  }\n}\n\n// add a string of cssText to the document.\n/**\n * @param {string} cssText\n * @param {string} moniker\n * @param {Node} target\n * @param {Node} contextNode\n * @return {HTMLStyleElement}\n */\nexport function applyCss(cssText, moniker, target, contextNode) {\n  let style = createScopeStyle(cssText, moniker);\n  applyStyle(style, target, contextNode);\n  return style;\n}\n\n/**\n * @param {string} cssText\n * @param {string} moniker\n * @return {HTMLStyleElement}\n */\nexport function createScopeStyle(cssText, moniker) {\n  let style = /** @type {HTMLStyleElement} */(document.createElement('style'));\n  if (moniker) {\n    style.setAttribute('scope', moniker);\n  }\n  style.textContent = cssText;\n  return style;\n}\n\n/**\n * Track the position of the last added style for placing placeholders\n * @type {Node}\n */\nlet lastHeadApplyNode = null;\n\n// insert a comment node as a styling position placeholder.\n/**\n * @param {string} moniker\n * @return {!Comment}\n */\nexport function applyStylePlaceHolder(moniker) {\n  let placeHolder = document.createComment(' Shady DOM styles for ' +\n    moniker + ' ');\n  let after = lastHeadApplyNode ?\n    lastHeadApplyNode['nextSibling'] : null;\n  let scope = document.head;\n  scope.insertBefore(placeHolder, after || scope.firstChild);\n  lastHeadApplyNode = placeHolder;\n  return placeHolder;\n}\n\n/**\n * @param {HTMLStyleElement} style\n * @param {?Node} target\n * @param {?Node} contextNode\n */\nexport function applyStyle(style, target, contextNode) {\n  target = target || document.head;\n  let after = (contextNode && contextNode.nextSibling) ||\n    target.firstChild;\n  target.insertBefore(style, after);\n  if (!lastHeadApplyNode) {\n    lastHeadApplyNode = style;\n  } else {\n    // only update lastHeadApplyNode if the new style is inserted after the old lastHeadApplyNode\n    let position = style.compareDocumentPosition(lastHeadApplyNode);\n    if (position === Node.DOCUMENT_POSITION_PRECEDING) {\n      lastHeadApplyNode = style;\n    }\n  }\n}\n\n/**\n * @param {string} buildType\n * @return {boolean}\n */\nexport function isTargetedBuild(buildType) {\n  return nativeShadow ? buildType === 'shadow' : buildType === 'shady';\n}\n\n/**\n * @param {Element} element\n * @return {?string}\n */\nexport function getCssBuildType(element) {\n  return element.getAttribute('css-build');\n}\n\n/**\n * Walk from text[start] matching parens and\n * returns position of the outer end paren\n * @param {string} text\n * @param {number} start\n * @return {number}\n */\nfunction findMatchingParen(text, start) {\n  let level = 0;\n  for (let i=start, l=text.length; i < l; i++) {\n    if (text[i] === '(') {\n      level++;\n    } else if (text[i] === ')') {\n      if (--level === 0) {\n        return i;\n      }\n    }\n  }\n  return -1;\n}\n\n/**\n * @param {string} str\n * @param {function(string, string, string, string)} callback\n */\nexport function processVariableAndFallback(str, callback) {\n  // find 'var('\n  let start = str.indexOf('var(');\n  if (start === -1) {\n    // no var?, everything is prefix\n    return callback(str, '', '', '');\n  }\n  //${prefix}var(${inner})${suffix}\n  let end = findMatchingParen(str, start + 3);\n  let inner = str.substring(start + 4, end);\n  let prefix = str.substring(0, start);\n  // suffix may have other variables\n  let suffix = processVariableAndFallback(str.substring(end + 1), callback);\n  let comma = inner.indexOf(',');\n  // value and fallback args should be trimmed to match in property lookup\n  if (comma === -1) {\n    // variable, no fallback\n    return callback(prefix, inner.trim(), '', suffix);\n  }\n  // var(${value},${fallback})\n  let value = inner.substring(0, comma).trim();\n  let fallback = inner.substring(comma + 1).trim();\n  return callback(prefix, value, fallback, suffix);\n}\n\n/**\n * @param {Element} element\n * @param {string} value\n */\nexport function setElementClassRaw(element, value) {\n  // use native setAttribute provided by ShadyDOM when setAttribute is patched\n  if (nativeShadow) {\n    element.setAttribute('class', value);\n  } else {\n    window['ShadyDOM']['nativeMethods']['setAttribute'].call(element, 'class', value);\n  }\n}\n\n/**\n * @param {Element | {is: string, extends: string}} element\n * @return {{is: string, typeExtension: string}}\n */\nexport function getIsExtends(element) {\n  let localName = element['localName'];\n  let is = '', typeExtension = '';\n  /*\n  NOTE: technically, this can be wrong for certain svg elements\n  with `-` in the name like `<font-face>`\n  */\n  if (localName) {\n    if (localName.indexOf('-') > -1) {\n      is = localName;\n    } else {\n      typeExtension = localName;\n      is = (element.getAttribute && element.getAttribute('is')) || '';\n    }\n  } else {\n    is = /** @type {?} */(element).is;\n    typeExtension = /** @type {?} */(element).extends;\n  }\n  return {is, typeExtension};\n}","/**\n@license\nCopyright (c) 2017 The Polymer Project Authors. All rights reserved.\nThis code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt\nThe complete set of authors may be found at http://polymer.github.io/AUTHORS.txt\nThe complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt\nCode distributed by Google as part of the polymer project is also\nsubject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt\n*/\n/*\n * The apply shim simulates the behavior of `@apply` proposed at\n * https://tabatkins.github.io/specs/css-apply-rule/.\n * The approach is to convert a property like this:\n *\n *    --foo: {color: red; background: blue;}\n *\n * to this:\n *\n *    --foo_-_color: red;\n *    --foo_-_background: blue;\n *\n * Then where `@apply --foo` is used, that is converted to:\n *\n *    color: var(--foo_-_color);\n *    background: var(--foo_-_background);\n *\n * This approach generally works but there are some issues and limitations.\n * Consider, for example, that somewhere *between* where `--foo` is set and used,\n * another element sets it to:\n *\n *    --foo: { border: 2px solid red; }\n *\n * We must now ensure that the color and background from the previous setting\n * do not apply. This is accomplished by changing the property set to this:\n *\n *    --foo_-_border: 2px solid red;\n *    --foo_-_color: initial;\n *    --foo_-_background: initial;\n *\n * This works but introduces one new issue.\n * Consider this setup at the point where the `@apply` is used:\n *\n *    background: orange;\n *    `@apply` --foo;\n *\n * In this case the background will be unset (initial) rather than the desired\n * `orange`. We address this by altering the property set to use a fallback\n * value like this:\n *\n *    color: var(--foo_-_color);\n *    background: var(--foo_-_background, orange);\n *    border: var(--foo_-_border);\n *\n * Note that the default is retained in the property set and the `background` is\n * the desired `orange`. This leads us to a limitation.\n *\n * Limitation 1:\n\n * Only properties in the rule where the `@apply`\n * is used are considered as default values.\n * If another rule matches the element and sets `background` with\n * less specificity than the rule in which `@apply` appears,\n * the `background` will not be set.\n *\n * Limitation 2:\n *\n * When using Polymer's `updateStyles` api, new properties may not be set for\n * `@apply` properties.\n\n*/\n\n'use strict';\n\nimport {forEachRule, processVariableAndFallback, rulesForStyle, toCssText} from './style-util'\nimport {MIXIN_MATCH, VAR_ASSIGN} from './common-regex'\nimport {StyleNode} from './css-parse' // eslint-disable-line no-unused-vars\n\nconst APPLY_NAME_CLEAN = /;\\s*/m;\nconst INITIAL_INHERIT = /^\\s*(initial)|(inherit)\\s*$/;\n\n// separator used between mixin-name and mixin-property-name when producing properties\n// NOTE: plain '-' may cause collisions in user styles\nconst MIXIN_VAR_SEP = '_-_';\n\n/**\n * @typedef {!Object<string, string>}\n */\nlet PropertyEntry; // eslint-disable-line no-unused-vars\n\n/**\n * @typedef {!Object<string, boolean>}\n */\nlet DependantsEntry; // eslint-disable-line no-unused-vars\n\n/** @typedef {{\n *    properties: PropertyEntry,\n *    dependants: DependantsEntry\n * }}\n */\nlet MixinMapEntry; // eslint-disable-line no-unused-vars\n\n// map of mixin to property names\n// --foo: {border: 2px} -> {properties: {(--foo, ['border'])}, dependants: {'element-name': proto}}\nclass MixinMap {\n  constructor() {\n    /** @type {!Object<string, !MixinMapEntry>} */\n    this._map = {};\n  }\n  /**\n   * @param {string} name\n   * @param {!PropertyEntry} props\n   */\n  set(name, props) {\n    name = name.trim();\n    this._map[name] = {\n      properties: props,\n      dependants: {}\n    }\n  }\n  /**\n   * @param {string} name\n   * @return {MixinMapEntry}\n   */\n  get(name) {\n    name = name.trim();\n    return this._map[name] || null;\n  }\n}\n\n/**\n * Callback for when an element is marked invalid\n * @type {?function(string)}\n */\nlet invalidCallback = null;\n\n/** @unrestricted */\nclass ApplyShim {\n  constructor() {\n    /** @type {?string} */\n    this._currentElement = null;\n    /** @type {HTMLMetaElement} */\n    this._measureElement = null;\n    this._map = new MixinMap();\n  }\n  /**\n   * return true if `cssText` contains a mixin definition or consumption\n   * @param {string} cssText\n   * @return {boolean}\n   */\n  detectMixin(cssText) {\n    const has = MIXIN_MATCH.test(cssText) || VAR_ASSIGN.test(cssText);\n    // reset state of the regexes\n    MIXIN_MATCH.lastIndex = 0;\n    VAR_ASSIGN.lastIndex = 0;\n    return has;\n  }\n  /**\n   * @param {!HTMLTemplateElement} template\n   * @param {string} elementName\n   * @return {StyleNode}\n   */\n  transformTemplate(template, elementName) {\n    const style = /** @type {HTMLStyleElement} */(template.content.querySelector('style'));\n    /** @type {StyleNode} */\n    let ast = null;\n    if (style) {\n      ast = this.transformStyle(style, elementName);\n    }\n    return ast;\n  }\n  /**\n   * @param {!HTMLStyleElement} style\n   * @param {string} elementName\n   * @return {StyleNode}\n   */\n  transformStyle(style, elementName = '') {\n    let ast = rulesForStyle(style);\n    this.transformRules(ast, elementName);\n    style.textContent = toCssText(ast);\n    return ast;\n  }\n  /**\n   * @param {!HTMLStyleElement} style\n   * @return {StyleNode}\n   */\n  transformCustomStyle(style) {\n    let ast = rulesForStyle(style);\n    forEachRule(ast, (rule) => {\n      if (rule['selector'] === ':root') {\n        rule['selector'] = 'html';\n      }\n      this.transformRule(rule);\n    })\n    style.textContent = toCssText(ast);\n    return ast;\n  }\n  /**\n   * @param {StyleNode} rules\n   * @param {string} elementName\n   */\n  transformRules(rules, elementName) {\n    this._currentElement = elementName;\n    forEachRule(rules, (r) => {\n      this.transformRule(r);\n    });\n    this._currentElement = null;\n  }\n  /**\n   * @param {!StyleNode} rule\n   */\n  transformRule(rule) {\n    rule['cssText'] = this.transformCssText(rule['parsedCssText']);\n    // :root was only used for variable assignment in property shim,\n    // but generates invalid selectors with real properties.\n    // replace with `:host > *`, which serves the same effect\n    if (rule['selector'] === ':root') {\n      rule['selector'] = ':host > *';\n    }\n  }\n  /**\n   * @param {string} cssText\n   * @return {string}\n   */\n  transformCssText(cssText) {\n    // produce variables\n    cssText = cssText.replace(VAR_ASSIGN, (matchText, propertyName, valueProperty, valueMixin) =>\n      this._produceCssProperties(matchText, propertyName, valueProperty, valueMixin));\n    // consume mixins\n    return this._consumeCssProperties(cssText);\n  }\n  /**\n   * @param {string} property\n   * @return {string}\n   */\n  _getInitialValueForProperty(property) {\n    if (!this._measureElement) {\n      this._measureElement = /** @type {HTMLMetaElement} */(document.createElement('meta'));\n      this._measureElement.setAttribute('apply-shim-measure', '');\n      this._measureElement.style.all = 'initial';\n      document.head.appendChild(this._measureElement);\n    }\n    return window.getComputedStyle(this._measureElement).getPropertyValue(property);\n  }\n  /**\n   * replace mixin consumption with variable consumption\n   * @param {string} text\n   * @return {string}\n   */\n  _consumeCssProperties(text) {\n    /** @type {Array} */\n    let m = null;\n    // loop over text until all mixins with defintions have been applied\n    while((m = MIXIN_MATCH.exec(text))) {\n      let matchText = m[0];\n      let mixinName = m[1];\n      let idx = m.index;\n      // collect properties before apply to be \"defaults\" if mixin might override them\n      // match includes a \"prefix\", so find the start and end positions of @apply\n      let applyPos = idx + matchText.indexOf('@apply');\n      let afterApplyPos = idx + matchText.length;\n      // find props defined before this @apply\n      let textBeforeApply = text.slice(0, applyPos);\n      let textAfterApply = text.slice(afterApplyPos);\n      let defaults = this._cssTextToMap(textBeforeApply);\n      let replacement = this._atApplyToCssProperties(mixinName, defaults);\n      // use regex match position to replace mixin, keep linear processing time\n      text = `${textBeforeApply}${replacement}${textAfterApply}`;\n      // move regex search to _after_ replacement\n      MIXIN_MATCH.lastIndex = idx + replacement.length;\n    }\n    return text;\n  }\n  /**\n   * produce variable consumption at the site of mixin consumption\n   * `@apply` --foo; -> for all props (${propname}: var(--foo_-_${propname}, ${fallback[propname]}}))\n   * Example:\n   *  border: var(--foo_-_border); padding: var(--foo_-_padding, 2px)\n   *\n   * @param {string} mixinName\n   * @param {Object} fallbacks\n   * @return {string}\n   */\n  _atApplyToCssProperties(mixinName, fallbacks) {\n    mixinName = mixinName.replace(APPLY_NAME_CLEAN, '');\n    let vars = [];\n    let mixinEntry = this._map.get(mixinName);\n    // if we depend on a mixin before it is created\n    // make a sentinel entry in the map to add this element as a dependency for when it is defined.\n    if (!mixinEntry) {\n      this._map.set(mixinName, {});\n      mixinEntry = this._map.get(mixinName);\n    }\n    if (mixinEntry) {\n      if (this._currentElement) {\n        mixinEntry.dependants[this._currentElement] = true;\n      }\n      let p, parts, f;\n      for (p in mixinEntry.properties) {\n        f = fallbacks && fallbacks[p];\n        parts = [p, ': var(', mixinName, MIXIN_VAR_SEP, p];\n        if (f) {\n          parts.push(',', f);\n        }\n        parts.push(')');\n        vars.push(parts.join(''));\n      }\n    }\n    return vars.join('; ');\n  }\n\n  /**\n   * @param {string} property\n   * @param {string} value\n   * @return {string}\n   */\n  _replaceInitialOrInherit(property, value) {\n    let match = INITIAL_INHERIT.exec(value);\n    if (match) {\n      if (match[1]) {\n        // initial\n        // replace `initial` with the concrete initial value for this property\n        value = this._getInitialValueForProperty(property);\n      } else {\n        // inherit\n        // with this purposfully illegal value, the variable will be invalid at\n        // compute time (https://www.w3.org/TR/css-variables/#invalid-at-computed-value-time)\n        // and for inheriting values, will behave similarly\n        // we cannot support the same behavior for non inheriting values like 'border'\n        value = 'apply-shim-inherit';\n      }\n    }\n    return value;\n  }\n\n  /**\n   * \"parse\" a mixin definition into a map of properties and values\n   * cssTextToMap('border: 2px solid black') -> ('border', '2px solid black')\n   * @param {string} text\n   * @return {!Object<string, string>}\n   */\n  _cssTextToMap(text) {\n    let props = text.split(';');\n    let property, value;\n    let out = {};\n    for (let i = 0, p, sp; i < props.length; i++) {\n      p = props[i];\n      if (p) {\n        sp = p.split(':');\n        // ignore lines that aren't definitions like @media\n        if (sp.length > 1) {\n          property = sp[0].trim();\n          // some properties may have ':' in the value, like data urls\n          value = this._replaceInitialOrInherit(property, sp.slice(1).join(':'));\n          out[property] = value;\n        }\n      }\n    }\n    return out;\n  }\n\n  /**\n   * @param {MixinMapEntry} mixinEntry\n   */\n  _invalidateMixinEntry(mixinEntry) {\n    if (!invalidCallback) {\n      return;\n    }\n    for (let elementName in mixinEntry.dependants) {\n      if (elementName !== this._currentElement) {\n        invalidCallback(elementName);\n      }\n    }\n  }\n\n  /**\n   * @param {string} matchText\n   * @param {string} propertyName\n   * @param {?string} valueProperty\n   * @param {?string} valueMixin\n   * @return {string}\n   */\n  _produceCssProperties(matchText, propertyName, valueProperty, valueMixin) {\n    // handle case where property value is a mixin\n    if (valueProperty) {\n      // form: --mixin2: var(--mixin1), where --mixin1 is in the map\n      processVariableAndFallback(valueProperty, (prefix, value) => {\n        if (value && this._map.get(value)) {\n          valueMixin = `@apply ${value};`\n        }\n      });\n    }\n    if (!valueMixin) {\n      return matchText;\n    }\n    let mixinAsProperties = this._consumeCssProperties(valueMixin);\n    let prefix = matchText.slice(0, matchText.indexOf('--'));\n    let mixinValues = this._cssTextToMap(mixinAsProperties);\n    let combinedProps = mixinValues;\n    let mixinEntry = this._map.get(propertyName);\n    let oldProps = mixinEntry && mixinEntry.properties;\n    if (oldProps) {\n      // NOTE: since we use mixin, the map of properties is updated here\n      // and this is what we want.\n      combinedProps = Object.assign(Object.create(oldProps), mixinValues);\n    } else {\n      this._map.set(propertyName, combinedProps);\n    }\n    let out = [];\n    let p, v;\n    // set variables defined by current mixin\n    let needToInvalidate = false;\n    for (p in combinedProps) {\n      v = mixinValues[p];\n      // if property not defined by current mixin, set initial\n      if (v === undefined) {\n        v = 'initial';\n      }\n      if (oldProps && !(p in oldProps)) {\n        needToInvalidate = true;\n      }\n      out.push(`${propertyName}${MIXIN_VAR_SEP}${p}: ${v}`);\n    }\n    if (needToInvalidate) {\n      this._invalidateMixinEntry(mixinEntry);\n    }\n    if (mixinEntry) {\n      mixinEntry.properties = combinedProps;\n    }\n    // because the mixinMap is global, the mixin might conflict with\n    // a different scope's simple variable definition:\n    // Example:\n    // some style somewhere:\n    // --mixin1:{ ... }\n    // --mixin2: var(--mixin1);\n    // some other element:\n    // --mixin1: 10px solid red;\n    // --foo: var(--mixin1);\n    // In this case, we leave the original variable definition in place.\n    if (valueProperty) {\n      prefix = `${matchText};${prefix}`;\n    }\n    return `${prefix}${out.join('; ')};`;\n  }\n}\n\n/* exports */\nApplyShim.prototype['detectMixin'] = ApplyShim.prototype.detectMixin;\nApplyShim.prototype['transformStyle'] = ApplyShim.prototype.transformStyle;\nApplyShim.prototype['transformCustomStyle'] = ApplyShim.prototype.transformCustomStyle;\nApplyShim.prototype['transformRules'] = ApplyShim.prototype.transformRules;\nApplyShim.prototype['transformRule'] = ApplyShim.prototype.transformRule;\nApplyShim.prototype['transformTemplate'] = ApplyShim.prototype.transformTemplate;\nApplyShim.prototype['_separator'] = MIXIN_VAR_SEP;\nObject.defineProperty(ApplyShim.prototype, 'invalidCallback', {\n  /** @return {?function(string)} */\n  get() {\n    return invalidCallback;\n  },\n  /** @param {?function(string)} cb */\n  set(cb) {\n    invalidCallback = cb;\n  }\n});\n\nexport default ApplyShim;","/**\n@license\nCopyright (c) 2017 The Polymer Project Authors. All rights reserved.\nThis code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt\nThe complete set of authors may be found at http://polymer.github.io/AUTHORS.txt\nThe complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt\nCode distributed by Google as part of the polymer project is also\nsubject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt\n*/\n\n'use strict';\n\n/** @type {Promise<void>} */\nlet readyPromise = null;\n\n/** @type {?function(?function())} */\nlet whenReady = window['HTMLImports'] && window['HTMLImports']['whenReady'] || null;\n\n/** @type {function()} */\nlet resolveFn;\n\n/**\n * @param {?function()} callback\n */\nexport default function documentWait(callback) {\n  requestAnimationFrame(function() {\n    if (whenReady) {\n      whenReady(callback)\n    } else {\n      if (!readyPromise) {\n        readyPromise = new Promise((resolve) => {resolveFn = resolve});\n        if (document.readyState === 'complete') {\n          resolveFn();\n        } else {\n          document.addEventListener('readystatechange', () => {\n            if (document.readyState === 'complete') {\n              resolveFn();\n            }\n          });\n        }\n      }\n      readyPromise.then(function(){ callback && callback(); });\n    }\n  });\n}\n","/**\n@license\nCopyright (c) 2017 The Polymer Project Authors. All rights reserved.\nThis code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt\nThe complete set of authors may be found at http://polymer.github.io/AUTHORS.txt\nThe complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt\nCode distributed by Google as part of the polymer project is also\nsubject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt\n*/\n\n'use strict';\n\nimport ApplyShim from '../src/apply-shim'\nimport templateMap from '../src/template-map'\nimport {getIsExtends, toCssText} from '../src/style-util'\nimport * as ApplyShimUtils from '../src/apply-shim-utils'\nimport documentWait from '../src/document-wait'\nimport {getComputedStyleValue, updateNativeProperties} from '../src/common-utils'\nimport {CustomStyleInterfaceInterface} from '../src/custom-style-interface' // eslint-disable-line no-unused-vars\nimport {nativeCssVariables, nativeShadow} from '../src/style-settings'\n\n/** @const {ApplyShim} */\nconst applyShim = new ApplyShim();\n\nclass ApplyShimInterface {\n  constructor() {\n    /** @type {?CustomStyleInterfaceInterface} */\n    this.customStyleInterface = null;\n    this.booted = false;\n    documentWait(() => {\n      this.ensure();\n    });\n    applyShim['invalidCallback'] = ApplyShimUtils.invalidate;\n  }\n  ensure() {\n    if (this.booted) {\n      return;\n    }\n    this.customStyleInterface = window.ShadyCSS.CustomStyleInterface;\n    if (this.customStyleInterface) {\n      this.customStyleInterface['transformCallback'] = (style) => {\n        applyShim.transformCustomStyle(style);\n      };\n      this.customStyleInterface['validateCallback'] = () => {\n        requestAnimationFrame(() => {\n          if (this.customStyleInterface['enqueued']) {\n            this.flushCustomStyles();\n          }\n        });\n      }\n    }\n    this.booted = true;\n  }\n  /**\n   * @param {!HTMLTemplateElement} template\n   * @param {string} elementName\n   */\n  prepareTemplate(template, elementName) {\n    this.ensure();\n    templateMap[elementName] = template;\n    let ast = applyShim.transformTemplate(template, elementName);\n    // save original style ast to use for revalidating instances\n    template['_styleAst'] = ast;\n  }\n  flushCustomStyles() {\n    this.ensure();\n    if (!this.customStyleInterface) {\n      return;\n    }\n    let styles = this.customStyleInterface['processStyles']();\n    if (!this.customStyleInterface['enqueued']) {\n      return;\n    }\n    for (let i = 0; i < styles.length; i++ ) {\n      let cs = styles[i];\n      let style = this.customStyleInterface['getStyleForCustomStyle'](cs);\n      if (style) {\n        applyShim.transformCustomStyle(style);\n      }\n    }\n    this.customStyleInterface['enqueued'] = false;\n  }\n  /**\n   * @param {HTMLElement} element\n   * @param {Object=} properties\n   */\n  styleSubtree(element, properties) {\n    this.ensure();\n    if (properties) {\n      updateNativeProperties(element, properties);\n    }\n    if (element.shadowRoot) {\n      this.styleElement(element);\n      let shadowChildren = element.shadowRoot.children || element.shadowRoot.childNodes;\n      for (let i = 0; i < shadowChildren.length; i++) {\n        this.styleSubtree(/** @type {HTMLElement} */(shadowChildren[i]));\n      }\n    } else {\n      let children = element.children || element.childNodes;\n      for (let i = 0; i < children.length; i++) {\n        this.styleSubtree(/** @type {HTMLElement} */(children[i]));\n      }\n    }\n  }\n  /**\n   * @param {HTMLElement} element\n   */\n  styleElement(element) {\n    this.ensure();\n    let {is} = getIsExtends(element);\n    let template = templateMap[is];\n    if (template && !ApplyShimUtils.templateIsValid(template)) {\n      // only revalidate template once\n      if (!ApplyShimUtils.templateIsValidating(template)) {\n        this.prepareTemplate(template, is);\n        ApplyShimUtils.startValidatingTemplate(template);\n      }\n      // update this element instance\n      let root = element.shadowRoot;\n      if (root) {\n        let style = /** @type {HTMLStyleElement} */(root.querySelector('style'));\n        if (style) {\n          // reuse the template's style ast, it has all the original css text\n          style['__cssRules'] = template['_styleAst'];\n          style.textContent = toCssText(template['_styleAst'])\n        }\n      }\n    }\n  }\n  /**\n   * @param {Object=} properties\n   */\n  styleDocument(properties) {\n    this.ensure();\n    this.styleSubtree(document.body, properties);\n  }\n}\n\nif (!window.ShadyCSS || !window.ShadyCSS.ScopingShim) {\n  const applyShimInterface = new ApplyShimInterface();\n  let CustomStyleInterface = window.ShadyCSS && window.ShadyCSS.CustomStyleInterface;\n\n  window.ShadyCSS = {\n    /**\n     * @param {!HTMLTemplateElement} template\n     * @param {string} elementName\n     * @param {string=} elementExtends\n     */\n    prepareTemplate(template, elementName, elementExtends) { // eslint-disable-line no-unused-vars\n      applyShimInterface.flushCustomStyles();\n      applyShimInterface.prepareTemplate(template, elementName)\n    },\n\n    /**\n     * @param {!HTMLElement} element\n     * @param {Object=} properties\n     */\n    styleSubtree(element, properties) {\n      applyShimInterface.flushCustomStyles();\n      applyShimInterface.styleSubtree(element, properties);\n    },\n\n    /**\n     * @param {!HTMLElement} element\n     */\n    styleElement(element) {\n      applyShimInterface.flushCustomStyles();\n      applyShimInterface.styleElement(element);\n    },\n\n    /**\n     * @param {Object=} properties\n     */\n    styleDocument(properties) {\n      applyShimInterface.flushCustomStyles();\n      applyShimInterface.styleDocument(properties);\n    },\n\n    /**\n     * @param {Element} element\n     * @param {string} property\n     * @return {string}\n     */\n    getComputedStyleValue(element, property) {\n      return getComputedStyleValue(element, property);\n    },\n    nativeCss: nativeCssVariables,\n    nativeShadow: nativeShadow\n  };\n\n  if (CustomStyleInterface) {\n    window.ShadyCSS.CustomStyleInterface = CustomStyleInterface;\n  }\n}\n\nwindow.ShadyCSS.ApplyShim = applyShim;","/**\n@license\nCopyright (c) 2017 The Polymer Project Authors. All rights reserved.\nThis code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt\nThe complete set of authors may be found at http://polymer.github.io/AUTHORS.txt\nThe complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt\nCode distributed by Google as part of the polymer project is also\nsubject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt\n*/\n\n'use strict';\n\n/**\n * @param {Element} element\n * @param {Object=} properties\n */\nexport function updateNativeProperties(element, properties) {\n  // remove previous properties\n  for (let p in properties) {\n    // NOTE: for bc with shim, don't apply null values.\n    if (p === null) {\n      element.style.removeProperty(p);\n    } else {\n      element.style.setProperty(p, properties[p]);\n    }\n  }\n}\n\n/**\n * @param {Element} element\n * @param {string} property\n * @return {string}\n */\nexport function getComputedStyleValue(element, property) {\n  /**\n   * @const {string}\n   */\n  const value = window.getComputedStyle(element).getPropertyValue(property);\n  if (!value) {\n    return '';\n  } else {\n    return value.trim();\n  }\n}"]}
\ No newline at end of file
diff --git a/src/main/resources/static/gltf-viewer/bower_components/shadycss/custom-style-interface.html b/src/main/resources/static/gltf-viewer/bower_components/shadycss/custom-style-interface.html
deleted file mode 100644 (file)
index a3919fa..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-<!--
-@license
-Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
-This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
-The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
-The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
-Code distributed by Google as part of the polymer project is also
-subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
--->
-<script src="custom-style-interface.min.js"></script>
diff --git a/src/main/resources/static/gltf-viewer/bower_components/shadycss/custom-style-interface.min.js b/src/main/resources/static/gltf-viewer/bower_components/shadycss/custom-style-interface.min.js
deleted file mode 100644 (file)
index 4347aa9..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-(function(){
-/*
-
-Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
-This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
-The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
-The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
-Code distributed by Google as part of the polymer project is also
-subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
-*/
-'use strict';var c=!(window.ShadyDOM&&window.ShadyDOM.inUse),f=!navigator.userAgent.match("AppleWebKit/601")&&window.CSS&&CSS.supports&&CSS.supports("box-shadow","0 0 0 var(--foo)");function g(a){a&&(f=f&&!a.nativeCss&&!a.shimcssproperties,c=c&&!a.nativeShadow&&!a.shimshadow)}window.ShadyCSS?g(window.ShadyCSS):window.WebComponents&&g(window.WebComponents.flags);var h=c,k=f;function l(a,b){for(var d in b)null===d?a.style.removeProperty(d):a.style.setProperty(d,b[d])};var m=null,n=window.HTMLImports&&window.HTMLImports.whenReady||null,r;function t(){var a=u;requestAnimationFrame(function(){n?n(a):(m||(m=new Promise(function(a){r=a}),"complete"===document.readyState?r():document.addEventListener("readystatechange",function(){"complete"===document.readyState&&r()})),m.then(function(){a&&a()}))})};var v=null,u=null;function x(){this.customStyles=[];this.enqueued=!1}function y(a){!a.enqueued&&u&&(a.enqueued=!0,t())}x.prototype.c=function(a){a.__seenByShadyCSS||(a.__seenByShadyCSS=!0,this.customStyles.push(a),y(this))};x.prototype.b=function(a){if(a.__shadyCSSCachedStyle)return a.__shadyCSSCachedStyle;var b;a.getStyle?b=a.getStyle():b=a;return b};
-x.prototype.a=function(){for(var a=this.customStyles,b=0;b<a.length;b++){var d=a[b];if(!d.__shadyCSSCachedStyle){var e=this.b(d);if(e){var p=e.__appliedElement;if(p)for(var q=0;q<e.attributes.length;q++){var w=e.attributes[q];p.setAttribute(w.name,w.value)}e=p||e;v&&v(e);d.__shadyCSSCachedStyle=e}}}return a};x.prototype.addCustomStyle=x.prototype.c;x.prototype.getStyleForCustomStyle=x.prototype.b;x.prototype.processStyles=x.prototype.a;
-Object.defineProperties(x.prototype,{transformCallback:{get:function(){return v},set:function(a){v=a}},validateCallback:{get:function(){return u},set:function(a){var b=!1;u||(b=!0);u=a;b&&y(this)}}});var z=new x;window.ShadyCSS||(window.ShadyCSS={prepareTemplate:function(){},styleSubtree:function(a,b){z.a();l(a,b)},styleElement:function(){z.a()},styleDocument:function(a){z.a();l(document.body,a)},getComputedStyleValue:function(a,b){return(a=window.getComputedStyle(a).getPropertyValue(b))?a.trim():""},nativeCss:k,nativeShadow:h});window.ShadyCSS.CustomStyleInterface=z;
-}).call(self);
-
-//# sourceMappingURL=custom-style-interface.min.js.map
diff --git a/src/main/resources/static/gltf-viewer/bower_components/shadycss/custom-style-interface.min.js.map b/src/main/resources/static/gltf-viewer/bower_components/shadycss/custom-style-interface.min.js.map
deleted file mode 100644 (file)
index ec8103b..0000000
+++ /dev/null
@@ -1 +0,0 @@
-{"version":3,"sources":["src/style-settings.js","src/common-utils.js","src/document-wait.js","src/custom-style-interface.js","entrypoints/custom-style-interface.js"],"names":["nativeShadow","window","nativeCssVariables","navigator","userAgent","match","CSS","supports","parseSettings$$module$$src$style_settings","parseSettings","settings","ShadyCSS","module$$src$style_settings.nativeShadow","module$$src$style_settings.nativeCssVariables","updateNativeProperties$$module$$src$common_utils","updateNativeProperties","element","properties","p","style","removeProperty","setProperty","readyPromise","whenReady","resolveFn","documentWait$$module$$src$document_wait","documentWait","validateFn","requestAnimationFrame","callback","Promise","resolve","document","readyState","addEventListener","then","transformFn","constructor","CustomStyleInterface","enqueueDocumentValidation","addCustomStyle","push","getStyleForCustomStyle","customStyle","processStyles","cs","i","length","appliedStyle","attributes","attr","setAttribute","name","value","styleToTransform","prototype","Object","defineProperties","get","set","fn","needsEnqueue","customStyleInterface","prepareTemplate","styleSubtree","styleElement","styleDocument","body","getComputedStyleValue","property","getComputedStyle","getPropertyValue","trim","nativeCss"],"mappings":"A;;;;;;;;;;aAYO,IAAIA,EAAe,EAAEC,MAAA,SAAF,EAAwBA,MAAA,SAAA,MAAxB,CAAnB,CAGIC,EAAsB,CAACC,SAAAC,UAAAC,MAAA,CAA0B,iBAA1B,CAAvBH,EACXD,MAAAK,IADWJ,EACGI,GAAAC,SADHL,EACmBI,GAAAC,SAAA,CAAa,YAAb,CAA2B,kBAA3B,CAK9BC,SAASC,EAAa,CAACC,CAAD,CAAW,CAC3BA,CAAJ,GACER,CACA,CADqBA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CV,CAAuBiB,QAAAmC,KAAvB,CAAsClD,CAAtC,CAFwB,CA3BV,CAqChBmD,sBAAAA,QAAqB,CAACpD,CAAD,CAAUqD,CAAV,CAAoB,CACvC,MHnBJ,CADMhB,CACN,CADcpD,MAAAqE,iBAAA,CGoBmBtD,CHpBnB,CAAAuD,iBAAA,CGoB4BF,CHpB5B,CACd,EAGShB,CAAAmB,KAAA,EAHT,CACS,EGiBkC,CArCzB,CAwChBC,UAAW5D,CAxCK,CAyChBb,aAAcY,CAzCE,CADpB,CA8CAX,OAAAU,SAAA2B,qBAAA,CAAuCwB","file":"custom-style-interface.min.js","sourcesContent":["/**\n@license\nCopyright (c) 2017 The Polymer Project Authors. All rights reserved.\nThis code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt\nThe complete set of authors may be found at http://polymer.github.io/AUTHORS.txt\nThe complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt\nCode distributed by Google as part of the polymer project is also\nsubject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt\n*/\n\n'use strict';\n\nexport let nativeShadow = !(window['ShadyDOM'] && window['ShadyDOM']['inUse']);\n// chrome 49 has semi-working css vars, check if box-shadow works\n// safari 9.1 has a recalc bug: https://bugs.webkit.org/show_bug.cgi?id=155782\nexport let nativeCssVariables = (!navigator.userAgent.match('AppleWebKit/601') &&\nwindow.CSS && CSS.supports && CSS.supports('box-shadow', '0 0 0 var(--foo)'));\n\n/**\n * @param {ShadyCSSOptions | ShadyCSSInterface | undefined} settings\n */\nfunction parseSettings(settings) {\n  if (settings) {\n    nativeCssVariables = nativeCssVariables && !settings['nativeCss'] && !settings['shimcssproperties'];\n    nativeShadow = nativeShadow && !settings['nativeShadow'] && !settings['shimshadow'];\n  }\n}\n\nif (window.ShadyCSS) {\n  parseSettings(window.ShadyCSS);\n} else if (window['WebComponents']) {\n  parseSettings(window['WebComponents']['flags']);\n}\n","/**\n@license\nCopyright (c) 2017 The Polymer Project Authors. All rights reserved.\nThis code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt\nThe complete set of authors may be found at http://polymer.github.io/AUTHORS.txt\nThe complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt\nCode distributed by Google as part of the polymer project is also\nsubject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt\n*/\n\n'use strict';\n\n/**\n * @param {Element} element\n * @param {Object=} properties\n */\nexport function updateNativeProperties(element, properties) {\n  // remove previous properties\n  for (let p in properties) {\n    // NOTE: for bc with shim, don't apply null values.\n    if (p === null) {\n      element.style.removeProperty(p);\n    } else {\n      element.style.setProperty(p, properties[p]);\n    }\n  }\n}\n\n/**\n * @param {Element} element\n * @param {string} property\n * @return {string}\n */\nexport function getComputedStyleValue(element, property) {\n  /**\n   * @const {string}\n   */\n  const value = window.getComputedStyle(element).getPropertyValue(property);\n  if (!value) {\n    return '';\n  } else {\n    return value.trim();\n  }\n}","/**\n@license\nCopyright (c) 2017 The Polymer Project Authors. All rights reserved.\nThis code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt\nThe complete set of authors may be found at http://polymer.github.io/AUTHORS.txt\nThe complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt\nCode distributed by Google as part of the polymer project is also\nsubject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt\n*/\n\n'use strict';\n\n/** @type {Promise<void>} */\nlet readyPromise = null;\n\n/** @type {?function(?function())} */\nlet whenReady = window['HTMLImports'] && window['HTMLImports']['whenReady'] || null;\n\n/** @type {function()} */\nlet resolveFn;\n\n/**\n * @param {?function()} callback\n */\nexport default function documentWait(callback) {\n  requestAnimationFrame(function() {\n    if (whenReady) {\n      whenReady(callback)\n    } else {\n      if (!readyPromise) {\n        readyPromise = new Promise((resolve) => {resolveFn = resolve});\n        if (document.readyState === 'complete') {\n          resolveFn();\n        } else {\n          document.addEventListener('readystatechange', () => {\n            if (document.readyState === 'complete') {\n              resolveFn();\n            }\n          });\n        }\n      }\n      readyPromise.then(function(){ callback && callback(); });\n    }\n  });\n}\n","/**\n@license\nCopyright (c) 2017 The Polymer Project Authors. All rights reserved.\nThis code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt\nThe complete set of authors may be found at http://polymer.github.io/AUTHORS.txt\nThe complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt\nCode distributed by Google as part of the polymer project is also\nsubject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt\n*/\n\n'use strict';\n\nimport documentWait from './document-wait'\n\n/**\n * @typedef {HTMLStyleElement | {getStyle: function():HTMLStyleElement}}\n */\nexport let CustomStyleProvider;\n\nconst SEEN_MARKER = '__seenByShadyCSS';\nconst CACHED_STYLE = '__shadyCSSCachedStyle';\n\n/** @type {?function(!HTMLStyleElement)} */\nlet transformFn = null;\n\n/** @type {?function()} */\nlet validateFn = null;\n\n/**\nThis interface is provided to add document-level <style> elements to ShadyCSS for processing.\nThese styles must be processed by ShadyCSS to simulate ShadowRoot upper-bound encapsulation from outside styles\nIn addition, these styles may also need to be processed for @apply rules and CSS Custom Properties\n\nTo add document-level styles to ShadyCSS, one can call `ShadyCSS.addDocumentStyle(styleElement)` or `ShadyCSS.addDocumentStyle({getStyle: () => styleElement})`\n\nIn addition, if the process used to discover document-level styles can be synchronously flushed, one should set `ShadyCSS.documentStyleFlush`.\nThis function will be called when calculating styles.\n\nAn example usage of the document-level styling api can be found in `examples/document-style-lib.js`\n\n@unrestricted\n*/\nexport default class CustomStyleInterface {\n  constructor() {\n    /** @type {!Array<!CustomStyleProvider>} */\n    this['customStyles'] = [];\n    this['enqueued'] = false;\n  }\n  /**\n   * Queue a validation for new custom styles to batch style recalculations\n   */\n  enqueueDocumentValidation() {\n    if (this['enqueued'] || !validateFn) {\n      return;\n    }\n    this['enqueued'] = true;\n    documentWait(validateFn);\n  }\n  /**\n   * @param {!HTMLStyleElement} style\n   */\n  addCustomStyle(style) {\n    if (!style[SEEN_MARKER]) {\n      style[SEEN_MARKER] = true;\n      this['customStyles'].push(style);\n      this.enqueueDocumentValidation();\n    }\n  }\n  /**\n   * @param {!CustomStyleProvider} customStyle\n   * @return {HTMLStyleElement}\n   */\n  getStyleForCustomStyle(customStyle) {\n    if (customStyle[CACHED_STYLE]) {\n      return customStyle[CACHED_STYLE];\n    }\n    let style;\n    if (customStyle['getStyle']) {\n      style = customStyle['getStyle']();\n    } else {\n      style = customStyle;\n    }\n    return style;\n  }\n  /**\n   * @return {!Array<!CustomStyleProvider>}\n   */\n  processStyles() {\n    let cs = this['customStyles'];\n    for (let i = 0; i < cs.length; i++) {\n      let customStyle = cs[i];\n      if (customStyle[CACHED_STYLE]) {\n        continue;\n      }\n      let style = this.getStyleForCustomStyle(customStyle);\n      if (style) {\n        // HTMLImports polyfill may have cloned the style into the main document,\n        // which is referenced with __appliedElement.\n        // Also, we must copy over the attributes.\n        let appliedStyle = /** @type {HTMLStyleElement} */(style['__appliedElement']);\n        if (appliedStyle) {\n          for (let i = 0; i < style.attributes.length; i++) {\n            let attr = style.attributes[i];\n            appliedStyle.setAttribute(attr.name, attr.value);\n          }\n        }\n        let styleToTransform = appliedStyle || style;\n        if (transformFn) {\n          transformFn(styleToTransform);\n        }\n        customStyle[CACHED_STYLE] = styleToTransform;\n      }\n    }\n    return cs;\n  }\n}\n\nCustomStyleInterface.prototype['addCustomStyle'] = CustomStyleInterface.prototype.addCustomStyle;\nCustomStyleInterface.prototype['getStyleForCustomStyle'] = CustomStyleInterface.prototype.getStyleForCustomStyle;\nCustomStyleInterface.prototype['processStyles'] = CustomStyleInterface.prototype.processStyles;\n\nObject.defineProperties(CustomStyleInterface.prototype, {\n  'transformCallback': {\n    /** @return {?function(!HTMLStyleElement)} */\n    get() {\n      return transformFn;\n    },\n    /** @param {?function(!HTMLStyleElement)} fn */\n    set(fn) {\n      transformFn = fn;\n    }\n  },\n  'validateCallback': {\n    /** @return {?function()} */\n    get() {\n      return validateFn;\n    },\n    /**\n     * @param {?function()} fn\n     * @this {CustomStyleInterface}\n     */\n    set(fn) {\n      let needsEnqueue = false;\n      if (!validateFn) {\n        needsEnqueue = true;\n      }\n      validateFn = fn;\n      if (needsEnqueue) {\n        this.enqueueDocumentValidation();\n      }\n    },\n  }\n})\n\n/** @typedef {{\n * customStyles: !Array<!CustomStyleProvider>,\n * addCustomStyle: function(!CustomStyleProvider),\n * getStyleForCustomStyle: function(!CustomStyleProvider): HTMLStyleElement,\n * findStyles: function(),\n * transformCallback: ?function(!HTMLStyleElement),\n * validateCallback: ?function()\n * }}\n */\nexport let CustomStyleInterfaceInterface;","/**\n@license\nCopyright (c) 2017 The Polymer Project Authors. All rights reserved.\nThis code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt\nThe complete set of authors may be found at http://polymer.github.io/AUTHORS.txt\nThe complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt\nCode distributed by Google as part of the polymer project is also\nsubject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt\n*/\n\n'use strict';\n\nimport CustomStyleInterface from '../src/custom-style-interface'\nimport {getComputedStyleValue, updateNativeProperties} from '../src/common-utils'\nimport {nativeCssVariables, nativeShadow} from '../src/style-settings'\n\nconst customStyleInterface = new CustomStyleInterface();\n\nif (!window.ShadyCSS) {\n  window.ShadyCSS = {\n    /**\n     * @param {HTMLTemplateElement} template\n     * @param {string} elementName\n     * @param {string=} elementExtends\n     */\n    prepareTemplate(template, elementName, elementExtends) {}, // eslint-disable-line no-unused-vars\n\n    /**\n     * @param {Element} element\n     * @param {Object=} properties\n     */\n    styleSubtree(element, properties) {\n      customStyleInterface.processStyles();\n      updateNativeProperties(element, properties);\n    },\n\n    /**\n     * @param {Element} element\n     */\n    styleElement(element) { // eslint-disable-line no-unused-vars\n      customStyleInterface.processStyles();\n    },\n\n    /**\n     * @param {Object=} properties\n     */\n    styleDocument(properties) {\n      customStyleInterface.processStyles();\n      updateNativeProperties(document.body, properties);\n    },\n\n    /**\n     * @param {Element} element\n     * @param {string} property\n     * @return {string}\n     */\n    getComputedStyleValue(element, property) {\n      return getComputedStyleValue(element, property);\n    },\n    nativeCss: nativeCssVariables,\n    nativeShadow: nativeShadow\n  }\n}\n\nwindow.ShadyCSS.CustomStyleInterface = customStyleInterface;"]}
\ No newline at end of file
diff --git a/src/main/resources/static/gltf-viewer/bower_components/shadycss/scoping-shim.min.js b/src/main/resources/static/gltf-viewer/bower_components/shadycss/scoping-shim.min.js
deleted file mode 100644 (file)
index cadfa76..0000000
+++ /dev/null
@@ -1,54 +0,0 @@
-(function(){
-/*
-
-Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
-This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
-The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
-The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
-Code distributed by Google as part of the polymer project is also
-subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
-*/
-'use strict';var l,aa="undefined"!=typeof window&&window===this?this:"undefined"!=typeof global&&null!=global?global:this,m={};function n(){this.end=this.start=0;this.rules=this.parent=this.previous=null;this.cssText=this.parsedCssText="";this.atRule=!1;this.type=0;this.parsedSelector=this.selector=this.keyframesName=""}
-function p(a){a=a.replace(ba,"").replace(ca,"");var b=da,c=a,e=new n;e.start=0;e.end=c.length;for(var d=e,f=0,g=c.length;f<g;f++)if("{"===c[f]){d.rules||(d.rules=[]);var h=d,k=h.rules[h.rules.length-1]||null,d=new n;d.start=f+1;d.parent=h;d.previous=k;h.rules.push(d)}else"}"===c[f]&&(d.end=f+1,d=d.parent||e);return b(e,a)}
-function da(a,b){var c=b.substring(a.start,a.end-1);a.parsedCssText=a.cssText=c.trim();a.parent&&((c=b.substring(a.previous?a.previous.end:a.parent.start,a.start-1),c=ea(c),c=c.replace(fa," "),c=c.substring(c.lastIndexOf(";")+1),c=a.parsedSelector=a.selector=c.trim(),a.atRule=!c.indexOf("@"),a.atRule)?c.indexOf("@media")?c.match(ha)&&(a.type=r,a.keyframesName=a.selector.split(fa).pop()):a.type=ga:a.type=c.indexOf("--")?ia:ja);if(c=a.rules)for(var e=0,d=c.length,f;e<d&&(f=c[e]);e++)da(f,b);return a}
-function ea(a){return a.replace(/\\([0-9a-f]{1,6})\s/gi,function(a,c){a=c;for(c=6-a.length;c--;)a="0"+a;return"\\"+a})}
-function ka(a,b,c){c=void 0===c?"":c;var e="";if(a.cssText||a.rules){var d=a.rules,f;if(f=d)f=d[0],f=!(f&&f.selector&&0===f.selector.indexOf("--"));if(f){f=0;for(var g=d.length,h;f<g&&(h=d[f]);f++)e=ka(h,b,e)}else b?b=a.cssText:(b=a.cssText,b=b.replace(la,"").replace(ma,""),b=b.replace(na,"").replace(oa,"")),(e=b.trim())&&(e="  "+e+"\n")}e&&(a.selector&&(c+=a.selector+" {\n"),c+=e,a.selector&&(c+="}\n\n"));return c}
-var ia=1,r=7,ga=4,ja=1E3,ba=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//gim,ca=/@import[^;]*;/gim,la=/(?:^[^;\-\s}]+)?--[^;{}]*?:[^{};]*?(?:[;\n]|$)/gim,ma=/(?:^[^;\-\s}]+)?--[^;{}]*?:[^{};]*?{[^}]*?}(?:[;\n]|$)?/gim,na=/@apply\s*\(?[^);]*\)?\s*(?:[;\n]|$)?/gim,oa=/[^;:]*?:[^;]*?var\([^;]*\)(?:[;\n]|$)?/gim,ha=/^@[^\s]*keyframes/,fa=/\s+/g;var pa=Promise.resolve();function qa(a){if(a=m[a])a._applyShimCurrentVersion=a._applyShimCurrentVersion||0,a._applyShimValidatingVersion=a._applyShimValidatingVersion||0,a._applyShimNextVersion=(a._applyShimNextVersion||0)+1}function ra(a){return a._applyShimCurrentVersion===a._applyShimNextVersion}function sa(a){a._applyShimValidatingVersion=a._applyShimNextVersion;a.b||(a.b=!0,pa.then(function(){a._applyShimCurrentVersion=a._applyShimNextVersion;a.b=!1}))};var ta=/(?:^|[;\s{]\s*)(--[\w-]*?)\s*:\s*(?:([^;{]*)|{([^}]*)})(?:(?=[;\s}])|$)/gi,ua=/(?:^|\W+)@apply\s*\(?([^);\n]*)\)?/gi,va=/(--[\w-]+)\s*([:,;)]|$)/gi,wa=/(animation\s*:)|(animation-name\s*:)/,xa=/@media[^(]*(\([^)]*\))/,ya=/\{[^}]*\}/g;var t=!(window.ShadyDOM&&window.ShadyDOM.inUse),u=!navigator.userAgent.match("AppleWebKit/601")&&window.CSS&&CSS.supports&&CSS.supports("box-shadow","0 0 0 var(--foo)");function za(a){a&&(u=u&&!a.nativeCss&&!a.shimcssproperties,t=t&&!a.nativeShadow&&!a.shimshadow)}window.ShadyCSS?za(window.ShadyCSS):window.WebComponents&&za(window.WebComponents.flags);var v=t,w=u;function y(a,b){if(!a)return"";"string"===typeof a&&(a=p(a));b&&z(a,b);return ka(a,w)}function A(a){!a.__cssRules&&a.textContent&&(a.__cssRules=p(a.textContent));return a.__cssRules||null}function Aa(a){return!!a.parent&&a.parent.type===r}function z(a,b,c,e){if(a){var d=!1,f=a.type;if(e&&f===ga){var g=a.selector.match(xa);g&&(window.matchMedia(g[1]).matches||(d=!0))}f===ia?b(a):c&&f===r?c(a):f===ja&&(d=!0);if((a=a.rules)&&!d)for(var d=0,f=a.length,h;d<f&&(h=a[d]);d++)z(h,b,c,e)}}
-function B(a,b,c,e){var d=document.createElement("style");b&&d.setAttribute("scope",b);d.textContent=a;Ba(d,c,e);return d}var C=null;function Ba(a,b,c){b=b||document.head;b.insertBefore(a,c&&c.nextSibling||b.firstChild);C?a.compareDocumentPosition(C)===Node.DOCUMENT_POSITION_PRECEDING&&(C=a):C=a}
-function Ca(a,b){var c=a.indexOf("var(");if(-1===c)return b(a,"","","");var e;a:{var d=0;e=c+3;for(var f=a.length;e<f;e++)if("("===a[e])d++;else if(")"===a[e]&&!--d)break a;e=-1}d=a.substring(c+4,e);c=a.substring(0,c);a=Ca(a.substring(e+1),b);e=d.indexOf(",");return-1===e?b(c,d.trim(),"",a):b(c,d.substring(0,e).trim(),d.substring(e+1).trim(),a)}function D(a,b){v?a.setAttribute("class",b):window.ShadyDOM.nativeMethods.setAttribute.call(a,"class",b)}
-function E(a){var b=a.localName,c="";b?-1<b.indexOf("-")||(c=b,b=a.getAttribute&&a.getAttribute("is")||""):(b=a.is,c=a.extends);return{is:b,u:c}};var F=null,Da=window.HTMLImports&&window.HTMLImports.whenReady||null,G;function Ea(a){requestAnimationFrame(function(){Da?Da(a):(F||(F=new Promise(function(a){G=a}),"complete"===document.readyState?G():document.addEventListener("readystatechange",function(){"complete"===document.readyState&&G()})),F.then(function(){a&&a()}))})};function H(){}function I(a,b,c){var e=J;a.__styleScoped?a.__styleScoped=null:Fa(e,a,b||"",c)}
-function Fa(a,b,c,e){if(b.nodeType===Node.ELEMENT_NODE&&c)if(b.classList)e?(b.classList.remove("style-scope"),b.classList.remove(c)):(b.classList.add("style-scope"),b.classList.add(c));else if(b.getAttribute){var d=b.getAttribute(Ga);e?d&&(d=d.replace("style-scope","").replace(c,""),D(b,d)):D(b,(d?d+" ":"")+"style-scope "+c)}if(b="template"===b.localName?(b.content||b.R).childNodes:b.children||b.childNodes)for(d=0;d<b.length;d++)Fa(a,b[d],c,e)}
-function K(a,b,c){var e=J,d=a.__cssBuild;v||"shady"===d?b=y(b,c):(a=E(a),b=Ha(e,b,a.is,a.u,c)+"\n\n");return b.trim()}function Ha(a,b,c,e,d){var f=L(c,e);c=c?Ia+c:"";return y(b,function(b){b.c||(b.selector=b.g=M(a,b,a.b,c,f),b.c=!0);d&&d(b,c,f)})}function L(a,b){return b?"[is="+a+"]":a}function M(a,b,c,e,d){var f=b.selector.split(Ja);if(!Aa(b)){b=0;for(var g=f.length,h;b<g&&(h=f[b]);b++)f[b]=c.call(a,h,e,d)}return f.join(Ja)}
-H.prototype.b=function(a,b,c){var e=!1;a=a.trim();a=a.replace(Ka,function(a,b,c){return":"+b+"("+c.replace(/\s/g,"")+")"});a=a.replace(La,Ma+" $1");return a=a.replace(Na,function(a,f,g){e||(a=Oa(g,f,b,c),e=e||a.stop,f=a.H,g=a.value);return f+g})};
-function Oa(a,b,c,e){var d=a.indexOf(Pa);0<=a.indexOf(Ma)?a=Qa(a,e):0!==d&&(a=c?Ra(a,c):a);c=!1;0<=d&&(b="",c=!0);var f;c&&(f=!0,c&&(a=a.replace(Sa,function(a,b){return" > "+b})));a=a.replace(Ta,function(a,b,c){return'[dir="'+c+'"] '+b+", "+b+'[dir="'+c+'"]'});return{value:a,H:b,stop:f}}function Ra(a,b){a=a.split(Ua);a[0]+=b;return a.join(Ua)}
-function Qa(a,b){var c=a.match(Va);return(c=c&&c[2].trim()||"")?c[0].match(Wa)?a.replace(Va,function(a,c,f){return b+f}):c.split(Wa)[0]===b?c:Xa:a.replace(Ma,b)}function Ya(a){a.selector===Za&&(a.selector="html")}H.prototype.c=function(a){return a.match(Pa)?this.b(a,$a):Ra(a.trim(),$a)};aa.Object.defineProperties(H.prototype,{a:{configurable:!0,enumerable:!0,get:function(){return"style-scope"}}});
-var Ka=/:(nth[-\w]+)\(([^)]+)\)/,$a=":not(.style-scope)",Ja=",",Na=/(^|[\s>+~]+)((?:\[.+?\]|[^\s>+~=\[])+)/g,Wa=/[[.:#*]/,Ma=":host",Za=":root",Pa="::slotted",La=new RegExp("^("+Pa+")"),Va=/(:host)(?:\(((?:\([^)(]*\)|[^)(]*)+?)\))/,Sa=/(?:::slotted)(?:\(((?:\([^)(]*\)|[^)(]*)+?)\))/,Ta=/(.*):dir\((?:(ltr|rtl))\)/,Ia=".",Ua=":",Ga="class",Xa="should_not_match",J=new H;function ab(){}
-function bb(a){for(var b=0;b<a.length;b++){var c=a[b];if(c.target!==document.documentElement&&c.target!==document.head)for(var e=0;e<c.addedNodes.length;e++){var d=c.addedNodes[e];if(d.nodeType===Node.ELEMENT_NODE){var f=d.getRootNode(),g;g=d;var h=[];g.classList?h=Array.from(g.classList):g instanceof window.SVGElement&&g.hasAttribute("class")&&(h=g.getAttribute("class").split(/\s+/));g=h;h=g.indexOf(J.a);(g=-1<h?g[h+1]:"")&&f===d.ownerDocument?I(d,g,!0):f.nodeType===Node.DOCUMENT_FRAGMENT_NODE&&(f=
-f.host)&&(f=E(f).is,g!==f&&(g&&I(d,g,!0),I(d,f)))}}}}
-if(!v){var cb=new MutationObserver(bb),db=function(a){cb.observe(a,{childList:!0,subtree:!0})};if(window.customElements&&!window.customElements.polyfillWrapFlushCallback)db(document);else{var eb=function(){db(document.body)};window.HTMLImports?window.HTMLImports.whenReady(eb):requestAnimationFrame(function(){if("loading"===document.readyState){var a=function(){eb();document.removeEventListener("readystatechange",a)};document.addEventListener("readystatechange",a)}else eb()})}ab=function(){bb(cb.takeRecords())}}
-var fb=ab;function O(a,b,c,e,d){this.j=a||null;this.b=b||null;this.B=c||[];this.s=null;this.u=d||"";this.a=this.h=this.m=null}function P(a){return a?a.__styleInfo:null}function gb(a,b){return a.__styleInfo=b}O.prototype.c=function(){return this.j};O.prototype._getStyleRules=O.prototype.c;var Q=window.Element.prototype,hb=Q.matches||Q.matchesSelector||Q.mozMatchesSelector||Q.msMatchesSelector||Q.oMatchesSelector||Q.webkitMatchesSelector,ib=navigator.userAgent.match("Trident");function jb(){}function kb(a){var b={},c=[],e=0;z(a,function(a){R(a);a.index=e++;a=a.f.cssText;for(var c;c=va.exec(a);){var d=c[1];":"!==c[2]&&(b[d]=!0)}},function(a){c.push(a)});a.b=c;a=[];for(var d in b)a.push(d);return a}
-function R(a){if(!a.f){var b={},c={};S(a,c)&&(b.i=c,a.rules=null);b.cssText=a.parsedCssText.replace(ya,"").replace(ta,"");a.f=b}}function S(a,b){var c=a.f;if(c){if(c.i)return Object.assign(b,c.i),!0}else{for(var c=a.parsedCssText,e;a=ta.exec(c);){e=(a[2]||a[3]).trim();if("inherit"!==e||"unset"!==e)b[a[1].trim()]=e;e=!0}return e}}
-function T(a,b,c){b&&(b=0<=b.indexOf(";")?lb(a,b,c):Ca(b,function(b,d,f,g){if(!d)return b+g;(d=T(a,c[d],c))&&"initial"!==d?"apply-shim-inherit"===d&&(d="inherit"):d=T(a,c[f]||f,c)||f;return b+(d||"")+g}));return b&&b.trim()||""}
-function lb(a,b,c){b=b.split(";");for(var e=0,d,f;e<b.length;e++)if(d=b[e]){ua.lastIndex=0;if(f=ua.exec(d))d=T(a,c[f[1]],c);else if(f=d.indexOf(":"),-1!==f){var g=d.substring(f),g=g.trim(),g=T(a,g,c)||g;d=d.substring(0,f)+g}b[e]=d&&d.lastIndexOf(";")===d.length-1?d.slice(0,-1):d||""}return b.join(";")}
-function mb(a,b){var c={},e=[];z(a,function(a){a.f||R(a);var d=a.g||a.parsedSelector;b&&a.f.i&&d&&hb.call(b,d)&&(S(a,c),a=a.index,d=parseInt(a/32,10),e[d]=(e[d]||0)|1<<a%32)},null,!0);return{i:c,key:e}}
-function nb(a,b,c,e,d){c.f||R(c);if(c.f.i){b=E(b);a=b.is;b=b.u;b=a?L(a,b):"html";var f=c.parsedSelector,g=":host > *"===f||"html"===f,h=0===f.indexOf(":host")&&!g;"shady"===e&&(g=f===b+" > *."+b||-1!==f.indexOf("html"),h=!g&&0===f.indexOf(b));"shadow"===e&&(g=":host > *"===f||"html"===f,h=h&&!g);if(g||h)e=b,h&&(v&&!c.g&&(c.g=M(J,c,J.b,a?Ia+a:"",b)),e=c.g||b),d({M:e,K:h,S:g})}}
-function ob(a,b){var c={},e={},d=U,f=b&&b.__cssBuild;z(b,function(b){nb(d,a,b,f,function(d){hb.call(a.A||a,d.M)&&(d.K?S(b,c):S(b,e))})},null,!0);return{L:e,J:c}}
-function pb(a,b,c,e){var d=E(b),f=L(d.is,d.u),g=new RegExp("(?:^|[^.#[:])"+(b.extends?"\\"+f.slice(0,-1)+"\\]":f)+"($|[.:[\\s>+~])"),d=P(b).j,h=qb(d,e);return K(b,d,function(b){var d="";b.f||R(b);b.f.cssText&&(d=lb(a,b.f.cssText,c));b.cssText=d;if(!v&&!Aa(b)&&b.cssText){var k=d=b.cssText;null==b.C&&(b.C=wa.test(d));if(b.C)if(null==b.w){b.w=[];for(var q in h)k=h[q],k=k(d),d!==k&&(d=k,b.w.push(q))}else{for(q=0;q<b.w.length;++q)k=h[b.w[q]],d=k(d);k=d}b.cssText=k;b.g=b.g||b.selector;d="."+e;q=b.g.split(",");
-for(var k=0,wb=q.length,N;k<wb&&(N=q[k]);k++)q[k]=N.match(g)?N.replace(f,d):d+" "+N;b.selector=q.join(",")}})}function qb(a,b){a=a.b;var c={};if(!v&&a)for(var e=0,d=a[e];e<a.length;d=a[++e]){var f=d,g=b;f.l=new RegExp(f.keyframesName,"g");f.a=f.keyframesName+"-"+g;f.g=f.g||f.selector;f.selector=f.g.replace(f.keyframesName,f.a);c[d.keyframesName]=rb(d)}return c}function rb(a){return function(b){return b.replace(a.l,a.a)}}
-function sb(a,b){var c=U,e=A(a);a.textContent=y(e,function(a){var d=a.cssText=a.parsedCssText;a.f&&a.f.cssText&&(d=d.replace(la,"").replace(ma,""),a.cssText=lb(c,d,b))})}aa.Object.defineProperties(jb.prototype,{a:{configurable:!0,enumerable:!0,get:function(){return"x-scope"}}});var U=new jb;var tb={},V=window.customElements;if(V&&!v){var ub=V.define;V.define=function(a,b,c){var e=document.createComment(" Shady DOM styles for "+a+" "),d=document.head;d.insertBefore(e,(C?C.nextSibling:null)||d.firstChild);C=e;tb[a]=e;return ub.call(V,a,b,c)}};var W=new function(){this.cache={};this.a=100};function X(){var a=this;this.A={};this.c=document.documentElement;var b=new n;b.rules=[];this.l=gb(this.c,new O(b));this.v=!1;this.a=this.b=null;Ea(function(){Y(a)})}l=X.prototype;l.F=function(){fb()};l.I=function(a){return A(a)};l.O=function(a){return y(a)};
-l.prepareTemplate=function(a,b,c){if(!a.l){a.l=!0;a.name=b;a.extends=c;m[b]=a;var e;e=(e=a.content.querySelector("style"))?e.getAttribute("css-build")||"":"";var d;d=a.content.querySelectorAll("style");for(var f=[],g=0;g<d.length;g++){var h=d[g];f.push(h.textContent);h.parentNode.removeChild(h)}d=f.join("").trim();c={is:b,extends:c,P:e};v||I(a.content,b);Y(this);f=this.b.detectMixin(d);d=p(d);f&&w&&this.b.transformRules(d,b);a._styleAst=d;a.v=e;e=[];w||(e=kb(a._styleAst));if(!e.length||w)d=v?a.content:
-null,b=tb[b],f=K(c,a._styleAst),b=f.length?B(f,c.is,d,b):void 0,a.a=b;a.c=e}};function vb(a){if(!a.b)if(window.ShadyCSS&&window.ShadyCSS.ApplyShim)a.b=window.ShadyCSS.ApplyShim,a.b.invalidCallback=qa;else{var b={};a.b=(b.detectMixin=function(){return!1},b.transformRule=function(){},b.transformRules=function(){},b)}}
-function xb(a){if(!a.a)if(window.ShadyCSS&&window.ShadyCSS.CustomStyleInterface)a.a=window.ShadyCSS.CustomStyleInterface,a.a.transformCallback=function(b){a.D(b)},a.a.validateCallback=function(){requestAnimationFrame(function(){(a.a.enqueued||a.v)&&a.o()})};else{var b={};a.a=(b.processStyles=function(){},b.enqueued=!1,b.getStyleForCustomStyle=function(){return null},b)}}function Y(a){vb(a);xb(a)}
-l.o=function(){Y(this);var a=this.a.processStyles();if(this.a.enqueued){if(w)for(var b=0;b<a.length;b++){var c=this.a.getStyleForCustomStyle(a[b]);if(c&&w){var e=A(c);Y(this);this.b.transformRules(e);c.textContent=y(e)}}else for(yb(this,this.c,this.l),b=0;b<a.length;b++)(c=this.a.getStyleForCustomStyle(a[b]))&&sb(c,this.l.m);this.a.enqueued=!1;this.v&&!w&&this.styleDocument()}};
-l.styleElement=function(a,b){var c=E(a).is,e=P(a);if(!e){var d=E(a),e=d.is,d=d.u,f=tb[e],e=m[e],g,h;e&&(g=e._styleAst,h=e.c);e=gb(a,new O(g,f,h,0,d))}a!==this.c&&(this.v=!0);b&&(e.s=e.s||{},Object.assign(e.s,b));if(w){if(e.s){b=e.s;for(var k in b)null===k?a.style.removeProperty(k):a.style.setProperty(k,b[k])}if(((k=m[c])||a===this.c)&&k&&k.a&&!ra(k)){if(ra(k)||k._applyShimValidatingVersion!==k._applyShimNextVersion)Y(this),this.b.transformRules(k._styleAst,c),k.a.textContent=K(a,e.j),sa(k);v&&(c=
-a.shadowRoot)&&(c.querySelector("style").textContent=K(a,e.j));e.j=k._styleAst}}else if(yb(this,a,e),e.B&&e.B.length){c=e;k=E(a).is;a:{if(b=W.cache[k])for(g=b.length-1;0<=g;g--){h=b[g];b:{e=c.B;for(d=0;d<e.length;d++)if(f=e[d],h.i[f]!==c.m[f]){e=!1;break b}e=!0}if(e){b=h;break a}}b=void 0}e=b?b.styleElement:null;g=c.h;(h=b&&b.h)||(h=this.A[k]=(this.A[k]||0)+1,h=k+"-"+h);c.h=h;h=c.h;var d=U,d=e?e.textContent||"":pb(d,a,c.m,h),f=P(a),x=f.a;x&&!v&&x!==e&&(x._useCount--,0>=x._useCount&&x.parentNode&&
-x.parentNode.removeChild(x));v?f.a?(f.a.textContent=d,e=f.a):d&&(e=B(d,h,a.shadowRoot,f.b)):e?e.parentNode||(ib&&-1<d.indexOf("@media")&&(e.textContent=d),Ba(e,null,f.b)):d&&(e=B(d,h,null,f.b));e&&(e._useCount=e._useCount||0,f.a!=e&&e._useCount++,f.a=e);h=e;v||(e=c.h,f=d=a.getAttribute("class")||"",g&&(f=d.replace(new RegExp("\\s*x-scope\\s*"+g+"\\s*","g")," ")),f+=(f?" ":"")+"x-scope "+e,d!==f&&D(a,f));b||(a=W.cache[k]||[],a.push({i:c.m,styleElement:h,h:c.h}),a.length>W.a&&a.shift(),W.cache[k]=a)}};
-function zb(a,b){return(b=b.getRootNode().host)?P(b)?b:zb(a,b):a.c}function yb(a,b,c){a=zb(a,b);var e=P(a);a=Object.create(e.m||null);var d=ob(b,c.j);b=mb(e.j,b).i;Object.assign(a,d.J,b,d.L);b=c.s;for(var f in b)if((d=b[f])||0===d)a[f]=d;f=U;b=Object.getOwnPropertyNames(a);for(d=0;d<b.length;d++)e=b[d],a[e]=T(f,a[e],a);c.m=a}l.styleDocument=function(a){this.styleSubtree(this.c,a)};
-l.styleSubtree=function(a,b){var c=a.shadowRoot;(c||a===this.c)&&this.styleElement(a,b);if(b=c&&(c.children||c.childNodes))for(a=0;a<b.length;a++)this.styleSubtree(b[a]);else if(a=a.children||a.childNodes)for(b=0;b<a.length;b++)this.styleSubtree(a[b])};l.D=function(a){var b=this,c=A(a);z(c,function(a){if(v)Ya(a);else{var c=J;a.selector=a.parsedSelector;Ya(a);a.selector=a.g=M(c,a,c.c,void 0,void 0)}w&&(Y(b),b.b.transformRule(a))});w?a.textContent=y(c):this.l.j.rules.push(c)};
-l.getComputedStyleValue=function(a,b){var c;w||(c=(P(a)||P(zb(this,a))).m[b]);return(c=c||window.getComputedStyle(a).getPropertyValue(b))?c.trim():""};l.N=function(a,b){var c=a.getRootNode();b=b?b.split(/\s/):[];c=c.host&&c.host.localName;if(!c){var e=a.getAttribute("class");if(e)for(var e=e.split(/\s/),d=0;d<e.length;d++)if(e[d]===J.a){c=e[d+1];break}}c&&b.push(J.a,c);w||(c=P(a))&&c.h&&b.push(U.a,c.h);D(a,b.join(" "))};l.G=function(a){return P(a)};X.prototype.flush=X.prototype.F;
-X.prototype.prepareTemplate=X.prototype.prepareTemplate;X.prototype.styleElement=X.prototype.styleElement;X.prototype.styleDocument=X.prototype.styleDocument;X.prototype.styleSubtree=X.prototype.styleSubtree;X.prototype.getComputedStyleValue=X.prototype.getComputedStyleValue;X.prototype.setElementClass=X.prototype.N;X.prototype._styleInfoForNode=X.prototype.G;X.prototype.transformCustomStyleForDocument=X.prototype.D;X.prototype.getStyleAst=X.prototype.I;X.prototype.styleAstToString=X.prototype.O;
-X.prototype.flushCustomStyles=X.prototype.o;Object.defineProperties(X.prototype,{nativeShadow:{get:function(){return v}},nativeCss:{get:function(){return w}}});var Z=new X,Ab,Bb;window.ShadyCSS&&(Ab=window.ShadyCSS.ApplyShim,Bb=window.ShadyCSS.CustomStyleInterface);window.ShadyCSS={ScopingShim:Z,prepareTemplate:function(a,b,c){Z.o();Z.prepareTemplate(a,b,c)},styleSubtree:function(a,b){Z.o();Z.styleSubtree(a,b)},styleElement:function(a){Z.o();Z.styleElement(a)},styleDocument:function(a){Z.o();Z.styleDocument(a)},getComputedStyleValue:function(a,b){return Z.getComputedStyleValue(a,b)},nativeCss:w,nativeShadow:v};Ab&&(window.ShadyCSS.ApplyShim=Ab);
-Bb&&(window.ShadyCSS.CustomStyleInterface=Bb);
-}).call(self);
-
-//# sourceMappingURL=scoping-shim.min.js.map
diff --git a/src/main/resources/static/gltf-viewer/bower_components/shadycss/scoping-shim.min.js.map b/src/main/resources/static/gltf-viewer/bower_components/shadycss/scoping-shim.min.js.map
deleted file mode 100644 (file)
index b14ab9a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-{"version":3,"sources":["src/template-map.js"," [synthetic:util/global] ","src/css-parse.js","src/apply-shim-utils.js","src/common-regex.js","src/style-settings.js","src/style-util.js","src/document-wait.js","src/style-transformer.js","src/document-watcher.js","src/style-info.js","src/style-properties.js","src/style-placeholder.js","src/scoping-shim.js","src/style-cache.js","src/common-utils.js","entrypoints/scoping-shim.js"],"names":["$jscomp.global","templateMap","constructor","StyleNode","parse$$module$$src$css_parse","parse","text","replace","RX$$module$$src$css_parse.comments","RX$$module$$src$css_parse.port","parseCss","root","length","n","i","l","OPEN_BRACE","p","previous","push","CLOSE_BRACE","parseCss$$module$$src$css_parse","node","t","substring","trim","ss","_expandUnicodeEscapes","RX$$module$$src$css_parse.multipleSpaces","lastIndexOf","s","indexOf","AT_START","MEDIA_START","match","RX$$module$$src$css_parse.keyframesRule","types$$module$$src$css_parse.KEYFRAMES_RULE","split","pop","types$$module$$src$css_parse.MEDIA_RULE","VAR_START","types$$module$$src$css_parse.STYLE_RULE","types$$module$$src$css_parse.MIXIN_RULE","r$","r","_expandUnicodeEscapes$$module$$src$css_parse","code","repeat","stringify$$module$$src$css_parse","stringify","preserveProperties","cssText","rules","RX$$module$$src$css_parse.customProp","RX$$module$$src$css_parse.mixinProp","RX$$module$$src$css_parse.mixinApply","RX$$module$$src$css_parse.varApply","STYLE_RULE","KEYFRAMES_RULE","MEDIA_RULE","MIXIN_RULE","comments","port","customProp","mixinProp","mixinApply","varApply","keyframesRule","multipleSpaces","promise","Promise","resolve","invalidate$$module$$src$apply_shim_utils","invalidate","elementName","template","templateIsValid$$module$$src$apply_shim_utils","templateIsValid","startValidatingTemplate$$module$$src$apply_shim_utils","startValidatingTemplate","_validating","then","VAR_ASSIGN","MIXIN_MATCH","VAR_CONSUMED","ANIMATION_MATCH","MEDIA_MATCH","BRACKETED","nativeShadow","window","nativeCssVariables","navigator","userAgent","CSS","supports","parseSettings$$module$$src$style_settings","parseSettings","settings","ShadyCSS","module$$src$style_settings.nativeShadow","module$$src$style_settings.nativeCssVariables","toCssText$$module$$src$style_util","toCssText","callback","forEachRule","rulesForStyle$$module$$src$style_util","rulesForStyle","style","textContent","isKeyframesSelector$$module$$src$style_util","isKeyframesSelector","rule","forEachRule$$module$$src$style_util","styleRuleCallback","keyframesRuleCallback","onlyActiveRules","skipRules","type","matchMedia","matches","applyCss$$module$$src$style_util","applyCss","moniker","target","contextNode","document","createElement","setAttribute","applyStyle","lastHeadApplyNode","applyStyle$$module$$src$style_util","head","insertBefore","nextSibling","firstChild","compareDocumentPosition","position","Node","DOCUMENT_POSITION_PRECEDING","processVariableAndFallback$$module$$src$style_util","processVariableAndFallback","str","start","end","level","inner","prefix","suffix","comma","value","fallback","setElementClassRaw$$module$$src$style_util","setElementClassRaw","element","call","getIsExtends$$module$$src$style_util","getIsExtends","localName","typeExtension","is","getAttribute","extends","readyPromise","whenReady","resolveFn","documentWait$$module$$src$document_wait","documentWait","requestAnimationFrame","readyState","addEventListener","StyleTransformer","dom","scope","shouldRemoveScope","$jscompDefaultExport","_transformDom","selector","nodeType","ELEMENT_NODE","classList","remove","SCOPE_NAME","add","c","CLASS","newValue","c$","childNodes","content","_content","children","elementStyles","styleRules","cssBuildType","css","ext","hostScope","_calcHostScope","CSS_CLASS_PREFIX","isScoped","transformedSelector","_transformRuleCss","self","_transformComplexSelector","transformer","p$","COMPLEX_SELECTOR_SEP","join","stop","NTH","m","SLOTTED_START","HOST","SIMPLE_SELECTOR_SEP","info","_transformCompoundSelector","combinator","slottedIndex","SLOTTED","_transformHostSelector","_transformSimpleSelector","slotted","SLOTTED_PAREN","paren","DIR_PAREN","before","dir","PSEUDO_PREFIX","HOST_PAREN","SIMPLE_SELECTOR_PREFIX","host","typeSelector","SELECTOR_NO_MATCH","normalizeRootSelector","ROOT","_transformDocumentSelector","SCOPE_DOC_SELECTOR","$jscomp.global.Object.defineProperties","RegExp","flush$$module$$src$document_watcher","handler$$module$$src$document_watcher","handler","mxns","x","mxn","documentElement","addedNodes","getRootNode","currentScope","classes","Array","from","hasAttribute","idx","ownerDocument","DOCUMENT_FRAGMENT_NODE","newScope","observer","MutationObserver","observe","childList","subtree","delayedStart","body","listener","removeEventListener","flush","takeRecords","module$$src$document_watcher.flush","StyleInfo","ast","placeholder","ownStylePropertyNames","overrideStyleProperties","customStyle","scopeSelector","styleProperties","get","set","styleInfo","_getStyleRules","prototype","Element","matchesSelector","mozMatchesSelector","msMatchesSelector","oMatchesSelector","webkitMatchesSelector","IS_IE","StyleProperties","decorateStyles","props","keyframes","ruleIndex","decorateRule","index","propertyInfo","exec","name","onKeyframesRule","_keyframes","names","properties","collectProperties","hasProperties","Object","assign","any","valueForProperty","property","valueForProperties","fn","propertyValue","parts","lastIndex","colon","pp","slice","propertyDataFromStyles","o","selectorToMatch","parseInt","key","whenHostOrRootRule","cssBuild","parsedSelector","isRoot","isHost","hostAndRootPropertiesForScope","hostProps","rootProps","_element","transformStyles","hostSelector","hostRx","HOST_PREFIX","rxHostSelector","HOST_SUFFIX","StyleInfo$$module$$src$style_info.get","keyframeTransforms","_elementKeyframeTransforms","output","input","hasAnimations","test","keyframeNamesToTransform","keyframe","transform","keyframesRules","keyframesNameRx","transformedKeyframesName","scopeId","_keyframesRuleTransformer","applyCustomStyle","XSCOPE_NAME","placeholderMap","ce","origDefine","wrappedDefine","clazz","options","placeHolder","createComment","after","styleCache","cache","typeMax","ScopingShim","_scopeCounter","_documentOwner","_documentOwnerStyleInfo","StyleInfo$$module$$src$style_info.set","_elementsHaveApplied","_customStyleInterface","_applyShim","_ensure","ScopingShim$$module$$src$scoping_shim.prototype","?.prototype","ScopingShim$$module$$src$scoping_shim_prototype$flush","getStyleAst","styleAstToString","prepareTemplate","_prepared","querySelector","styles","querySelectorAll","parentNode","removeChild","__cssBuild","hasMixins","_cssBuild","ownPropertyNames","shadowroot","_style","_ownPropertyNames","_ensureApplyShim","ApplyShim","_ensureCustomStyleInterface","CustomStyleInterface","transformCustomStyleForDocument","flushCustomStyles","customStyles","_revalidateCustomStyleApplyShim","_updateProperties","_applyCustomStyles","styleDocument","styleElement","overrideProps","_isRootOwner","removeProperty","setProperty","shadowRoot","list","entry","pn","cachedStyle","cacheEntry","oldScopeSelector","cachedScopeSelector","id","v","shift","_styleOwnerForNode","owner","ownerStyleInfo","create","hostAndRootProps","propertiesMatchingHost","propertyData","overrides","getOwnPropertyNames","styleSubtree","shadowChildren","_transformRule","getComputedStyleValue","getComputedStyle","getPropertyValue","setElementClass","classString","scopeName","classAttr","k$","_styleInfoForNode","defineProperties","scopingShim","elementExtends","nativeCss"],"mappings":"A;;;;;;;;;;aAUA,IAAA,CAAA,CCiCAA,GAb2B,WAAlB,EAAC,MAAO,OAAR,EAAiC,MAAjC,GAa0B,IAb1B,CAa0B,IAb1B,CAEe,WAAlB,EAAC,MAAO,OAAR,EAA2C,IAA3C,EAAiC,MAAjC,CAAmD,MAAnD,CAW6B,IDjCnC,CAKMC,EAAc,E,CEIlBC,QADIC,EACO,EAAG,CAIZ,IAAA,IAAA,CAFA,IAAA,MAEA,CAFgB,CAQhB,KAAA,MAAA,CAFA,IAAA,OAEA,CAJA,IAAA,SAIA,CAJmB,IAQnB,KAAA,QAAA,CAFA,IAAA,cAEA,CAFwB,EAIxB,KAAA,OAAA,CAAiB,CAAA,CAEjB,KAAA,KAAA,CAAe,CAMf,KAAA,eAAA,CAFA,IAAA,SAEA,CAJA,IAAA,cAIA,CAJwB,EApBZ;AAmCTC,QAASC,EAAK,CAACC,CAAD,CA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CGhdA,IAAMwV,EAAc,IHgBL7E,CGhBf,CAEI6B,EAFJ,CAEeE,EAEXrT,OAAA,SAAJ,GACEmT,EACA,CADYnT,MAAA,SAAA,UACZ,CAAAqT,EAAA,CAAuBrT,MAAA,SAAA,qBAFzB,CAKAA,OAAAS,SAAA,CAAkB,CAChB6Q,YAAa6E,CADG,CAOhB/D,gBAAAA,QAAe,CAAClT,CAAD,CAAWD,CAAX,CAAwBmX,CAAxB,CAAwC,CACrDD,CAAA5C,EAAA,EACA4C,EAAA/D,gBAAA,CAA4BlT,CAA5B,CAAsCD,CAAtC,CAAmDmX,CAAnD,CAFqD,CAPvC,CAgBhBd,aAAAA,QAAY,CAACtR,CAAD,CAAUqJ,CAAV,CAAsB,CAChC8I,CAAA5C,EAAA,EACA4C,EAAAb,aAAA,CAAyBtR,CAAzB,CAAkCqJ,CAAlC,CAFgC,CAhBlB,CAwBhBwG,aAAAA,QAAY,CAAC7P,CAAD,CAAU,CACpBmS,CAAA5C,EAAA,EACA4C,EAAAtC,aAAA,CAAyB7P,CAAzB,CAFoB,CAxBN,CAgChB4P,cAAAA,QAAa,CAACvG,CAAD,CAAa,CACxB8I,CAAA5C,EAAA,EACA4C,EAAAvC,cAAA,CAA0BvG,CAA1B,CAFwB,CAhCV,CA0ChBoI,sBAAAA,QAAqB,CAACzR,CAAD,CAAU4J,CAAV,CAAoB,CACvC,MAAOuI,EAAAV,sBAAA,CAAkCzR,CAAlC,CAA2C4J,CAA3C,CADgC,CA1CzB,CA8ChByI,UAAW1V,CA9CK,CAgDhBZ,aAAcW,CAhDE,CAmDdyS,GAAJ,GACEnT,MAAAS,SAAA0S,UADF,CAC8BA,EAD9B,CAIIE;EAAJ,GACErT,MAAAS,SAAA4S,qBADF,CACyCA,EADzC","file":"scoping-shim.min.js","sourcesContent":["/**\n@license\nCopyright (c) 2017 The Polymer Project Authors. All rights reserved.\nThis code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt\nThe complete set of authors may be found at http://polymer.github.io/AUTHORS.txt\nThe complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt\nCode distributed by Google as part of the polymer project is also\nsubject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt\n*/\n\n'use strict';\n\n/**\n * @const {!Object<string, !HTMLTemplateElement>}\n */\nconst templateMap = {};\nexport default templateMap;\n",null,"/**\n@license\nCopyright (c) 2017 The Polymer Project Authors. All rights reserved.\nThis code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt\nThe complete set of authors may be found at http://polymer.github.io/AUTHORS.txt\nThe complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt\nCode distributed by Google as part of the polymer project is also\nsubject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt\n*/\n\n/*\nExtremely simple css parser. Intended to be not more than what we need\nand definitely not necessarily correct =).\n*/\n\n'use strict';\n\n/** @unrestricted */\nclass StyleNode {\n  constructor() {\n    /** @type {number} */\n    this['start'] = 0;\n    /** @type {number} */\n    this['end'] = 0;\n    /** @type {StyleNode} */\n    this['previous'] = null;\n    /** @type {StyleNode} */\n    this['parent'] = null;\n    /** @type {Array<StyleNode>} */\n    this['rules'] = null;\n    /** @type {string} */\n    this['parsedCssText'] = '';\n    /** @type {string} */\n    this['cssText'] = '';\n    /** @type {boolean} */\n    this['atRule'] = false;\n    /** @type {number} */\n    this['type'] = 0;\n    /** @type {string} */\n    this['keyframesName'] = '';\n    /** @type {string} */\n    this['selector'] = '';\n    /** @type {string} */\n    this['parsedSelector'] = '';\n  }\n}\n\nexport {StyleNode}\n\n// given a string of css, return a simple rule tree\n/**\n * @param {string} text\n * @return {StyleNode}\n */\nexport function parse(text) {\n  text = clean(text);\n  return parseCss(lex(text), text);\n}\n\n// remove stuff we don't care about that may hinder parsing\n/**\n * @param {string} cssText\n * @return {string}\n */\nfunction clean(cssText) {\n  return cssText.replace(RX.comments, '').replace(RX.port, '');\n}\n\n// super simple {...} lexer that returns a node tree\n/**\n * @param {string} text\n * @return {StyleNode}\n */\nfunction lex(text) {\n  let root = new StyleNode();\n  root['start'] = 0;\n  root['end'] = text.length\n  let n = root;\n  for (let i = 0, l = text.length; i < l; i++) {\n    if (text[i] === OPEN_BRACE) {\n      if (!n['rules']) {\n        n['rules'] = [];\n      }\n      let p = n;\n      let previous = p['rules'][p['rules'].length - 1] || null;\n      n = new StyleNode();\n      n['start'] = i + 1;\n      n['parent'] = p;\n      n['previous'] = previous;\n      p['rules'].push(n);\n    } else if (text[i] === CLOSE_BRACE) {\n      n['end'] = i + 1;\n      n = n['parent'] || root;\n    }\n  }\n  return root;\n}\n\n// add selectors/cssText to node tree\n/**\n * @param {StyleNode} node\n * @param {string} text\n * @return {StyleNode}\n */\nfunction parseCss(node, text) {\n  let t = text.substring(node['start'], node['end'] - 1);\n  node['parsedCssText'] = node['cssText'] = t.trim();\n  if (node['parent']) {\n    let ss = node['previous'] ? node['previous']['end'] : node['parent']['start'];\n    t = text.substring(ss, node['start'] - 1);\n    t = _expandUnicodeEscapes(t);\n    t = t.replace(RX.multipleSpaces, ' ');\n    // TODO(sorvell): ad hoc; make selector include only after last ;\n    // helps with mixin syntax\n    t = t.substring(t.lastIndexOf(';') + 1);\n    let s = node['parsedSelector'] = node['selector'] = t.trim();\n    node['atRule'] = (s.indexOf(AT_START) === 0);\n    // note, support a subset of rule types...\n    if (node['atRule']) {\n      if (s.indexOf(MEDIA_START) === 0) {\n        node['type'] = types.MEDIA_RULE;\n      } else if (s.match(RX.keyframesRule)) {\n        node['type'] = types.KEYFRAMES_RULE;\n        node['keyframesName'] =\n          node['selector'].split(RX.multipleSpaces).pop();\n      }\n    } else {\n      if (s.indexOf(VAR_START) === 0) {\n        node['type'] = types.MIXIN_RULE;\n      } else {\n        node['type'] = types.STYLE_RULE;\n      }\n    }\n  }\n  let r$ = node['rules'];\n  if (r$) {\n    for (let i = 0, l = r$.length, r;\n      (i < l) && (r = r$[i]); i++) {\n      parseCss(r, text);\n    }\n  }\n  return node;\n}\n\n/**\n * conversion of sort unicode escapes with spaces like `\\33 ` (and longer) into\n * expanded form that doesn't require trailing space `\\000033`\n * @param {string} s\n * @return {string}\n */\nfunction _expandUnicodeEscapes(s) {\n  return s.replace(/\\\\([0-9a-f]{1,6})\\s/gi, function() {\n    let code = arguments[1],\n      repeat = 6 - code.length;\n    while (repeat--) {\n      code = '0' + code;\n    }\n    return '\\\\' + code;\n  });\n}\n\n/**\n * stringify parsed css.\n * @param {StyleNode} node\n * @param {boolean=} preserveProperties\n * @param {string=} text\n * @return {string}\n */\nexport function stringify(node, preserveProperties, text = '') {\n  // calc rule cssText\n  let cssText = '';\n  if (node['cssText'] || node['rules']) {\n    let r$ = node['rules'];\n    if (r$ && !_hasMixinRules(r$)) {\n      for (let i = 0, l = r$.length, r;\n        (i < l) && (r = r$[i]); i++) {\n        cssText = stringify(r, preserveProperties, cssText);\n      }\n    } else {\n      cssText = preserveProperties ? node['cssText'] :\n        removeCustomProps(node['cssText']);\n      cssText = cssText.trim();\n      if (cssText) {\n        cssText = '  ' + cssText + '\\n';\n      }\n    }\n  }\n  // emit rule if there is cssText\n  if (cssText) {\n    if (node['selector']) {\n      text += node['selector'] + ' ' + OPEN_BRACE + '\\n';\n    }\n    text += cssText;\n    if (node['selector']) {\n      text += CLOSE_BRACE + '\\n\\n';\n    }\n  }\n  return text;\n}\n\n/**\n * @param {Array<StyleNode>} rules\n * @return {boolean}\n */\nfunction _hasMixinRules(rules) {\n  let r = rules[0];\n  return Boolean(r) && Boolean(r['selector']) && r['selector'].indexOf(VAR_START) === 0;\n}\n\n/**\n * @param {string} cssText\n * @return {string}\n */\nfunction removeCustomProps(cssText) {\n  cssText = removeCustomPropAssignment(cssText);\n  return removeCustomPropApply(cssText);\n}\n\n/**\n * @param {string} cssText\n * @return {string}\n */\nexport function removeCustomPropAssignment(cssText) {\n  return cssText\n    .replace(RX.customProp, '')\n    .replace(RX.mixinProp, '');\n}\n\n/**\n * @param {string} cssText\n * @return {string}\n */\nfunction removeCustomPropApply(cssText) {\n  return cssText\n    .replace(RX.mixinApply, '')\n    .replace(RX.varApply, '');\n}\n\n/** @enum {number} */\nexport const types = {\n  STYLE_RULE: 1,\n  KEYFRAMES_RULE: 7,\n  MEDIA_RULE: 4,\n  MIXIN_RULE: 1000\n}\n\nconst OPEN_BRACE = '{';\nconst CLOSE_BRACE = '}';\n\n// helper regexp's\nconst RX = {\n  comments: /\\/\\*[^*]*\\*+([^/*][^*]*\\*+)*\\//gim,\n  port: /@import[^;]*;/gim,\n  customProp: /(?:^[^;\\-\\s}]+)?--[^;{}]*?:[^{};]*?(?:[;\\n]|$)/gim,\n  mixinProp: /(?:^[^;\\-\\s}]+)?--[^;{}]*?:[^{};]*?{[^}]*?}(?:[;\\n]|$)?/gim,\n  mixinApply: /@apply\\s*\\(?[^);]*\\)?\\s*(?:[;\\n]|$)?/gim,\n  varApply: /[^;:]*?:[^;]*?var\\([^;]*\\)(?:[;\\n]|$)?/gim,\n  keyframesRule: /^@[^\\s]*keyframes/,\n  multipleSpaces: /\\s+/g\n}\n\nconst VAR_START = '--';\nconst MEDIA_START = '@media';\nconst AT_START = '@';\n","/**\n@license\nCopyright (c) 2017 The Polymer Project Authors. All rights reserved.\nThis code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt\nThe complete set of authors may be found at http://polymer.github.io/AUTHORS.txt\nThe complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt\nCode distributed by Google as part of the polymer project is also\nsubject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt\n*/\n\n'use strict';\nimport templateMap from './template-map'\nimport {StyleNode} from './css-parse' // eslint-disable-line no-unused-vars\n\n/*\n * Utilities for handling invalidating apply-shim mixins for a given template.\n *\n * The invalidation strategy involves keeping track of the \"current\" version of a template's mixins, and updating that count when a mixin is invalidated.\n * The template\n */\n\n/** @const {string} */\nconst CURRENT_VERSION = '_applyShimCurrentVersion';\n\n/** @const {string} */\nconst NEXT_VERSION = '_applyShimNextVersion';\n\n/** @const {string} */\nconst VALIDATING_VERSION = '_applyShimValidatingVersion';\n\n/**\n * @const {Promise<void>}\n */\nconst promise = Promise.resolve();\n\n/**\n * @param {string} elementName\n */\nexport function invalidate(elementName){\n  let template = templateMap[elementName];\n  if (template) {\n    invalidateTemplate(template);\n  }\n}\n\n/**\n * This function can be called multiple times to mark a template invalid\n * and signal that the style inside must be regenerated.\n *\n * Use `startValidatingTemplate` to begin an asynchronous validation cycle.\n * During that cycle, call `templateIsValidating` to see if the template must\n * be revalidated\n * @param {HTMLTemplateElement} template\n */\nexport function invalidateTemplate(template) {\n  // default the current version to 0\n  template[CURRENT_VERSION] = template[CURRENT_VERSION] || 0;\n  // ensure the \"validating for\" flag exists\n  template[VALIDATING_VERSION] = template[VALIDATING_VERSION] || 0;\n  // increment the next version\n  template[NEXT_VERSION] = (template[NEXT_VERSION] || 0) + 1;\n}\n\n/**\n * @param {string} elementName\n * @return {boolean}\n */\nexport function isValid(elementName) {\n  let template = templateMap[elementName];\n  if (template) {\n    return templateIsValid(template);\n  }\n  return true;\n}\n\n/**\n * @param {HTMLTemplateElement} template\n * @return {boolean}\n */\nexport function templateIsValid(template) {\n  return template[CURRENT_VERSION] === template[NEXT_VERSION];\n}\n\n/**\n * @param {string} elementName\n * @return {boolean}\n */\nexport function isValidating(elementName) {\n  let template = templateMap[elementName];\n  if (template) {\n    return templateIsValidating(template);\n  }\n  return false;\n}\n\n/**\n * Returns true if the template is currently invalid and `startValidating` has been called since the last invalidation.\n * If false, the template must be validated.\n * @param {HTMLTemplateElement} template\n * @return {boolean}\n */\nexport function templateIsValidating(template) {\n  return !templateIsValid(template) && template[VALIDATING_VERSION] === template[NEXT_VERSION];\n}\n\n/**\n * the template is marked as `validating` for one microtask so that all instances\n * found in the tree crawl of `applyStyle` will update themselves,\n * but the template will only be updated once.\n * @param {string} elementName\n*/\nexport function startValidating(elementName) {\n  let template = templateMap[elementName];\n  startValidatingTemplate(template);\n}\n\n/**\n * Begin an asynchronous invalidation cycle.\n * This should be called after every validation of a template\n *\n * After one microtask, the template will be marked as valid until the next call to `invalidateTemplate`\n * @param {HTMLTemplateElement} template\n */\nexport function startValidatingTemplate(template) {\n  // remember that the current \"next version\" is the reason for this validation cycle\n  template[VALIDATING_VERSION] = template[NEXT_VERSION];\n  // however, there only needs to be one async task to clear the counters\n  if (!template._validating) {\n    template._validating = true;\n    promise.then(function() {\n      // sync the current version to let future invalidations cause a refresh cycle\n      template[CURRENT_VERSION] = template[NEXT_VERSION];\n      template._validating = false;\n    });\n  }\n}\n\n/**\n * @return {boolean}\n */\nexport function elementsAreInvalid() {\n  for (let elementName in templateMap) {\n    let template = templateMap[elementName];\n    if (!templateIsValid(template)) {\n      return true;\n    }\n  }\n  return false;\n}","/**\n@license\nCopyright (c) 2017 The Polymer Project Authors. All rights reserved.\nThis code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt\nThe complete set of authors may be found at http://polymer.github.io/AUTHORS.txt\nThe complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt\nCode distributed by Google as part of the polymer project is also\nsubject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt\n*/\n\nexport const VAR_ASSIGN = /(?:^|[;\\s{]\\s*)(--[\\w-]*?)\\s*:\\s*(?:([^;{]*)|{([^}]*)})(?:(?=[;\\s}])|$)/gi;\nexport const MIXIN_MATCH = /(?:^|\\W+)@apply\\s*\\(?([^);\\n]*)\\)?/gi;\nexport const VAR_CONSUMED = /(--[\\w-]+)\\s*([:,;)]|$)/gi;\nexport const ANIMATION_MATCH = /(animation\\s*:)|(animation-name\\s*:)/;\nexport const MEDIA_MATCH = /@media[^(]*(\\([^)]*\\))/;\nexport const IS_VAR = /^--/;\nexport const BRACKETED = /\\{[^}]*\\}/g;\nexport const HOST_PREFIX = '(?:^|[^.#[:])';\nexport const HOST_SUFFIX = '($|[.:[\\\\s>+~])';","/**\n@license\nCopyright (c) 2017 The Polymer Project Authors. All rights reserved.\nThis code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt\nThe complete set of authors may be found at http://polymer.github.io/AUTHORS.txt\nThe complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt\nCode distributed by Google as part of the polymer project is also\nsubject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt\n*/\n\n'use strict';\n\nexport let nativeShadow = !(window['ShadyDOM'] && window['ShadyDOM']['inUse']);\n// chrome 49 has semi-working css vars, check if box-shadow works\n// safari 9.1 has a recalc bug: https://bugs.webkit.org/show_bug.cgi?id=155782\nexport let nativeCssVariables = (!navigator.userAgent.match('AppleWebKit/601') &&\nwindow.CSS && CSS.supports && CSS.supports('box-shadow', '0 0 0 var(--foo)'));\n\n/**\n * @param {ShadyCSSOptions | ShadyCSSInterface | undefined} settings\n */\nfunction parseSettings(settings) {\n  if (settings) {\n    nativeCssVariables = nativeCssVariables && !settings['nativeCss'] && !settings['shimcssproperties'];\n    nativeShadow = nativeShadow && !settings['nativeShadow'] && !settings['shimshadow'];\n  }\n}\n\nif (window.ShadyCSS) {\n  parseSettings(window.ShadyCSS);\n} else if (window['WebComponents']) {\n  parseSettings(window['WebComponents']['flags']);\n}\n","/**\n@license\nCopyright (c) 2017 The Polymer Project Authors. All rights reserved.\nThis code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt\nThe complete set of authors may be found at http://polymer.github.io/AUTHORS.txt\nThe complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt\nCode distributed by Google as part of the polymer project is also\nsubject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt\n*/\n\n'use strict';\n\nimport {nativeShadow, nativeCssVariables} from './style-settings'\nimport {parse, stringify, types, StyleNode} from './css-parse' // eslint-disable-line no-unused-vars\nimport {MEDIA_MATCH} from './common-regex';\n\n/**\n * @param {string|StyleNode} rules\n * @param {function(StyleNode)=} callback\n * @return {string}\n */\nexport function toCssText (rules, callback) {\n  if (!rules) {\n    return '';\n  }\n  if (typeof rules === 'string') {\n    rules = parse(rules);\n  }\n  if (callback) {\n    forEachRule(rules, callback);\n  }\n  return stringify(rules, nativeCssVariables);\n}\n\n/**\n * @param {HTMLStyleElement} style\n * @return {StyleNode}\n */\nexport function rulesForStyle(style) {\n  if (!style['__cssRules'] && style.textContent) {\n    style['__cssRules'] = parse(style.textContent);\n  }\n  return style['__cssRules'] || null;\n}\n\n// Tests if a rule is a keyframes selector, which looks almost exactly\n// like a normal selector but is not (it has nothing to do with scoping\n// for example).\n/**\n * @param {StyleNode} rule\n * @return {boolean}\n */\nexport function isKeyframesSelector(rule) {\n  return Boolean(rule['parent']) &&\n  rule['parent']['type'] === types.KEYFRAMES_RULE;\n}\n\n/**\n * @param {StyleNode} node\n * @param {Function=} styleRuleCallback\n * @param {Function=} keyframesRuleCallback\n * @param {boolean=} onlyActiveRules\n */\nexport function forEachRule(node, styleRuleCallback, keyframesRuleCallback, onlyActiveRules) {\n  if (!node) {\n    return;\n  }\n  let skipRules = false;\n  let type = node['type'];\n  if (onlyActiveRules) {\n    if (type === types.MEDIA_RULE) {\n      let matchMedia = node['selector'].match(MEDIA_MATCH);\n      if (matchMedia) {\n        // if rule is a non matching @media rule, skip subrules\n        if (!window.matchMedia(matchMedia[1]).matches) {\n          skipRules = true;\n        }\n      }\n    }\n  }\n  if (type === types.STYLE_RULE) {\n    styleRuleCallback(node);\n  } else if (keyframesRuleCallback &&\n    type === types.KEYFRAMES_RULE) {\n    keyframesRuleCallback(node);\n  } else if (type === types.MIXIN_RULE) {\n    skipRules = true;\n  }\n  let r$ = node['rules'];\n  if (r$ && !skipRules) {\n    for (let i=0, l=r$.length, r; (i<l) && (r=r$[i]); i++) {\n      forEachRule(r, styleRuleCallback, keyframesRuleCallback, onlyActiveRules);\n    }\n  }\n}\n\n// add a string of cssText to the document.\n/**\n * @param {string} cssText\n * @param {string} moniker\n * @param {Node} target\n * @param {Node} contextNode\n * @return {HTMLStyleElement}\n */\nexport function applyCss(cssText, moniker, target, contextNode) {\n  let style = createScopeStyle(cssText, moniker);\n  applyStyle(style, target, contextNode);\n  return style;\n}\n\n/**\n * @param {string} cssText\n * @param {string} moniker\n * @return {HTMLStyleElement}\n */\nexport function createScopeStyle(cssText, moniker) {\n  let style = /** @type {HTMLStyleElement} */(document.createElement('style'));\n  if (moniker) {\n    style.setAttribute('scope', moniker);\n  }\n  style.textContent = cssText;\n  return style;\n}\n\n/**\n * Track the position of the last added style for placing placeholders\n * @type {Node}\n */\nlet lastHeadApplyNode = null;\n\n// insert a comment node as a styling position placeholder.\n/**\n * @param {string} moniker\n * @return {!Comment}\n */\nexport function applyStylePlaceHolder(moniker) {\n  let placeHolder = document.createComment(' Shady DOM styles for ' +\n    moniker + ' ');\n  let after = lastHeadApplyNode ?\n    lastHeadApplyNode['nextSibling'] : null;\n  let scope = document.head;\n  scope.insertBefore(placeHolder, after || scope.firstChild);\n  lastHeadApplyNode = placeHolder;\n  return placeHolder;\n}\n\n/**\n * @param {HTMLStyleElement} style\n * @param {?Node} target\n * @param {?Node} contextNode\n */\nexport function applyStyle(style, target, contextNode) {\n  target = target || document.head;\n  let after = (contextNode && contextNode.nextSibling) ||\n    target.firstChild;\n  target.insertBefore(style, after);\n  if (!lastHeadApplyNode) {\n    lastHeadApplyNode = style;\n  } else {\n    // only update lastHeadApplyNode if the new style is inserted after the old lastHeadApplyNode\n    let position = style.compareDocumentPosition(lastHeadApplyNode);\n    if (position === Node.DOCUMENT_POSITION_PRECEDING) {\n      lastHeadApplyNode = style;\n    }\n  }\n}\n\n/**\n * @param {string} buildType\n * @return {boolean}\n */\nexport function isTargetedBuild(buildType) {\n  return nativeShadow ? buildType === 'shadow' : buildType === 'shady';\n}\n\n/**\n * @param {Element} element\n * @return {?string}\n */\nexport function getCssBuildType(element) {\n  return element.getAttribute('css-build');\n}\n\n/**\n * Walk from text[start] matching parens and\n * returns position of the outer end paren\n * @param {string} text\n * @param {number} start\n * @return {number}\n */\nfunction findMatchingParen(text, start) {\n  let level = 0;\n  for (let i=start, l=text.length; i < l; i++) {\n    if (text[i] === '(') {\n      level++;\n    } else if (text[i] === ')') {\n      if (--level === 0) {\n        return i;\n      }\n    }\n  }\n  return -1;\n}\n\n/**\n * @param {string} str\n * @param {function(string, string, string, string)} callback\n */\nexport function processVariableAndFallback(str, callback) {\n  // find 'var('\n  let start = str.indexOf('var(');\n  if (start === -1) {\n    // no var?, everything is prefix\n    return callback(str, '', '', '');\n  }\n  //${prefix}var(${inner})${suffix}\n  let end = findMatchingParen(str, start + 3);\n  let inner = str.substring(start + 4, end);\n  let prefix = str.substring(0, start);\n  // suffix may have other variables\n  let suffix = processVariableAndFallback(str.substring(end + 1), callback);\n  let comma = inner.indexOf(',');\n  // value and fallback args should be trimmed to match in property lookup\n  if (comma === -1) {\n    // variable, no fallback\n    return callback(prefix, inner.trim(), '', suffix);\n  }\n  // var(${value},${fallback})\n  let value = inner.substring(0, comma).trim();\n  let fallback = inner.substring(comma + 1).trim();\n  return callback(prefix, value, fallback, suffix);\n}\n\n/**\n * @param {Element} element\n * @param {string} value\n */\nexport function setElementClassRaw(element, value) {\n  // use native setAttribute provided by ShadyDOM when setAttribute is patched\n  if (nativeShadow) {\n    element.setAttribute('class', value);\n  } else {\n    window['ShadyDOM']['nativeMethods']['setAttribute'].call(element, 'class', value);\n  }\n}\n\n/**\n * @param {Element | {is: string, extends: string}} element\n * @return {{is: string, typeExtension: string}}\n */\nexport function getIsExtends(element) {\n  let localName = element['localName'];\n  let is = '', typeExtension = '';\n  /*\n  NOTE: technically, this can be wrong for certain svg elements\n  with `-` in the name like `<font-face>`\n  */\n  if (localName) {\n    if (localName.indexOf('-') > -1) {\n      is = localName;\n    } else {\n      typeExtension = localName;\n      is = (element.getAttribute && element.getAttribute('is')) || '';\n    }\n  } else {\n    is = /** @type {?} */(element).is;\n    typeExtension = /** @type {?} */(element).extends;\n  }\n  return {is, typeExtension};\n}","/**\n@license\nCopyright (c) 2017 The Polymer Project Authors. All rights reserved.\nThis code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt\nThe complete set of authors may be found at http://polymer.github.io/AUTHORS.txt\nThe complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt\nCode distributed by Google as part of the polymer project is also\nsubject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt\n*/\n\n'use strict';\n\n/** @type {Promise<void>} */\nlet readyPromise = null;\n\n/** @type {?function(?function())} */\nlet whenReady = window['HTMLImports'] && window['HTMLImports']['whenReady'] || null;\n\n/** @type {function()} */\nlet resolveFn;\n\n/**\n * @param {?function()} callback\n */\nexport default function documentWait(callback) {\n  requestAnimationFrame(function() {\n    if (whenReady) {\n      whenReady(callback)\n    } else {\n      if (!readyPromise) {\n        readyPromise = new Promise((resolve) => {resolveFn = resolve});\n        if (document.readyState === 'complete') {\n          resolveFn();\n        } else {\n          document.addEventListener('readystatechange', () => {\n            if (document.readyState === 'complete') {\n              resolveFn();\n            }\n          });\n        }\n      }\n      readyPromise.then(function(){ callback && callback(); });\n    }\n  });\n}\n","/**\n@license\nCopyright (c) 2017 The Polymer Project Authors. All rights reserved.\nThis code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt\nThe complete set of authors may be found at http://polymer.github.io/AUTHORS.txt\nThe complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt\nCode distributed by Google as part of the polymer project is also\nsubject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt\n*/\n\n'use strict';\n\nimport {StyleNode} from './css-parse' // eslint-disable-line no-unused-vars\nimport * as StyleUtil from './style-util'\nimport {nativeShadow} from './style-settings'\n\n/* Transforms ShadowDOM styling into ShadyDOM styling\n\n* scoping:\n\n  * elements in scope get scoping selector class=\"x-foo-scope\"\n  * selectors re-written as follows:\n\n    div button -> div.x-foo-scope button.x-foo-scope\n\n* :host -> scopeName\n\n* :host(...) -> scopeName...\n\n* ::slotted(...) -> scopeName > ...\n\n* ...:dir(ltr|rtl) -> [dir=\"ltr|rtl\"] ..., ...[dir=\"ltr|rtl\"]\n\n* :host(:dir[rtl]) -> scopeName:dir(rtl) -> [dir=\"rtl\"] scopeName, scopeName[dir=\"rtl\"]\n\n*/\nconst SCOPE_NAME = 'style-scope';\n\nclass StyleTransformer {\n  get SCOPE_NAME() {\n    return SCOPE_NAME;\n  }\n  // Given a node and scope name, add a scoping class to each node\n  // in the tree. This facilitates transforming css into scoped rules.\n  dom(node, scope, shouldRemoveScope) {\n    // one time optimization to skip scoping...\n    if (node['__styleScoped']) {\n      node['__styleScoped'] = null;\n    } else {\n      this._transformDom(node, scope || '', shouldRemoveScope);\n    }\n  }\n\n  _transformDom(node, selector, shouldRemoveScope) {\n    if (node.nodeType === Node.ELEMENT_NODE) {\n      this.element(node, selector, shouldRemoveScope);\n    }\n    let c$ = (node.localName === 'template') ?\n      (node.content || node._content).childNodes :\n      node.children || node.childNodes;\n    if (c$) {\n      for (let i=0; i<c$.length; i++) {\n        this._transformDom(c$[i], selector, shouldRemoveScope);\n      }\n    }\n  }\n\n  element(element, scope, shouldRemoveScope) {\n    // note: if using classes, we add both the general 'style-scope' class\n    // as well as the specific scope. This enables easy filtering of all\n    // `style-scope` elements\n    if (scope) {\n      // note: svg on IE does not have classList so fallback to class\n      if (element.classList) {\n        if (shouldRemoveScope) {\n          element.classList.remove(SCOPE_NAME);\n          element.classList.remove(scope);\n        } else {\n          element.classList.add(SCOPE_NAME);\n          element.classList.add(scope);\n        }\n      } else if (element.getAttribute) {\n        let c = element.getAttribute(CLASS);\n        if (shouldRemoveScope) {\n          if (c) {\n            let newValue = c.replace(SCOPE_NAME, '').replace(scope, '');\n            StyleUtil.setElementClassRaw(element, newValue);\n          }\n        } else {\n          let newValue = (c ? c + ' ' : '') + SCOPE_NAME + ' ' + scope;\n          StyleUtil.setElementClassRaw(element, newValue);\n        }\n      }\n    }\n  }\n\n  elementStyles(element, styleRules, callback) {\n    let cssBuildType = element['__cssBuild'];\n    // no need to shim selectors if settings.useNativeShadow, also\n    // a shady css build will already have transformed selectors\n    // NOTE: This method may be called as part of static or property shimming.\n    // When there is a targeted build it will not be called for static shimming,\n    // but when the property shim is used it is called and should opt out of\n    // static shimming work when a proper build exists.\n    let cssText = '';\n    if (nativeShadow || cssBuildType === 'shady') {\n      cssText = StyleUtil.toCssText(styleRules, callback);\n    } else {\n      let {is, typeExtension} = StyleUtil.getIsExtends(element);\n      cssText = this.css(styleRules, is, typeExtension, callback) + '\\n\\n';\n    }\n    return cssText.trim();\n  }\n\n  // Given a string of cssText and a scoping string (scope), returns\n  // a string of scoped css where each selector is transformed to include\n  // a class created from the scope. ShadowDOM selectors are also transformed\n  // (e.g. :host) to use the scoping selector.\n  css(rules, scope, ext, callback) {\n    let hostScope = this._calcHostScope(scope, ext);\n    scope = this._calcElementScope(scope);\n    let self = this;\n    return StyleUtil.toCssText(rules, function(/** StyleNode */rule) {\n      if (!rule.isScoped) {\n        self.rule(rule, scope, hostScope);\n        rule.isScoped = true;\n      }\n      if (callback) {\n        callback(rule, scope, hostScope);\n      }\n    });\n  }\n\n  _calcElementScope(scope) {\n    if (scope) {\n      return CSS_CLASS_PREFIX + scope;\n    } else {\n      return '';\n    }\n  }\n\n  _calcHostScope(scope, ext) {\n    return ext ? `[is=${scope}]` : scope;\n  }\n\n  rule(rule, scope, hostScope) {\n    this._transformRule(rule, this._transformComplexSelector,\n      scope, hostScope);\n  }\n\n  /**\n   * transforms a css rule to a scoped rule.\n   *\n   * @param {StyleNode} rule\n   * @param {Function} transformer\n   * @param {string=} scope\n   * @param {string=} hostScope\n   */\n  _transformRule(rule, transformer, scope, hostScope) {\n    // NOTE: save transformedSelector for subsequent matching of elements\n    // against selectors (e.g. when calculating style properties)\n    rule['selector'] = rule.transformedSelector =\n      this._transformRuleCss(rule, transformer, scope, hostScope);\n  }\n\n  /**\n   * @param {StyleNode} rule\n   * @param {Function} transformer\n   * @param {string=} scope\n   * @param {string=} hostScope\n   */\n  _transformRuleCss(rule, transformer, scope, hostScope) {\n    let p$ = rule['selector'].split(COMPLEX_SELECTOR_SEP);\n    // we want to skip transformation of rules that appear in keyframes,\n    // because they are keyframe selectors, not element selectors.\n    if (!StyleUtil.isKeyframesSelector(rule)) {\n      for (let i=0, l=p$.length, p; (i<l) && (p=p$[i]); i++) {\n        p$[i] = transformer.call(this, p, scope, hostScope);\n      }\n    }\n    return p$.join(COMPLEX_SELECTOR_SEP);\n  }\n\n/**\n * @param {string} selector\n * @param {string} scope\n * @param {string=} hostScope\n */\n  _transformComplexSelector(selector, scope, hostScope) {\n    let stop = false;\n    selector = selector.trim();\n    // Remove spaces inside of selectors like `:nth-of-type` because it confuses SIMPLE_SELECTOR_SEP\n    selector = selector.replace(NTH, (m, type, inner) => `:${type}(${inner.replace(/\\s/g, '')})`);\n    selector = selector.replace(SLOTTED_START, `${HOST} $1`);\n    selector = selector.replace(SIMPLE_SELECTOR_SEP, (m, c, s) => {\n      if (!stop) {\n        let info = this._transformCompoundSelector(s, c, scope, hostScope);\n        stop = stop || info.stop;\n        c = info.combinator;\n        s = info.value;\n      }\n      return c + s;\n    });\n    return selector;\n  }\n\n  _transformCompoundSelector(selector, combinator, scope, hostScope) {\n    // replace :host with host scoping class\n    let slottedIndex = selector.indexOf(SLOTTED);\n    if (selector.indexOf(HOST) >= 0) {\n      selector = this._transformHostSelector(selector, hostScope);\n    // replace other selectors with scoping class\n    } else if (slottedIndex !== 0) {\n      selector = scope ? this._transformSimpleSelector(selector, scope) :\n        selector;\n    }\n    // mark ::slotted() scope jump to replace with descendant selector + arg\n    // also ignore left-side combinator\n    let slotted = false;\n    if (slottedIndex >= 0) {\n      combinator = '';\n      slotted = true;\n    }\n    // process scope jumping selectors up to the scope jump and then stop\n    let stop;\n    if (slotted) {\n      stop = true;\n      if (slotted) {\n        // .zonk ::slotted(.foo) -> .zonk.scope > .foo\n        selector = selector.replace(SLOTTED_PAREN, (m, paren) => ` > ${paren}`);\n      }\n    }\n    selector = selector.replace(DIR_PAREN, (m, before, dir) =>\n      `[dir=\"${dir}\"] ${before}, ${before}[dir=\"${dir}\"]`);\n    return {value: selector, combinator, stop};\n  }\n\n  _transformSimpleSelector(selector, scope) {\n    let p$ = selector.split(PSEUDO_PREFIX);\n    p$[0] += scope;\n    return p$.join(PSEUDO_PREFIX);\n  }\n\n  // :host(...) -> scopeName...\n  _transformHostSelector(selector, hostScope) {\n    let m = selector.match(HOST_PAREN);\n    let paren = m && m[2].trim() || '';\n    if (paren) {\n      if (!paren[0].match(SIMPLE_SELECTOR_PREFIX)) {\n        // paren starts with a type selector\n        let typeSelector = paren.split(SIMPLE_SELECTOR_PREFIX)[0];\n        // if the type selector is our hostScope then avoid pre-pending it\n        if (typeSelector === hostScope) {\n          return paren;\n        // otherwise, this selector should not match in this scope so\n        // output a bogus selector.\n        } else {\n          return SELECTOR_NO_MATCH;\n        }\n      } else {\n        // make sure to do a replace here to catch selectors like:\n        // `:host(.foo)::before`\n        return selector.replace(HOST_PAREN, function(m, host, paren) {\n          return hostScope + paren;\n        });\n      }\n    // if no paren, do a straight :host replacement.\n    // TODO(sorvell): this should not strictly be necessary but\n    // it's needed to maintain support for `:host[foo]` type selectors\n    // which have been improperly used under Shady DOM. This should be\n    // deprecated.\n    } else {\n      return selector.replace(HOST, hostScope);\n    }\n  }\n\n  /**\n   * @param {StyleNode} rule\n   */\n  documentRule(rule) {\n    // reset selector in case this is redone.\n    rule['selector'] = rule['parsedSelector'];\n    this.normalizeRootSelector(rule);\n    this._transformRule(rule, this._transformDocumentSelector);\n  }\n\n  /**\n   * @param {StyleNode} rule\n   */\n  normalizeRootSelector(rule) {\n    if (rule['selector'] === ROOT) {\n      rule['selector'] = 'html';\n    }\n  }\n\n/**\n * @param {string} selector\n */\n  _transformDocumentSelector(selector) {\n    return selector.match(SLOTTED) ?\n      this._transformComplexSelector(selector, SCOPE_DOC_SELECTOR) :\n      this._transformSimpleSelector(selector.trim(), SCOPE_DOC_SELECTOR);\n  }\n}\n\nlet NTH = /:(nth[-\\w]+)\\(([^)]+)\\)/;\nlet SCOPE_DOC_SELECTOR = `:not(.${SCOPE_NAME})`;\nlet COMPLEX_SELECTOR_SEP = ',';\nlet SIMPLE_SELECTOR_SEP = /(^|[\\s>+~]+)((?:\\[.+?\\]|[^\\s>+~=\\[])+)/g;\nlet SIMPLE_SELECTOR_PREFIX = /[[.:#*]/;\nlet HOST = ':host';\nlet ROOT = ':root';\nlet SLOTTED = '::slotted';\nlet SLOTTED_START = new RegExp(`^(${SLOTTED})`);\n// NOTE: this supports 1 nested () pair for things like\n// :host(:not([selected]), more general support requires\n// parsing which seems like overkill\nlet HOST_PAREN = /(:host)(?:\\(((?:\\([^)(]*\\)|[^)(]*)+?)\\))/;\n// similar to HOST_PAREN\nlet SLOTTED_PAREN = /(?:::slotted)(?:\\(((?:\\([^)(]*\\)|[^)(]*)+?)\\))/;\nlet DIR_PAREN = /(.*):dir\\((?:(ltr|rtl))\\)/;\nlet CSS_CLASS_PREFIX = '.';\nlet PSEUDO_PREFIX = ':';\nlet CLASS = 'class';\nlet SELECTOR_NO_MATCH = 'should_not_match';\n\nexport default new StyleTransformer()","/**\n@license\nCopyright (c) 2017 The Polymer Project Authors. All rights reserved.\nThis code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt\nThe complete set of authors may be found at http://polymer.github.io/AUTHORS.txt\nThe complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt\nCode distributed by Google as part of the polymer project is also\nsubject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt\n*/\n\n'use strict';\n\nimport {nativeShadow} from './style-settings'\nimport StyleTransformer from './style-transformer'\nimport {getIsExtends} from './style-util'\n\nexport let flush = function() {};\n\n/**\n * @param {HTMLElement} element\n * @return {!Array<string>}\n */\nfunction getClasses(element) {\n  let classes = [];\n  if (element.classList) {\n    classes = Array.from(element.classList);\n  } else if (element instanceof window['SVGElement'] && element.hasAttribute('class')) {\n    classes = element.getAttribute('class').split(/\\s+/);\n  }\n  return classes;\n}\n\n/**\n * @param {HTMLElement} element\n * @return {string}\n */\nfunction getCurrentScope(element) {\n  let classes = getClasses(element);\n  let idx = classes.indexOf(StyleTransformer.SCOPE_NAME);\n  if (idx > -1) {\n    return classes[idx + 1];\n  }\n  return '';\n}\n\n/**\n * @param {Array<MutationRecord|null>|null} mxns\n */\nfunction handler(mxns) {\n  for (let x=0; x < mxns.length; x++) {\n    let mxn = mxns[x];\n    if (mxn.target === document.documentElement ||\n      mxn.target === document.head) {\n      continue;\n    }\n    for (let i=0; i < mxn.addedNodes.length; i++) {\n      let n = mxn.addedNodes[i];\n      if (n.nodeType !== Node.ELEMENT_NODE) {\n        continue;\n      }\n      n = /** @type {HTMLElement} */(n); // eslint-disable-line no-self-assign\n      let root = n.getRootNode();\n      let currentScope = getCurrentScope(n);\n      // node was scoped, but now is in document\n      if (currentScope && root === n.ownerDocument) {\n        StyleTransformer.dom(n, currentScope, true);\n      } else if (root.nodeType === Node.DOCUMENT_FRAGMENT_NODE) {\n        let newScope;\n        let host = /** @type {ShadowRoot} */(root).host;\n        // element may no longer be in a shadowroot\n        if (!host) {\n          continue;\n        }\n        newScope = getIsExtends(host).is;\n        if (currentScope === newScope) {\n          continue;\n        }\n        if (currentScope) {\n          StyleTransformer.dom(n, currentScope, true);\n        }\n        StyleTransformer.dom(n, newScope);\n      }\n    }\n  }\n}\n\nif (!nativeShadow) {\n  let observer = new MutationObserver(handler);\n  let start = (node) => {\n    observer.observe(node, {childList: true, subtree: true});\n  }\n  let nativeCustomElements = (window['customElements'] &&\n    !window['customElements']['polyfillWrapFlushCallback']);\n  // need to start immediately with native custom elements\n  // TODO(dfreedm): with polyfilled HTMLImports and native custom elements\n  // excessive mutations may be observed; this can be optimized via cooperation\n  // with the HTMLImports polyfill.\n  if (nativeCustomElements) {\n    start(document);\n  } else {\n    let delayedStart = () => {\n      start(document.body);\n    }\n    // use polyfill timing if it's available\n    if (window['HTMLImports']) {\n      window['HTMLImports']['whenReady'](delayedStart);\n    // otherwise push beyond native imports being ready\n    // which requires RAF + readystate interactive.\n    } else {\n      requestAnimationFrame(function() {\n        if (document.readyState === 'loading') {\n          let listener = function() {\n            delayedStart();\n            document.removeEventListener('readystatechange', listener);\n          }\n          document.addEventListener('readystatechange', listener);\n        } else {\n          delayedStart();\n        }\n      });\n    }\n  }\n\n  flush = function() {\n    handler(observer.takeRecords());\n  }\n}\n","/**\n@license\nCopyright (c) 2017 The Polymer Project Authors. All rights reserved.\nThis code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt\nThe complete set of authors may be found at http://polymer.github.io/AUTHORS.txt\nThe complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt\nCode distributed by Google as part of the polymer project is also\nsubject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt\n*/\n\n'use strict';\n\nimport {StyleNode} from './css-parse' // eslint-disable-line no-unused-vars\n\n/** @const {string} */\nconst infoKey = '__styleInfo';\n\nexport default class StyleInfo {\n  /**\n   * @param {Element} node\n   * @return {StyleInfo}\n   */\n  static get(node) {\n    if (node) {\n      return node[infoKey];\n    } else {\n      return null;\n    }\n  }\n  /**\n   * @param {!Element} node\n   * @param {StyleInfo} styleInfo\n   * @return {StyleInfo}\n   */\n  static set(node, styleInfo) {\n    node[infoKey] = styleInfo;\n    return styleInfo;\n  }\n  /**\n   * @param {StyleNode} ast\n   * @param {Node=} placeholder\n   * @param {Array<string>=} ownStylePropertyNames\n   * @param {string=} elementName\n   * @param {string=} typeExtension\n   * @param {string=} cssBuild\n   */\n  constructor(ast, placeholder, ownStylePropertyNames, elementName, typeExtension, cssBuild) {\n    /** @type {StyleNode} */\n    this.styleRules = ast || null;\n    /** @type {Node} */\n    this.placeholder = placeholder || null;\n    /** @type {!Array<string>} */\n    this.ownStylePropertyNames = ownStylePropertyNames || [];\n    /** @type {Array<Object>} */\n    this.overrideStyleProperties = null;\n    /** @type {string} */\n    this.elementName = elementName || '';\n    /** @type {string} */\n    this.cssBuild = cssBuild || '';\n    /** @type {string} */\n    this.typeExtension = typeExtension || '';\n    /** @type {Object<string, string>} */\n    this.styleProperties = null;\n    /** @type {?string} */\n    this.scopeSelector = null;\n    /** @type {HTMLStyleElement} */\n    this.customStyle = null;\n  }\n  _getStyleRules() {\n    return this.styleRules;\n  }\n}\n\nStyleInfo.prototype['_getStyleRules'] = StyleInfo.prototype._getStyleRules;","/**\n@license\nCopyright (c) 2017 The Polymer Project Authors. All rights reserved.\nThis code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt\nThe complete set of authors may be found at http://polymer.github.io/AUTHORS.txt\nThe complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt\nCode distributed by Google as part of the polymer project is also\nsubject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt\n*/\n\n'use strict';\n\nimport {removeCustomPropAssignment, StyleNode} from './css-parse' // eslint-disable-line no-unused-vars\nimport {nativeShadow} from './style-settings'\nimport StyleTransformer from './style-transformer'\nimport * as StyleUtil from './style-util'\nimport * as RX from './common-regex'\nimport StyleInfo from './style-info'\n\n// TODO: dedupe with shady\n/**\n * @const {function(string):boolean}\n */\nconst matchesSelector = ((p) => p.matches || p.matchesSelector ||\n  p.mozMatchesSelector || p.msMatchesSelector ||\np.oMatchesSelector || p.webkitMatchesSelector)(window.Element.prototype);\n\nconst IS_IE = navigator.userAgent.match('Trident');\n\nconst XSCOPE_NAME = 'x-scope';\n\nclass StyleProperties {\n  get XSCOPE_NAME() {\n    return XSCOPE_NAME;\n  }\n/**\n * decorates styles with rule info and returns an array of used style property names\n *\n * @param {StyleNode} rules\n * @return {Array<string>}\n */\n  decorateStyles(rules) {\n    let self = this, props = {}, keyframes = [], ruleIndex = 0;\n    StyleUtil.forEachRule(rules, function(rule) {\n      self.decorateRule(rule);\n      // mark in-order position of ast rule in styles block, used for cache key\n      rule.index = ruleIndex++;\n      self.collectPropertiesInCssText(rule.propertyInfo.cssText, props);\n    }, function onKeyframesRule(rule) {\n      keyframes.push(rule);\n    });\n    // Cache all found keyframes rules for later reference:\n    rules._keyframes = keyframes;\n    // return this list of property names *consumes* in these styles.\n    let names = [];\n    for (let i in props) {\n      names.push(i);\n    }\n    return names;\n  }\n\n  // decorate a single rule with property info\n  decorateRule(rule) {\n    if (rule.propertyInfo) {\n      return rule.propertyInfo;\n    }\n    let info = {}, properties = {};\n    let hasProperties = this.collectProperties(rule, properties);\n    if (hasProperties) {\n      info.properties = properties;\n      // TODO(sorvell): workaround parser seeing mixins as additional rules\n      rule['rules'] = null;\n    }\n    info.cssText = this.collectCssText(rule);\n    rule.propertyInfo = info;\n    return info;\n  }\n\n  // collects the custom properties from a rule's cssText\n  collectProperties(rule, properties) {\n    let info = rule.propertyInfo;\n    if (info) {\n      if (info.properties) {\n        Object.assign(properties, info.properties);\n        return true;\n      }\n    } else {\n      let m, rx = RX.VAR_ASSIGN;\n      let cssText = rule['parsedCssText'];\n      let value;\n      let any;\n      while ((m = rx.exec(cssText))) {\n        // note: group 2 is var, 3 is mixin\n        value = (m[2] || m[3]).trim();\n        // value of 'inherit' or 'unset' is equivalent to not setting the property here\n        if (value !== 'inherit' || value !== 'unset') {\n          properties[m[1].trim()] = value;\n        }\n        any = true;\n      }\n      return any;\n    }\n\n  }\n\n  // returns cssText of properties that consume variables/mixins\n  collectCssText(rule) {\n    return this.collectConsumingCssText(rule['parsedCssText']);\n  }\n\n  // NOTE: we support consumption inside mixin assignment\n  // but not production, so strip out {...}\n  collectConsumingCssText(cssText) {\n    return cssText.replace(RX.BRACKETED, '')\n      .replace(RX.VAR_ASSIGN, '');\n  }\n\n  collectPropertiesInCssText(cssText, props) {\n    let m;\n    while ((m = RX.VAR_CONSUMED.exec(cssText))) {\n      let name = m[1];\n      // This regex catches all variable names, and following non-whitespace char\n      // If next char is not ':', then variable is a consumer\n      if (m[2] !== ':') {\n        props[name] = true;\n      }\n    }\n  }\n\n  // turns custom properties into realized values.\n  reify(props) {\n    // big perf optimization here: reify only *own* properties\n    // since this object has __proto__ of the element's scope properties\n    let names = Object.getOwnPropertyNames(props);\n    for (let i=0, n; i < names.length; i++) {\n      n = names[i];\n      props[n] = this.valueForProperty(props[n], props);\n    }\n  }\n\n  // given a property value, returns the reified value\n  // a property value may be:\n  // (1) a literal value like: red or 5px;\n  // (2) a variable value like: var(--a), var(--a, red), or var(--a, --b) or\n  // var(--a, var(--b));\n  // (3) a literal mixin value like { properties }. Each of these properties\n  // can have values that are: (a) literal, (b) variables, (c) @apply mixins.\n  valueForProperty(property, props) {\n    // case (1) default\n    // case (3) defines a mixin and we have to reify the internals\n    if (property) {\n      if (property.indexOf(';') >=0) {\n        property = this.valueForProperties(property, props);\n      } else {\n        // case (2) variable\n        let self = this;\n        let fn = function(prefix, value, fallback, suffix) {\n          if (!value) {\n            return prefix + suffix;\n          }\n          let propertyValue = self.valueForProperty(props[value], props);\n          // if value is \"initial\", then the variable should be treated as unset\n          if (!propertyValue || propertyValue === 'initial') {\n            // fallback may be --a or var(--a) or literal\n            propertyValue = self.valueForProperty(props[fallback] || fallback, props) ||\n            fallback;\n          } else if (propertyValue === 'apply-shim-inherit') {\n            // CSS build will replace `inherit` with `apply-shim-inherit`\n            // for use with native css variables.\n            // Since we have full control, we can use `inherit` directly.\n            propertyValue = 'inherit';\n          }\n          return prefix + (propertyValue || '') + suffix;\n        };\n        property = StyleUtil.processVariableAndFallback(property, fn);\n      }\n    }\n    return property && property.trim() || '';\n  }\n\n  // note: we do not yet support mixin within mixin\n  valueForProperties(property, props) {\n    let parts = property.split(';');\n    for (let i=0, p, m; i<parts.length; i++) {\n      if ((p = parts[i])) {\n        RX.MIXIN_MATCH.lastIndex = 0;\n        m = RX.MIXIN_MATCH.exec(p);\n        if (m) {\n          p = this.valueForProperty(props[m[1]], props);\n        } else {\n          let colon = p.indexOf(':');\n          if (colon !== -1) {\n            let pp = p.substring(colon);\n            pp = pp.trim();\n            pp = this.valueForProperty(pp, props) || pp;\n            p = p.substring(0, colon) + pp;\n          }\n        }\n        parts[i] = (p && p.lastIndexOf(';') === p.length - 1) ?\n          // strip trailing ;\n          p.slice(0, -1) :\n          p || '';\n      }\n    }\n    return parts.join(';');\n  }\n\n  applyProperties(rule, props) {\n    let output = '';\n    // dynamically added sheets may not be decorated so ensure they are.\n    if (!rule.propertyInfo) {\n      this.decorateRule(rule);\n    }\n    if (rule.propertyInfo.cssText) {\n      output = this.valueForProperties(rule.propertyInfo.cssText, props);\n    }\n    rule['cssText'] = output;\n  }\n\n  // Apply keyframe transformations to the cssText of a given rule. The\n  // keyframeTransforms object is a map of keyframe names to transformer\n  // functions which take in cssText and spit out transformed cssText.\n  applyKeyframeTransforms(rule, keyframeTransforms) {\n    let input = rule['cssText'];\n    let output = rule['cssText'];\n    if (rule.hasAnimations == null) {\n      // Cache whether or not the rule has any animations to begin with:\n      rule.hasAnimations = RX.ANIMATION_MATCH.test(input);\n    }\n    // If there are no animations referenced, we can skip transforms:\n    if (rule.hasAnimations) {\n      let transform;\n      // If we haven't transformed this rule before, we iterate over all\n      // transforms:\n      if (rule.keyframeNamesToTransform == null) {\n        rule.keyframeNamesToTransform = [];\n        for (let keyframe in keyframeTransforms) {\n          transform = keyframeTransforms[keyframe];\n          output = transform(input);\n          // If the transform actually changed the CSS text, we cache the\n          // transform name for future use:\n          if (input !== output) {\n            input = output;\n            rule.keyframeNamesToTransform.push(keyframe);\n          }\n        }\n      } else {\n        // If we already have a list of keyframe names that apply to this\n        // rule, we apply only those keyframe name transforms:\n        for (let i = 0; i < rule.keyframeNamesToTransform.length; ++i) {\n          transform = keyframeTransforms[rule.keyframeNamesToTransform[i]];\n          input = transform(input);\n        }\n        output = input;\n      }\n    }\n    rule['cssText'] = output;\n  }\n\n  // Test if the rules in these styles matches the given `element` and if so,\n  // collect any custom properties into `props`.\n  /**\n   * @param {StyleNode} rules\n   * @param {Element} element\n   */\n  propertyDataFromStyles(rules, element) {\n    let props = {}, self = this;\n    // generates a unique key for these matches\n    let o = [];\n    // note: active rules excludes non-matching @media rules\n    StyleUtil.forEachRule(rules, function(rule) {\n      // TODO(sorvell): we could trim the set of rules at declaration\n      // time to only include ones that have properties\n      if (!rule.propertyInfo) {\n        self.decorateRule(rule);\n      }\n      // match element against transformedSelector: selector may contain\n      // unwanted uniquification and parsedSelector does not directly match\n      // for :host selectors.\n      let selectorToMatch = rule.transformedSelector || rule['parsedSelector'];\n      if (element && rule.propertyInfo.properties && selectorToMatch) {\n        if (matchesSelector.call(element, selectorToMatch)) {\n          self.collectProperties(rule, props);\n          // produce numeric key for these matches for lookup\n          addToBitMask(rule.index, o);\n        }\n      }\n    }, null, true);\n    return {properties: props, key: o};\n  }\n\n  /**\n   * @param {Element} scope\n   * @param {StyleNode} rule\n   * @param {string|undefined} cssBuild\n   * @param {function(Object)} callback\n   */\n  whenHostOrRootRule(scope, rule, cssBuild, callback) {\n    if (!rule.propertyInfo) {\n      this.decorateRule(rule);\n    }\n    if (!rule.propertyInfo.properties) {\n      return;\n    }\n    let {is, typeExtension} = StyleUtil.getIsExtends(scope);\n    let hostScope = is ?\n      StyleTransformer._calcHostScope(is, typeExtension) :\n      'html';\n    let parsedSelector = rule['parsedSelector'];\n    let isRoot = (parsedSelector === ':host > *' || parsedSelector === 'html');\n    let isHost = parsedSelector.indexOf(':host') === 0 && !isRoot;\n    // build info is either in scope (when scope is an element) or in the style\n    // when scope is the default scope; note: this allows default scope to have\n    // mixed mode built and unbuilt styles.\n    if (cssBuild === 'shady') {\n      // :root -> x-foo > *.x-foo for elements and html for custom-style\n      isRoot = parsedSelector === (hostScope + ' > *.' + hostScope) || parsedSelector.indexOf('html') !== -1;\n      // :host -> x-foo for elements, but sub-rules have .x-foo in them\n      isHost = !isRoot && parsedSelector.indexOf(hostScope) === 0;\n    }\n    if (cssBuild === 'shadow') {\n      isRoot = parsedSelector === ':host > *' || parsedSelector === 'html';\n      isHost = isHost && !isRoot;\n    }\n    if (!isRoot && !isHost) {\n      return;\n    }\n    let selectorToMatch = hostScope;\n    if (isHost) {\n      // need to transform :host under ShadowDOM because `:host` does not work with `matches`\n      if (nativeShadow && !rule.transformedSelector) {\n        // transform :host into a matchable selector\n        rule.transformedSelector =\n        StyleTransformer._transformRuleCss(\n          rule,\n          StyleTransformer._transformComplexSelector,\n          StyleTransformer._calcElementScope(is),\n          hostScope\n        );\n      }\n      selectorToMatch = rule.transformedSelector || hostScope;\n    }\n    callback({\n      selector: selectorToMatch,\n      isHost: isHost,\n      isRoot: isRoot\n    });\n  }\n/**\n * @param {Element} scope\n * @param {StyleNode} rules\n * @return {Object}\n */\n  hostAndRootPropertiesForScope(scope, rules) {\n    let hostProps = {}, rootProps = {}, self = this;\n    // note: active rules excludes non-matching @media rules\n    let cssBuild = rules && rules['__cssBuild'];\n    StyleUtil.forEachRule(rules, function(rule) {\n      // if scope is StyleDefaults, use _element for matchesSelector\n      self.whenHostOrRootRule(scope, rule, cssBuild, function(info) {\n        let element = scope._element || scope;\n        if (matchesSelector.call(element, info.selector)) {\n          if (info.isHost) {\n            self.collectProperties(rule, hostProps);\n          } else {\n            self.collectProperties(rule, rootProps);\n          }\n        }\n      });\n    }, null, true);\n    return {rootProps: rootProps, hostProps: hostProps};\n  }\n\n  /**\n   * @param {Element} element\n   * @param {Object} properties\n   * @param {string} scopeSelector\n   */\n  transformStyles(element, properties, scopeSelector) {\n    let self = this;\n    let {is, typeExtension} = StyleUtil.getIsExtends(element);\n    let hostSelector = StyleTransformer\n      ._calcHostScope(is, typeExtension);\n    let rxHostSelector = element.extends ?\n      '\\\\' + hostSelector.slice(0, -1) + '\\\\]' :\n      hostSelector;\n    let hostRx = new RegExp(RX.HOST_PREFIX + rxHostSelector +\n      RX.HOST_SUFFIX);\n    let rules = StyleInfo.get(element).styleRules;\n    let keyframeTransforms =\n      this._elementKeyframeTransforms(element, rules, scopeSelector);\n    return StyleTransformer.elementStyles(element, rules, function(rule) {\n      self.applyProperties(rule, properties);\n      if (!nativeShadow &&\n          !StyleUtil.isKeyframesSelector(rule) &&\n          rule['cssText']) {\n        // NOTE: keyframe transforms only scope munge animation names, so it\n        // is not necessary to apply them in ShadowDOM.\n        self.applyKeyframeTransforms(rule, keyframeTransforms);\n        self._scopeSelector(rule, hostRx, hostSelector, scopeSelector);\n      }\n    });\n  }\n\n  /**\n   * @param {Element} element\n   * @param {StyleNode} rules\n   * @param {string} scopeSelector\n   * @return {Object}\n   */\n  _elementKeyframeTransforms(element, rules, scopeSelector) {\n    let keyframesRules = rules._keyframes;\n    let keyframeTransforms = {};\n    if (!nativeShadow && keyframesRules) {\n      // For non-ShadowDOM, we transform all known keyframes rules in\n      // advance for the current scope. This allows us to catch keyframes\n      // rules that appear anywhere in the stylesheet:\n      for (let i = 0, keyframesRule = keyframesRules[i];\n           i < keyframesRules.length;\n           keyframesRule = keyframesRules[++i]) {\n        this._scopeKeyframes(keyframesRule, scopeSelector);\n        keyframeTransforms[keyframesRule['keyframesName']] =\n            this._keyframesRuleTransformer(keyframesRule);\n      }\n    }\n    return keyframeTransforms;\n  }\n\n  // Generate a factory for transforming a chunk of CSS text to handle a\n  // particular scoped keyframes rule.\n  /**\n   * @param {StyleNode} keyframesRule\n   * @return {function(string):string}\n   */\n  _keyframesRuleTransformer(keyframesRule) {\n    return function(cssText) {\n      return cssText.replace(\n          keyframesRule.keyframesNameRx,\n          keyframesRule.transformedKeyframesName);\n    };\n  }\n\n/**\n * Transforms `@keyframes` names to be unique for the current host.\n * Example: @keyframes foo-anim -> @keyframes foo-anim-x-foo-0\n *\n * @param {StyleNode} rule\n * @param {string} scopeId\n */\n  _scopeKeyframes(rule, scopeId) {\n    rule.keyframesNameRx = new RegExp(rule['keyframesName'], 'g');\n    rule.transformedKeyframesName = rule['keyframesName'] + '-' + scopeId;\n    rule.transformedSelector = rule.transformedSelector || rule['selector'];\n    rule['selector'] = rule.transformedSelector.replace(\n        rule['keyframesName'], rule.transformedKeyframesName);\n  }\n\n  // Strategy: x scope shim a selector e.g. to scope `.x-foo-42` (via classes):\n  // non-host selector: .a.x-foo -> .x-foo-42 .a.x-foo\n  // host selector: x-foo.wide -> .x-foo-42.wide\n  // note: we use only the scope class (.x-foo-42) and not the hostSelector\n  // (x-foo) to scope :host rules; this helps make property host rules\n  // have low specificity. They are overrideable by class selectors but,\n  // unfortunately, not by type selectors (e.g. overriding via\n  // `.special` is ok, but not by `x-foo`).\n  /**\n   * @param {StyleNode} rule\n   * @param {RegExp} hostRx\n   * @param {string} hostSelector\n   * @param {string} scopeId\n   */\n  _scopeSelector(rule, hostRx, hostSelector, scopeId) {\n    rule.transformedSelector = rule.transformedSelector || rule['selector'];\n    let selector = rule.transformedSelector;\n    let scope = '.' + scopeId;\n    let parts = selector.split(',');\n    for (let i=0, l=parts.length, p; (i<l) && (p=parts[i]); i++) {\n      parts[i] = p.match(hostRx) ?\n        p.replace(hostSelector, scope) :\n        scope + ' ' + p;\n    }\n    rule['selector'] = parts.join(',');\n  }\n\n  /**\n   * @param {Element} element\n   * @param {string} selector\n   * @param {string} old\n   */\n  applyElementScopeSelector(element, selector, old) {\n    let c = element.getAttribute('class') || '';\n    let v = c;\n    if (old) {\n      v = c.replace(\n        new RegExp('\\\\s*' + XSCOPE_NAME + '\\\\s*' + old + '\\\\s*', 'g'), ' ');\n    }\n    v += (v ? ' ' : '') + XSCOPE_NAME + ' ' + selector;\n    if (c !== v) {\n      StyleUtil.setElementClassRaw(element, v);\n    }\n  }\n\n  /**\n   * @param {HTMLElement} element\n   * @param {Object} properties\n   * @param {string} selector\n   * @param {HTMLStyleElement} style\n   * @return {HTMLStyleElement}\n   */\n  applyElementStyle(element, properties, selector, style) {\n    // calculate cssText to apply\n    let cssText = style ? style.textContent || '' :\n      this.transformStyles(element, properties, selector);\n    // if shady and we have a cached style that is not style, decrement\n    let styleInfo = StyleInfo.get(element);\n    let s = styleInfo.customStyle;\n    if (s && !nativeShadow && (s !== style)) {\n      s['_useCount']--;\n      if (s['_useCount'] <= 0 && s.parentNode) {\n        s.parentNode.removeChild(s);\n      }\n    }\n    // apply styling always under native or if we generated style\n    // or the cached style is not in document(!)\n    if (nativeShadow) {\n      // update existing style only under native\n      if (styleInfo.customStyle) {\n        styleInfo.customStyle.textContent = cssText;\n        style = styleInfo.customStyle;\n      // otherwise, if we have css to apply, do so\n      } else if (cssText) {\n        // apply css after the scope style of the element to help with\n        // style precedence rules.\n        style = StyleUtil.applyCss(cssText, selector, element.shadowRoot,\n          styleInfo.placeholder);\n      }\n    } else {\n      // shady and no cache hit\n      if (!style) {\n        // apply css after the scope style of the element to help with\n        // style precedence rules.\n        if (cssText) {\n          style = StyleUtil.applyCss(cssText, selector, null,\n            styleInfo.placeholder);\n        }\n      // shady and cache hit but not in document\n      } else if (!style.parentNode) {\n        if (IS_IE && cssText.indexOf('@media') > -1) {\n            // @media rules may be stale in IE 10 and 11\n            // refresh the text content of the style to revalidate them.\n          style.textContent = cssText;\n        }\n        StyleUtil.applyStyle(style, null, styleInfo.placeholder);\n      }\n    }\n    // ensure this style is our custom style and increment its use count.\n    if (style) {\n      style['_useCount'] = style['_useCount'] || 0;\n      // increment use count if we changed styles\n      if (styleInfo.customStyle != style) {\n        style['_useCount']++;\n      }\n      styleInfo.customStyle = style;\n    }\n    return style;\n  }\n\n  /**\n   * @param {Element} style\n   * @param {Object} properties\n   */\n  applyCustomStyle(style, properties) {\n    let rules = StyleUtil.rulesForStyle(/** @type {HTMLStyleElement} */(style));\n    let self = this;\n    style.textContent = StyleUtil.toCssText(rules, function(/** StyleNode */rule) {\n      let css = rule['cssText'] = rule['parsedCssText'];\n      if (rule.propertyInfo && rule.propertyInfo.cssText) {\n        // remove property assignments\n        // so next function isn't confused\n        // NOTE: we have 3 categories of css:\n        // (1) normal properties,\n        // (2) custom property assignments (--foo: red;),\n        // (3) custom property usage: border: var(--foo); @apply(--foo);\n        // In elements, 1 and 3 are separated for efficiency; here they\n        // are not and this makes this case unique.\n        css = removeCustomPropAssignment(/** @type {string} */(css));\n        // replace with reified properties, scenario is same as mixin\n        rule['cssText'] = self.valueForProperties(css, properties);\n      }\n    });\n  }\n}\n\n/**\n * @param {number} n\n * @param {Array<number>} bits\n */\nfunction addToBitMask(n, bits) {\n  let o = parseInt(n / 32, 10);\n  let v = 1 << (n % 32);\n  bits[o] = (bits[o] || 0) | v;\n}\n\nexport default new StyleProperties();","/**\n@license\nCopyright (c) 2017 The Polymer Project Authors. All rights reserved.\nThis code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt\nThe complete set of authors may be found at http://polymer.github.io/AUTHORS.txt\nThe complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt\nCode distributed by Google as part of the polymer project is also\nsubject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt\n*/\n\n'use strict';\n\nimport {applyStylePlaceHolder} from './style-util'\nimport {nativeShadow} from './style-settings'\n\n/** @type {Object<string, !Node>} */\nlet placeholderMap = {};\n\n/**\n * @const {CustomElementRegistry}\n */\nconst ce = window['customElements'];\nif (ce && !nativeShadow) {\n  /**\n   * @const {function(this:CustomElementRegistry, string,function(new:HTMLElement),{extends: string}=)}\n   */\n  const origDefine = ce['define'];\n  /**\n   * @param {string} name\n   * @param {function(new:HTMLElement)} clazz\n   * @param {{extends: string}=} options\n   * @return {function(new:HTMLElement)}\n   */\n  const wrappedDefine = (name, clazz, options) => {\n    placeholderMap[name] = applyStylePlaceHolder(name);\n    return origDefine.call(/** @type {!CustomElementRegistry} */(ce), name, clazz, options);\n  }\n  ce['define'] = wrappedDefine;\n}\n\nexport default placeholderMap;\n","/**\n@license\nCopyright (c) 2017 The Polymer Project Authors. All rights reserved.\nThis code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt\nThe complete set of authors may be found at http://polymer.github.io/AUTHORS.txt\nThe complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt\nCode distributed by Google as part of the polymer project is also\nsubject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt\n*/\n\n'use strict';\n\nimport {parse, StyleNode} from './css-parse'\nimport {nativeShadow, nativeCssVariables} from './style-settings'\nimport StyleTransformer from './style-transformer'\nimport * as StyleUtil from './style-util'\nimport StyleProperties from './style-properties'\nimport placeholderMap from './style-placeholder'\nimport StyleInfo from './style-info'\nimport StyleCache from './style-cache'\nimport {flush as watcherFlush} from './document-watcher'\nimport templateMap from './template-map'\nimport * as ApplyShimUtils from './apply-shim-utils'\nimport documentWait from './document-wait'\nimport {updateNativeProperties} from './common-utils'\nimport {CustomStyleInterfaceInterface} from './custom-style-interface' //eslint-disable-line no-unused-vars\n\n/**\n * @const {StyleCache}\n */\nconst styleCache = new StyleCache();\n\nexport default class ScopingShim {\n  constructor() {\n    this._scopeCounter = {};\n    this._documentOwner = document.documentElement;\n    let ast = new StyleNode();\n    ast['rules'] = [];\n    this._documentOwnerStyleInfo = StyleInfo.set(this._documentOwner, new StyleInfo(ast));\n    this._elementsHaveApplied = false;\n    this._applyShim = null;\n    /** @type {?CustomStyleInterfaceInterface} */\n    this._customStyleInterface = null;\n    documentWait(() => {\n      this._ensure();\n    });\n  }\n  flush() {\n    watcherFlush();\n  }\n  _generateScopeSelector(name) {\n    let id = this._scopeCounter[name] = (this._scopeCounter[name] || 0) + 1;\n    return `${name}-${id}`;\n  }\n  getStyleAst(style) {\n    return StyleUtil.rulesForStyle(style);\n  }\n  styleAstToString(ast) {\n    return StyleUtil.toCssText(ast);\n  }\n  _gatherStyles(template) {\n    let styles = template.content.querySelectorAll('style');\n    let cssText = [];\n    for (let i = 0; i < styles.length; i++) {\n      let s = styles[i];\n      cssText.push(s.textContent);\n      s.parentNode.removeChild(s);\n    }\n    return cssText.join('').trim();\n  }\n  _getCssBuild(template) {\n    let style = template.content.querySelector('style');\n    if (!style) {\n      return '';\n    }\n    return style.getAttribute('css-build') || '';\n  }\n  /**\n   * Prepare the styling and template for the given element type\n   *\n   * @param {HTMLTemplateElement} template\n   * @param {string} elementName\n   * @param {string=} typeExtension\n   */\n  prepareTemplate(template, elementName, typeExtension) {\n    if (template._prepared) {\n      return;\n    }\n    template._prepared = true;\n    template.name = elementName;\n    template.extends = typeExtension;\n    templateMap[elementName] = template;\n    let cssBuild = this._getCssBuild(template);\n    let cssText = this._gatherStyles(template);\n    let info = {\n      is: elementName,\n      extends: typeExtension,\n      __cssBuild: cssBuild,\n    };\n    if (!nativeShadow) {\n      StyleTransformer.dom(template.content, elementName);\n    }\n    // check if the styling has mixin definitions or uses\n    this._ensure();\n    let hasMixins = this._applyShim['detectMixin'](cssText);\n    let ast = parse(cssText);\n    // only run the applyshim transforms if there is a mixin involved\n    if (hasMixins && nativeCssVariables) {\n      this._applyShim['transformRules'](ast, elementName);\n    }\n    template['_styleAst'] = ast;\n    template._cssBuild = cssBuild;\n\n    let ownPropertyNames = [];\n    if (!nativeCssVariables) {\n      ownPropertyNames = StyleProperties.decorateStyles(template['_styleAst'], info);\n    }\n    if (!ownPropertyNames.length || nativeCssVariables) {\n      let root = nativeShadow ? template.content : null;\n      let placeholder = placeholderMap[elementName];\n      let style = this._generateStaticStyle(info, template['_styleAst'], root, placeholder);\n      template._style = style;\n    }\n    template._ownPropertyNames = ownPropertyNames;\n  }\n  _generateStaticStyle(info, rules, shadowroot, placeholder) {\n    let cssText = StyleTransformer.elementStyles(info, rules);\n    if (cssText.length) {\n      return StyleUtil.applyCss(cssText, info.is, shadowroot, placeholder);\n    }\n  }\n  _prepareHost(host) {\n    let {is, typeExtension} = StyleUtil.getIsExtends(host);\n    let placeholder = placeholderMap[is];\n    let template = templateMap[is];\n    let ast;\n    let ownStylePropertyNames;\n    let cssBuild;\n    if (template) {\n      ast = template['_styleAst'];\n      ownStylePropertyNames = template._ownPropertyNames;\n      cssBuild = template._cssBuild;\n    }\n    return StyleInfo.set(host,\n      new StyleInfo(\n        ast,\n        placeholder,\n        ownStylePropertyNames,\n        is,\n        typeExtension,\n        cssBuild\n      )\n    );\n  }\n  _ensureApplyShim() {\n    if (this._applyShim) {\n      return;\n    } else if (window.ShadyCSS && window.ShadyCSS.ApplyShim) {\n      this._applyShim = window.ShadyCSS.ApplyShim;\n      this._applyShim['invalidCallback'] = ApplyShimUtils.invalidate;\n    } else {\n      this._applyShim = {\n        /* eslint-disable no-unused-vars */\n        ['detectMixin'](str){return false},\n        ['transformRule'](ast){},\n        ['transformRules'](ast, name){},\n        /* eslint-enable no-unused-vars */\n      }\n    }\n  }\n  _ensureCustomStyleInterface() {\n    if (this._customStyleInterface) {\n      return;\n    } else if (window.ShadyCSS && window.ShadyCSS.CustomStyleInterface) {\n      this._customStyleInterface = /** @type {!CustomStyleInterfaceInterface} */(window.ShadyCSS.CustomStyleInterface);\n      /** @type {function(!HTMLStyleElement)} */\n      this._customStyleInterface['transformCallback'] = (style) => {this.transformCustomStyleForDocument(style)};\n      this._customStyleInterface['validateCallback'] = () => {\n        requestAnimationFrame(() => {\n          if (this._customStyleInterface['enqueued'] || this._elementsHaveApplied) {\n            this.flushCustomStyles();\n          }\n        })\n      };\n    } else {\n      this._customStyleInterface = /** @type {!CustomStyleInterfaceInterface} */({\n        ['processStyles']() {},\n        ['enqueued']: false,\n        ['getStyleForCustomStyle'](s) { return null } // eslint-disable-line no-unused-vars\n      })\n    }\n  }\n  _ensure() {\n    this._ensureApplyShim();\n    this._ensureCustomStyleInterface();\n  }\n  /**\n   * Flush and apply custom styles to document\n   */\n  flushCustomStyles() {\n    this._ensure();\n    let customStyles = this._customStyleInterface['processStyles']();\n    // early return if custom-styles don't need validation\n    if (!this._customStyleInterface['enqueued']) {\n      return;\n    }\n    if (!nativeCssVariables) {\n      this._updateProperties(this._documentOwner, this._documentOwnerStyleInfo);\n      this._applyCustomStyles(customStyles);\n    } else {\n      this._revalidateCustomStyleApplyShim(customStyles);\n    }\n    this._customStyleInterface['enqueued'] = false;\n    // if custom elements have upgraded and there are no native css variables, we must recalculate the whole tree\n    if (this._elementsHaveApplied && !nativeCssVariables) {\n      this.styleDocument();\n    }\n  }\n  /**\n   * Apply styles for the given element\n   *\n   * @param {!HTMLElement} host\n   * @param {Object=} overrideProps\n   */\n  styleElement(host, overrideProps) {\n    let {is} = StyleUtil.getIsExtends(host);\n    let styleInfo = StyleInfo.get(host);\n    if (!styleInfo) {\n      styleInfo = this._prepareHost(host);\n    }\n    // Only trip the `elementsHaveApplied` flag if a node other that the root document has `applyStyle` called\n    if (!this._isRootOwner(host)) {\n      this._elementsHaveApplied = true;\n    }\n    if (overrideProps) {\n      styleInfo.overrideStyleProperties =\n        styleInfo.overrideStyleProperties || {};\n      Object.assign(styleInfo.overrideStyleProperties, overrideProps);\n    }\n    if (!nativeCssVariables) {\n     this._updateProperties(host, styleInfo);\n      if (styleInfo.ownStylePropertyNames && styleInfo.ownStylePropertyNames.length) {\n        this._applyStyleProperties(host, styleInfo);\n      }\n    } else {\n      if (styleInfo.overrideStyleProperties) {\n        updateNativeProperties(host, styleInfo.overrideStyleProperties);\n      }\n      let template = templateMap[is];\n      // bail early if there is no shadowroot for this element\n      if (!template && !this._isRootOwner(host)) {\n        return;\n      }\n      if (template && template._style && !ApplyShimUtils.templateIsValid(template)) {\n        // update template\n        if (!ApplyShimUtils.templateIsValidating(template)) {\n          this._ensure();\n          this._applyShim['transformRules'](template['_styleAst'], is);\n          template._style.textContent = StyleTransformer.elementStyles(host, styleInfo.styleRules);\n          ApplyShimUtils.startValidatingTemplate(template);\n        }\n        // update instance if native shadowdom\n        if (nativeShadow) {\n          let root = host.shadowRoot;\n          if (root) {\n            let style = root.querySelector('style');\n            style.textContent = StyleTransformer.elementStyles(host, styleInfo.styleRules);\n          }\n        }\n        styleInfo.styleRules = template['_styleAst'];\n      }\n    }\n  }\n  _styleOwnerForNode(node) {\n    let root = node.getRootNode();\n    let host = root.host;\n    if (host) {\n      if (StyleInfo.get(host)) {\n        return host;\n      } else {\n        return this._styleOwnerForNode(host);\n      }\n    }\n    return this._documentOwner;\n  }\n  _isRootOwner(node) {\n    return (node === this._documentOwner);\n  }\n  _applyStyleProperties(host, styleInfo) {\n    let is = StyleUtil.getIsExtends(host).is;\n    let cacheEntry = styleCache.fetch(is, styleInfo.styleProperties, styleInfo.ownStylePropertyNames);\n    let cachedScopeSelector = cacheEntry && cacheEntry.scopeSelector;\n    let cachedStyle = cacheEntry ? cacheEntry.styleElement : null;\n    let oldScopeSelector = styleInfo.scopeSelector;\n    // only generate new scope if cached style is not found\n    styleInfo.scopeSelector = cachedScopeSelector || this._generateScopeSelector(is);\n    let style = StyleProperties.applyElementStyle(host, styleInfo.styleProperties, styleInfo.scopeSelector, cachedStyle);\n    if (!nativeShadow) {\n      StyleProperties.applyElementScopeSelector(host, styleInfo.scopeSelector, oldScopeSelector);\n    }\n    if (!cacheEntry) {\n      styleCache.store(is, styleInfo.styleProperties, style, styleInfo.scopeSelector);\n    }\n    return style;\n  }\n  _updateProperties(host, styleInfo) {\n    let owner = this._styleOwnerForNode(host);\n    let ownerStyleInfo = StyleInfo.get(owner);\n    let ownerProperties = ownerStyleInfo.styleProperties;\n    let props = Object.create(ownerProperties || null);\n    let hostAndRootProps = StyleProperties.hostAndRootPropertiesForScope(host, styleInfo.styleRules);\n    let propertyData = StyleProperties.propertyDataFromStyles(ownerStyleInfo.styleRules, host);\n    let propertiesMatchingHost = propertyData.properties\n    Object.assign(\n      props,\n      hostAndRootProps.hostProps,\n      propertiesMatchingHost,\n      hostAndRootProps.rootProps\n    );\n    this._mixinOverrideStyles(props, styleInfo.overrideStyleProperties);\n    StyleProperties.reify(props);\n    styleInfo.styleProperties = props;\n  }\n  _mixinOverrideStyles(props, overrides) {\n    for (let p in overrides) {\n      let v = overrides[p];\n      // skip override props if they are not truthy or 0\n      // in order to fall back to inherited values\n      if (v || v === 0) {\n        props[p] = v;\n      }\n    }\n  }\n  /**\n   * Update styles of the whole document\n   *\n   * @param {Object=} properties\n   */\n  styleDocument(properties) {\n    this.styleSubtree(this._documentOwner, properties);\n  }\n  /**\n   * Update styles of a subtree\n   *\n   * @param {!HTMLElement} host\n   * @param {Object=} properties\n   */\n  styleSubtree(host, properties) {\n    let root = host.shadowRoot;\n    if (root || this._isRootOwner(host)) {\n      this.styleElement(host, properties);\n    }\n    // process the shadowdom children of `host`\n    let shadowChildren = root && (root.children || root.childNodes);\n    if (shadowChildren) {\n      for (let i = 0; i < shadowChildren.length; i++) {\n        let c = /** @type {!HTMLElement} */(shadowChildren[i]);\n        this.styleSubtree(c);\n      }\n    } else {\n      // process the lightdom children of `host`\n      let children = host.children || host.childNodes;\n      if (children) {\n        for (let i = 0; i < children.length; i++) {\n          let c = /** @type {!HTMLElement} */(children[i]);\n          this.styleSubtree(c);\n        }\n      }\n    }\n  }\n  /* Custom Style operations */\n  _revalidateCustomStyleApplyShim(customStyles) {\n    for (let i = 0; i < customStyles.length; i++) {\n      let c = customStyles[i];\n      let s = this._customStyleInterface['getStyleForCustomStyle'](c);\n      if (s) {\n        this._revalidateApplyShim(s);\n      }\n    }\n  }\n  _applyCustomStyles(customStyles) {\n    for (let i = 0; i < customStyles.length; i++) {\n      let c = customStyles[i];\n      let s = this._customStyleInterface['getStyleForCustomStyle'](c);\n      if (s) {\n        StyleProperties.applyCustomStyle(s, this._documentOwnerStyleInfo.styleProperties);\n      }\n    }\n  }\n  transformCustomStyleForDocument(style) {\n    let ast = StyleUtil.rulesForStyle(style);\n    StyleUtil.forEachRule(ast, (rule) => {\n      if (nativeShadow) {\n        StyleTransformer.normalizeRootSelector(rule);\n      } else {\n        StyleTransformer.documentRule(rule);\n      }\n      if (nativeCssVariables) {\n        this._ensure();\n        this._applyShim['transformRule'](rule);\n      }\n    });\n    if (nativeCssVariables) {\n      style.textContent = StyleUtil.toCssText(ast);\n    } else {\n      this._documentOwnerStyleInfo.styleRules.rules.push(ast);\n    }\n  }\n  _revalidateApplyShim(style) {\n    if (nativeCssVariables) {\n      let ast = StyleUtil.rulesForStyle(style);\n      this._ensure();\n      this._applyShim['transformRules'](ast);\n      style.textContent = StyleUtil.toCssText(ast);\n    }\n  }\n  getComputedStyleValue(element, property) {\n    let value;\n    if (!nativeCssVariables) {\n      // element is either a style host, or an ancestor of a style host\n      let styleInfo = StyleInfo.get(element) || StyleInfo.get(this._styleOwnerForNode(element));\n      value = styleInfo.styleProperties[property];\n    }\n    // fall back to the property value from the computed styling\n    value = value || window.getComputedStyle(element).getPropertyValue(property);\n    // trim whitespace that can come after the `:` in css\n    // example: padding: 2px -> \" 2px\"\n    return value ? value.trim() : '';\n  }\n  // given an element and a classString, replaces\n  // the element's class with the provided classString and adds\n  // any necessary ShadyCSS static and property based scoping selectors\n  setElementClass(element, classString) {\n    let root = element.getRootNode();\n    let classes = classString ? classString.split(/\\s/) : [];\n    let scopeName = root.host && root.host.localName;\n    // If no scope, try to discover scope name from existing class.\n    // This can occur if, for example, a template stamped element that\n    // has been scoped is manipulated when not in a root.\n    if (!scopeName) {\n      var classAttr = element.getAttribute('class');\n      if (classAttr) {\n        let k$ = classAttr.split(/\\s/);\n        for (let i=0; i < k$.length; i++) {\n          if (k$[i] === StyleTransformer.SCOPE_NAME) {\n            scopeName = k$[i+1];\n            break;\n          }\n        }\n      }\n    }\n    if (scopeName) {\n      classes.push(StyleTransformer.SCOPE_NAME, scopeName);\n    }\n    if (!nativeCssVariables) {\n      let styleInfo = StyleInfo.get(element);\n      if (styleInfo && styleInfo.scopeSelector) {\n        classes.push(StyleProperties.XSCOPE_NAME, styleInfo.scopeSelector);\n      }\n    }\n    StyleUtil.setElementClassRaw(element, classes.join(' '));\n  }\n  _styleInfoForNode(node) {\n    return StyleInfo.get(node);\n  }\n}\n\n/* exports */\nScopingShim.prototype['flush'] = ScopingShim.prototype.flush;\nScopingShim.prototype['prepareTemplate'] = ScopingShim.prototype.prepareTemplate;\nScopingShim.prototype['styleElement'] = ScopingShim.prototype.styleElement;\nScopingShim.prototype['styleDocument'] = ScopingShim.prototype.styleDocument;\nScopingShim.prototype['styleSubtree'] = ScopingShim.prototype.styleSubtree;\nScopingShim.prototype['getComputedStyleValue'] = ScopingShim.prototype.getComputedStyleValue;\nScopingShim.prototype['setElementClass'] = ScopingShim.prototype.setElementClass;\nScopingShim.prototype['_styleInfoForNode'] = ScopingShim.prototype._styleInfoForNode;\nScopingShim.prototype['transformCustomStyleForDocument'] = ScopingShim.prototype.transformCustomStyleForDocument;\nScopingShim.prototype['getStyleAst'] = ScopingShim.prototype.getStyleAst;\nScopingShim.prototype['styleAstToString'] = ScopingShim.prototype.styleAstToString;\nScopingShim.prototype['flushCustomStyles'] = ScopingShim.prototype.flushCustomStyles;\nObject.defineProperties(ScopingShim.prototype, {\n  'nativeShadow': {\n    get() {\n      return nativeShadow;\n    }\n  },\n  'nativeCss': {\n    get() {\n      return nativeCssVariables;\n    }\n  }\n});","/**\n@license\nCopyright (c) 2017 The Polymer Project Authors. All rights reserved.\nThis code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt\nThe complete set of authors may be found at http://polymer.github.io/AUTHORS.txt\nThe complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt\nCode distributed by Google as part of the polymer project is also\nsubject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt\n*/\n'use strict';\n\nexport default class StyleCache {\n  constructor(typeMax = 100) {\n    // map element name -> [{properties, styleElement, scopeSelector}]\n    this.cache = {};\n    this.typeMax = typeMax;\n  }\n\n  _validate(cacheEntry, properties, ownPropertyNames) {\n    for (let idx = 0; idx < ownPropertyNames.length; idx++) {\n      let pn = ownPropertyNames[idx];\n      if (cacheEntry.properties[pn] !== properties[pn]) {\n        return false;\n      }\n    }\n    return true;\n  }\n\n  store(tagname, properties, styleElement, scopeSelector) {\n    let list = this.cache[tagname] || [];\n    list.push({properties, styleElement, scopeSelector});\n    if (list.length > this.typeMax) {\n      list.shift();\n    }\n    this.cache[tagname] = list;\n  }\n\n  fetch(tagname, properties, ownPropertyNames) {\n    let list = this.cache[tagname];\n    if (!list) {\n      return;\n    }\n    // reverse list for most-recent lookups\n    for (let idx = list.length - 1; idx >= 0; idx--) {\n      let entry = list[idx];\n      if (this._validate(entry, properties, ownPropertyNames)) {\n        return entry;\n      }\n    }\n  }\n}\n","/**\n@license\nCopyright (c) 2017 The Polymer Project Authors. All rights reserved.\nThis code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt\nThe complete set of authors may be found at http://polymer.github.io/AUTHORS.txt\nThe complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt\nCode distributed by Google as part of the polymer project is also\nsubject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt\n*/\n\n'use strict';\n\n/**\n * @param {Element} element\n * @param {Object=} properties\n */\nexport function updateNativeProperties(element, properties) {\n  // remove previous properties\n  for (let p in properties) {\n    // NOTE: for bc with shim, don't apply null values.\n    if (p === null) {\n      element.style.removeProperty(p);\n    } else {\n      element.style.setProperty(p, properties[p]);\n    }\n  }\n}\n\n/**\n * @param {Element} element\n * @param {string} property\n * @return {string}\n */\nexport function getComputedStyleValue(element, property) {\n  /**\n   * @const {string}\n   */\n  const value = window.getComputedStyle(element).getPropertyValue(property);\n  if (!value) {\n    return '';\n  } else {\n    return value.trim();\n  }\n}","/**\n@license\nCopyright (c) 2017 The Polymer Project Authors. All rights reserved.\nThis code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt\nThe complete set of authors may be found at http://polymer.github.io/AUTHORS.txt\nThe complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt\nCode distributed by Google as part of the polymer project is also\nsubject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt\n*/\n\n'use strict';\n\nimport ScopingShim from '../src/scoping-shim'\nimport {nativeCssVariables, nativeShadow} from '../src/style-settings'\n\n/** @const {ScopingShim} */\nconst scopingShim = new ScopingShim();\n\nlet ApplyShim, CustomStyleInterface;\n\nif (window['ShadyCSS']) {\n  ApplyShim = window['ShadyCSS']['ApplyShim'];\n  CustomStyleInterface = window['ShadyCSS']['CustomStyleInterface'];\n}\n\nwindow.ShadyCSS = {\n  ScopingShim: scopingShim,\n  /**\n   * @param {!HTMLTemplateElement} template\n   * @param {string} elementName\n   * @param {string=} elementExtends\n   */\n  prepareTemplate(template, elementName, elementExtends) {\n    scopingShim.flushCustomStyles();\n    scopingShim.prepareTemplate(template, elementName, elementExtends)\n  },\n\n  /**\n   * @param {!HTMLElement} element\n   * @param {Object=} properties\n   */\n  styleSubtree(element, properties) {\n    scopingShim.flushCustomStyles();\n    scopingShim.styleSubtree(element, properties);\n  },\n\n  /**\n   * @param {!HTMLElement} element\n   */\n  styleElement(element) {\n    scopingShim.flushCustomStyles();\n    scopingShim.styleElement(element);\n  },\n\n  /**\n   * @param {Object=} properties\n   */\n  styleDocument(properties) {\n    scopingShim.flushCustomStyles();\n    scopingShim.styleDocument(properties);\n  },\n\n  /**\n   * @param {Element} element\n   * @param {string} property\n   * @return {string}\n   */\n  getComputedStyleValue(element, property) {\n    return scopingShim.getComputedStyleValue(element, property);\n  },\n\n  nativeCss: nativeCssVariables,\n\n  nativeShadow: nativeShadow\n};\n\nif (ApplyShim) {\n  window.ShadyCSS.ApplyShim = ApplyShim;\n}\n\nif (CustomStyleInterface) {\n  window.ShadyCSS.CustomStyleInterface = CustomStyleInterface;\n}"]}
\ No newline at end of file
diff --git a/src/main/resources/static/gltf-viewer/bower_components/webcomponentsjs/webcomponents-lite.js b/src/main/resources/static/gltf-viewer/bower_components/webcomponentsjs/webcomponents-lite.js
deleted file mode 100644 (file)
index 9f3e62b..0000000
+++ /dev/null
@@ -1,194 +0,0 @@
-(function(){
-/*
-
- Copyright (c) 2016 The Polymer Project Authors. All rights reserved.
- This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
- The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
- The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
- Code distributed by Google as part of the polymer project is also
- subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
-
- Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
- This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
- The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
- The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
- Code distributed by Google as part of the polymer project is also
- subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
-
-Copyright (c) 2016 The Polymer Project Authors. All rights reserved.
-This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
-The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
-The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
-Code distributed by Google as part of the polymer project is also
-subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
-
-Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
-This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
-The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
-The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
-Code distributed by Google as part of the polymer project is also
-subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
-*/
-'use strict';var mb="undefined"!=typeof window&&window===this?this:"undefined"!=typeof global&&null!=global?global:this;
-(function(){function k(){var a=this;this.s={};this.g=document.documentElement;var b=new va;b.rules=[];this.h=v.set(this.g,new v(b));this.i=!1;this.a=this.b=null;nb(function(){a.c()})}function K(){this.customStyles=[];this.enqueued=!1}function ob(){}function ia(a){this.cache={};this.f=void 0===a?100:a}function p(){}function v(a,b,c,d,e){this.I=a||null;this.b=b||null;this.Ba=c||[];this.S=null;this.aa=e||"";this.a=this.F=this.K=null}function q(){}function va(){this.end=this.start=0;this.rules=this.parent=
-this.previous=null;this.cssText=this.parsedCssText="";this.atRule=!1;this.type=0;this.parsedSelector=this.selector=this.keyframesName=""}function Tc(a){function b(b,c){Object.defineProperty(b,"innerHTML",{enumerable:c.enumerable,configurable:!0,get:c.get,set:function(b){var d=this,e=void 0;n(this)&&(e=[],O(this,function(a){a!==d&&e.push(a)}));c.set.call(this,b);if(e)for(var f=0;f<e.length;f++){var g=e[f];1===g.__CE_state&&a.disconnectedCallback(g)}this.ownerDocument.__CE_hasRegistry?a.c(this):a.j(this);
-return b}})}function c(b,c){w(b,"insertAdjacentElement",function(b,d){var e=n(d);b=c.call(this,b,d);e&&a.a(d);n(b)&&a.b(d);return b})}pb?w(Element.prototype,"attachShadow",function(a){return this.__CE_shadowRoot=a=pb.call(this,a)}):console.warn("Custom Elements: `Element#attachShadow` was not patched.");if(wa&&wa.get)b(Element.prototype,wa);else if(xa&&xa.get)b(HTMLElement.prototype,xa);else{var d=ya.call(document,"div");a.u(function(a){b(a,{enumerable:!0,configurable:!0,get:function(){return qb.call(this,
-!0).innerHTML},set:function(a){var b="template"===this.localName?this.content:this;for(d.innerHTML=a;0<b.childNodes.length;)za.call(b,b.childNodes[0]);for(;0<d.childNodes.length;)ja.call(b,d.childNodes[0])}})})}w(Element.prototype,"setAttribute",function(b,c){if(1!==this.__CE_state)return rb.call(this,b,c);var d=Aa.call(this,b);rb.call(this,b,c);c=Aa.call(this,b);a.attributeChangedCallback(this,b,d,c,null)});w(Element.prototype,"setAttributeNS",function(b,c,d){if(1!==this.__CE_state)return sb.call(this,
-b,c,d);var e=ka.call(this,b,c);sb.call(this,b,c,d);d=ka.call(this,b,c);a.attributeChangedCallback(this,c,e,d,b)});w(Element.prototype,"removeAttribute",function(b){if(1!==this.__CE_state)return tb.call(this,b);var c=Aa.call(this,b);tb.call(this,b);null!==c&&a.attributeChangedCallback(this,b,c,null,null)});w(Element.prototype,"removeAttributeNS",function(b,c){if(1!==this.__CE_state)return ub.call(this,b,c);var d=ka.call(this,b,c);ub.call(this,b,c);var e=ka.call(this,b,c);d!==e&&a.attributeChangedCallback(this,
-c,d,e,b)});vb?c(HTMLElement.prototype,vb):wb?c(Element.prototype,wb):console.warn("Custom Elements: `Element#insertAdjacentElement` was not patched.");xb(a,Element.prototype,{Sa:Uc,append:Vc});Wc(a,{pb:Xc,ob:Yc,zb:Zc,remove:$c})}function Wc(a,b){var c=Element.prototype;c.before=function(c){for(var d=[],f=0;f<arguments.length;++f)d[f-0]=arguments[f];f=d.filter(function(a){return a instanceof Node&&n(a)});b.pb.apply(this,d);for(var g=0;g<f.length;g++)a.a(f[g]);if(n(this))for(f=0;f<d.length;f++)g=d[f],
-g instanceof Element&&a.b(g)};c.after=function(c){for(var d=[],f=0;f<arguments.length;++f)d[f-0]=arguments[f];f=d.filter(function(a){return a instanceof Node&&n(a)});b.ob.apply(this,d);for(var g=0;g<f.length;g++)a.a(f[g]);if(n(this))for(f=0;f<d.length;f++)g=d[f],g instanceof Element&&a.b(g)};c.replaceWith=function(c){for(var d=[],f=0;f<arguments.length;++f)d[f-0]=arguments[f];var f=d.filter(function(a){return a instanceof Node&&n(a)}),g=n(this);b.zb.apply(this,d);for(var h=0;h<f.length;h++)a.a(f[h]);
-if(g)for(a.a(this),f=0;f<d.length;f++)g=d[f],g instanceof Element&&a.b(g)};c.remove=function(){var c=n(this);b.remove.call(this);c&&a.a(this)}}function ad(a){function b(b,d){Object.defineProperty(b,"textContent",{enumerable:d.enumerable,configurable:!0,get:d.get,set:function(b){if(this.nodeType===Node.TEXT_NODE)d.set.call(this,b);else{var c=void 0;if(this.firstChild){var e=this.childNodes,h=e.length;if(0<h&&n(this))for(var c=Array(h),l=0;l<h;l++)c[l]=e[l]}d.set.call(this,b);if(c)for(b=0;b<c.length;b++)a.a(c[b])}}})}
-w(Node.prototype,"insertBefore",function(b,d){if(b instanceof DocumentFragment){var c=Array.prototype.slice.apply(b.childNodes);b=yb.call(this,b,d);if(n(this))for(d=0;d<c.length;d++)a.b(c[d]);return b}c=n(b);d=yb.call(this,b,d);c&&a.a(b);n(this)&&a.b(b);return d});w(Node.prototype,"appendChild",function(b){if(b instanceof DocumentFragment){var c=Array.prototype.slice.apply(b.childNodes);b=ja.call(this,b);if(n(this))for(var e=0;e<c.length;e++)a.b(c[e]);return b}c=n(b);e=ja.call(this,b);c&&a.a(b);n(this)&&
-a.b(b);return e});w(Node.prototype,"cloneNode",function(b){b=qb.call(this,b);this.ownerDocument.__CE_hasRegistry?a.c(b):a.j(b);return b});w(Node.prototype,"removeChild",function(b){var c=n(b),e=za.call(this,b);c&&a.a(b);return e});w(Node.prototype,"replaceChild",function(b,d){if(b instanceof DocumentFragment){var c=Array.prototype.slice.apply(b.childNodes);b=zb.call(this,b,d);if(n(this))for(a.a(d),d=0;d<c.length;d++)a.b(c[d]);return b}var c=n(b),f=zb.call(this,b,d),g=n(this);g&&a.a(d);c&&a.a(b);g&&
-a.b(b);return f});Ba&&Ba.get?b(Node.prototype,Ba):a.u(function(a){b(a,{enumerable:!0,configurable:!0,get:function(){for(var a=[],b=0;b<this.childNodes.length;b++)a.push(this.childNodes[b].textContent);return a.join("")},set:function(a){for(;this.firstChild;)za.call(this,this.firstChild);ja.call(this,document.createTextNode(a))}})})}function bd(a){w(Document.prototype,"createElement",function(b){if(this.__CE_hasRegistry){var c=a.f(b);if(c)return new c.constructor}b=ya.call(this,b);a.g(b);return b});
-w(Document.prototype,"importNode",function(b,c){b=cd.call(this,b,c);this.__CE_hasRegistry?a.c(b):a.j(b);return b});w(Document.prototype,"createElementNS",function(b,c){if(this.__CE_hasRegistry&&(null===b||"http://www.w3.org/1999/xhtml"===b)){var d=a.f(c);if(d)return new d.constructor}b=dd.call(this,b,c);a.g(b);return b});xb(a,Document.prototype,{Sa:ed,append:fd})}function xb(a,b,c){b.prepend=function(b){for(var d=[],f=0;f<arguments.length;++f)d[f-0]=arguments[f];f=d.filter(function(a){return a instanceof
-Node&&n(a)});c.Sa.apply(this,d);for(var g=0;g<f.length;g++)a.a(f[g]);if(n(this))for(f=0;f<d.length;f++)g=d[f],g instanceof Element&&a.b(g)};b.append=function(b){for(var d=[],f=0;f<arguments.length;++f)d[f-0]=arguments[f];f=d.filter(function(a){return a instanceof Node&&n(a)});c.append.apply(this,d);for(var g=0;g<f.length;g++)a.a(f[g]);if(n(this))for(f=0;f<d.length;f++)g=d[f],g instanceof Element&&a.b(g)}}function gd(a){window.HTMLElement=function(){function b(){var b=this.constructor,d=a.L(b);if(!d)throw Error("The custom element being constructed was not registered with `customElements`.");
-var e=d.constructionStack;if(!e.length)return e=ya.call(document,d.localName),Object.setPrototypeOf(e,b.prototype),e.__CE_state=1,e.__CE_definition=d,a.g(e),e;var d=e.length-1,f=e[d];if(f===Ab)throw Error("The HTMLElement constructor was either called reentrantly for this constructor or called multiple times.");e[d]=Ab;Object.setPrototypeOf(f,b.prototype);a.g(f);return f}b.prototype=hd.prototype;return b}()}function t(a){this.f=!1;this.a=a;this.h=new Map;this.g=function(a){return a()};this.b=!1;this.c=
-[];this.i=new Ca(a,document)}function Bb(){var a=this;this.b=this.a=void 0;this.c=new Promise(function(b){a.b=b;a.a&&b(a.a)})}function Ca(a,b){this.b=a;this.a=b;this.N=void 0;this.b.c(this.a);"loading"===this.a.readyState&&(this.N=new MutationObserver(this.f.bind(this)),this.N.observe(this.a,{childList:!0,subtree:!0}))}function A(){this.s=new Map;this.o=new Map;this.i=[];this.h=!1}function r(a,b){if(a!==Cb)throw new TypeError("Illegal constructor");a=document.createDocumentFragment();a.__proto__=
-r.prototype;a.i(b);return a}function G(a){this.root=a;this.fa="slot"}function U(a){if(!a.__shady||void 0===a.__shady.firstChild){a.__shady=a.__shady||{};a.__shady.firstChild=Da(a);a.__shady.lastChild=Ea(a);Db(a);for(var b=a.__shady.childNodes=ca(a),c=0,d;c<b.length&&(d=b[c]);c++)d.__shady=d.__shady||{},d.__shady.parentNode=a,d.__shady.nextSibling=b[c+1]||null,d.__shady.previousSibling=b[c-1]||null,Eb(d)}}function id(a){var b=a&&a.N;b&&(b.ea.delete(a.hb),b.ea.size||(a.mb.__shady.Z=null))}function jd(a,
-b){a.__shady=a.__shady||{};a.__shady.Z||(a.__shady.Z=new la);a.__shady.Z.ea.add(b);var c=a.__shady.Z;return{hb:b,N:c,mb:a,takeRecords:function(){return c.takeRecords()}}}function la(){this.a=!1;this.addedNodes=[];this.removedNodes=[];this.ea=new Set}function B(a){return"ShadyRoot"===a.eb}function V(a){a=a.getRootNode();if(B(a))return a}function Fa(a,b){if(a&&b)for(var c=Object.getOwnPropertyNames(b),d=0,e;d<c.length&&(e=c[d]);d++){var f=Object.getOwnPropertyDescriptor(b,e);f&&Object.defineProperty(a,
-e,f)}}function Ga(a,b){for(var c=[],d=1;d<arguments.length;++d)c[d-1]=arguments[d];for(d=0;d<c.length;d++)Fa(a,c[d]);return a}function kd(a,b){for(var c in b)a[c]=b[c]}function Fb(a){Ha.push(a);Ia.textContent=Gb++}function Hb(a){Ja||(Ja=!0,Fb(Ka));da.push(a)}function Ka(){Ja=!1;for(var a=!!da.length;da.length;)da.shift()();return a}function ld(a,b){var c=b.getRootNode();return a.map(function(a){var b=c===a.target.getRootNode();if(b&&a.addedNodes){if(b=Array.from(a.addedNodes).filter(function(a){return c===
-a.getRootNode()}),b.length)return a=Object.create(a),Object.defineProperty(a,"addedNodes",{value:b,configurable:!0}),a}else if(b)return a}).filter(function(a){return a})}function Ib(a){switch(a){case "&":return"&amp;";case "<":return"&lt;";case ">":return"&gt;";case '"':return"&quot;";case "\u00a0":return"&nbsp;"}}function Jb(a){for(var b={},c=0;c<a.length;c++)b[a[c]]=!0;return b}function La(a,b){"template"===a.localName&&(a=a.content);for(var c="",d=b?b(a):a.childNodes,e=0,f=d.length,g;e<f&&(g=d[e]);e++){var h;
-a:{var l;h=g;l=a;var m=b;switch(h.nodeType){case Node.ELEMENT_NODE:for(var k=h.localName,F="<"+k,n=h.attributes,p=0;l=n[p];p++)F+=" "+l.name+'="'+l.value.replace(md,Ib)+'"';F+=">";h=nd[k]?F:F+La(h,m)+"</"+k+">";break a;case Node.TEXT_NODE:h=h.data;h=l&&od[l.localName]?h:h.replace(pd,Ib);break a;case Node.COMMENT_NODE:h="\x3c!--"+h.data+"--\x3e";break a;default:throw window.console.error(h),Error("not implemented");}}c+=h}return c}function P(a){C.currentNode=a;return C.parentNode()}function Da(a){C.currentNode=
-a;return C.firstChild()}function Ea(a){C.currentNode=a;return C.lastChild()}function Kb(a){C.currentNode=a;return C.previousSibling()}function Lb(a){C.currentNode=a;return C.nextSibling()}function ca(a){var b=[];C.currentNode=a;for(a=C.firstChild();a;)b.push(a),a=C.nextSibling();return b}function Mb(a){D.currentNode=a;return D.parentNode()}function Nb(a){D.currentNode=a;return D.firstChild()}function Ob(a){D.currentNode=a;return D.lastChild()}function Pb(a){D.currentNode=a;return D.previousSibling()}
-function Qb(a){D.currentNode=a;return D.nextSibling()}function Rb(a){var b=[];D.currentNode=a;for(a=D.firstChild();a;)b.push(a),a=D.nextSibling();return b}function Sb(a){return La(a,function(a){return ca(a)})}function Tb(a){if(a.nodeType!==Node.ELEMENT_NODE)return a.nodeValue;a=document.createTreeWalker(a,NodeFilter.SHOW_TEXT,null,!1);for(var b="",c;c=a.nextNode();)b+=c.nodeValue;return b}function L(a,b,c){for(var d in b){var e=Object.getOwnPropertyDescriptor(a,d);e&&e.configurable||!e&&c?Object.defineProperty(a,
-d,b[d]):c&&console.warn("Could not define",d,"on",a)}}function Q(a){L(a,Ub);L(a,Ma);L(a,Na)}function Vb(a,b,c){Eb(a);c=c||null;a.__shady=a.__shady||{};b.__shady=b.__shady||{};c&&(c.__shady=c.__shady||{});a.__shady.previousSibling=c?c.__shady.previousSibling:b.lastChild;var d=a.__shady.previousSibling;d&&d.__shady&&(d.__shady.nextSibling=a);(d=a.__shady.nextSibling=c)&&d.__shady&&(d.__shady.previousSibling=a);a.__shady.parentNode=b;c?c===b.__shady.firstChild&&(b.__shady.firstChild=a):(b.__shady.lastChild=
-a,b.__shady.firstChild||(b.__shady.firstChild=a));b.__shady.childNodes=null}function Wb(a){var b=a.__shady&&a.__shady.parentNode,c,d=V(a);if(b||d){c=Xb(a);if(b){a.__shady=a.__shady||{};b.__shady=b.__shady||{};a===b.__shady.firstChild&&(b.__shady.firstChild=a.__shady.nextSibling);a===b.__shady.lastChild&&(b.__shady.lastChild=a.__shady.previousSibling);var e=a.__shady.previousSibling,f=a.__shady.nextSibling;e&&(e.__shady=e.__shady||{},e.__shady.nextSibling=f);f&&(f.__shady=f.__shady||{},f.__shady.previousSibling=
-e);a.__shady.parentNode=a.__shady.previousSibling=a.__shady.nextSibling=void 0;void 0!==b.__shady.childNodes&&(b.__shady.childNodes=null)}if(e=d){for(var g,e=d.ta(),f=0;f<e.length;f++){var h=e[f],l;a:{for(l=h;l;){if(l==a){l=!0;break a}l=l.parentNode}l=void 0}if(l)for(h=h.assignedNodes({flatten:!0}),l=0;l<h.length;l++){g=!0;var m=h[l],k=P(m);k&&W.call(k,m)}}e=g}b=b&&d&&b.localName===d.C.fa;if(e||b)d.ca=!1,ma(d)}Oa(a);return c}function Pa(a,b,c){if(a=a.__shady&&a.__shady.Z)b&&a.addedNodes.push(b),c&&
-a.removedNodes.push(c),a.Bb()}function Qa(a){if(a&&a.nodeType){a.__shady=a.__shady||{};var b=a.__shady.Ca;void 0===b&&(B(a)?b=a:b=(b=a.parentNode)?Qa(b):a,document.documentElement.contains(a)&&(a.__shady.Ca=b));return b}}function Yb(a,b,c){var d,e=c.C.fa;if(a.nodeType!==Node.DOCUMENT_FRAGMENT_NODE||a.__noInsertionPoint)a.localName===e&&(U(b),U(a),d=!0);else for(var e=a.querySelectorAll(e),f=0,g,h;f<e.length&&(g=e[f]);f++)h=g.parentNode,h===a&&(h=b),h=Yb(g,h,c),d=d||h;return d}function Zb(a){return(a=
-a&&a.__shady&&a.__shady.root)&&a.za()}function Oa(a){if(a.__shady&&void 0!==a.__shady.Ca)for(var b=a.childNodes,c=0,d=b.length,e;c<d&&(e=b[c]);c++)Oa(e);a.__shady=a.__shady||{};a.__shady.Ca=void 0}function Xb(a){a=a.parentNode;if(Zb(a))return ma(a.__shady.root),!0}function ma(a){a.sa=!0;a.update()}function $b(a,b){"slot"===b?Xb(a):"slot"===a.localName&&"name"===b&&(a=V(a))&&a.update()}function ac(a,b,c){var d=[];bc(a.childNodes,b,c,d);return d}function bc(a,b,c,d){for(var e=0,f=a.length,g;e<f&&(g=
-a[e]);e++){var h;if(h=g.nodeType===Node.ELEMENT_NODE){h=g;var l=b,m=c,k=d,F=l(h);F&&k.push(h);m&&m(F)?h=F:(bc(h.childNodes,l,m,k),h=void 0)}if(h)break}}function cc(a){a=a.getRootNode();B(a)&&a.Ta()}function dc(a,b,c){if(c){var d=c.__shady&&c.__shady.parentNode;if(void 0!==d&&d!==a||void 0===d&&P(c)!==a)throw Error("Failed to execute 'insertBefore' on 'Node': The node before which the new node is to be inserted is not a child of this node.");}if(c===b)return b;b.nodeType!==Node.DOCUMENT_FRAGMENT_NODE&&
-((d=b.__shady&&b.__shady.parentNode)?(Pa(d,null,b),Wb(b)):(b.parentNode&&W.call(b.parentNode,b),Oa(b)));var d=c,e=V(a),f;e&&(b.__noInsertionPoint&&!e.sa&&(e.ca=!0),f=Yb(b,a,e))&&(e.ca=!1);if(a.__shady&&void 0!==a.__shady.firstChild)if(Db(a),a.__shady=a.__shady||{},void 0!==a.__shady.firstChild&&(a.__shady.childNodes=null),b.nodeType===Node.DOCUMENT_FRAGMENT_NODE){for(var g=b.childNodes,h=0;h<g.length;h++)Vb(g[h],a,d);b.__shady=b.__shady||{};g=void 0!==b.__shady.firstChild?null:void 0;b.__shady.firstChild=
-b.__shady.lastChild=g;b.__shady.childNodes=g}else Vb(b,a,d);var g=f,h=e&&e.C.fa||"",l=b.nodeType===Node.DOCUMENT_FRAGMENT_NODE&&!b.__noInsertionPoint&&h&&b.querySelector(h);f=l&&l.parentNode.nodeType!==Node.DOCUMENT_FRAGMENT_NODE;((l=l||b.localName===h)||a.localName===h||g)&&e&&ma(e);(e=Zb(a))&&ma(a.__shady&&a.__shady.root);if(!(e||l&&!f||a.__shady.root||d&&B(d.parentNode)&&d.parentNode.O)){if(c&&(d=V(c))){var m;if(c.localName===d.C.fa)a:{d=c.assignedNodes({flatten:!0});e=Qa(c);f=0;for(g=d.length;f<
-g&&(m=d[f]);f++)if(e.ga(c,m))break a;m=void 0}else m=c;c=m}m=B(a)?a.host:a;c?Ra.call(m,b,c):ec.call(m,b)}Pa(a,b);return b}function fc(a,b){if(a.ownerDocument!==document)return Sa.call(document,a,b);var c=Sa.call(document,a,!1);if(b){a=a.childNodes;b=0;for(var d;b<a.length;b++)d=fc(a[b],!0),c.appendChild(d)}return c}function Ta(a,b){var c=[],d=a;for(a=a===window?window:a.getRootNode();d;)c.push(d),d=d.assignedSlot?d.assignedSlot:d.nodeType===Node.DOCUMENT_FRAGMENT_NODE&&d.host&&(b||d!==a)?d.host:d.parentNode;
-c[c.length-1]===document&&c.push(window);return c}function gc(a,b){if(!B)return a;a=Ta(a,!0);for(var c=0,d,e,f,g;c<b.length;c++)if(d=b[c],f=d===window?window:d.getRootNode(),f!==e&&(g=a.indexOf(f),e=f),!B(f)||-1<g)return d}function Ua(a){function b(b,d){b=new a(b,d);b.oa=d&&!!d.composed;return b}kd(b,a);b.prototype=a.prototype;return b}function hc(a,b,c){if(c=b.B&&b.B[a.type]&&b.B[a.type][c])for(var d=0,e;(e=c[d])&&a.target!==a.relatedTarget&&(e.call(b,a),!a.bb);d++);}function qd(a){var b=a.composedPath(),
-c;Object.defineProperty(a,"currentTarget",{get:function(){return c},configurable:!0});for(var d=b.length-1;0<=d;d--)if(c=b[d],hc(a,c,"capture"),a.pa)return;Object.defineProperty(a,"eventPhase",{get:function(){return Event.AT_TARGET}});for(var e,d=0;d<b.length;d++)if(c=b[d],!d||c.shadowRoot&&c.shadowRoot===e)if(hc(a,c,"bubble"),c!==window&&(e=c.getRootNode()),a.pa)break}function ic(a,b,c,d,e,f){for(var g=0;g<a.length;g++){var h=a[g],l=h.type,m=h.capture,k=h.once,F=h.passive;if(b===h.node&&c===l&&d===
-m&&e===k&&f===F)return g}return-1}function rd(){for(var a in Va)window.addEventListener(a,function(a){a.__target||(jc(a),qd(a))},!0)}function jc(a){a.__target=a.target;a.Ia=a.relatedTarget;if(z.Y){var b=kc,c=Object.getPrototypeOf(a);if(!c.hasOwnProperty("__patchProto")){var d=Object.create(c);d.Gb=c;Fa(d,b);c.__patchProto=d}a.__proto__=c.__patchProto}else Fa(a,kc)}function ea(a,b){return{index:a,$:[],da:b}}function sd(a,b,c,d){var e=0,f=0,g=0,h=0,l=Math.min(b-e,d-f);if(0==e&&0==f)a:{for(g=0;g<l;g++)if(a[g]!==
-c[g])break a;g=l}if(b==a.length&&d==c.length){for(var h=a.length,m=c.length,k=0;k<l-g&&td(a[--h],c[--m]);)k++;h=k}e+=g;f+=g;b-=h;d-=h;if(!(b-e||d-f))return[];if(e==b){for(b=ea(e,0);f<d;)b.$.push(c[f++]);return[b]}if(f==d)return[ea(e,b-e)];l=e;g=f;d=d-g+1;h=b-l+1;b=Array(d);for(m=0;m<d;m++)b[m]=Array(h),b[m][0]=m;for(m=0;m<h;m++)b[0][m]=m;for(m=1;m<d;m++)for(k=1;k<h;k++)if(a[l+k-1]===c[g+m-1])b[m][k]=b[m-1][k-1];else{var F=b[m-1][k]+1,n=b[m][k-1]+1;b[m][k]=F<n?F:n}l=b.length-1;g=b[0].length-1;d=b[l][g];
-for(a=[];0<l||0<g;)l?g?(h=b[l-1][g-1],m=b[l-1][g],k=b[l][g-1],F=m<k?m<h?m:h:k<h?k:h,F==h?(h==d?a.push(0):(a.push(1),d=h),l--,g--):F==m?(a.push(3),l--,d=m):(a.push(2),g--,d=k)):(a.push(3),l--):(a.push(2),g--);a.reverse();b=void 0;l=[];for(g=0;g<a.length;g++)switch(a[g]){case 0:b&&(l.push(b),b=void 0);e++;f++;break;case 1:b||(b=ea(e,0));b.da++;e++;b.$.push(c[f]);f++;break;case 2:b||(b=ea(e,0));b.da++;e++;break;case 3:b||(b=ea(e,0)),b.$.push(c[f]),f++}b&&l.push(b);return l}function td(a,b){return a===
-b}function lc(a){cc(a);return a.__shady&&a.__shady.assignedSlot||null}function R(a,b){for(var c=Object.getOwnPropertyNames(b),d=0;d<c.length;d++){var e=c[d],f=Object.getOwnPropertyDescriptor(b,e);f.value?a[e]=f.value:Object.defineProperty(a,e,f)}}function ud(){var a=window.customElements&&window.customElements.nativeHTMLElement||HTMLElement;R(window.Node.prototype,vd);R(window.Text.prototype,wd);R(window.DocumentFragment.prototype,Wa);R(window.Element.prototype,mc);R(window.Document.prototype,nc);
-window.HTMLSlotElement&&R(window.HTMLSlotElement.prototype,oc);R(a.prototype,xd);z.Y&&(Q(window.Node.prototype),Q(window.Text.prototype),Q(window.DocumentFragment.prototype),Q(window.Element.prototype),Q(a.prototype),Q(window.Document.prototype),window.HTMLSlotElement&&Q(window.HTMLSlotElement.prototype))}function pc(a){var b=yd.has(a);a=/^[a-z][.0-9_a-z]*-[\-.0-9_a-z]*$/.test(a);return!b&&a}function n(a){var b=a.isConnected;if(void 0!==b)return b;for(;a&&!(a.__CE_isImportDocument||a instanceof Document);)a=
-a.parentNode||(window.ShadowRoot&&a instanceof ShadowRoot?a.host:void 0);return!(!a||!(a.__CE_isImportDocument||a instanceof Document))}function Xa(a,b){for(;b&&b!==a&&!b.nextSibling;)b=b.parentNode;return b&&b!==a?b.nextSibling:null}function O(a,b,c){c=c?c:new Set;for(var d=a;d;){if(d.nodeType===Node.ELEMENT_NODE){var e=d;b(e);var f=e.localName;if("link"===f&&"import"===e.getAttribute("rel")){d=e.import;if(d instanceof Node&&!c.has(d))for(c.add(d),d=d.firstChild;d;d=d.nextSibling)O(d,b,c);d=Xa(a,
-e);continue}else if("template"===f){d=Xa(a,e);continue}if(e=e.__CE_shadowRoot)for(e=e.firstChild;e;e=e.nextSibling)O(e,b,c)}d=d.firstChild?d.firstChild:Xa(a,d)}}function w(a,b,c){a[b]=c}function Ya(a){a=a.replace(M.rb,"").replace(M.port,"");var b=qc,c=a,d=new va;d.start=0;d.end=c.length;for(var e=d,f=0,g=c.length;f<g;f++)if("{"===c[f]){e.rules||(e.rules=[]);var h=e,l=h.rules[h.rules.length-1]||null,e=new va;e.start=f+1;e.parent=h;e.previous=l;h.rules.push(e)}else"}"===c[f]&&(e.end=f+1,e=e.parent||
-d);return b(d,a)}function qc(a,b){var c=b.substring(a.start,a.end-1);a.parsedCssText=a.cssText=c.trim();a.parent&&((c=b.substring(a.previous?a.previous.end:a.parent.start,a.start-1),c=zd(c),c=c.replace(M.Ra," "),c=c.substring(c.lastIndexOf(";")+1),c=a.parsedSelector=a.selector=c.trim(),a.atRule=!c.indexOf("@"),a.atRule)?c.indexOf("@media")?c.match(M.xb)&&(a.type=H.na,a.keyframesName=a.selector.split(M.Ra).pop()):a.type=H.MEDIA_RULE:a.type=c.indexOf("--")?H.STYLE_RULE:H.Ea);if(c=a.rules)for(var d=
-0,e=c.length,f;d<e&&(f=c[d]);d++)qc(f,b);return a}function zd(a){return a.replace(/\\([0-9a-f]{1,6})\s/gi,function(a,c){a=c;for(c=6-a.length;c--;)a="0"+a;return"\\"+a})}function rc(a,b,c){c=void 0===c?"":c;var d="";if(a.cssText||a.rules){var e=a.rules,f;if(f=e)f=e[0],f=!(f&&f.selector&&0===f.selector.indexOf("--"));if(f){f=0;for(var g=e.length,h;f<g&&(h=e[f]);f++)d=rc(h,b,d)}else b?b=a.cssText:(b=a.cssText,b=b.replace(M.Ma,"").replace(M.Qa,""),b=b.replace(M.yb,"").replace(M.Db,"")),(d=b.trim())&&
-(d="  "+d+"\n")}d&&(a.selector&&(c+=a.selector+" {\n"),c+=d,a.selector&&(c+="}\n\n"));return c}function sc(a){a&&(x=x&&!a.nativeCss&&!a.shimcssproperties,y=y&&!a.nativeShadow&&!a.shimshadow)}function X(a,b){if(!a)return"";"string"===typeof a&&(a=Ya(a));b&&Y(a,b);return rc(a,x)}function na(a){!a.__cssRules&&a.textContent&&(a.__cssRules=Ya(a.textContent));return a.__cssRules||null}function tc(a){return!!a.parent&&a.parent.type===H.na}function Y(a,b,c,d){if(a){var e=!1,f=a.type;if(d&&f===H.MEDIA_RULE){var g=
-a.selector.match(Ad);g&&(window.matchMedia(g[1]).matches||(e=!0))}f===H.STYLE_RULE?b(a):c&&f===H.na?c(a):f===H.Ea&&(e=!0);if((a=a.rules)&&!e)for(var e=0,f=a.length,h;e<f&&(h=a[e]);e++)Y(h,b,c,d)}}function Za(a,b,c,d){var e=document.createElement("style");b&&e.setAttribute("scope",b);e.textContent=a;uc(e,c,d);return e}function uc(a,b,c){b=b||document.head;b.insertBefore(a,c&&c.nextSibling||b.firstChild);S?a.compareDocumentPosition(S)===Node.DOCUMENT_POSITION_PRECEDING&&(S=a):S=a}function vc(a,b){var c=
-a.indexOf("var(");if(-1===c)return b(a,"","","");var d;a:{var e=0;d=c+3;for(var f=a.length;d<f;d++)if("("===a[d])e++;else if(")"===a[d]&&!--e)break a;d=-1}e=a.substring(c+4,d);c=a.substring(0,c);a=vc(a.substring(d+1),b);d=e.indexOf(",");return-1===d?b(c,e.trim(),"",a):b(c,e.substring(0,d).trim(),e.substring(d+1).trim(),a)}function oa(a,b){y?a.setAttribute("class",b):window.ShadyDOM.nativeMethods.setAttribute.call(a,"class",b)}function T(a){var b=a.localName,c="";b?-1<b.indexOf("-")||(c=b,b=a.getAttribute&&
-a.getAttribute("is")||""):(b=a.is,c=a.extends);return{is:b,aa:c}}function wc(a){for(var b=0;b<a.length;b++){var c=a[b];if(c.target!==document.documentElement&&c.target!==document.head)for(var d=0;d<c.addedNodes.length;d++){var e=c.addedNodes[d];if(e.nodeType===Node.ELEMENT_NODE){var f=e.getRootNode(),g;g=e;var h=[];g.classList?h=Array.from(g.classList):g instanceof window.SVGElement&&g.hasAttribute("class")&&(h=g.getAttribute("class").split(/\s+/));g=h;h=g.indexOf(u.c);(g=-1<h?g[h+1]:"")&&f===e.ownerDocument?
-u.a(e,g,!0):f.nodeType===Node.DOCUMENT_FRAGMENT_NODE&&(f=f.host)&&(f=T(f).is,g!==f&&(g&&u.a(e,g,!0),u.a(e,f)))}}}}function Bd(a){if(a=pa[a])a._applyShimCurrentVersion=a._applyShimCurrentVersion||0,a._applyShimValidatingVersion=a._applyShimValidatingVersion||0,a._applyShimNextVersion=(a._applyShimNextVersion||0)+1}function xc(a){return a._applyShimCurrentVersion===a._applyShimNextVersion}function Cd(a){a._applyShimValidatingVersion=a._applyShimNextVersion;a.b||(a.b=!0,Dd.then(function(){a._applyShimCurrentVersion=
-a._applyShimNextVersion;a.b=!1}))}function nb(a){requestAnimationFrame(function(){yc?yc(a):($a||($a=new Promise(function(a){ab=a}),"complete"===document.readyState?ab():document.addEventListener("readystatechange",function(){"complete"===document.readyState&&ab()})),$a.then(function(){a&&a()}))})}(function(){if(!function(){var a=document.createEvent("Event");a.initEvent("foo",!0,!0);a.preventDefault();return a.defaultPrevented}()){var a=Event.prototype.preventDefault;Event.prototype.preventDefault=
-function(){this.cancelable&&(a.call(this),Object.defineProperty(this,"defaultPrevented",{get:function(){return!0},configurable:!0}))}}var b=/Trident/.test(navigator.userAgent);if(!window.CustomEvent||b&&"function"!==typeof window.CustomEvent)window.CustomEvent=function(a,b){b=b||{};var c=document.createEvent("CustomEvent");c.initCustomEvent(a,!!b.bubbles,!!b.cancelable,b.detail);return c},window.CustomEvent.prototype=window.Event.prototype;if(!window.Event||b&&"function"!==typeof window.Event){var c=
-window.Event;window.Event=function(a,b){b=b||{};var c=document.createEvent("Event");c.initEvent(a,!!b.bubbles,!!b.cancelable);return c};if(c)for(var d in c)window.Event[d]=c[d];window.Event.prototype=c.prototype}if(!window.MouseEvent||b&&"function"!==typeof window.MouseEvent){b=window.MouseEvent;window.MouseEvent=function(a,b){b=b||{};var c=document.createEvent("MouseEvent");c.initMouseEvent(a,!!b.bubbles,!!b.cancelable,b.view||window,b.detail,b.screenX,b.screenY,b.clientX,b.clientY,b.ctrlKey,b.altKey,
-b.shiftKey,b.metaKey,b.button,b.relatedTarget);return c};if(b)for(d in b)window.MouseEvent[d]=b[d];window.MouseEvent.prototype=b.prototype}Array.from||(Array.from=function(a){return[].slice.call(a)});Object.assign||(Object.assign=function(a,b){for(var c=[].slice.call(arguments,1),d=0,e;d<c.length;d++)if(e=c[d])for(var f=a,k=e,n=Object.getOwnPropertyNames(k),p=0;p<n.length;p++)e=n[p],f[e]=k[e];return a})})(window.WebComponents);(function(){function a(){}var b="undefined"===typeof HTMLTemplateElement;
-/Trident/.test(navigator.userAgent)&&function(){var a=Document.prototype.importNode;Document.prototype.importNode=function(){var b=a.apply(this,arguments);if(b.nodeType===Node.DOCUMENT_FRAGMENT_NODE){var c=this.createDocumentFragment();c.appendChild(b);return c}return b}}();var c=Node.prototype.cloneNode,d=Document.prototype.createElement,e=Document.prototype.importNode,f=function(){if(!b){var a=document.createElement("template"),c=document.createElement("template");c.content.appendChild(document.createElement("div"));
-a.content.appendChild(c);a=a.cloneNode(!0);return 0===a.content.childNodes.length||0===a.content.firstChild.content.childNodes.length||!(document.createDocumentFragment().cloneNode()instanceof DocumentFragment)}}();if(b){var g=function(a){switch(a){case "&":return"&amp;";case "<":return"&lt;";case ">":return"&gt;";case "\u00a0":return"&nbsp;"}},h=function(b){Object.defineProperty(b,"innerHTML",{get:function(){for(var a="",b=this.content.firstChild;b;b=b.nextSibling)a+=b.outerHTML||b.data.replace(q,
-g);return a},set:function(b){l.body.innerHTML=b;for(a.b(l);this.content.firstChild;)this.content.removeChild(this.content.firstChild);for(;l.body.firstChild;)this.content.appendChild(l.body.firstChild)},configurable:!0})},l=document.implementation.createHTMLDocument("template"),k=!0,n=document.createElement("style");n.textContent="template{display:none;}";var p=document.head;p.insertBefore(n,p.firstElementChild);a.prototype=Object.create(HTMLElement.prototype);var r=!document.createElement("div").hasOwnProperty("innerHTML");
-a.P=function(b){if(!b.content){b.content=l.createDocumentFragment();for(var c;c=b.firstChild;)b.content.appendChild(c);if(r)b.__proto__=a.prototype;else if(b.cloneNode=function(b){return a.a(this,b)},k)try{h(b)}catch(ge){k=!1}a.b(b.content)}};h(a.prototype);a.b=function(b){b=b.querySelectorAll("template");for(var c=0,d=b.length,e;c<d&&(e=b[c]);c++)a.P(e)};document.addEventListener("DOMContentLoaded",function(){a.b(document)});Document.prototype.createElement=function(){var b=d.apply(this,arguments);
-"template"===b.localName&&a.P(b);return b};var q=/[&\u00A0<>]/g}if(b||f)a.a=function(a,b){var d=c.call(a,!1);this.P&&this.P(d);b&&(d.content.appendChild(c.call(a.content,!0)),this.ya(d.content,a.content));return d},a.prototype.cloneNode=function(b){return a.a(this,b)},a.ya=function(a,b){if(b.querySelectorAll){b=b.querySelectorAll("template");a=a.querySelectorAll("template");for(var c=0,d=a.length,e,f;c<d;c++)f=b[c],e=a[c],this.P&&this.P(f),e.parentNode.replaceChild(f.cloneNode(!0),e)}},Node.prototype.cloneNode=
-function(b){var d;if(this instanceof DocumentFragment)if(b)d=this.ownerDocument.importNode(this,!0);else return this.ownerDocument.createDocumentFragment();else d=c.call(this,b);b&&a.ya(d,this);return d},Document.prototype.importNode=function(b,c){if("template"===b.localName)return a.a(b,c);var d=e.call(this,b,c);c&&a.ya(d,b);return d},f&&(window.HTMLTemplateElement.prototype.cloneNode=function(b){return a.a(this,b)});b&&(window.HTMLTemplateElement=a)})();!function(a,b){"object"==typeof exports&&
-"undefined"!=typeof module?module.exports=b():"function"==typeof define&&define.Jb?define(b):a.ES6Promise=b()}(window,function(){function a(a,b){B[Z]=a;B[Z+1]=b;Z+=2;2===Z&&(D?D(g):M())}function b(){return function(){return process.Mb(g)}}function c(){return"undefined"!=typeof C?function(){C(g)}:f()}function d(){var a=0,b=new K(g),c=document.createTextNode("");return b.observe(c,{characterData:!0}),function(){c.data=a=++a%2}}function e(){var a=new MessageChannel;return a.port1.onmessage=g,function(){return a.port2.postMessage(0)}}
-function f(){var a=setTimeout;return function(){return a(g,1)}}function g(){for(var a=0;a<Z;a+=2)(0,B[a])(B[a+1]),B[a]=void 0,B[a+1]=void 0;Z=0}function h(){try{var a=require("vertx");return C=a.Ob||a.Nb,c()}catch(zc){return f()}}function l(b,c){var d=arguments,e=this,f=new this.constructor(n);void 0===f[J]&&Ac(f);var g=e.m;return g?!function(){var b=d[g-1];a(function(){return fa(g,f,b,e.l)})}():w(e,f,b,c),f}function k(a){if(a&&"object"==typeof a&&a.constructor===this)return a;var b=new this(n);return u(b,
-a),b}function n(){}function p(a){try{return a.then}catch(zc){return O.error=zc,O}}function r(a,b,c,d){try{a.call(b,c,d)}catch(Gd){return Gd}}function q(b,c,d){a(function(a){var b=!1,e=r(d,c,function(d){b||(b=!0,c!==d?u(a,d):t(a,d))},function(c){b||(b=!0,N(a,c))});!b&&e&&(b=!0,N(a,e))},b)}function v(a,b){b.m===L?t(a,b.l):b.m===I?N(a,b.l):w(b,void 0,function(b){return u(a,b)},function(b){return N(a,b)})}function y(a,b,c){b.constructor===a.constructor&&c===l&&b.constructor.resolve===k?v(a,b):c===O?(N(a,
-O.error),O.error=null):void 0===c?t(a,b):"function"==typeof c?q(a,b,c):t(a,b)}function u(a,b){a===b?N(a,new TypeError("You cannot resolve a promise with itself")):"function"==typeof b||"object"==typeof b&&null!==b?y(a,b,p(b)):t(a,b)}function x(a){a.Ka&&a.Ka(a.l);A(a)}function t(b,c){b.m===H&&(b.l=c,b.m=L,0!==b.X.length&&a(A,b))}function N(b,c){b.m===H&&(b.m=I,b.l=c,a(x,b))}function w(b,c,d,e){var f=b.X,g=f.length;b.Ka=null;f[g]=c;f[g+L]=d;f[g+I]=e;0===g&&b.m&&a(A,b)}function A(a){var b=a.X,c=a.m;
-if(0!==b.length){for(var d,e,f=a.l,g=0;g<b.length;g+=3)d=b[g],e=b[g+c],d?fa(c,d,e,f):e(f);a.X.length=0}}function G(){this.error=null}function fa(a,b,c,d){var e="function"==typeof c,f=void 0,g=void 0,h=void 0,fa=void 0;if(e){var l;try{l=c(d)}catch(Hd){l=(P.error=Hd,P)}if(f=l,f===P?(fa=!0,g=f.error,f.error=null):h=!0,b===f)return void N(b,new TypeError("A promises callback cannot return that same promise."))}else f=d,h=!0;b.m!==H||(e&&h?u(b,f):fa?N(b,g):a===L?t(b,f):a===I&&N(b,f))}function Id(a,b){try{b(function(b){u(a,
-b)},function(b){N(a,b)})}catch(Ed){N(a,Ed)}}function Ac(a){a[J]=Q++;a.m=void 0;a.l=void 0;a.X=[]}function aa(a,b){this.lb=a;this.J=new a(n);this.J[J]||Ac(this.J);Bc(b)?(this.kb=b,this.length=b.length,this.ba=b.length,this.l=Array(this.length),0===this.length?t(this.J,this.l):(this.length=this.length||0,this.jb(),0===this.ba&&t(this.J,this.l))):N(this.J,Error("Array Methods must be provided an Array"))}function E(a){this[J]=Q++;this.l=this.m=void 0;this.X=[];if(n!==a){if("function"!=typeof a)throw new TypeError("You must pass a resolver function as the first argument to the promise constructor");
-if(this instanceof E)Id(this,a);else throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.");}}var bb=void 0,Bc=bb=Array.isArray?Array.isArray:function(a){return"[object Array]"===Object.prototype.toString.call(a)},Z=0,C=void 0,D=void 0,z=(bb="undefined"!=typeof window?window:void 0)||{},K=z.MutationObserver||z.WebKitMutationObserver,z="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=
-typeof MessageChannel,B=Array(1E3),M=void 0,M="undefined"==typeof self&&"undefined"!=typeof process&&"[object process]"==={}.toString.call(process)?b():K?d():z?e():bb||"function"!=typeof require?f():h(),J=Math.random().toString(36).substring(16),H=void 0,L=1,I=2,O=new G,P=new G,Q=0;return aa.prototype.jb=function(){for(var a=this.length,b=this.kb,c=0;this.m===H&&c<a;c++)this.ib(b[c],c)},aa.prototype.ib=function(a,b){var c=this.lb,d=c.resolve;d===k?(d=p(a),d===l&&a.m!==H?this.va(a.m,b,a.l):"function"!=
-typeof d?(this.ba--,this.l[b]=a):c===E?(c=new c(n),y(c,a,d),this.wa(c,b)):this.wa(new c(function(b){return b(a)}),b)):this.wa(d(a),b)},aa.prototype.va=function(a,b,c){var d=this.J;d.m===H&&(this.ba--,a===I?N(d,c):this.l[b]=c);0===this.ba&&t(d,this.l)},aa.prototype.wa=function(a,b){var c=this;w(a,void 0,function(a){return c.va(L,b,a)},function(a){return c.va(I,b,a)})},E.g=function(a){return(new aa(this,a)).J},E.h=function(a){var b=this;return new b(Bc(a)?function(c,d){for(var e=a.length,f=0;f<e;f++)b.resolve(a[f]).then(c,
-d)}:function(a,b){return b(new TypeError("You must pass an array to race."))})},E.resolve=k,E.i=function(a){var b=new this(n);return N(b,a),b},E.f=function(a){D=a},E.c=function(b){a=b},E.b=a,E.prototype={constructor:E,then:l,"catch":function(a){return this.then(null,a)}},E.a=function(){var a=void 0;if("undefined"!=typeof global)a=global;else if("undefined"!=typeof self)a=self;else try{a=Function("return this")()}catch(Fd){throw Error("polyfill failed because global object is unavailable in this environment");
-}var b=a.Promise;if(b){var c=null;try{c=Object.prototype.toString.call(b.resolve())}catch(Fd){}if("[object Promise]"===c&&!b.Kb)return}a.Promise=E},E.Promise=E,E.a(),E});(function(a){function b(a,b){if("function"===typeof window.CustomEvent)return new CustomEvent(a,b);var c=document.createEvent("CustomEvent");c.initCustomEvent(a,!!b.bubbles,!!b.cancelable,b.detail);return c}function c(a){if(k)return a.ownerDocument!==document?a.ownerDocument:null;var b=a.__importDoc;if(!b&&a.parentNode){b=a.parentNode;
-if("function"===typeof b.closest)b=b.closest("link[rel=import]");else for(;!h(b)&&(b=b.parentNode););a.__importDoc=b}return b}function d(a){var b=document.querySelectorAll("link[rel=import]:not(import-dependency)"),c=b.length;if(c)for(var d=0,e=b.length,f;d<e&&(f=b[d]);d++)g(f,function(){--c||a()});else a()}function e(a){if("loading"!==document.readyState)a();else{var b=function(){"loading"!==document.readyState&&(document.removeEventListener("readystatechange",b),a())};document.addEventListener("readystatechange",
-b)}}function f(a){e(function(){return d(function(){return a&&a()})})}function g(a,b){if(a.__loaded)b&&b();else if(h(a)&&!k&&null===a.import||a.import&&"complete"===a.import.readyState)a.__loaded=!0,b&&b();else if("script"!==a.localName||a.src){var c=function(d){a.removeEventListener(d.type,c);a.__loaded=!0;b&&b()};a.addEventListener("load",c);v&&"style"===a.localName||a.addEventListener("error",c)}else a.__loaded=!0,b&&b()}function h(a){return a.nodeType===Node.ELEMENT_NODE&&"link"===a.localName&&
-"import"===a.rel}function l(){var a=this;this.a={};this.b=0;this.f=new MutationObserver(function(b){return a.o(b)});this.f.observe(document.head,{childList:!0,subtree:!0});this.c(document)}var k="import"in document.createElement("link"),n=null;!1==="currentScript"in document&&Object.defineProperty(document,"currentScript",{get:function(){return n||("complete"!==document.readyState?document.scripts[document.scripts.length-1]:null)},configurable:!0});var p=/(^\/)|(^#)|(^[\w-\d]*:)/,r=/(url\()([^)]*)(\))/g,
-t=/(@import[\s]+(?!url\())([^;]*)(;)/g,u=/(<link[^>]*)(rel=['|"]?stylesheet['|"]?[^>]*>)/g,q={sb:function(a,b){a.href&&a.setAttribute("href",q.Da(a.getAttribute("href"),b));a.src&&a.setAttribute("src",q.Da(a.getAttribute("src"),b));if("style"===a.localName){var c=q.Ua(a.textContent,b,r);a.textContent=q.Ua(c,b,t)}},Ua:function(a,b,c){return a.replace(c,function(a,c,d,e){a=d.replace(/["']/g,"");b&&(a=q.Va(a,b));return c+"'"+a+"'"+e})},Da:function(a,b){return a&&p.test(a)?a:q.Va(a,b)},Va:function(a,
-b){if(void 0===q.ra){q.ra=!1;try{var c=new URL("b","http://a");c.pathname="c%20d";q.ra="http://a/c%20d"===c.href}catch(aa){}}if(q.ra)return(new URL(a,b)).href;c=q.gb;c||(c=document.implementation.createHTMLDocument("temp"),q.gb=c,c.Ga=c.createElement("base"),c.head.appendChild(c.Ga),c.Fa=c.createElement("a"));c.Ga.href=b;c.Fa.href=a;return c.Fa.href||a}},y={async:!0,load:function(a,b,c){if(a)if(a.match(/^data:/)){a=a.split(",");var d=a[1],d=-1<a[0].indexOf(";base64")?atob(d):decodeURIComponent(d);
-b(d)}else{var e=new XMLHttpRequest;e.open("GET",a,y.async);e.onload=function(){var a=e.getResponseHeader("Location");a&&!a.indexOf("/")&&(a=(location.origin||location.protocol+"//"+location.host)+a);var d=e.response||e.responseText;304===e.status||!e.status||200<=e.status&&300>e.status?b(d,a):c(d)};e.send()}else c("error: href must be specified")}},v=/Trident/.test(navigator.userAgent)||/Edge\/\d./i.test(navigator.userAgent);l.prototype.c=function(a){a=a.querySelectorAll("link[rel=import]");for(var b=
-0,c=a.length;b<c;b++)this.h(a[b])};l.prototype.h=function(a){var b=this,c=a.href;if(void 0!==this.a[c]){var d=this.a[c];d&&d.__loaded&&(a.import=d,this.g(a))}else this.b++,this.a[c]="pending",y.load(c,function(a,d){a=b.s(a,d||c);b.a[c]=a;b.b--;b.c(a);b.i()},function(){b.a[c]=null;b.b--;b.i()})};l.prototype.s=function(a,b){if(!a)return document.createDocumentFragment();v&&(a=a.replace(u,function(a,b,c){return-1===a.indexOf("type=")?b+" type=import-disable "+c:a}));var c=document.createElement("template");
-c.innerHTML=a;if(c.content)a=c.content;else for(a=document.createDocumentFragment();c.firstChild;)a.appendChild(c.firstChild);if(c=a.querySelector("base"))b=q.Da(c.getAttribute("href"),b),c.removeAttribute("href");for(var c=a.querySelectorAll('link[rel=import], link[rel=stylesheet][href][type=import-disable],\n    style:not([type]), link[rel=stylesheet][href]:not([type]),\n    script:not([type]), script[type="application/javascript"],\n    script[type="text/javascript"]'),d=0,e=0,f=c.length,h;e<f&&
-(h=c[e]);e++)g(h),q.sb(h,b),h.setAttribute("import-dependency",""),"script"===h.localName&&!h.src&&h.textContent&&(h.setAttribute("src","data:text/javascript;charset=utf-8,"+encodeURIComponent(h.textContent+("\n//# sourceURL="+b+(d?"-"+d:"")+".js\n"))),h.textContent="",d++);return a};l.prototype.i=function(){var a=this;if(!this.b){this.f.disconnect();this.flatten(document);var b=!1,c=!1,d=function(){c&&b&&(a.c(document),a.b||(a.f.observe(document.head,{childList:!0,subtree:!0}),a.j()))};this.A(function(){c=
-!0;d()});this.u(function(){b=!0;d()})}};l.prototype.flatten=function(a){a=a.querySelectorAll("link[rel=import]");for(var b=0,c=a.length,d;b<c&&(d=a[b]);b++){var e=this.a[d.href];(d.import=e)&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE&&(this.a[d.href]=d,d.readyState="loading",d.import=d,this.flatten(e),d.appendChild(e))}};l.prototype.u=function(a){function b(e){if(e<d){var f=c[e],h=document.createElement("script");f.removeAttribute("import-dependency");for(var l=0,k=f.attributes.length;l<k;l++)h.setAttribute(f.attributes[l].name,
-f.attributes[l].value);n=h;f.parentNode.replaceChild(h,f);g(h,function(){n=null;b(e+1)})}else a()}var c=document.querySelectorAll("script[import-dependency]"),d=c.length;b(0)};l.prototype.A=function(a){var b=document.querySelectorAll("style[import-dependency],\n    link[rel=stylesheet][import-dependency]"),d=b.length;if(d)for(var e=v&&!!document.querySelector("link[rel=stylesheet][href][type=import-disable]"),f={},h=0,l=b.length;h<l&&(f.w=b[h]);f={w:f.w},h++){if(g(f.w,function(b){return function(){b.w.removeAttribute("import-dependency");
---d||a()}}(f)),e&&f.w.parentNode!==document.head){var k=document.createElement(f.w.localName);k.__appliedElement=f.w;k.setAttribute("type","import-placeholder");f.w.parentNode.insertBefore(k,f.w.nextSibling);for(k=c(f.w);k&&c(k);)k=c(k);k.parentNode!==document.head&&(k=null);document.head.insertBefore(f.w,k);f.w.removeAttribute("type")}}else a()};l.prototype.j=function(){for(var a=document.querySelectorAll("link[rel=import]"),b=a.length-1,c;0<=b&&(c=a[b]);b--)this.g(c)};l.prototype.g=function(a){a.__loaded||
-(a.__loaded=!0,a.import&&(a.import.readyState="complete"),a.dispatchEvent(b(a.import?"load":"error",{bubbles:!1,cancelable:!1,detail:void 0})))};l.prototype.o=function(a){for(var b=0;b<a.length;b++){var c=a[b];if(c.addedNodes)for(var d=0;d<c.addedNodes.length;d++){var e=c.addedNodes[d];e&&e.nodeType===Node.ELEMENT_NODE&&(h(e)?this.h(e):this.c(e))}}};if(k){for(var w=document.querySelectorAll("link[rel=import]"),A=0,B=w.length,z;A<B&&(z=w[A]);A++)z.import&&"loading"===z.import.readyState||(z.__loaded=
-!0);w=function(a){a=a.target;h(a)&&(a.__loaded=!0)};document.addEventListener("load",w,!0);document.addEventListener("error",w,!0)}else{var x=Object.getOwnPropertyDescriptor(Node.prototype,"baseURI");Object.defineProperty((!x||x.configurable?Node:Element).prototype,"baseURI",{get:function(){var a=h(this)?this:c(this);return a?a.href:x&&x.get?x.get.call(this):(document.querySelector("base")||window.location).href},configurable:!0,enumerable:!0});e(function(){return new l})}f(function(){return document.dispatchEvent(b("HTMLImportsLoaded",
-{cancelable:!0,bubbles:!0,detail:void 0}))});a.useNative=k;a.whenReady=f;a.importForElement=c})(window.HTMLImports=window.HTMLImports||{});(function(){window.WebComponents=window.WebComponents||{flags:{}};var a=document.querySelector('script[src*="webcomponents-lite.js"]'),b=/wc-(.+)/,c={};if(!c.noOpts){location.search.slice(1).split("&").forEach(function(a){a=a.split("=");var d;a[0]&&(d=a[0].match(b))&&(c[d[1]]=a[1]||!0)});if(a)for(var d=0,e;e=a.attributes[d];d++)"src"!==e.name&&(c[e.name]=e.value||
-!0);c.log&&c.log.split?(a=c.log.split(","),c.log={},a.forEach(function(a){c.log[a]=!0})):c.log={}}window.WebComponents.flags=c;if(a=c.shadydom)window.ShadyDOM=window.ShadyDOM||{},window.ShadyDOM.force=a;(a=c.register||c.ce)&&window.customElements&&(window.customElements.forcePolyfill=a)})();var z=window.ShadyDOM||{};z.ub=!(!Element.prototype.attachShadow||!Node.prototype.getRootNode);var cb=Object.getOwnPropertyDescriptor(Node.prototype,"firstChild");z.Y=!!(cb&&cb.configurable&&cb.get);z.Pa=z.force||
-!z.ub;var ba=Element.prototype,Cc=ba.matches||ba.matchesSelector||ba.mozMatchesSelector||ba.msMatchesSelector||ba.oMatchesSelector||ba.webkitMatchesSelector,Ia=document.createTextNode(""),Gb=0,Ha=[];(new MutationObserver(function(){for(;Ha.length;)try{Ha.shift()()}catch(a){throw Ia.textContent=Gb++,a;}})).observe(Ia,{characterData:!0});var da=[],Ja;Ka.list=da;la.prototype.Bb=function(){var a=this;this.a||(this.a=!0,Fb(function(){a.b()}))};la.prototype.b=function(){if(this.a){this.a=!1;var a=this.takeRecords();
-a.length&&this.ea.forEach(function(b){b(a)})}};la.prototype.takeRecords=function(){if(this.addedNodes.length||this.removedNodes.length){var a=[{addedNodes:this.addedNodes,removedNodes:this.removedNodes}];this.addedNodes=[];this.removedNodes=[];return a}return[]};var ec=Element.prototype.appendChild,Ra=Element.prototype.insertBefore,W=Element.prototype.removeChild,Dc=Element.prototype.setAttribute,Ec=Element.prototype.removeAttribute,db=Element.prototype.cloneNode,Sa=Document.prototype.importNode,
-Fc=Element.prototype.addEventListener,Gc=Element.prototype.removeEventListener,Jd=Object.freeze({appendChild:ec,insertBefore:Ra,removeChild:W,setAttribute:Dc,removeAttribute:Ec,cloneNode:db,importNode:Sa,addEventListener:Fc,removeEventListener:Gc}),md=/[&\u00A0"]/g,pd=/[&\u00A0<>]/g,nd=Jb("area base br col command embed hr img input keygen link meta param source track wbr".split(" ")),od=Jb("style script xmp iframe noembed noframes plaintext noscript".split(" ")),C=document.createTreeWalker(document,
-NodeFilter.SHOW_ALL,null,!1),D=document.createTreeWalker(document,NodeFilter.SHOW_ELEMENT,null,!1),Kd=Object.freeze({parentNode:P,firstChild:Da,lastChild:Ea,previousSibling:Kb,nextSibling:Lb,childNodes:ca,parentElement:Mb,firstElementChild:Nb,lastElementChild:Ob,previousElementSibling:Pb,nextElementSibling:Qb,children:Rb,innerHTML:Sb,textContent:Tb}),eb=Object.getOwnPropertyDescriptor(Element.prototype,"innerHTML")||Object.getOwnPropertyDescriptor(HTMLElement.prototype,"innerHTML"),qa=document.implementation.createHTMLDocument("inert").createElement("div"),
-fb=Object.getOwnPropertyDescriptor(Document.prototype,"activeElement"),Ub={parentElement:{get:function(){var a=this.__shady&&this.__shady.parentElement;return void 0!==a?a:Mb(this)},configurable:!0},parentNode:{get:function(){var a=this.__shady&&this.__shady.parentNode;return void 0!==a?a:P(this)},configurable:!0},nextSibling:{get:function(){var a=this.__shady&&this.__shady.nextSibling;return void 0!==a?a:Lb(this)},configurable:!0},previousSibling:{get:function(){var a=this.__shady&&this.__shady.previousSibling;
-return void 0!==a?a:Kb(this)},configurable:!0},className:{get:function(){return this.getAttribute("class")||""},set:function(a){this.setAttribute("class",a)},configurable:!0},nextElementSibling:{get:function(){if(this.__shady&&void 0!==this.__shady.nextSibling){for(var a=this.nextSibling;a&&a.nodeType!==Node.ELEMENT_NODE;)a=a.nextSibling;return a}return Qb(this)},configurable:!0},previousElementSibling:{get:function(){if(this.__shady&&void 0!==this.__shady.previousSibling){for(var a=this.previousSibling;a&&
-a.nodeType!==Node.ELEMENT_NODE;)a=a.previousSibling;return a}return Pb(this)},configurable:!0}},Ma={childNodes:{get:function(){if(this.__shady&&void 0!==this.__shady.firstChild){if(!this.__shady.childNodes){this.__shady.childNodes=[];for(var a=this.firstChild;a;a=a.nextSibling)this.__shady.childNodes.push(a)}return this.__shady.childNodes}return ca(this)},configurable:!0},firstChild:{get:function(){var a=this.__shady&&this.__shady.firstChild;return void 0!==a?a:Da(this)},configurable:!0},lastChild:{get:function(){var a=
-this.__shady&&this.__shady.lastChild;return void 0!==a?a:Ea(this)},configurable:!0},textContent:{get:function(){if(this.__shady&&void 0!==this.__shady.firstChild){for(var a=[],b=0,c=this.childNodes,d;d=c[b];b++)d.nodeType!==Node.COMMENT_NODE&&a.push(d.textContent);return a.join("")}return Tb(this)},set:function(a){if(this.nodeType!==Node.ELEMENT_NODE)this.nodeValue=a;else{for(;this.firstChild;)this.removeChild(this.firstChild);a&&this.appendChild(document.createTextNode(a))}},configurable:!0},firstElementChild:{get:function(){if(this.__shady&&
-void 0!==this.__shady.firstChild){for(var a=this.firstChild;a&&a.nodeType!==Node.ELEMENT_NODE;)a=a.nextSibling;return a}return Nb(this)},configurable:!0},lastElementChild:{get:function(){if(this.__shady&&void 0!==this.__shady.lastChild){for(var a=this.lastChild;a&&a.nodeType!==Node.ELEMENT_NODE;)a=a.previousSibling;return a}return Ob(this)},configurable:!0},children:{get:function(){return this.__shady&&void 0!==this.__shady.firstChild?Array.prototype.filter.call(this.childNodes,function(a){return a.nodeType===
-Node.ELEMENT_NODE}):Rb(this)},configurable:!0},innerHTML:{get:function(){var a="template"===this.localName?this.content:this;return this.__shady&&void 0!==this.__shady.firstChild?La(a):Sb(a)},set:function(a){for(var b="template"===this.localName?this.content:this;b.firstChild;)b.removeChild(b.firstChild);for(eb&&eb.set?eb.set.call(qa,a):qa.innerHTML=a;qa.firstChild;)b.appendChild(qa.firstChild)},configurable:!0}},Hc={shadowRoot:{get:function(){return this.__shady&&this.__shady.root||null},set:function(a){this.__shady=
-this.__shady||{};this.__shady.root=a},configurable:!0}},Na={activeElement:{get:function(){var a;a=fb&&fb.get?fb.get.call(document):z.Y?void 0:document.activeElement;if(a&&a.nodeType){var b=!!B(this);if(this===document||b&&this.host!==a&&this.host.contains(a)){for(b=V(a);b&&b!==this;)a=b.host,b=V(a);a=this===document?b?null:a:b===this?a:null}else a=null}else a=null;return a},set:function(){},configurable:!0}},Eb=z.Y?function(){}:function(a){a.__shady&&a.__shady.fb||(a.__shady=a.__shady||{},a.__shady.fb=
-!0,L(a,Ub,!0))},Db=z.Y?function(){}:function(a){a.__shady&&a.__shady.cb||(a.__shady=a.__shady||{},a.__shady.cb=!0,L(a,Ma,!0),L(a,Hc,!0))},ra=null,Ld={blur:!0,focus:!0,focusin:!0,focusout:!0,click:!0,dblclick:!0,mousedown:!0,mouseenter:!0,mouseleave:!0,mousemove:!0,mouseout:!0,mouseover:!0,mouseup:!0,wheel:!0,beforeinput:!0,input:!0,keydown:!0,keyup:!0,compositionstart:!0,compositionupdate:!0,compositionend:!0,touchstart:!0,touchend:!0,touchmove:!0,touchcancel:!0,pointerover:!0,pointerenter:!0,pointerdown:!0,
-pointermove:!0,pointerup:!0,pointercancel:!0,pointerout:!0,pointerleave:!0,gotpointercapture:!0,lostpointercapture:!0,dragstart:!0,drag:!0,dragenter:!0,dragleave:!0,dragover:!0,drop:!0,dragend:!0,DOMActivate:!0,DOMFocusIn:!0,DOMFocusOut:!0,keypress:!0},kc={get composed(){!1!==this.isTrusted&&void 0===this.oa&&(this.oa=Ld[this.type]);return this.oa||!1},composedPath:function(){this.Ha||(this.Ha=Ta(this.__target,this.composed));return this.Ha},get target(){return gc(this.currentTarget,this.composedPath())},
-get relatedTarget(){if(!this.Ia)return null;this.Ja||(this.Ja=Ta(this.Ia,!0));return gc(this.currentTarget,this.Ja)},stopPropagation:function(){Event.prototype.stopPropagation.call(this);this.pa=!0},stopImmediatePropagation:function(){Event.prototype.stopImmediatePropagation.call(this);this.pa=this.bb=!0}},Va={focus:!0,blur:!0},Md=Ua(window.Event),Nd=Ua(window.CustomEvent),Od=Ua(window.MouseEvent),Pd="function"===typeof Event?Event:function(a,b){b=b||{};var c=document.createEvent("Event");c.initEvent(a,
-!!b.bubbles,!!b.cancelable);return c};G.prototype.tb=function(){return this.root.querySelectorAll("slot")};G.prototype.Aa=function(a){return a.localName&&"slot"==a.localName};G.prototype.xa=function(){return this.root.za()?this.g(this.c()):[]};G.prototype.c=function(){for(var a=[],b=0,c=this.root.host.firstChild;c;c=c.nextSibling)a[b++]=c;return a};G.prototype.g=function(a){for(var b=[],c=this.root.ta(),d=0,e=c.length,f;d<e&&(f=c[d]);d++){this.f(f,a);var g=f.parentNode;(g=g&&g.__shady&&g.__shady.root)&&
-g.za()&&b.push(g)}for(c=0;c<a.length;c++)if(d=a[c])d.__shady=d.__shady||{},d.__shady.assignedSlot=void 0,(e=P(d))&&W.call(e,d);return b};G.prototype.f=function(a,b){var c=a.__shady.assignedNodes;c&&this.La(a,!0);a.__shady.assignedNodes=[];for(var d=!1,e=!1,f=0,g=b.length,h;f<g;f++)(h=b[f])&&this.h(h,a)&&(h.__shady.ua!=a&&(d=!0),this.b(h,a),b[f]=void 0,e=!0);if(!e)for(b=a.childNodes,e=0;e<b.length;e++)h=b[e],h.__shady.ua!=a&&(d=!0),this.b(h,a);if(c){for(h=0;h<c.length;h++)c[h].__shady.ua=null;a.__shady.assignedNodes.length<
-c.length&&(d=!0)}this.i(a);d&&this.a(a)};G.prototype.La=function(a,b){var c=a.__shady.assignedNodes;if(c)for(var d=0;d<c.length;d++){var e=c[d];b&&(e.__shady.ua=e.__shady.assignedSlot);e.__shady.assignedSlot===a&&(e.__shady.assignedSlot=null)}};G.prototype.h=function(a,b){b=(b=b.getAttribute("name"))?b.trim():"";a=(a=a.getAttribute&&a.getAttribute("slot"))?a.trim():"";return a==b};G.prototype.b=function(a,b){b.__shady.assignedNodes.push(a);a.__shady.assignedSlot=b};G.prototype.i=function(a){var b=
-a.__shady.assignedNodes;a.__shady.R=[];for(var c=0,d;c<b.length&&(d=b[c]);c++)if(this.Aa(d)){var e=d.__shady.R;if(e)for(var f=0;f<e.length;f++)a.__shady.R.push(e[f])}else a.__shady.R.push(b[c])};G.prototype.a=function(a){a.dispatchEvent(new Pd("slotchange"));a.__shady.assignedSlot&&this.a(a.__shady.assignedSlot)};G.prototype.ga=function(a){return!a.__shady.assignedSlot};var Cb={};r.prototype=Object.create(DocumentFragment.prototype);r.prototype.i=function(a){this.eb="ShadyRoot";U(a);U(this);a.shadowRoot=
-this;this.host=a;this.sa=this.O=!1;this.C=new G(this);this.update()};r.prototype.update=function(){var a=this;this.O||(this.O=!0,Hb(function(){return a.Ta()}))};r.prototype.h=function(){for(var a=this,b=this;b;)b.O&&(a=b),b=b.nb();return a};r.prototype.nb=function(){var a=this.host.getRootNode();if(B(a))for(var b=this.host.childNodes,c=0,d;c<b.length;c++)if(d=b[c],this.C.Aa(d))return a};r.prototype.Ta=function(){this.O&&this.h()._render()};r.prototype._render=function(){this.sa=this.O=!1;this.ca||
-this.f();this.ca=!1;this.xa();this.j()};r.prototype.xa=function(){for(var a=this.C.xa(),b=0;b<a.length;b++)a[b]._render()};r.prototype.f=function(){var a=this.a;if(a)for(var b=0,c;b<a.length;b++)c=a[b],c.getRootNode()!==this&&this.C.La(c);a=this.a=this.C.tb();for(b=0;b<a.length;b++)c=a[b],c.__shady=c.__shady||{},U(c),U(c.parentNode)};r.prototype.j=function(){this.g()};r.prototype.g=function(){this.c(this.host,this.b(this.host));for(var a=this.ta(),b=0,c=a.length,d,e;b<c&&(d=a[b]);b++)e=d.parentNode,
-e!==this.host&&e!==this&&this.c(e,this.b(e))};r.prototype.b=function(a){var b=[];a=(a.__shady&&a.__shady.root||a).childNodes;for(var c=0;c<a.length;c++){var d=a[c];if(this.C.Aa(d))for(var e=d.__shady.R||(d.__shady.R=[]),f=0;f<e.length;f++){var g=e[f];this.ga(d,g)&&b.push(g)}else b.push(d)}return b};r.prototype.ga=function(a,b){return this.C.ga(a,b)};r.prototype.c=function(a,b){for(var c=ca(a),d=sd(b,b.length,c,c.length),e=0,f=0,g;e<d.length&&(g=d[e]);e++){for(var h=0,l;h<g.$.length&&(l=g.$[h]);h++)P(l)===
-a&&W.call(a,l),c.splice(g.index+f,1);f-=g.da}for(e=0;e<d.length&&(g=d[e]);e++)for(f=c[g.index],h=g.index;h<g.index+g.da;h++)l=b[h],Ra.call(a,l,f),c.splice(h,0,l)};r.prototype.za=function(){return!(!this.a||!this.a.length)};r.prototype.ta=function(){this.a||this.f();return this.a};r.prototype.addEventListener=function(a,b,c){"object"!==typeof c&&(c={capture:!!c});c.qa=this;this.host.addEventListener(a,b,c)};r.prototype.removeEventListener=function(a,b,c){"object"!==typeof c&&(c={capture:!!c});c.qa=
-this;this.host.removeEventListener(a,b,c)};(function(a){L(a,Ma,!0);L(a,Na,!0)})(r.prototype);var vd={addEventListener:function(a,b,c){if(b){var d,e,f;"object"===typeof c?(d=!!c.capture,e=!!c.once,f=!!c.passive):(d=!!c,f=e=!1);var g=c&&c.qa||this;if(b.G){if(-1<ic(b.G,g,a,d,e,f))return}else b.G=[];var h=function(d){e&&this.removeEventListener(a,b,c);d.__target||jc(d);var f;g!==this&&(f=Object.getOwnPropertyDescriptor(d,"currentTarget"),Object.defineProperty(d,"currentTarget",{get:function(){return g},
-configurable:!0}));if(d.composed||-1<d.composedPath().indexOf(g))if(d.target===d.relatedTarget)d.eventPhase===Event.BUBBLING_PHASE&&d.stopImmediatePropagation();else if(d.eventPhase===Event.CAPTURING_PHASE||d.bubbles||d.target===g){var h=b.call(g,d);g!==this&&(f?(Object.defineProperty(d,"currentTarget",f),f=null):delete d.currentTarget);return h}};b.G.push({node:this,type:a,capture:d,once:e,passive:f,Eb:h});Va[a]?(this.B=this.B||{},this.B[a]=this.B[a]||{capture:[],bubble:[]},this.B[a][d?"capture":
-"bubble"].push(h)):Fc.call(this,a,h,c)}},removeEventListener:function(a,b,c){if(b){var d,e,f;"object"===typeof c?(d=!!c.capture,e=!!c.once,f=!!c.passive):(d=!!c,f=e=!1);var g=c&&c.qa||this,h=void 0;b.G&&(e=ic(b.G,g,a,d,e,f),-1<e&&(h=b.G.splice(e,1)[0].Eb,b.G.length||(b.G=void 0)));Gc.call(this,a,h||b,c);h&&Va[a]&&this.B&&this.B[a]&&(a=this.B[a][d?"capture":"bubble"],h=a.indexOf(h),-1<h&&a.splice(h,1))}},appendChild:function(a){return dc(this,a)},insertBefore:function(a,b){return dc(this,a,b)},removeChild:function(a){if(a.parentNode!==
-this)throw Error("The node to be removed is not a child of this node: "+a);if(!Wb(a)){var b=B(this)?this.host:this,c=P(a);b===c&&W.call(b,a)}Pa(this,null,a);return a},replaceChild:function(a,b){this.insertBefore(a,b);this.removeChild(b);return a},cloneNode:function(a){var b;if("template"==this.localName)b=db.call(this,a);else if(b=db.call(this,!1),a){a=this.childNodes;for(var c=0,d;c<a.length;c++)d=a[c].cloneNode(!0),b.appendChild(d)}return b},getRootNode:function(){return Qa(this)},get isConnected(){var a=
-this.ownerDocument;if(a&&a.contains&&a.contains(this)||(a=a.documentElement)&&a.contains&&a.contains(this))return!0;for(a=this;a&&!(a instanceof Document);)a=a.parentNode||(a instanceof r?a.host:void 0);return!!(a&&a instanceof Document)}},wd={get assignedSlot(){return lc(this)}},Wa={querySelector:function(a){return ac(this,function(b){return Cc.call(b,a)},function(a){return!!a})[0]||null},querySelectorAll:function(a){return ac(this,function(b){return Cc.call(b,a)})}},oc={assignedNodes:function(a){if("slot"===
-this.localName)return cc(this),this.__shady?(a&&a.flatten?this.__shady.R:this.__shady.assignedNodes)||[]:[]}},mc=Ga({setAttribute:function(a,b){ra||(ra=window.ShadyCSS&&window.ShadyCSS.ScopingShim);ra&&"class"===a?ra.setElementClass(this,b):(Dc.call(this,a,b),$b(this,a))},removeAttribute:function(a){Ec.call(this,a);$b(this,a)},attachShadow:function(a){if(!this)throw"Must provide a host.";if(!a)throw"Not enough arguments.";return new r(Cb,this)},get slot(){return this.getAttribute("slot")},set slot(a){this.setAttribute("slot",
-a)},get assignedSlot(){return lc(this)}},Wa,oc);Object.defineProperties(mc,Hc);var nc=Ga({importNode:function(a,b){return fc(a,b)}},Wa);Object.defineProperties(nc,{_activeElement:Na.activeElement});var Qd=HTMLElement.prototype.blur,xd=Ga({blur:function(){var a=this.shadowRoot;(a=a&&a.activeElement)?a.blur():Qd.call(this)}});z.Pa&&(window.ShadyDOM={inUse:z.Pa,patch:function(a){return a},isShadyRoot:B,enqueue:Hb,flush:Ka,settings:z,filterMutations:ld,observeChildren:jd,unobserveChildren:id,nativeMethods:Jd,
-nativeTree:Kd},window.Event=Md,window.CustomEvent=Nd,window.MouseEvent=Od,rd(),ud(),window.ShadowRoot=r);var yd=new Set("annotation-xml color-profile font-face font-face-src font-face-uri font-face-format font-face-name missing-glyph".split(" "));A.prototype.M=function(a,b){this.s.set(a,b);this.o.set(b.constructor,b)};A.prototype.f=function(a){return this.s.get(a)};A.prototype.L=function(a){return this.o.get(a)};A.prototype.u=function(a){this.h=!0;this.i.push(a)};A.prototype.j=function(a){var b=this;
-this.h&&O(a,function(a){return b.g(a)})};A.prototype.g=function(a){if(this.h&&!a.__CE_patched){a.__CE_patched=!0;for(var b=0;b<this.i.length;b++)this.i[b](a)}};A.prototype.b=function(a){var b=[];O(a,function(a){return b.push(a)});for(a=0;a<b.length;a++){var c=b[a];1===c.__CE_state?this.connectedCallback(c):this.A(c)}};A.prototype.a=function(a){var b=[];O(a,function(a){return b.push(a)});for(a=0;a<b.length;a++){var c=b[a];1===c.__CE_state&&this.disconnectedCallback(c)}};A.prototype.c=function(a,b){b=
-b?b:new Set;var c=this,d=[];O(a,function(a){if("link"===a.localName&&"import"===a.getAttribute("rel")){var e=a.import;e instanceof Node&&"complete"===e.readyState?(e.__CE_isImportDocument=!0,e.__CE_hasRegistry=!0):a.addEventListener("load",function(){var d=a.import;d.__CE_documentLoadHandled||(d.__CE_documentLoadHandled=!0,d.__CE_isImportDocument=!0,d.__CE_hasRegistry=!0,b.delete(d),c.c(d,b))})}else d.push(a)},b);if(this.h)for(a=0;a<d.length;a++)this.g(d[a]);for(a=0;a<d.length;a++)this.A(d[a])};A.prototype.A=
-function(a){if(void 0===a.__CE_state){var b=this.f(a.localName);if(b){b.constructionStack.push(a);var c=b.constructor;try{try{if(new c!==a)throw Error("The custom element constructor did not produce the element being upgraded.");}finally{b.constructionStack.pop()}}catch(f){throw a.__CE_state=2,f;}a.__CE_state=1;a.__CE_definition=b;if(b.attributeChangedCallback)for(b=b.observedAttributes,c=0;c<b.length;c++){var d=b[c],e=a.getAttribute(d);null!==e&&this.attributeChangedCallback(a,d,null,e,null)}n(a)&&
-this.connectedCallback(a)}}};A.prototype.connectedCallback=function(a){var b=a.__CE_definition;b.connectedCallback&&b.connectedCallback.call(a)};A.prototype.disconnectedCallback=function(a){var b=a.__CE_definition;b.disconnectedCallback&&b.disconnectedCallback.call(a)};A.prototype.attributeChangedCallback=function(a,b,c,d,e){var f=a.__CE_definition;f.attributeChangedCallback&&-1<f.observedAttributes.indexOf(b)&&f.attributeChangedCallback.call(a,b,c,d,e)};Ca.prototype.c=function(){this.N&&this.N.disconnect()};
-Ca.prototype.f=function(a){var b=this.a.readyState;"interactive"!==b&&"complete"!==b||this.c();for(b=0;b<a.length;b++)for(var c=a[b].addedNodes,d=0;d<c.length;d++)this.b.c(c[d])};Bb.prototype.resolve=function(a){if(this.a)throw Error("Already resolved.");this.a=a;this.b&&this.b(a)};t.prototype.define=function(a,b){var c=this;if(!(b instanceof Function))throw new TypeError("Custom element constructors must be functions.");if(!pc(a))throw new SyntaxError("The element name '"+a+"' is not valid.");if(this.a.f(a))throw Error("A custom element with name '"+
-a+"' has already been defined.");if(this.f)throw Error("A custom element is already being defined.");this.f=!0;var d,e,f,g,h;try{var k=function(a){var b=m[a];if(void 0!==b&&!(b instanceof Function))throw Error("The '"+a+"' callback must be a function.");return b},m=b.prototype;if(!(m instanceof Object))throw new TypeError("The custom element constructor's prototype is not an object.");d=k("connectedCallback");e=k("disconnectedCallback");f=k("adoptedCallback");g=k("attributeChangedCallback");h=b.observedAttributes||
-[]}catch(fe){return}finally{this.f=!1}this.a.M(a,{localName:a,constructor:b,connectedCallback:d,disconnectedCallback:e,adoptedCallback:f,attributeChangedCallback:g,observedAttributes:h,constructionStack:[]});this.c.push(a);this.b||(this.b=!0,this.g(function(){return c.j()}))};t.prototype.j=function(){if(!1!==this.b)for(this.b=!1,this.a.c(document);0<this.c.length;){var a=this.c.shift();(a=this.h.get(a))&&a.resolve(void 0)}};t.prototype.get=function(a){if(a=this.a.f(a))return a.constructor};t.prototype.whenDefined=
-function(a){if(!pc(a))return Promise.reject(new SyntaxError("'"+a+"' is not a valid custom element name."));var b=this.h.get(a);if(b)return b.c;b=new Bb;this.h.set(a,b);this.a.f(a)&&-1===this.c.indexOf(a)&&b.resolve(void 0);return b.c};t.prototype.o=function(a){this.i.c();var b=this.g;this.g=function(c){return a(function(){return b(c)})}};window.CustomElementRegistry=t;t.prototype.define=t.prototype.define;t.prototype.get=t.prototype.get;t.prototype.whenDefined=t.prototype.whenDefined;t.prototype.polyfillWrapFlushCallback=
-t.prototype.o;var ya=window.Document.prototype.createElement,dd=window.Document.prototype.createElementNS,cd=window.Document.prototype.importNode,ed=window.Document.prototype.prepend,fd=window.Document.prototype.append,qb=window.Node.prototype.cloneNode,ja=window.Node.prototype.appendChild,yb=window.Node.prototype.insertBefore,za=window.Node.prototype.removeChild,zb=window.Node.prototype.replaceChild,Ba=Object.getOwnPropertyDescriptor(window.Node.prototype,"textContent"),pb=window.Element.prototype.attachShadow,
-wa=Object.getOwnPropertyDescriptor(window.Element.prototype,"innerHTML"),Aa=window.Element.prototype.getAttribute,rb=window.Element.prototype.setAttribute,tb=window.Element.prototype.removeAttribute,ka=window.Element.prototype.getAttributeNS,sb=window.Element.prototype.setAttributeNS,ub=window.Element.prototype.removeAttributeNS,wb=window.Element.prototype.insertAdjacentElement,Uc=window.Element.prototype.prepend,Vc=window.Element.prototype.append,Xc=window.Element.prototype.before,Yc=window.Element.prototype.after,
-Zc=window.Element.prototype.replaceWith,$c=window.Element.prototype.remove,hd=window.HTMLElement,xa=Object.getOwnPropertyDescriptor(window.HTMLElement.prototype,"innerHTML"),vb=window.HTMLElement.prototype.insertAdjacentElement,Ab=new function(){},sa=window.customElements;if(!sa||sa.forcePolyfill||"function"!=typeof sa.define||"function"!=typeof sa.get){var ga=new A;gd(ga);bd(ga);ad(ga);Tc(ga);document.__CE_hasRegistry=!0;var Rd=new t(ga);Object.defineProperty(window,"customElements",{configurable:!0,
-enumerable:!0,value:Rd})}var H={STYLE_RULE:1,na:7,MEDIA_RULE:4,Ea:1E3},M={rb:/\/\*[^*]*\*+([^/*][^*]*\*+)*\//gim,port:/@import[^;]*;/gim,Ma:/(?:^[^;\-\s}]+)?--[^;{}]*?:[^{};]*?(?:[;\n]|$)/gim,Qa:/(?:^[^;\-\s}]+)?--[^;{}]*?:[^{};]*?{[^}]*?}(?:[;\n]|$)?/gim,yb:/@apply\s*\(?[^);]*\)?\s*(?:[;\n]|$)?/gim,Db:/[^;:]*?:[^;]*?var\([^;]*\)(?:[;\n]|$)?/gim,xb:/^@[^\s]*keyframes/,Ra:/\s+/g},y=!(window.ShadyDOM&&window.ShadyDOM.inUse),x=!navigator.userAgent.match("AppleWebKit/601")&&window.CSS&&CSS.supports&&
-CSS.supports("box-shadow","0 0 0 var(--foo)");window.ShadyCSS?sc(window.ShadyCSS):window.WebComponents&&sc(window.WebComponents.flags);var Ic=/(?:^|[;\s{]\s*)(--[\w-]*?)\s*:\s*(?:([^;{]*)|{([^}]*)})(?:(?=[;\s}])|$)/gi,Jc=/(?:^|\W+)@apply\s*\(?([^);\n]*)\)?/gi,Sd=/(--[\w-]+)\s*([:,;)]|$)/gi,Td=/(animation\s*:)|(animation-name\s*:)/,Ad=/@media[^(]*(\([^)]*\))/,Ud=/\{[^}]*\}/g,S=null;q.prototype.a=function(a,b,c){a.__styleScoped?a.__styleScoped=null:this.i(a,b||"",c)};q.prototype.i=function(a,b,c){a.nodeType===
-Node.ELEMENT_NODE&&this.A(a,b,c);if(a="template"===a.localName?(a.content||a.Hb).childNodes:a.children||a.childNodes)for(var d=0;d<a.length;d++)this.i(a[d],b,c)};q.prototype.A=function(a,b,c){if(b)if(a.classList)c?(a.classList.remove("style-scope"),a.classList.remove(b)):(a.classList.add("style-scope"),a.classList.add(b));else if(a.getAttribute){var d=a.getAttribute(Vd);c?d&&(b=d.replace("style-scope","").replace(b,""),oa(a,b)):oa(a,(d?d+" ":"")+"style-scope "+b)}};q.prototype.b=function(a,b,c){var d=
-a.__cssBuild;y||"shady"===d?b=X(b,c):(a=T(a),b=this.U(b,a.is,a.aa,c)+"\n\n");return b.trim()};q.prototype.U=function(a,b,c,d){var e=this.f(b,c);b=this.h(b);var f=this;return X(a,function(a){a.c||(f.W(a,b,e),a.c=!0);d&&d(a,b,e)})};q.prototype.h=function(a){return a?Wd+a:""};q.prototype.f=function(a,b){return b?"[is="+a+"]":a};q.prototype.W=function(a,b,c){this.j(a,this.g,b,c)};q.prototype.j=function(a,b,c,d){a.selector=a.D=this.o(a,b,c,d)};q.prototype.o=function(a,b,c,d){var e=a.selector.split(Kc);
-if(!tc(a)){a=0;for(var f=e.length,g;a<f&&(g=e[a]);a++)e[a]=b.call(this,g,c,d)}return e.join(Kc)};q.prototype.g=function(a,b,c){var d=this,e=!1;a=a.trim();a=a.replace(Xd,function(a,b,c){return":"+b+"("+c.replace(/\s/g,"")+")"});a=a.replace(Yd,gb+" $1");return a=a.replace(Zd,function(a,g,h){e||(a=d.L(h,g,b,c),e=e||a.stop,g=a.qb,h=a.value);return g+h})};q.prototype.L=function(a,b,c,d){var e=a.indexOf(hb);0<=a.indexOf(gb)?a=this.T(a,d):0!==e&&(a=c?this.s(a,c):a);c=!1;0<=e&&(b="",c=!0);var f;c&&(f=!0,
-c&&(a=a.replace($d,function(a,b){return" > "+b})));a=a.replace(ae,function(a,b,c){return'[dir="'+c+'"] '+b+", "+b+'[dir="'+c+'"]'});return{value:a,qb:b,stop:f}};q.prototype.s=function(a,b){a=a.split(Lc);a[0]+=b;return a.join(Lc)};q.prototype.T=function(a,b){var c=a.match(Mc);return(c=c&&c[2].trim()||"")?c[0].match(Nc)?a.replace(Mc,function(a,c,f){return b+f}):c.split(Nc)[0]===b?c:be:a.replace(gb,b)};q.prototype.V=function(a){a.selector=a.parsedSelector;this.u(a);this.j(a,this.M)};q.prototype.u=function(a){a.selector===
-ce&&(a.selector="html")};q.prototype.M=function(a){return a.match(hb)?this.g(a,Oc):this.s(a.trim(),Oc)};mb.Object.defineProperties(q.prototype,{c:{configurable:!0,enumerable:!0,get:function(){return"style-scope"}}});var Xd=/:(nth[-\w]+)\(([^)]+)\)/,Oc=":not(.style-scope)",Kc=",",Zd=/(^|[\s>+~]+)((?:\[.+?\]|[^\s>+~=\[])+)/g,Nc=/[[.:#*]/,gb=":host",ce=":root",hb="::slotted",Yd=new RegExp("^("+hb+")"),Mc=/(:host)(?:\(((?:\([^)(]*\)|[^)(]*)+?)\))/,$d=/(?:::slotted)(?:\(((?:\([^)(]*\)|[^)(]*)+?)\))/,ae=
-/(.*):dir\((?:(ltr|rtl))\)/,Wd=".",Lc=":",Vd="class",be="should_not_match",u=new q;v.get=function(a){return a?a.__styleInfo:null};v.set=function(a,b){return a.__styleInfo=b};v.prototype.c=function(){return this.I};v.prototype._getStyleRules=v.prototype.c;var Pc=function(a){return a.matches||a.matchesSelector||a.mozMatchesSelector||a.msMatchesSelector||a.oMatchesSelector||a.webkitMatchesSelector}(window.Element.prototype),de=navigator.userAgent.match("Trident");p.prototype.W=function(a){var b=this,
-c={},d=[],e=0;Y(a,function(a){b.c(a);a.index=e++;b.V(a.v.cssText,c)},function(a){d.push(a)});a.b=d;a=[];for(var f in c)a.push(f);return a};p.prototype.c=function(a){if(!a.v){var b={},c={};this.b(a,c)&&(b.H=c,a.rules=null);b.cssText=this.U(a);a.v=b}};p.prototype.b=function(a,b){var c=a.v;if(c){if(c.H)return Object.assign(b,c.H),!0}else{for(var c=a.parsedCssText,d;a=Ic.exec(c);){d=(a[2]||a[3]).trim();if("inherit"!==d||"unset"!==d)b[a[1].trim()]=d;d=!0}return d}};p.prototype.U=function(a){return this.T(a.parsedCssText)};
-p.prototype.T=function(a){return a.replace(Ud,"").replace(Ic,"")};p.prototype.V=function(a,b){for(var c;c=Sd.exec(a);){var d=c[1];":"!==c[2]&&(b[d]=!0)}};p.prototype.ka=function(a){for(var b=Object.getOwnPropertyNames(a),c=0,d;c<b.length;c++)d=b[c],a[d]=this.a(a[d],a)};p.prototype.a=function(a,b){if(a)if(0<=a.indexOf(";"))a=this.f(a,b);else{var c=this;a=vc(a,function(a,e,f,g){if(!e)return a+g;(e=c.a(b[e],b))&&"initial"!==e?"apply-shim-inherit"===e&&(e="inherit"):e=c.a(b[f]||f,b)||f;return a+(e||"")+
-g})}return a&&a.trim()||""};p.prototype.f=function(a,b){a=a.split(";");for(var c=0,d,e;c<a.length;c++)if(d=a[c]){Jc.lastIndex=0;if(e=Jc.exec(d))d=this.a(b[e[1]],b);else if(e=d.indexOf(":"),-1!==e){var f=d.substring(e),f=f.trim(),f=this.a(f,b)||f;d=d.substring(0,e)+f}a[c]=d&&d.lastIndexOf(";")===d.length-1?d.slice(0,-1):d||""}return a.join(";")};p.prototype.M=function(a,b){var c="";a.v||this.c(a);a.v.cssText&&(c=this.f(a.v.cssText,b));a.cssText=c};p.prototype.L=function(a,b){var c=a.cssText,d=a.cssText;
-null==a.Oa&&(a.Oa=Td.test(c));if(a.Oa)if(null==a.ha){a.ha=[];for(var e in b)d=b[e],d=d(c),c!==d&&(c=d,a.ha.push(e))}else{for(e=0;e<a.ha.length;++e)d=b[a.ha[e]],c=d(c);d=c}a.cssText=d};p.prototype.ja=function(a,b){var c={},d=this,e=[];Y(a,function(a){a.v||d.c(a);var f=a.D||a.parsedSelector;b&&a.v.H&&f&&Pc.call(b,f)&&(d.b(a,c),a=a.index,f=parseInt(a/32,10),e[f]=(e[f]||0)|1<<a%32)},null,!0);return{H:c,key:e}};p.prototype.ma=function(a,b,c,d){b.v||this.c(b);if(b.v.H){var e=T(a);a=e.is;var e=e.aa,e=a?
-u.f(a,e):"html",f=b.parsedSelector,g=":host > *"===f||"html"===f,h=0===f.indexOf(":host")&&!g;"shady"===c&&(g=f===e+" > *."+e||-1!==f.indexOf("html"),h=!g&&0===f.indexOf(e));"shadow"===c&&(g=":host > *"===f||"html"===f,h=h&&!g);if(g||h)c=e,h&&(y&&!b.D&&(b.D=u.o(b,u.g,u.h(a),e)),c=b.D||e),d({Cb:c,wb:h,Lb:g})}};p.prototype.ia=function(a,b){var c={},d={},e=this,f=b&&b.__cssBuild;Y(b,function(b){e.ma(a,b,f,function(f){Pc.call(a.Ib||a,f.Cb)&&(f.wb?e.b(b,c):e.b(b,d))})},null,!0);return{Ab:d,vb:c}};p.prototype.la=
-function(a,b,c){var d=this,e=T(a),f=u.f(e.is,e.aa),g=new RegExp("(?:^|[^.#[:])"+(a.extends?"\\"+f.slice(0,-1)+"\\]":f)+"($|[.:[\\s>+~])"),e=v.get(a).I,h=this.h(e,c);return u.b(a,e,function(a){d.M(a,b);y||tc(a)||!a.cssText||(d.L(a,h),d.o(a,g,f,c))})};p.prototype.h=function(a,b){a=a.b;var c={};if(!y&&a)for(var d=0,e=a[d];d<a.length;e=a[++d])this.j(e,b),c[e.keyframesName]=this.i(e);return c};p.prototype.i=function(a){return function(b){return b.replace(a.f,a.a)}};p.prototype.j=function(a,b){a.f=new RegExp(a.keyframesName,
-"g");a.a=a.keyframesName+"-"+b;a.D=a.D||a.selector;a.selector=a.D.replace(a.keyframesName,a.a)};p.prototype.o=function(a,b,c,d){a.D=a.D||a.selector;d="."+d;for(var e=a.D.split(","),f=0,g=e.length,h;f<g&&(h=e[f]);f++)e[f]=h.match(b)?h.replace(c,d):d+" "+h;a.selector=e.join(",")};p.prototype.u=function(a,b,c){var d=a.getAttribute("class")||"",e=d;c&&(e=d.replace(new RegExp("\\s*x-scope\\s*"+c+"\\s*","g")," "));e+=(e?" ":"")+"x-scope "+b;d!==e&&oa(a,e)};p.prototype.A=function(a,b,c,d){b=d?d.textContent||
-"":this.la(a,b,c);var e=v.get(a),f=e.a;f&&!y&&f!==d&&(f._useCount--,0>=f._useCount&&f.parentNode&&f.parentNode.removeChild(f));y?e.a?(e.a.textContent=b,d=e.a):b&&(d=Za(b,c,a.shadowRoot,e.b)):d?d.parentNode||(de&&-1<b.indexOf("@media")&&(d.textContent=b),uc(d,null,e.b)):b&&(d=Za(b,c,null,e.b));d&&(d._useCount=d._useCount||0,e.a!=d&&d._useCount++,e.a=d);return d};p.prototype.s=function(a,b){var c=na(a),d=this;a.textContent=X(c,function(a){var c=a.cssText=a.parsedCssText;a.v&&a.v.cssText&&(c=c.replace(M.Ma,
-"").replace(M.Qa,""),a.cssText=d.f(c,b))})};mb.Object.defineProperties(p.prototype,{g:{configurable:!0,enumerable:!0,get:function(){return"x-scope"}}});var I=new p,ib={},ta=window.customElements;if(ta&&!y){var ee=ta.define;ta.define=function(a,b,c){var d=document.createComment(" Shady DOM styles for "+a+" "),e=document.head;e.insertBefore(d,(S?S.nextSibling:null)||e.firstChild);S=d;ib[a]=d;return ee.call(ta,a,b,c)}}ia.prototype.b=function(a,b,c){for(var d=0;d<c.length;d++){var e=c[d];if(a.H[e]!==
-b[e])return!1}return!0};ia.prototype.c=function(a,b,c,d){var e=this.cache[a]||[];e.push({H:b,styleElement:c,F:d});e.length>this.f&&e.shift();this.cache[a]=e};ia.prototype.a=function(a,b,c){if(a=this.cache[a])for(var d=a.length-1;0<=d;d--){var e=a[d];if(this.b(e,b,c))return e}};if(!y){var Qc=new MutationObserver(wc),Rc=function(a){Qc.observe(a,{childList:!0,subtree:!0})};if(window.customElements&&!window.customElements.polyfillWrapFlushCallback)Rc(document);else{var jb=function(){Rc(document.body)};
-window.HTMLImports?window.HTMLImports.whenReady(jb):requestAnimationFrame(function(){if("loading"===document.readyState){var a=function(){jb();document.removeEventListener("readystatechange",a)};document.addEventListener("readystatechange",a)}else jb()})}ob=function(){wc(Qc.takeRecords())}}var pa={},Dd=Promise.resolve(),$a=null,yc=window.HTMLImports&&window.HTMLImports.whenReady||null,ab,ua=null,ha=null;K.prototype.Na=function(){!this.enqueued&&ha&&(this.enqueued=!0,nb(ha))};K.prototype.b=function(a){a.__seenByShadyCSS||
-(a.__seenByShadyCSS=!0,this.customStyles.push(a),this.Na())};K.prototype.a=function(a){return a.__shadyCSSCachedStyle?a.__shadyCSSCachedStyle:a.getStyle?a.getStyle():a};K.prototype.c=function(){for(var a=this.customStyles,b=0;b<a.length;b++){var c=a[b];if(!c.__shadyCSSCachedStyle){var d=this.a(c);if(d){var e=d.__appliedElement;if(e)for(var f=0;f<d.attributes.length;f++){var g=d.attributes[f];e.setAttribute(g.name,g.value)}d=e||d;ua&&ua(d);c.__shadyCSSCachedStyle=d}}}return a};K.prototype.addCustomStyle=
-K.prototype.b;K.prototype.getStyleForCustomStyle=K.prototype.a;K.prototype.processStyles=K.prototype.c;Object.defineProperties(K.prototype,{transformCallback:{get:function(){return ua},set:function(a){ua=a}},validateCallback:{get:function(){return ha},set:function(a){var b=!1;ha||(b=!0);ha=a;b&&this.Na()}}});var Sc=new ia;k.prototype.L=function(){ob()};k.prototype.ia=function(a){var b=this.s[a]=(this.s[a]||0)+1;return a+"-"+b};k.prototype.Za=function(a){return na(a)};k.prototype.ab=function(a){return X(a)};
-k.prototype.W=function(a){a=a.content.querySelectorAll("style");for(var b=[],c=0;c<a.length;c++){var d=a[c];b.push(d.textContent);d.parentNode.removeChild(d)}return b.join("").trim()};k.prototype.ka=function(a){return(a=a.content.querySelector("style"))?a.getAttribute("css-build")||"":""};k.prototype.prepareTemplate=function(a,b,c){if(!a.f){a.f=!0;a.name=b;a.extends=c;pa[b]=a;var d=this.ka(a),e=this.W(a);c={is:b,extends:c,Fb:d};y||u.a(a.content,b);this.c();var f=this.b.detectMixin(e),e=Ya(e);f&&x&&
-this.b.transformRules(e,b);a._styleAst=e;a.g=d;d=[];x||(d=I.W(a._styleAst));if(!d.length||x)b=this.ja(c,a._styleAst,y?a.content:null,ib[b]),a.a=b;a.c=d}};k.prototype.ja=function(a,b,c,d){b=u.b(a,b);if(b.length)return Za(b,a.is,c,d)};k.prototype.ma=function(a){var b=T(a),c=b.is,b=b.aa,d=ib[c],c=pa[c],e,f;c&&(e=c._styleAst,f=c.c);return v.set(a,new v(e,d,f,0,b))};k.prototype.U=function(){if(!this.b)if(window.ShadyCSS&&window.ShadyCSS.ApplyShim)this.b=window.ShadyCSS.ApplyShim,this.b.invalidCallback=
-Bd;else{var a={};this.b=(a.detectMixin=function(){return!1},a.transformRule=function(){},a.transformRules=function(){},a)}};k.prototype.V=function(){var a=this;if(!this.a)if(window.ShadyCSS&&window.ShadyCSS.CustomStyleInterface)this.a=window.ShadyCSS.CustomStyleInterface,this.a.transformCallback=function(b){a.A(b)},this.a.validateCallback=function(){requestAnimationFrame(function(){(a.a.enqueued||a.i)&&a.f()})};else{var b={};this.a=(b.processStyles=function(){},b.enqueued=!1,b.getStyleForCustomStyle=
-function(){return null},b)}};k.prototype.c=function(){this.U();this.V()};k.prototype.f=function(){this.c();var a=this.a.processStyles();this.a.enqueued&&(x?this.Xa(a):(this.u(this.g,this.h),this.M(a)),this.a.enqueued=!1,this.i&&!x&&this.styleDocument())};k.prototype.styleElement=function(a,b){var c=T(a).is,d=v.get(a);d||(d=this.ma(a));this.j(a)||(this.i=!0);b&&(d.S=d.S||{},Object.assign(d.S,b));if(x){if(d.S){b=d.S;for(var e in b)null===e?a.style.removeProperty(e):a.style.setProperty(e,b[e])}if(((e=
-pa[c])||this.j(a))&&e&&e.a&&!xc(e)){if(xc(e)||e._applyShimValidatingVersion!==e._applyShimNextVersion)this.c(),this.b.transformRules(e._styleAst,c),e.a.textContent=u.b(a,d.I),Cd(e);y&&(c=a.shadowRoot)&&(c.querySelector("style").textContent=u.b(a,d.I));d.I=e._styleAst}}else this.u(a,d),d.Ba&&d.Ba.length&&this.T(a,d)};k.prototype.o=function(a){return(a=a.getRootNode().host)?v.get(a)?a:this.o(a):this.g};k.prototype.j=function(a){return a===this.g};k.prototype.T=function(a,b){var c=T(a).is,d=Sc.a(c,b.K,
-b.Ba),e=d?d.styleElement:null,f=b.F;b.F=d&&d.F||this.ia(c);e=I.A(a,b.K,b.F,e);y||I.u(a,b.F,f);d||Sc.c(c,b.K,e,b.F)};k.prototype.u=function(a,b){var c=this.o(a),d=v.get(c),c=Object.create(d.K||null),e=I.ia(a,b.I);a=I.ja(d.I,a).H;Object.assign(c,e.vb,a,e.Ab);this.la(c,b.S);I.ka(c);b.K=c};k.prototype.la=function(a,b){for(var c in b){var d=b[c];if(d||0===d)a[c]=d}};k.prototype.styleDocument=function(a){this.styleSubtree(this.g,a)};k.prototype.styleSubtree=function(a,b){var c=a.shadowRoot;(c||this.j(a))&&
-this.styleElement(a,b);if(b=c&&(c.children||c.childNodes))for(a=0;a<b.length;a++)this.styleSubtree(b[a]);else if(a=a.children||a.childNodes)for(b=0;b<a.length;b++)this.styleSubtree(a[b])};k.prototype.Xa=function(a){for(var b=0;b<a.length;b++){var c=this.a.getStyleForCustomStyle(a[b]);c&&this.Wa(c)}};k.prototype.M=function(a){for(var b=0;b<a.length;b++){var c=this.a.getStyleForCustomStyle(a[b]);c&&I.s(c,this.h.K)}};k.prototype.A=function(a){var b=this,c=na(a);Y(c,function(a){y?u.u(a):u.V(a);x&&(b.c(),
-b.b.transformRule(a))});x?a.textContent=X(c):this.h.I.rules.push(c)};k.prototype.Wa=function(a){if(x){var b=na(a);this.c();this.b.transformRules(b);a.textContent=X(b)}};k.prototype.getComputedStyleValue=function(a,b){var c;x||(c=(v.get(a)||v.get(this.o(a))).K[b]);return(c=c||window.getComputedStyle(a).getPropertyValue(b))?c.trim():""};k.prototype.$a=function(a,b){var c=a.getRootNode();b=b?b.split(/\s/):[];c=c.host&&c.host.localName;if(!c){var d=a.getAttribute("class");if(d)for(var d=d.split(/\s/),
-e=0;e<d.length;e++)if(d[e]===u.c){c=d[e+1];break}}c&&b.push(u.c,c);x||(c=v.get(a))&&c.F&&b.push(I.g,c.F);oa(a,b.join(" "))};k.prototype.Ya=function(a){return v.get(a)};k.prototype.flush=k.prototype.L;k.prototype.prepareTemplate=k.prototype.prepareTemplate;k.prototype.styleElement=k.prototype.styleElement;k.prototype.styleDocument=k.prototype.styleDocument;k.prototype.styleSubtree=k.prototype.styleSubtree;k.prototype.getComputedStyleValue=k.prototype.getComputedStyleValue;k.prototype.setElementClass=
-k.prototype.$a;k.prototype._styleInfoForNode=k.prototype.Ya;k.prototype.transformCustomStyleForDocument=k.prototype.A;k.prototype.getStyleAst=k.prototype.Za;k.prototype.styleAstToString=k.prototype.ab;k.prototype.flushCustomStyles=k.prototype.f;Object.defineProperties(k.prototype,{nativeShadow:{get:function(){return y}},nativeCss:{get:function(){return x}}});var J=new k,kb,lb;window.ShadyCSS&&(kb=window.ShadyCSS.ApplyShim,lb=window.ShadyCSS.CustomStyleInterface);window.ShadyCSS={ScopingShim:J,prepareTemplate:function(a,
-b,c){J.f();J.prepareTemplate(a,b,c)},styleSubtree:function(a,b){J.f();J.styleSubtree(a,b)},styleElement:function(a){J.f();J.styleElement(a)},styleDocument:function(a){J.f();J.styleDocument(a)},getComputedStyleValue:function(a,b){return J.getComputedStyleValue(a,b)},nativeCss:x,nativeShadow:y};kb&&(window.ShadyCSS.ApplyShim=kb);lb&&(window.ShadyCSS.CustomStyleInterface=lb);(function(){var a=window.customElements,b=window.HTMLImports;if(a&&a.polyfillWrapFlushCallback){var c,d=function(){if(c){var a=
-c;c=null;a();return!0}},e=b.whenReady;a.polyfillWrapFlushCallback(function(a){c=a;e(d)});b.whenReady=function(a){e(function(){d()?b.whenReady(a):a()})}}b.whenReady(function(){requestAnimationFrame(function(){document.dispatchEvent(new CustomEvent("WebComponentsReady",{bubbles:!0}))})})})();(function(){var a=document.createElement("style");a.textContent="body {transition: opacity ease-in 0.2s; } \nbody[unresolved] {opacity: 0; display: block; overflow: hidden; position: relative; } \n";var b=document.querySelector("head");
-b.insertBefore(a,b.firstChild)})()})();
-}).call(self)
-
-//# sourceMappingURL=webcomponents-lite.js.map
diff --git a/src/main/resources/static/gltf-viewer/bower_components/webcomponentsjs/webcomponents-lite.js.map b/src/main/resources/static/gltf-viewer/bower_components/webcomponentsjs/webcomponents-lite.js.map
deleted file mode 100644 (file)
index 8780acf..0000000
+++ /dev/null
@@ -1 +0,0 @@
-{"version":3,"sources":[" [synthetic:util/global] ","entrypoints/webcomponents-hi-sd-ce-pf-index.js","bower_components/shadycss/src/scoping-shim.js","bower_components/shadycss/src/custom-style-interface.js","bower_components/shadycss/src/document-watcher.js","bower_components/shadycss/src/style-cache.js","bower_components/shadycss/src/style-properties.js","bower_components/shadycss/src/style-info.js","bower_components/shadycss/src/style-transformer.js","bower_components/shadycss/src/css-parse.js","bower_components/custom-elements/src/Patch/Element.js","bower_components/custom-elements/src/CustomElementState.js","bower_components/custom-elements/src/Patch/Interface/ChildNode.js","bower_components/custom-elements/src/Patch/Node.js","bower_components/custom-elements/src/Patch/Document.js","bower_components/custom-elements/src/Patch/Interface/ParentNode.js","bower_components/custom-elements/src/Patch/HTMLElement.js","bower_components/custom-elements/src/CustomElementRegistry.js","bower_components/custom-elements/src/Deferred.js","bower_components/custom-elements/src/DocumentConstructionObserver.js","bower_components/custom-elements/src/CustomElementInternals.js","bower_components/shadydom/src/attach-shadow.js","bower_components/shadydom/src/distributor.js","bower_components/shadydom/src/logical-tree.js","bower_components/shadydom/src/observe-changes.js","bower_components/shadydom/src/utils.js","bower_components/shadydom/src/flush.js","bower_components/shadydom/src/innerHTML.js","bower_components/shadydom/src/native-tree.js","bower_components/shadydom/src/patch-accessors.js","bower_components/shadydom/src/logical-mutation.js","bower_components/shadydom/src/patch-events.js","bower_components/shadydom/src/array-splice.js","bower_components/shadydom/src/patch-builtins.js","bower_components/custom-elements/src/Utilities.js","bower_components/shadycss/src/style-settings.js","bower_components/shadycss/src/style-util.js","bower_components/shadycss/src/apply-shim-utils.js","bower_components/shadycss/src/document-wait.js","bower_components/webcomponents-platform/webcomponents-platform.js","bower_components/template/template.js","bower_components/es6-promise/dist/es6-promise.auto.min.js","bower_components/html-imports/src/html-imports.js","src/pre-polyfill.js","bower_components/shadydom/src/native-methods.js","bower_components/shadydom/src/shadydom.js","bower_components/custom-elements/src/Patch/Native.js","bower_components/custom-elements/src/AlreadyConstructedMarker.js","bower_components/custom-elements/src/custom-elements.js","bower_components/shadycss/src/common-regex.js","bower_components/shadycss/src/style-placeholder.js","bower_components/shadycss/src/template-map.js","bower_components/shadycss/src/common-utils.js","bower_components/shadycss/entrypoints/scoping-shim.js","src/post-polyfill.js","src/unresolved.js"],"names":["$jscomp.global","constructor","ScopingShim","_scopeCounter","_documentOwner","document","documentElement","ast","StyleNode","_documentOwnerStyleInfo","StyleInfo","set","_elementsHaveApplied","_customStyleInterface","_applyShim","documentWait","_ensure","CustomStyleInterface$1","flush$1","StyleCache","typeMax","cache","StyleProperties","placeholder","ownStylePropertyNames","elementName","typeExtension","styleRules","overrideStyleProperties","customStyle","scopeSelector","styleProperties","StyleTransformer","PatchElement","internals","patch_innerHTML","destination","baseDescriptor","Object","defineProperty","enumerable","configurable","get","htmlString","removedElements","undefined","isConnected","isConnected$$1","walkDeepDescendantElements","element","push","call","i","length","custom","__CE_state","disconnectedCallback","ownerDocument","__CE_hasRegistry","patchAndUpgradeTree","patchTree","patch_insertAdjacentElement","baseMethod","setPropertyUnchecked","where","wasConnected","insertedElement","disconnectTree","connectTree","Element_attachShadow","Element","prototype","init","__CE_shadowRoot","shadowRoot","console","warn","Element_innerHTML","HTMLElement_innerHTML","HTMLElement","rawDiv","Document_createElement","addPatch","Node_cloneNode","innerHTML","assignedValue","content","localName","childNodes","Node_removeChild","Node_appendChild","name","newValue","Element_setAttribute","oldValue","Element_getAttribute","attributeChangedCallback","namespace","Element_setAttributeNS","Element_getAttributeNS","Element_removeAttribute","Element_removeAttributeNS","HTMLElement_insertAdjacentElement","Element_insertAdjacentElement","PatchParentNode","prepend","Element_prepend","append","Element_append","PatchChildNode","before","Element_before","after","Element_after","replaceWith","Element_replaceWith","remove","Element_remove","builtIn","connectedBefore","nodes","filter","node","Node","apply","PatchNode","patch_textContent","nodeType","TEXT_NODE","removedNodes","firstChild","childNodesLength","Array","refNode","DocumentFragment","insertedNodes","slice","nativeResult","Node_insertBefore","nodeWasConnected","deep","clone","nodeToInsert","nodeToRemove","Node_replaceChild","nodeToInsertWasConnected","thisIsConnected","Node_textContent","parts","textContent","join","createTextNode","PatchDocument","Document","definition","localNameToDefinition","result","patch","Document_importNode","NS_HTML","Document_createElementNS","Document_prepend","Document_append","PatchHTMLElement","window","constructorToDefinition","Error","constructionStack","setPrototypeOf","__CE_definition","lastIndex","AlreadyConstructedMarker$1","CustomElementRegistry","_elementDefinitionIsRunning","_internals","_whenDefinedDeferred","Map","_flushCallback","this._flushCallback","fn","_flushPending","_unflushedLocalNames","_documentConstructionObserver","DocumentConstructionObserver","Deferred","_resolve","_value","_promise","Promise","resolve","doc","_document","_observer","readyState","MutationObserver","_handleMutations","bind","observe","childList","subtree","CustomElementInternals","_localNameToDefinition","_constructorToDefinition","_patches","_hasPatches","ShadyRoot","token","host","ShadyRootConstructionToken","TypeError","createDocumentFragment","__proto__","_init","root","insertionPointTag","recordChildNodes","__shady","lastChild","patchInsideElementAccessors","c$","n","parentNode","nextSibling","previousSibling","patchOutsideElementAccessors","unobserveChildren","handle","observer","callbacks","delete","_callback","size","_node","observeChildren","callback","AsyncObserver","add","takeRecords","_scheduled","addedNodes","Set","isShadyRoot","obj","__localName","ownerShadyRootForNode","getRootNode","extend","target","source","n$","getOwnPropertyNames","pd","getOwnPropertyDescriptor","extendAll","sources","mixin","microtask","queue","twiddle","enqueue","scheduled","flush","flushList","didFlush","shift","filterMutations","mutations","targetRootNode","map","mutation","mutationInScope","from","create","value","m","escapeReplace","c","makeSet","arr","getInnerHTML","s","l","child","attr","ELEMENT_NODE","tagName","attrs","attributes","replace","escapeAttrRegExp","voidElements","data","plaintextParents","escapeDataRegExp","COMMENT_NODE","error","nodeWalker","currentNode","parentElement","elementWalker","firstElementChild","lastElementChild","previousElementSibling","nextElementSibling","children","nodeValue","textWalker","createTreeWalker","NodeFilter","SHOW_TEXT","nextNode","patchAccessorGroup","descriptors","force","p","objDesc","patchAccessors","proto","OutsideAccessors","InsideAccessors","ActiveElementAccessor","linkNode","container","ref_node","ps","ns","removeNode","logicalParent","distributed","ownerRoot","maybeDistributeParent","hostNeedsDist","ip$","_getInsertionPoints","insertionPoint","dc$","j","assignedNodes","flatten","parent","removeChild","addedInsertionPoint","_distributor","removedDistributed","_skipUpdateInsertionPoints","updateRootViaContentChange","_removeOwnerShadyRoot","_scheduleObserver","addedNode","removedNode","schedule","ownerShadyRoot","contains","_maybeAddInsertionPoint","added","DOCUMENT_FRAGMENT_NODE","querySelectorAll","np","na","_nodeNeedsDistribution","hasInsertionPoint","_changePending","update","distributeAttributeChange","query","matcher","halter","list","_queryElements","elements","renderRootNode","render","insertBefore$1","ipAdded","resetTo","fragContent","querySelector","wrappedContent","hasContent","needsDist","handled","_renderPending","isFinalDestination","insertBefore","appendChild","importNode$1","importNode","nc","pathComposer","startNode","composed","composedPath","current","startRoot","assignedSlot","retarget","path","refNodePath","ancestor","lastRoot","rootIdx","indexOf","mixinComposedFlag","Base","klazz","type","options","event","__composed","fireHandlers","phase","hs","__handlers","relatedTarget","__immediatePropagationStopped","retargetNonBubblingEvent","e","__propagationStopped","Event","AT_TARGET","lastFiredRoot","findListener","wrappers","capture","once","passive","savedType","savedListener","savedCapture","savedOnce","savedPassive","savedNode","activateFocusEventOverrides","ev","nonBubblingEventsToRetarget","addEventListener","patchEvent","__relatedTarget","settings","hasDescriptors","eventMixin","getPrototypeOf","hasOwnProperty","patchProto","__sourceProto","newSplice","index","addedCount","removed","calcSplices","currentEnd","old","oldEnd","prefixCount","suffixCount","minLength","Math","min","currentStart","oldStart","currentValue","previousValue","index1","index2","count","equals","splice","rowCount","columnCount","distances","north","west","edits","northWest","EDIT_LEAVE","EDIT_UPDATE","EDIT_DELETE","EDIT_ADD","reverse","splices","oldIndex","getAssignedSlot","patchBuiltin","d","patchBuiltins","nativeHTMLElement","nodeMixin","Text","textMixin","fragmentMixin","elementMixin","documentMixin","HTMLSlotElement","slotMixin","htmlElementMixin","isValidCustomElementName","reserved","reservedTagList","has","validForm","test","nativeValue","__CE_isImportDocument","ShadowRoot","nextSiblingOrAncestorSibling","start","visitedImports","getAttribute","import","parse","text","RX","comments","port","parseCss","OPEN_BRACE","previous","CLOSE_BRACE","t","substring","trim","ss","_expandUnicodeEscapes","multipleSpaces","lastIndexOf","AT_START","MEDIA_START","match","keyframesRule","types","KEYFRAMES_RULE","split","pop","MEDIA_RULE","VAR_START","STYLE_RULE","MIXIN_RULE","r$","r","code","repeat","stringify","preserveProperties","cssText","rules","customProp","mixinProp","mixinApply","varApply","parseSettings","nativeCssVariables","nativeShadow","toCssText","forEachRule","rulesForStyle","style","isKeyframesSelector","rule","styleRuleCallback","keyframesRuleCallback","onlyActiveRules","skipRules","matchMedia","MEDIA_MATCH","matches","applyCss","moniker","contextNode","createElement","setAttribute","applyStyle","head","lastHeadApplyNode","compareDocumentPosition","position","DOCUMENT_POSITION_PRECEDING","processVariableAndFallback","str","end","level","inner","prefix","suffix","comma","fallback","setElementClassRaw","getIsExtends","is","extends","handler","mxns","x","mxn","currentScope","classes","classList","hasAttribute","idx","StyleTransformer$1","SCOPE_NAME","dom","newScope","invalidate","template","templateMap","templateIsValid","startValidatingTemplate","_validating","promise","then","requestAnimationFrame","whenReady","readyPromise","resolveFn","workingDefaultPrevented","createEvent","initEvent","preventDefault","defaultPrevented","origPreventDefault","Event.prototype.preventDefault","cancelable","isIE","navigator","userAgent","CustomEvent","window.CustomEvent","inType","params","initCustomEvent","bubbles","detail","origEvent","window.Event","MouseEvent","origMouseEvent","window.MouseEvent","initMouseEvent","view","screenX","screenY","clientX","clientY","ctrlKey","altKey","shiftKey","metaKey","button","Array.from","object","assign","Object.assign","args","arguments","WebComponents","PolyfilledHTMLTemplateElement","needsTemplate","HTMLTemplateElement","Native_importNode","Document.prototype.importNode","f","Native_cloneNode","cloneNode","Native_createElement","needsCloning","t2","defineInnerHTML","o","outerHTML","contentDoc","body","bootstrap","implementation","createHTMLDocument","canDecorate","templateStyle","canProtoPatch","decorate","PolyfilledHTMLTemplateElement.decorate","template.cloneNode","_cloneNode","err","PolyfilledHTMLTemplateElement.bootstrap","templates","TEMPLATE_TAG","Document.prototype.createElement","el","PolyfilledHTMLTemplateElement._cloneNode","fixClonedDom","PolyfilledHTMLTemplateElement.prototype.cloneNode","PolyfilledHTMLTemplateElement.fixClonedDom","s$","t$","replaceChild","Node.prototype.cloneNode","window.HTMLTemplateElement.prototype.cloneNode","exports","module","define","amd","ES6Promise","J","$","G","I","a","tt","process","nextTick","H","V","characterData","u","MessageChannel","port1","onmessage","port2","postMessage","setTimeout","require","runOnLoop","runOnContext","et","k","_state","_result","E","h","g","_","it","y","S","b","rt","ot","w","A","_onerror","T","nt","_subscribers","M","st","C","ut","Y","_instanceConstructor","B","_input","_remaining","_enumerate","U","z","isArray","toString","R","Q","WebKitMutationObserver","Z","Uint8ClampedArray","importScripts","self","random","Y.prototype._enumerate","_eachEntry","Y.prototype._eachEntry","_settledAt","_willSettleAt","Y.prototype._settledAt","Y.prototype._willSettleAt","all","F","race","D","reject","K","_setScheduler","_setAsap","_asap","catch","polyfill","W","global","Function","cast","scope","newCustomEvent","importForElement","useNative","closest","importSelector","isImportLink","whenImportsReady","imports","rootImportSelector","pending","imp","whenElementLoaded","whenDocumentReady","stateChanged","removeEventListener","src","onLoadingDone","rel","Importer","documents","inflight","dynamicImportsMO","handleMutations","loadImports","currentScript","scripts","ABS_URL_TEST","CSS_URL_REGEXP","CSS_IMPORT_REGEXP","STYLESHEET_REGEXP","Path","fixUrls","base","href","replaceAttrUrl","replaceUrls","linkUrl","regexp","pre","url","post","urlPath","resolveUrl","__workingURL","URL","pathname","__tempDoc","__base","__anchor","Xhr","async","load","success","fail","pieces","resource","header","atob","decodeURIComponent","request","XMLHttpRequest","open","onload","request.onload","redirectedUrl","getResponseHeader","location","origin","protocol","response","responseText","status","send","links","loadImport","link","fireEventIfNeeded","makeDocument","processImportsIfLoadingDone","p1","p2","baseEl","removeAttribute","importDependenciesSelector","inlineScriptIndex","importDependencyAttr","encodeURIComponent","num","disconnect","scriptsOk","stylesOk","fireEvents","waitForStyles","runScripts","cloneScript","ll","pendingScriptsSelector","pendingStylesSelector","needsMove","disabledLinkSelector","newSibling","dispatchEvent","eventType","ii","elem","imps","native_baseURI","klass","ownerDoc","HTMLImports","script","flagMatcher","flags","search","forEach","option","forceShady","forceCE","hasNativeShadowDOM","attachShadow","desc","inUse","matchesSelector","mozMatchesSelector","msMatchesSelector","oMatchesSelector","webkitMatchesSelector","cb","nativeMethods","freeze","SHOW_ALL","SHOW_ELEMENT","nativeTree","nativeInnerHTMLDesc","htmlContainer","inertDoc","nativeActiveElementDescriptor","className","tc","cn","ShadowRootAccessor","activeElement","active","isShadyRoot$$1","activeRoot","__outsideAccessors","__insideAccessors","scopingShim","alwaysComposed","isTrusted","__composedPath","currentTarget","__relatedTargetComposedPath","stopPropagation","stopImmediatePropagation","PatchedEvent","PatchedCustomEvent","PatchedMouseEvent","NormalizedEvent","getInsertionPoints","isInsertionPoint","distribute","distributePool","collectPool","pool","dirtyRoots","p$","distributeInsertionPoint","prevAssignedNodes","clearAssignedSlots","needsSlotChange","anyDistributed","matchesInsertionPoint","_prevAssignedSlot","distributeNodeInto","children$$1","setDistributedNodesOnInsertionPoint","_fireSlotChange","slot","savePrevious","slotName","distributedNodes","d$","ShadyRoot.prototype._init","Distributor","ShadyRoot.prototype.update","_getRenderRoot","ShadyRoot.prototype._getRenderRoot","renderRoot","_rendererForHost","ShadyRoot.prototype._rendererForHost","ShadyRoot.prototype.render","updateInsertionPoints","compose","ShadyRoot.prototype.distribute","ShadyRoot.prototype.updateInsertionPoints","i$","_insertionPoints","ShadyRoot.prototype.compose","_composeTree","ShadyRoot.prototype._composeTree","_updateChildNodes","_composeNode","ShadyRoot.prototype._composeNode","distributedNode","ShadyRoot.prototype.isFinalDestination","ShadyRoot.prototype._updateChildNodes","next","ShadyRoot.prototype.hasInsertionPoint","ShadyRoot.prototype._getInsertionPoints","ShadyRoot.prototype.addEventListener","optionsOrCapture","__shadyTarget","ShadyRoot.prototype.removeEventListener","patchShadowRootAccessors","addEventListener$1","__eventWrappers","wrapperFn","lastCurrentTargetDesc","eventPhase","BUBBLING_PHASE","CAPTURING_PHASE","ret","removeEventListener$1","nativeParent","ownerDocumentElement","selector","defineProperties","nativeBlur","blur","shadowActive","ShadyDOM","setDefinition","listener","__CE_patched","connectedCallback","upgradeElement","gatherElements","__CE_documentLoadHandled","failed","observedAttributes","SyntaxError","adoptedCallback","getCallback","callbackValue","_flush","deferred","whenDefined","prior","polyfillWrapFlushCallback","outer","createElementNS","getAttributeNS","setAttributeNS","removeAttributeNS","AlreadyConstructedMarker","priorCustomElements","customElements","CSS","supports","ShadyCSS","VAR_ASSIGN","MIXIN_MATCH","VAR_CONSUMED","ANIMATION_MATCH","BRACKETED","shouldRemoveScope","_transformDom","_content","CLASS","elementStyles","cssBuildType","css","ext","hostScope","_calcHostScope","_calcElementScope","isScoped","CSS_CLASS_PREFIX","_transformRule","_transformComplexSelector","transformer","transformedSelector","_transformRuleCss","COMPLEX_SELECTOR_SEP","stop","NTH","SLOTTED_START","HOST","SIMPLE_SELECTOR_SEP","info","_transformCompoundSelector","combinator","slottedIndex","SLOTTED","_transformHostSelector","_transformSimpleSelector","slotted","SLOTTED_PAREN","paren","DIR_PAREN","dir","PSEUDO_PREFIX","HOST_PAREN","SIMPLE_SELECTOR_PREFIX","typeSelector","SELECTOR_NO_MATCH","documentRule","normalizeRootSelector","_transformDocumentSelector","ROOT","SCOPE_DOC_SELECTOR","$jscomp.global.Object.defineProperties","RegExp","styleInfo","_getStyleRules","matchesSelector$1","IS_IE","decorateStyles","props","keyframes","ruleIndex","decorateRule","collectPropertiesInCssText","propertyInfo","onKeyframesRule","_keyframes","names","properties","collectProperties","hasProperties","collectCssText","exec","any","collectConsumingCssText","reify","valueForProperty","property","valueForProperties","propertyValue","colon","pp","applyProperties","output","applyKeyframeTransforms","keyframeTransforms","input","hasAnimations","keyframeNamesToTransform","keyframe","transform","propertyDataFromStyles","selectorToMatch","parseInt","key","whenHostOrRootRule","cssBuild","parsedSelector","isRoot","isHost","hostAndRootPropertiesForScope","hostProps","rootProps","_element","transformStyles","hostSelector","hostRx","HOST_PREFIX","rxHostSelector","HOST_SUFFIX","_elementKeyframeTransforms","_scopeSelector","keyframesRules","_scopeKeyframes","_keyframesRuleTransformer","keyframesNameRx","transformedKeyframesName","scopeId","applyElementScopeSelector","v","applyElementStyle","applyCustomStyle","XSCOPE_NAME","StyleProperties$1","placeholderMap","ce","origDefine","wrappedDefine","clazz","placeHolder","createComment","_validate","cacheEntry","ownPropertyNames","pn","store","tagname","styleElement","fetch","entry","delayedStart","transformFn","validateFn","enqueueDocumentValidation","addCustomStyle","getStyleForCustomStyle","processStyles","cs","appliedStyle","styleToTransform","needsEnqueue","styleCache","_generateScopeSelector","id","getStyleAst","styleAstToString","_gatherStyles","styles","_getCssBuild","prepareTemplate","_prepared","__cssBuild","hasMixins","_cssBuild","_generateStaticStyle","_style","_ownPropertyNames","shadowroot","_prepareHost","_ensureApplyShim","ApplyShim","_ensureCustomStyleInterface","CustomStyleInterface","transformCustomStyleForDocument","flushCustomStyles","customStyles","_revalidateCustomStyleApplyShim","_updateProperties","_applyCustomStyles","styleDocument","overrideProps","_isRootOwner","removeProperty","setProperty","_applyStyleProperties","_styleOwnerForNode","cachedStyle","oldScopeSelector","owner","ownerStyleInfo","hostAndRootProps","propertiesMatchingHost","propertyData","_mixinOverrideStyles","overrides","styleSubtree","shadowChildren","_revalidateApplyShim","getComputedStyleValue","getComputedStyle","getPropertyValue","setElementClass","classString","scopeName","classAttr","k$","_styleInfoForNode","scopingShim$1","elementExtends","nativeCss","flushCallback","runAndClearCallback","origWhenReady"],"mappings":"A;;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mjB,cAAA,CAAuB,OAAvB,CACZb,EAAAtZ,YAAA,CAAoB,sIAQpB,KAAIsa,EAAOtjB,QAAAmX,cAAA,CAAuB,MAAvB,CACXmM;CAAA5L,aAAA,CAAkB4K,CAAlB,CAAyBgB,CAAAzb,WAAzB,CArBU,CAAX,CAAD,EtDVa,CAAZ,CAAA","file":"webcomponents-lite.js","sourcesContent":[null,"/**\n@license\nCopyright (c) 2017 The Polymer Project Authors. All rights reserved.\nThis code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt\nThe complete set of authors may be found at http://polymer.github.io/AUTHORS.txt\nThe complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt\nCode distributed by Google as part of the polymer project is also\nsubject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt\n*/\n'use strict';\n\n/*\n * Polyfills loaded: HTML Imports, Custom Elements, Shady DOM/Shady CSS, platform polyfills, template\n * Used in: IE 11\n */\n\nimport '../bower_components/webcomponents-platform/webcomponents-platform.js'\nimport '../bower_components/template/template.js'\nimport '../bower_components/es6-promise/dist/es6-promise.auto.min.js'\nimport '../bower_components/html-imports/src/html-imports.js'\nimport '../src/pre-polyfill.js'\nimport '../bower_components/shadydom/src/shadydom.js'\nimport '../bower_components/custom-elements/src/custom-elements.js'\nimport '../bower_components/shadycss/entrypoints/scoping-shim.js'\nimport '../src/post-polyfill.js'\nimport '../src/unresolved.js'\n","/**\n@license\nCopyright (c) 2017 The Polymer Project Authors. All rights reserved.\nThis code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt\nThe complete set of authors may be found at http://polymer.github.io/AUTHORS.txt\nThe complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt\nCode distributed by Google as part of the polymer project is also\nsubject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt\n*/\n\n'use strict';\n\nimport {parse, StyleNode} from './css-parse'\nimport {nativeShadow, nativeCssVariables} from './style-settings'\nimport StyleTransformer from './style-transformer'\nimport * as StyleUtil from './style-util'\nimport StyleProperties from './style-properties'\nimport placeholderMap from './style-placeholder'\nimport StyleInfo from './style-info'\nimport StyleCache from './style-cache'\nimport {flush as watcherFlush} from './document-watcher'\nimport templateMap from './template-map'\nimport * as ApplyShimUtils from './apply-shim-utils'\nimport documentWait from './document-wait'\nimport {updateNativeProperties} from './common-utils'\nimport {CustomStyleInterfaceInterface} from './custom-style-interface' //eslint-disable-line no-unused-vars\n\n/**\n * @const {StyleCache}\n */\nconst styleCache = new StyleCache();\n\nexport default class ScopingShim {\n  constructor() {\n    this._scopeCounter = {};\n    this._documentOwner = document.documentElement;\n    let ast = new StyleNode();\n    ast['rules'] = [];\n    this._documentOwnerStyleInfo = StyleInfo.set(this._documentOwner, new StyleInfo(ast));\n    this._elementsHaveApplied = false;\n    this._applyShim = null;\n    /** @type {?CustomStyleInterfaceInterface} */\n    this._customStyleInterface = null;\n    documentWait(() => {\n      this._ensure();\n    });\n  }\n  flush() {\n    watcherFlush();\n  }\n  _generateScopeSelector(name) {\n    let id = this._scopeCounter[name] = (this._scopeCounter[name] || 0) + 1;\n    return `${name}-${id}`;\n  }\n  getStyleAst(style) {\n    return StyleUtil.rulesForStyle(style);\n  }\n  styleAstToString(ast) {\n    return StyleUtil.toCssText(ast);\n  }\n  _gatherStyles(template) {\n    let styles = template.content.querySelectorAll('style');\n    let cssText = [];\n    for (let i = 0; i < styles.length; i++) {\n      let s = styles[i];\n      cssText.push(s.textContent);\n      s.parentNode.removeChild(s);\n    }\n    return cssText.join('').trim();\n  }\n  _getCssBuild(template) {\n    let style = template.content.querySelector('style');\n    if (!style) {\n      return '';\n    }\n    return style.getAttribute('css-build') || '';\n  }\n  /**\n   * Prepare the styling and template for the given element type\n   *\n   * @param {HTMLTemplateElement} template\n   * @param {string} elementName\n   * @param {string=} typeExtension\n   */\n  prepareTemplate(template, elementName, typeExtension) {\n    if (template._prepared) {\n      return;\n    }\n    template._prepared = true;\n    template.name = elementName;\n    template.extends = typeExtension;\n    templateMap[elementName] = template;\n    let cssBuild = this._getCssBuild(template);\n    let cssText = this._gatherStyles(template);\n    let info = {\n      is: elementName,\n      extends: typeExtension,\n      __cssBuild: cssBuild,\n    };\n    if (!nativeShadow) {\n      StyleTransformer.dom(template.content, elementName);\n    }\n    // check if the styling has mixin definitions or uses\n    this._ensure();\n    let hasMixins = this._applyShim['detectMixin'](cssText);\n    let ast = parse(cssText);\n    // only run the applyshim transforms if there is a mixin involved\n    if (hasMixins && nativeCssVariables) {\n      this._applyShim['transformRules'](ast, elementName);\n    }\n    template['_styleAst'] = ast;\n    template._cssBuild = cssBuild;\n\n    let ownPropertyNames = [];\n    if (!nativeCssVariables) {\n      ownPropertyNames = StyleProperties.decorateStyles(template['_styleAst'], info);\n    }\n    if (!ownPropertyNames.length || nativeCssVariables) {\n      let root = nativeShadow ? template.content : null;\n      let placeholder = placeholderMap[elementName];\n      let style = this._generateStaticStyle(info, template['_styleAst'], root, placeholder);\n      template._style = style;\n    }\n    template._ownPropertyNames = ownPropertyNames;\n  }\n  _generateStaticStyle(info, rules, shadowroot, placeholder) {\n    let cssText = StyleTransformer.elementStyles(info, rules);\n    if (cssText.length) {\n      return StyleUtil.applyCss(cssText, info.is, shadowroot, placeholder);\n    }\n  }\n  _prepareHost(host) {\n    let {is, typeExtension} = StyleUtil.getIsExtends(host);\n    let placeholder = placeholderMap[is];\n    let template = templateMap[is];\n    let ast;\n    let ownStylePropertyNames;\n    let cssBuild;\n    if (template) {\n      ast = template['_styleAst'];\n      ownStylePropertyNames = template._ownPropertyNames;\n      cssBuild = template._cssBuild;\n    }\n    return StyleInfo.set(host,\n      new StyleInfo(\n        ast,\n        placeholder,\n        ownStylePropertyNames,\n        is,\n        typeExtension,\n        cssBuild\n      )\n    );\n  }\n  _ensureApplyShim() {\n    if (this._applyShim) {\n      return;\n    } else if (window.ShadyCSS && window.ShadyCSS.ApplyShim) {\n      this._applyShim = window.ShadyCSS.ApplyShim;\n      this._applyShim['invalidCallback'] = ApplyShimUtils.invalidate;\n    } else {\n      this._applyShim = {\n        /* eslint-disable no-unused-vars */\n        ['detectMixin'](str){return false},\n        ['transformRule'](ast){},\n        ['transformRules'](ast, name){},\n        /* eslint-enable no-unused-vars */\n      }\n    }\n  }\n  _ensureCustomStyleInterface() {\n    if (this._customStyleInterface) {\n      return;\n    } else if (window.ShadyCSS && window.ShadyCSS.CustomStyleInterface) {\n      this._customStyleInterface = /** @type {!CustomStyleInterfaceInterface} */(window.ShadyCSS.CustomStyleInterface);\n      /** @type {function(!HTMLStyleElement)} */\n      this._customStyleInterface['transformCallback'] = (style) => {this.transformCustomStyleForDocument(style)};\n      this._customStyleInterface['validateCallback'] = () => {\n        requestAnimationFrame(() => {\n          if (this._customStyleInterface['enqueued'] || this._elementsHaveApplied) {\n            this.flushCustomStyles();\n          }\n        })\n      };\n    } else {\n      this._customStyleInterface = /** @type {!CustomStyleInterfaceInterface} */({\n        ['processStyles']() {},\n        ['enqueued']: false,\n        ['getStyleForCustomStyle'](s) { return null } // eslint-disable-line no-unused-vars\n      })\n    }\n  }\n  _ensure() {\n    this._ensureApplyShim();\n    this._ensureCustomStyleInterface();\n  }\n  /**\n   * Flush and apply custom styles to document\n   */\n  flushCustomStyles() {\n    this._ensure();\n    let customStyles = this._customStyleInterface['processStyles']();\n    // early return if custom-styles don't need validation\n    if (!this._customStyleInterface['enqueued']) {\n      return;\n    }\n    if (!nativeCssVariables) {\n      this._updateProperties(this._documentOwner, this._documentOwnerStyleInfo);\n      this._applyCustomStyles(customStyles);\n    } else {\n      this._revalidateCustomStyleApplyShim(customStyles);\n    }\n    this._customStyleInterface['enqueued'] = false;\n    // if custom elements have upgraded and there are no native css variables, we must recalculate the whole tree\n    if (this._elementsHaveApplied && !nativeCssVariables) {\n      this.styleDocument();\n    }\n  }\n  /**\n   * Apply styles for the given element\n   *\n   * @param {!HTMLElement} host\n   * @param {Object=} overrideProps\n   */\n  styleElement(host, overrideProps) {\n    let {is} = StyleUtil.getIsExtends(host);\n    let styleInfo = StyleInfo.get(host);\n    if (!styleInfo) {\n      styleInfo = this._prepareHost(host);\n    }\n    // Only trip the `elementsHaveApplied` flag if a node other that the root document has `applyStyle` called\n    if (!this._isRootOwner(host)) {\n      this._elementsHaveApplied = true;\n    }\n    if (overrideProps) {\n      styleInfo.overrideStyleProperties =\n        styleInfo.overrideStyleProperties || {};\n      Object.assign(styleInfo.overrideStyleProperties, overrideProps);\n    }\n    if (!nativeCssVariables) {\n     this._updateProperties(host, styleInfo);\n      if (styleInfo.ownStylePropertyNames && styleInfo.ownStylePropertyNames.length) {\n        this._applyStyleProperties(host, styleInfo);\n      }\n    } else {\n      if (styleInfo.overrideStyleProperties) {\n        updateNativeProperties(host, styleInfo.overrideStyleProperties);\n      }\n      let template = templateMap[is];\n      // bail early if there is no shadowroot for this element\n      if (!template && !this._isRootOwner(host)) {\n        return;\n      }\n      if (template && template._style && !ApplyShimUtils.templateIsValid(template)) {\n        // update template\n        if (!ApplyShimUtils.templateIsValidating(template)) {\n          this._ensure();\n          this._applyShim['transformRules'](template['_styleAst'], is);\n          template._style.textContent = StyleTransformer.elementStyles(host, styleInfo.styleRules);\n          ApplyShimUtils.startValidatingTemplate(template);\n        }\n        // update instance if native shadowdom\n        if (nativeShadow) {\n          let root = host.shadowRoot;\n          if (root) {\n            let style = root.querySelector('style');\n            style.textContent = StyleTransformer.elementStyles(host, styleInfo.styleRules);\n          }\n        }\n        styleInfo.styleRules = template['_styleAst'];\n      }\n    }\n  }\n  _styleOwnerForNode(node) {\n    let root = node.getRootNode();\n    let host = root.host;\n    if (host) {\n      if (StyleInfo.get(host)) {\n        return host;\n      } else {\n        return this._styleOwnerForNode(host);\n      }\n    }\n    return this._documentOwner;\n  }\n  _isRootOwner(node) {\n    return (node === this._documentOwner);\n  }\n  _applyStyleProperties(host, styleInfo) {\n    let is = StyleUtil.getIsExtends(host).is;\n    let cacheEntry = styleCache.fetch(is, styleInfo.styleProperties, styleInfo.ownStylePropertyNames);\n    let cachedScopeSelector = cacheEntry && cacheEntry.scopeSelector;\n    let cachedStyle = cacheEntry ? cacheEntry.styleElement : null;\n    let oldScopeSelector = styleInfo.scopeSelector;\n    // only generate new scope if cached style is not found\n    styleInfo.scopeSelector = cachedScopeSelector || this._generateScopeSelector(is);\n    let style = StyleProperties.applyElementStyle(host, styleInfo.styleProperties, styleInfo.scopeSelector, cachedStyle);\n    if (!nativeShadow) {\n      StyleProperties.applyElementScopeSelector(host, styleInfo.scopeSelector, oldScopeSelector);\n    }\n    if (!cacheEntry) {\n      styleCache.store(is, styleInfo.styleProperties, style, styleInfo.scopeSelector);\n    }\n    return style;\n  }\n  _updateProperties(host, styleInfo) {\n    let owner = this._styleOwnerForNode(host);\n    let ownerStyleInfo = StyleInfo.get(owner);\n    let ownerProperties = ownerStyleInfo.styleProperties;\n    let props = Object.create(ownerProperties || null);\n    let hostAndRootProps = StyleProperties.hostAndRootPropertiesForScope(host, styleInfo.styleRules);\n    let propertyData = StyleProperties.propertyDataFromStyles(ownerStyleInfo.styleRules, host);\n    let propertiesMatchingHost = propertyData.properties\n    Object.assign(\n      props,\n      hostAndRootProps.hostProps,\n      propertiesMatchingHost,\n      hostAndRootProps.rootProps\n    );\n    this._mixinOverrideStyles(props, styleInfo.overrideStyleProperties);\n    StyleProperties.reify(props);\n    styleInfo.styleProperties = props;\n  }\n  _mixinOverrideStyles(props, overrides) {\n    for (let p in overrides) {\n      let v = overrides[p];\n      // skip override props if they are not truthy or 0\n      // in order to fall back to inherited values\n      if (v || v === 0) {\n        props[p] = v;\n      }\n    }\n  }\n  /**\n   * Update styles of the whole document\n   *\n   * @param {Object=} properties\n   */\n  styleDocument(properties) {\n    this.styleSubtree(this._documentOwner, properties);\n  }\n  /**\n   * Update styles of a subtree\n   *\n   * @param {!HTMLElement} host\n   * @param {Object=} properties\n   */\n  styleSubtree(host, properties) {\n    let root = host.shadowRoot;\n    if (root || this._isRootOwner(host)) {\n      this.styleElement(host, properties);\n    }\n    // process the shadowdom children of `host`\n    let shadowChildren = root && (root.children || root.childNodes);\n    if (shadowChildren) {\n      for (let i = 0; i < shadowChildren.length; i++) {\n        let c = /** @type {!HTMLElement} */(shadowChildren[i]);\n        this.styleSubtree(c);\n      }\n    } else {\n      // process the lightdom children of `host`\n      let children = host.children || host.childNodes;\n      if (children) {\n        for (let i = 0; i < children.length; i++) {\n          let c = /** @type {!HTMLElement} */(children[i]);\n          this.styleSubtree(c);\n        }\n      }\n    }\n  }\n  /* Custom Style operations */\n  _revalidateCustomStyleApplyShim(customStyles) {\n    for (let i = 0; i < customStyles.length; i++) {\n      let c = customStyles[i];\n      let s = this._customStyleInterface['getStyleForCustomStyle'](c);\n      if (s) {\n        this._revalidateApplyShim(s);\n      }\n    }\n  }\n  _applyCustomStyles(customStyles) {\n    for (let i = 0; i < customStyles.length; i++) {\n      let c = customStyles[i];\n      let s = this._customStyleInterface['getStyleForCustomStyle'](c);\n      if (s) {\n        StyleProperties.applyCustomStyle(s, this._documentOwnerStyleInfo.styleProperties);\n      }\n    }\n  }\n  transformCustomStyleForDocument(style) {\n    let ast = StyleUtil.rulesForStyle(style);\n    StyleUtil.forEachRule(ast, (rule) => {\n      if (nativeShadow) {\n        StyleTransformer.normalizeRootSelector(rule);\n      } else {\n        StyleTransformer.documentRule(rule);\n      }\n      if (nativeCssVariables) {\n        this._ensure();\n        this._applyShim['transformRule'](rule);\n      }\n    });\n    if (nativeCssVariables) {\n      style.textContent = StyleUtil.toCssText(ast);\n    } else {\n      this._documentOwnerStyleInfo.styleRules.rules.push(ast);\n    }\n  }\n  _revalidateApplyShim(style) {\n    if (nativeCssVariables) {\n      let ast = StyleUtil.rulesForStyle(style);\n      this._ensure();\n      this._applyShim['transformRules'](ast);\n      style.textContent = StyleUtil.toCssText(ast);\n    }\n  }\n  getComputedStyleValue(element, property) {\n    let value;\n    if (!nativeCssVariables) {\n      // element is either a style host, or an ancestor of a style host\n      let styleInfo = StyleInfo.get(element) || StyleInfo.get(this._styleOwnerForNode(element));\n      value = styleInfo.styleProperties[property];\n    }\n    // fall back to the property value from the computed styling\n    value = value || window.getComputedStyle(element).getPropertyValue(property);\n    // trim whitespace that can come after the `:` in css\n    // example: padding: 2px -> \" 2px\"\n    return value ? value.trim() : '';\n  }\n  // given an element and a classString, replaces\n  // the element's class with the provided classString and adds\n  // any necessary ShadyCSS static and property based scoping selectors\n  setElementClass(element, classString) {\n    let root = element.getRootNode();\n    let classes = classString ? classString.split(/\\s/) : [];\n    let scopeName = root.host && root.host.localName;\n    // If no scope, try to discover scope name from existing class.\n    // This can occur if, for example, a template stamped element that\n    // has been scoped is manipulated when not in a root.\n    if (!scopeName) {\n      var classAttr = element.getAttribute('class');\n      if (classAttr) {\n        let k$ = classAttr.split(/\\s/);\n        for (let i=0; i < k$.length; i++) {\n          if (k$[i] === StyleTransformer.SCOPE_NAME) {\n            scopeName = k$[i+1];\n            break;\n          }\n        }\n      }\n    }\n    if (scopeName) {\n      classes.push(StyleTransformer.SCOPE_NAME, scopeName);\n    }\n    if (!nativeCssVariables) {\n      let styleInfo = StyleInfo.get(element);\n      if (styleInfo && styleInfo.scopeSelector) {\n        classes.push(StyleProperties.XSCOPE_NAME, styleInfo.scopeSelector);\n      }\n    }\n    StyleUtil.setElementClassRaw(element, classes.join(' '));\n  }\n  _styleInfoForNode(node) {\n    return StyleInfo.get(node);\n  }\n}\n\n/* exports */\nScopingShim.prototype['flush'] = ScopingShim.prototype.flush;\nScopingShim.prototype['prepareTemplate'] = ScopingShim.prototype.prepareTemplate;\nScopingShim.prototype['styleElement'] = ScopingShim.prototype.styleElement;\nScopingShim.prototype['styleDocument'] = ScopingShim.prototype.styleDocument;\nScopingShim.prototype['styleSubtree'] = ScopingShim.prototype.styleSubtree;\nScopingShim.prototype['getComputedStyleValue'] = ScopingShim.prototype.getComputedStyleValue;\nScopingShim.prototype['setElementClass'] = ScopingShim.prototype.setElementClass;\nScopingShim.prototype['_styleInfoForNode'] = ScopingShim.prototype._styleInfoForNode;\nScopingShim.prototype['transformCustomStyleForDocument'] = ScopingShim.prototype.transformCustomStyleForDocument;\nScopingShim.prototype['getStyleAst'] = ScopingShim.prototype.getStyleAst;\nScopingShim.prototype['styleAstToString'] = ScopingShim.prototype.styleAstToString;\nScopingShim.prototype['flushCustomStyles'] = ScopingShim.prototype.flushCustomStyles;\nObject.defineProperties(ScopingShim.prototype, {\n  'nativeShadow': {\n    get() {\n      return nativeShadow;\n    }\n  },\n  'nativeCss': {\n    get() {\n      return nativeCssVariables;\n    }\n  }\n});","/**\n@license\nCopyright (c) 2017 The Polymer Project Authors. All rights reserved.\nThis code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt\nThe complete set of authors may be found at http://polymer.github.io/AUTHORS.txt\nThe complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt\nCode distributed by Google as part of the polymer project is also\nsubject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt\n*/\n\n'use strict';\n\nimport documentWait from './document-wait'\n\n/**\n * @typedef {HTMLStyleElement | {getStyle: function():HTMLStyleElement}}\n */\nexport let CustomStyleProvider;\n\nconst SEEN_MARKER = '__seenByShadyCSS';\nconst CACHED_STYLE = '__shadyCSSCachedStyle';\n\n/** @type {?function(!HTMLStyleElement)} */\nlet transformFn = null;\n\n/** @type {?function()} */\nlet validateFn = null;\n\n/**\nThis interface is provided to add document-level <style> elements to ShadyCSS for processing.\nThese styles must be processed by ShadyCSS to simulate ShadowRoot upper-bound encapsulation from outside styles\nIn addition, these styles may also need to be processed for @apply rules and CSS Custom Properties\n\nTo add document-level styles to ShadyCSS, one can call `ShadyCSS.addDocumentStyle(styleElement)` or `ShadyCSS.addDocumentStyle({getStyle: () => styleElement})`\n\nIn addition, if the process used to discover document-level styles can be synchronously flushed, one should set `ShadyCSS.documentStyleFlush`.\nThis function will be called when calculating styles.\n\nAn example usage of the document-level styling api can be found in `examples/document-style-lib.js`\n\n@unrestricted\n*/\nexport default class CustomStyleInterface {\n  constructor() {\n    /** @type {!Array<!CustomStyleProvider>} */\n    this['customStyles'] = [];\n    this['enqueued'] = false;\n  }\n  /**\n   * Queue a validation for new custom styles to batch style recalculations\n   */\n  enqueueDocumentValidation() {\n    if (this['enqueued'] || !validateFn) {\n      return;\n    }\n    this['enqueued'] = true;\n    documentWait(validateFn);\n  }\n  /**\n   * @param {!HTMLStyleElement} style\n   */\n  addCustomStyle(style) {\n    if (!style[SEEN_MARKER]) {\n      style[SEEN_MARKER] = true;\n      this['customStyles'].push(style);\n      this.enqueueDocumentValidation();\n    }\n  }\n  /**\n   * @param {!CustomStyleProvider} customStyle\n   * @return {HTMLStyleElement}\n   */\n  getStyleForCustomStyle(customStyle) {\n    if (customStyle[CACHED_STYLE]) {\n      return customStyle[CACHED_STYLE];\n    }\n    let style;\n    if (customStyle['getStyle']) {\n      style = customStyle['getStyle']();\n    } else {\n      style = customStyle;\n    }\n    return style;\n  }\n  /**\n   * @return {!Array<!CustomStyleProvider>}\n   */\n  processStyles() {\n    let cs = this['customStyles'];\n    for (let i = 0; i < cs.length; i++) {\n      let customStyle = cs[i];\n      if (customStyle[CACHED_STYLE]) {\n        continue;\n      }\n      let style = this.getStyleForCustomStyle(customStyle);\n      if (style) {\n        // HTMLImports polyfill may have cloned the style into the main document,\n        // which is referenced with __appliedElement.\n        // Also, we must copy over the attributes.\n        let appliedStyle = /** @type {HTMLStyleElement} */(style['__appliedElement']);\n        if (appliedStyle) {\n          for (let i = 0; i < style.attributes.length; i++) {\n            let attr = style.attributes[i];\n            appliedStyle.setAttribute(attr.name, attr.value);\n          }\n        }\n        let styleToTransform = appliedStyle || style;\n        if (transformFn) {\n          transformFn(styleToTransform);\n        }\n        customStyle[CACHED_STYLE] = styleToTransform;\n      }\n    }\n    return cs;\n  }\n}\n\nCustomStyleInterface.prototype['addCustomStyle'] = CustomStyleInterface.prototype.addCustomStyle;\nCustomStyleInterface.prototype['getStyleForCustomStyle'] = CustomStyleInterface.prototype.getStyleForCustomStyle;\nCustomStyleInterface.prototype['processStyles'] = CustomStyleInterface.prototype.processStyles;\n\nObject.defineProperties(CustomStyleInterface.prototype, {\n  'transformCallback': {\n    /** @return {?function(!HTMLStyleElement)} */\n    get() {\n      return transformFn;\n    },\n    /** @param {?function(!HTMLStyleElement)} fn */\n    set(fn) {\n      transformFn = fn;\n    }\n  },\n  'validateCallback': {\n    /** @return {?function()} */\n    get() {\n      return validateFn;\n    },\n    /**\n     * @param {?function()} fn\n     * @this {CustomStyleInterface}\n     */\n    set(fn) {\n      let needsEnqueue = false;\n      if (!validateFn) {\n        needsEnqueue = true;\n      }\n      validateFn = fn;\n      if (needsEnqueue) {\n        this.enqueueDocumentValidation();\n      }\n    },\n  }\n})\n\n/** @typedef {{\n * customStyles: !Array<!CustomStyleProvider>,\n * addCustomStyle: function(!CustomStyleProvider),\n * getStyleForCustomStyle: function(!CustomStyleProvider): HTMLStyleElement,\n * findStyles: function(),\n * transformCallback: ?function(!HTMLStyleElement),\n * validateCallback: ?function()\n * }}\n */\nexport let CustomStyleInterfaceInterface;","/**\n@license\nCopyright (c) 2017 The Polymer Project Authors. All rights reserved.\nThis code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt\nThe complete set of authors may be found at http://polymer.github.io/AUTHORS.txt\nThe complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt\nCode distributed by Google as part of the polymer project is also\nsubject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt\n*/\n\n'use strict';\n\nimport {nativeShadow} from './style-settings'\nimport StyleTransformer from './style-transformer'\nimport {getIsExtends} from './style-util'\n\nexport let flush = function() {};\n\n/**\n * @param {HTMLElement} element\n * @return {!Array<string>}\n */\nfunction getClasses(element) {\n  let classes = [];\n  if (element.classList) {\n    classes = Array.from(element.classList);\n  } else if (element instanceof window['SVGElement'] && element.hasAttribute('class')) {\n    classes = element.getAttribute('class').split(/\\s+/);\n  }\n  return classes;\n}\n\n/**\n * @param {HTMLElement} element\n * @return {string}\n */\nfunction getCurrentScope(element) {\n  let classes = getClasses(element);\n  let idx = classes.indexOf(StyleTransformer.SCOPE_NAME);\n  if (idx > -1) {\n    return classes[idx + 1];\n  }\n  return '';\n}\n\n/**\n * @param {Array<MutationRecord|null>|null} mxns\n */\nfunction handler(mxns) {\n  for (let x=0; x < mxns.length; x++) {\n    let mxn = mxns[x];\n    if (mxn.target === document.documentElement ||\n      mxn.target === document.head) {\n      continue;\n    }\n    for (let i=0; i < mxn.addedNodes.length; i++) {\n      let n = mxn.addedNodes[i];\n      if (n.nodeType !== Node.ELEMENT_NODE) {\n        continue;\n      }\n      n = /** @type {HTMLElement} */(n); // eslint-disable-line no-self-assign\n      let root = n.getRootNode();\n      let currentScope = getCurrentScope(n);\n      // node was scoped, but now is in document\n      if (currentScope && root === n.ownerDocument) {\n        StyleTransformer.dom(n, currentScope, true);\n      } else if (root.nodeType === Node.DOCUMENT_FRAGMENT_NODE) {\n        let newScope;\n        let host = /** @type {ShadowRoot} */(root).host;\n        // element may no longer be in a shadowroot\n        if (!host) {\n          continue;\n        }\n        newScope = getIsExtends(host).is;\n        if (currentScope === newScope) {\n          continue;\n        }\n        if (currentScope) {\n          StyleTransformer.dom(n, currentScope, true);\n        }\n        StyleTransformer.dom(n, newScope);\n      }\n    }\n  }\n}\n\nif (!nativeShadow) {\n  let observer = new MutationObserver(handler);\n  let start = (node) => {\n    observer.observe(node, {childList: true, subtree: true});\n  }\n  let nativeCustomElements = (window['customElements'] &&\n    !window['customElements']['polyfillWrapFlushCallback']);\n  // need to start immediately with native custom elements\n  // TODO(dfreedm): with polyfilled HTMLImports and native custom elements\n  // excessive mutations may be observed; this can be optimized via cooperation\n  // with the HTMLImports polyfill.\n  if (nativeCustomElements) {\n    start(document);\n  } else {\n    let delayedStart = () => {\n      start(document.body);\n    }\n    // use polyfill timing if it's available\n    if (window['HTMLImports']) {\n      window['HTMLImports']['whenReady'](delayedStart);\n    // otherwise push beyond native imports being ready\n    // which requires RAF + readystate interactive.\n    } else {\n      requestAnimationFrame(function() {\n        if (document.readyState === 'loading') {\n          let listener = function() {\n            delayedStart();\n            document.removeEventListener('readystatechange', listener);\n          }\n          document.addEventListener('readystatechange', listener);\n        } else {\n          delayedStart();\n        }\n      });\n    }\n  }\n\n  flush = function() {\n    handler(observer.takeRecords());\n  }\n}\n","/**\n@license\nCopyright (c) 2017 The Polymer Project Authors. All rights reserved.\nThis code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt\nThe complete set of authors may be found at http://polymer.github.io/AUTHORS.txt\nThe complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt\nCode distributed by Google as part of the polymer project is also\nsubject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt\n*/\n'use strict';\n\nexport default class StyleCache {\n  constructor(typeMax = 100) {\n    // map element name -> [{properties, styleElement, scopeSelector}]\n    this.cache = {};\n    this.typeMax = typeMax;\n  }\n\n  _validate(cacheEntry, properties, ownPropertyNames) {\n    for (let idx = 0; idx < ownPropertyNames.length; idx++) {\n      let pn = ownPropertyNames[idx];\n      if (cacheEntry.properties[pn] !== properties[pn]) {\n        return false;\n      }\n    }\n    return true;\n  }\n\n  store(tagname, properties, styleElement, scopeSelector) {\n    let list = this.cache[tagname] || [];\n    list.push({properties, styleElement, scopeSelector});\n    if (list.length > this.typeMax) {\n      list.shift();\n    }\n    this.cache[tagname] = list;\n  }\n\n  fetch(tagname, properties, ownPropertyNames) {\n    let list = this.cache[tagname];\n    if (!list) {\n      return;\n    }\n    // reverse list for most-recent lookups\n    for (let idx = list.length - 1; idx >= 0; idx--) {\n      let entry = list[idx];\n      if (this._validate(entry, properties, ownPropertyNames)) {\n        return entry;\n      }\n    }\n  }\n}\n","/**\n@license\nCopyright (c) 2017 The Polymer Project Authors. All rights reserved.\nThis code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt\nThe complete set of authors may be found at http://polymer.github.io/AUTHORS.txt\nThe complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt\nCode distributed by Google as part of the polymer project is also\nsubject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt\n*/\n\n'use strict';\n\nimport {removeCustomPropAssignment, StyleNode} from './css-parse' // eslint-disable-line no-unused-vars\nimport {nativeShadow} from './style-settings'\nimport StyleTransformer from './style-transformer'\nimport * as StyleUtil from './style-util'\nimport * as RX from './common-regex'\nimport StyleInfo from './style-info'\n\n// TODO: dedupe with shady\n/**\n * @const {function(string):boolean}\n */\nconst matchesSelector = ((p) => p.matches || p.matchesSelector ||\n  p.mozMatchesSelector || p.msMatchesSelector ||\np.oMatchesSelector || p.webkitMatchesSelector)(window.Element.prototype);\n\nconst IS_IE = navigator.userAgent.match('Trident');\n\nconst XSCOPE_NAME = 'x-scope';\n\nclass StyleProperties {\n  get XSCOPE_NAME() {\n    return XSCOPE_NAME;\n  }\n/**\n * decorates styles with rule info and returns an array of used style property names\n *\n * @param {StyleNode} rules\n * @return {Array<string>}\n */\n  decorateStyles(rules) {\n    let self = this, props = {}, keyframes = [], ruleIndex = 0;\n    StyleUtil.forEachRule(rules, function(rule) {\n      self.decorateRule(rule);\n      // mark in-order position of ast rule in styles block, used for cache key\n      rule.index = ruleIndex++;\n      self.collectPropertiesInCssText(rule.propertyInfo.cssText, props);\n    }, function onKeyframesRule(rule) {\n      keyframes.push(rule);\n    });\n    // Cache all found keyframes rules for later reference:\n    rules._keyframes = keyframes;\n    // return this list of property names *consumes* in these styles.\n    let names = [];\n    for (let i in props) {\n      names.push(i);\n    }\n    return names;\n  }\n\n  // decorate a single rule with property info\n  decorateRule(rule) {\n    if (rule.propertyInfo) {\n      return rule.propertyInfo;\n    }\n    let info = {}, properties = {};\n    let hasProperties = this.collectProperties(rule, properties);\n    if (hasProperties) {\n      info.properties = properties;\n      // TODO(sorvell): workaround parser seeing mixins as additional rules\n      rule['rules'] = null;\n    }\n    info.cssText = this.collectCssText(rule);\n    rule.propertyInfo = info;\n    return info;\n  }\n\n  // collects the custom properties from a rule's cssText\n  collectProperties(rule, properties) {\n    let info = rule.propertyInfo;\n    if (info) {\n      if (info.properties) {\n        Object.assign(properties, info.properties);\n        return true;\n      }\n    } else {\n      let m, rx = RX.VAR_ASSIGN;\n      let cssText = rule['parsedCssText'];\n      let value;\n      let any;\n      while ((m = rx.exec(cssText))) {\n        // note: group 2 is var, 3 is mixin\n        value = (m[2] || m[3]).trim();\n        // value of 'inherit' or 'unset' is equivalent to not setting the property here\n        if (value !== 'inherit' || value !== 'unset') {\n          properties[m[1].trim()] = value;\n        }\n        any = true;\n      }\n      return any;\n    }\n\n  }\n\n  // returns cssText of properties that consume variables/mixins\n  collectCssText(rule) {\n    return this.collectConsumingCssText(rule['parsedCssText']);\n  }\n\n  // NOTE: we support consumption inside mixin assignment\n  // but not production, so strip out {...}\n  collectConsumingCssText(cssText) {\n    return cssText.replace(RX.BRACKETED, '')\n      .replace(RX.VAR_ASSIGN, '');\n  }\n\n  collectPropertiesInCssText(cssText, props) {\n    let m;\n    while ((m = RX.VAR_CONSUMED.exec(cssText))) {\n      let name = m[1];\n      // This regex catches all variable names, and following non-whitespace char\n      // If next char is not ':', then variable is a consumer\n      if (m[2] !== ':') {\n        props[name] = true;\n      }\n    }\n  }\n\n  // turns custom properties into realized values.\n  reify(props) {\n    // big perf optimization here: reify only *own* properties\n    // since this object has __proto__ of the element's scope properties\n    let names = Object.getOwnPropertyNames(props);\n    for (let i=0, n; i < names.length; i++) {\n      n = names[i];\n      props[n] = this.valueForProperty(props[n], props);\n    }\n  }\n\n  // given a property value, returns the reified value\n  // a property value may be:\n  // (1) a literal value like: red or 5px;\n  // (2) a variable value like: var(--a), var(--a, red), or var(--a, --b) or\n  // var(--a, var(--b));\n  // (3) a literal mixin value like { properties }. Each of these properties\n  // can have values that are: (a) literal, (b) variables, (c) @apply mixins.\n  valueForProperty(property, props) {\n    // case (1) default\n    // case (3) defines a mixin and we have to reify the internals\n    if (property) {\n      if (property.indexOf(';') >=0) {\n        property = this.valueForProperties(property, props);\n      } else {\n        // case (2) variable\n        let self = this;\n        let fn = function(prefix, value, fallback, suffix) {\n          if (!value) {\n            return prefix + suffix;\n          }\n          let propertyValue = self.valueForProperty(props[value], props);\n          // if value is \"initial\", then the variable should be treated as unset\n          if (!propertyValue || propertyValue === 'initial') {\n            // fallback may be --a or var(--a) or literal\n            propertyValue = self.valueForProperty(props[fallback] || fallback, props) ||\n            fallback;\n          } else if (propertyValue === 'apply-shim-inherit') {\n            // CSS build will replace `inherit` with `apply-shim-inherit`\n            // for use with native css variables.\n            // Since we have full control, we can use `inherit` directly.\n            propertyValue = 'inherit';\n          }\n          return prefix + (propertyValue || '') + suffix;\n        };\n        property = StyleUtil.processVariableAndFallback(property, fn);\n      }\n    }\n    return property && property.trim() || '';\n  }\n\n  // note: we do not yet support mixin within mixin\n  valueForProperties(property, props) {\n    let parts = property.split(';');\n    for (let i=0, p, m; i<parts.length; i++) {\n      if ((p = parts[i])) {\n        RX.MIXIN_MATCH.lastIndex = 0;\n        m = RX.MIXIN_MATCH.exec(p);\n        if (m) {\n          p = this.valueForProperty(props[m[1]], props);\n        } else {\n          let colon = p.indexOf(':');\n          if (colon !== -1) {\n            let pp = p.substring(colon);\n            pp = pp.trim();\n            pp = this.valueForProperty(pp, props) || pp;\n            p = p.substring(0, colon) + pp;\n          }\n        }\n        parts[i] = (p && p.lastIndexOf(';') === p.length - 1) ?\n          // strip trailing ;\n          p.slice(0, -1) :\n          p || '';\n      }\n    }\n    return parts.join(';');\n  }\n\n  applyProperties(rule, props) {\n    let output = '';\n    // dynamically added sheets may not be decorated so ensure they are.\n    if (!rule.propertyInfo) {\n      this.decorateRule(rule);\n    }\n    if (rule.propertyInfo.cssText) {\n      output = this.valueForProperties(rule.propertyInfo.cssText, props);\n    }\n    rule['cssText'] = output;\n  }\n\n  // Apply keyframe transformations to the cssText of a given rule. The\n  // keyframeTransforms object is a map of keyframe names to transformer\n  // functions which take in cssText and spit out transformed cssText.\n  applyKeyframeTransforms(rule, keyframeTransforms) {\n    let input = rule['cssText'];\n    let output = rule['cssText'];\n    if (rule.hasAnimations == null) {\n      // Cache whether or not the rule has any animations to begin with:\n      rule.hasAnimations = RX.ANIMATION_MATCH.test(input);\n    }\n    // If there are no animations referenced, we can skip transforms:\n    if (rule.hasAnimations) {\n      let transform;\n      // If we haven't transformed this rule before, we iterate over all\n      // transforms:\n      if (rule.keyframeNamesToTransform == null) {\n        rule.keyframeNamesToTransform = [];\n        for (let keyframe in keyframeTransforms) {\n          transform = keyframeTransforms[keyframe];\n          output = transform(input);\n          // If the transform actually changed the CSS text, we cache the\n          // transform name for future use:\n          if (input !== output) {\n            input = output;\n            rule.keyframeNamesToTransform.push(keyframe);\n          }\n        }\n      } else {\n        // If we already have a list of keyframe names that apply to this\n        // rule, we apply only those keyframe name transforms:\n        for (let i = 0; i < rule.keyframeNamesToTransform.length; ++i) {\n          transform = keyframeTransforms[rule.keyframeNamesToTransform[i]];\n          input = transform(input);\n        }\n        output = input;\n      }\n    }\n    rule['cssText'] = output;\n  }\n\n  // Test if the rules in these styles matches the given `element` and if so,\n  // collect any custom properties into `props`.\n  /**\n   * @param {StyleNode} rules\n   * @param {Element} element\n   */\n  propertyDataFromStyles(rules, element) {\n    let props = {}, self = this;\n    // generates a unique key for these matches\n    let o = [];\n    // note: active rules excludes non-matching @media rules\n    StyleUtil.forEachRule(rules, function(rule) {\n      // TODO(sorvell): we could trim the set of rules at declaration\n      // time to only include ones that have properties\n      if (!rule.propertyInfo) {\n        self.decorateRule(rule);\n      }\n      // match element against transformedSelector: selector may contain\n      // unwanted uniquification and parsedSelector does not directly match\n      // for :host selectors.\n      let selectorToMatch = rule.transformedSelector || rule['parsedSelector'];\n      if (element && rule.propertyInfo.properties && selectorToMatch) {\n        if (matchesSelector.call(element, selectorToMatch)) {\n          self.collectProperties(rule, props);\n          // produce numeric key for these matches for lookup\n          addToBitMask(rule.index, o);\n        }\n      }\n    }, null, true);\n    return {properties: props, key: o};\n  }\n\n  /**\n   * @param {Element} scope\n   * @param {StyleNode} rule\n   * @param {string|undefined} cssBuild\n   * @param {function(Object)} callback\n   */\n  whenHostOrRootRule(scope, rule, cssBuild, callback) {\n    if (!rule.propertyInfo) {\n      this.decorateRule(rule);\n    }\n    if (!rule.propertyInfo.properties) {\n      return;\n    }\n    let {is, typeExtension} = StyleUtil.getIsExtends(scope);\n    let hostScope = is ?\n      StyleTransformer._calcHostScope(is, typeExtension) :\n      'html';\n    let parsedSelector = rule['parsedSelector'];\n    let isRoot = (parsedSelector === ':host > *' || parsedSelector === 'html');\n    let isHost = parsedSelector.indexOf(':host') === 0 && !isRoot;\n    // build info is either in scope (when scope is an element) or in the style\n    // when scope is the default scope; note: this allows default scope to have\n    // mixed mode built and unbuilt styles.\n    if (cssBuild === 'shady') {\n      // :root -> x-foo > *.x-foo for elements and html for custom-style\n      isRoot = parsedSelector === (hostScope + ' > *.' + hostScope) || parsedSelector.indexOf('html') !== -1;\n      // :host -> x-foo for elements, but sub-rules have .x-foo in them\n      isHost = !isRoot && parsedSelector.indexOf(hostScope) === 0;\n    }\n    if (cssBuild === 'shadow') {\n      isRoot = parsedSelector === ':host > *' || parsedSelector === 'html';\n      isHost = isHost && !isRoot;\n    }\n    if (!isRoot && !isHost) {\n      return;\n    }\n    let selectorToMatch = hostScope;\n    if (isHost) {\n      // need to transform :host under ShadowDOM because `:host` does not work with `matches`\n      if (nativeShadow && !rule.transformedSelector) {\n        // transform :host into a matchable selector\n        rule.transformedSelector =\n        StyleTransformer._transformRuleCss(\n          rule,\n          StyleTransformer._transformComplexSelector,\n          StyleTransformer._calcElementScope(is),\n          hostScope\n        );\n      }\n      selectorToMatch = rule.transformedSelector || hostScope;\n    }\n    callback({\n      selector: selectorToMatch,\n      isHost: isHost,\n      isRoot: isRoot\n    });\n  }\n/**\n * @param {Element} scope\n * @param {StyleNode} rules\n * @return {Object}\n */\n  hostAndRootPropertiesForScope(scope, rules) {\n    let hostProps = {}, rootProps = {}, self = this;\n    // note: active rules excludes non-matching @media rules\n    let cssBuild = rules && rules['__cssBuild'];\n    StyleUtil.forEachRule(rules, function(rule) {\n      // if scope is StyleDefaults, use _element for matchesSelector\n      self.whenHostOrRootRule(scope, rule, cssBuild, function(info) {\n        let element = scope._element || scope;\n        if (matchesSelector.call(element, info.selector)) {\n          if (info.isHost) {\n            self.collectProperties(rule, hostProps);\n          } else {\n            self.collectProperties(rule, rootProps);\n          }\n        }\n      });\n    }, null, true);\n    return {rootProps: rootProps, hostProps: hostProps};\n  }\n\n  /**\n   * @param {Element} element\n   * @param {Object} properties\n   * @param {string} scopeSelector\n   */\n  transformStyles(element, properties, scopeSelector) {\n    let self = this;\n    let {is, typeExtension} = StyleUtil.getIsExtends(element);\n    let hostSelector = StyleTransformer\n      ._calcHostScope(is, typeExtension);\n    let rxHostSelector = element.extends ?\n      '\\\\' + hostSelector.slice(0, -1) + '\\\\]' :\n      hostSelector;\n    let hostRx = new RegExp(RX.HOST_PREFIX + rxHostSelector +\n      RX.HOST_SUFFIX);\n    let rules = StyleInfo.get(element).styleRules;\n    let keyframeTransforms =\n      this._elementKeyframeTransforms(element, rules, scopeSelector);\n    return StyleTransformer.elementStyles(element, rules, function(rule) {\n      self.applyProperties(rule, properties);\n      if (!nativeShadow &&\n          !StyleUtil.isKeyframesSelector(rule) &&\n          rule['cssText']) {\n        // NOTE: keyframe transforms only scope munge animation names, so it\n        // is not necessary to apply them in ShadowDOM.\n        self.applyKeyframeTransforms(rule, keyframeTransforms);\n        self._scopeSelector(rule, hostRx, hostSelector, scopeSelector);\n      }\n    });\n  }\n\n  /**\n   * @param {Element} element\n   * @param {StyleNode} rules\n   * @param {string} scopeSelector\n   * @return {Object}\n   */\n  _elementKeyframeTransforms(element, rules, scopeSelector) {\n    let keyframesRules = rules._keyframes;\n    let keyframeTransforms = {};\n    if (!nativeShadow && keyframesRules) {\n      // For non-ShadowDOM, we transform all known keyframes rules in\n      // advance for the current scope. This allows us to catch keyframes\n      // rules that appear anywhere in the stylesheet:\n      for (let i = 0, keyframesRule = keyframesRules[i];\n           i < keyframesRules.length;\n           keyframesRule = keyframesRules[++i]) {\n        this._scopeKeyframes(keyframesRule, scopeSelector);\n        keyframeTransforms[keyframesRule['keyframesName']] =\n            this._keyframesRuleTransformer(keyframesRule);\n      }\n    }\n    return keyframeTransforms;\n  }\n\n  // Generate a factory for transforming a chunk of CSS text to handle a\n  // particular scoped keyframes rule.\n  /**\n   * @param {StyleNode} keyframesRule\n   * @return {function(string):string}\n   */\n  _keyframesRuleTransformer(keyframesRule) {\n    return function(cssText) {\n      return cssText.replace(\n          keyframesRule.keyframesNameRx,\n          keyframesRule.transformedKeyframesName);\n    };\n  }\n\n/**\n * Transforms `@keyframes` names to be unique for the current host.\n * Example: @keyframes foo-anim -> @keyframes foo-anim-x-foo-0\n *\n * @param {StyleNode} rule\n * @param {string} scopeId\n */\n  _scopeKeyframes(rule, scopeId) {\n    rule.keyframesNameRx = new RegExp(rule['keyframesName'], 'g');\n    rule.transformedKeyframesName = rule['keyframesName'] + '-' + scopeId;\n    rule.transformedSelector = rule.transformedSelector || rule['selector'];\n    rule['selector'] = rule.transformedSelector.replace(\n        rule['keyframesName'], rule.transformedKeyframesName);\n  }\n\n  // Strategy: x scope shim a selector e.g. to scope `.x-foo-42` (via classes):\n  // non-host selector: .a.x-foo -> .x-foo-42 .a.x-foo\n  // host selector: x-foo.wide -> .x-foo-42.wide\n  // note: we use only the scope class (.x-foo-42) and not the hostSelector\n  // (x-foo) to scope :host rules; this helps make property host rules\n  // have low specificity. They are overrideable by class selectors but,\n  // unfortunately, not by type selectors (e.g. overriding via\n  // `.special` is ok, but not by `x-foo`).\n  /**\n   * @param {StyleNode} rule\n   * @param {RegExp} hostRx\n   * @param {string} hostSelector\n   * @param {string} scopeId\n   */\n  _scopeSelector(rule, hostRx, hostSelector, scopeId) {\n    rule.transformedSelector = rule.transformedSelector || rule['selector'];\n    let selector = rule.transformedSelector;\n    let scope = '.' + scopeId;\n    let parts = selector.split(',');\n    for (let i=0, l=parts.length, p; (i<l) && (p=parts[i]); i++) {\n      parts[i] = p.match(hostRx) ?\n        p.replace(hostSelector, scope) :\n        scope + ' ' + p;\n    }\n    rule['selector'] = parts.join(',');\n  }\n\n  /**\n   * @param {Element} element\n   * @param {string} selector\n   * @param {string} old\n   */\n  applyElementScopeSelector(element, selector, old) {\n    let c = element.getAttribute('class') || '';\n    let v = c;\n    if (old) {\n      v = c.replace(\n        new RegExp('\\\\s*' + XSCOPE_NAME + '\\\\s*' + old + '\\\\s*', 'g'), ' ');\n    }\n    v += (v ? ' ' : '') + XSCOPE_NAME + ' ' + selector;\n    if (c !== v) {\n      StyleUtil.setElementClassRaw(element, v);\n    }\n  }\n\n  /**\n   * @param {HTMLElement} element\n   * @param {Object} properties\n   * @param {string} selector\n   * @param {HTMLStyleElement} style\n   * @return {HTMLStyleElement}\n   */\n  applyElementStyle(element, properties, selector, style) {\n    // calculate cssText to apply\n    let cssText = style ? style.textContent || '' :\n      this.transformStyles(element, properties, selector);\n    // if shady and we have a cached style that is not style, decrement\n    let styleInfo = StyleInfo.get(element);\n    let s = styleInfo.customStyle;\n    if (s && !nativeShadow && (s !== style)) {\n      s['_useCount']--;\n      if (s['_useCount'] <= 0 && s.parentNode) {\n        s.parentNode.removeChild(s);\n      }\n    }\n    // apply styling always under native or if we generated style\n    // or the cached style is not in document(!)\n    if (nativeShadow) {\n      // update existing style only under native\n      if (styleInfo.customStyle) {\n        styleInfo.customStyle.textContent = cssText;\n        style = styleInfo.customStyle;\n      // otherwise, if we have css to apply, do so\n      } else if (cssText) {\n        // apply css after the scope style of the element to help with\n        // style precedence rules.\n        style = StyleUtil.applyCss(cssText, selector, element.shadowRoot,\n          styleInfo.placeholder);\n      }\n    } else {\n      // shady and no cache hit\n      if (!style) {\n        // apply css after the scope style of the element to help with\n        // style precedence rules.\n        if (cssText) {\n          style = StyleUtil.applyCss(cssText, selector, null,\n            styleInfo.placeholder);\n        }\n      // shady and cache hit but not in document\n      } else if (!style.parentNode) {\n        if (IS_IE && cssText.indexOf('@media') > -1) {\n            // @media rules may be stale in IE 10 and 11\n            // refresh the text content of the style to revalidate them.\n          style.textContent = cssText;\n        }\n        StyleUtil.applyStyle(style, null, styleInfo.placeholder);\n      }\n    }\n    // ensure this style is our custom style and increment its use count.\n    if (style) {\n      style['_useCount'] = style['_useCount'] || 0;\n      // increment use count if we changed styles\n      if (styleInfo.customStyle != style) {\n        style['_useCount']++;\n      }\n      styleInfo.customStyle = style;\n    }\n    return style;\n  }\n\n  /**\n   * @param {Element} style\n   * @param {Object} properties\n   */\n  applyCustomStyle(style, properties) {\n    let rules = StyleUtil.rulesForStyle(/** @type {HTMLStyleElement} */(style));\n    let self = this;\n    style.textContent = StyleUtil.toCssText(rules, function(/** StyleNode */rule) {\n      let css = rule['cssText'] = rule['parsedCssText'];\n      if (rule.propertyInfo && rule.propertyInfo.cssText) {\n        // remove property assignments\n        // so next function isn't confused\n        // NOTE: we have 3 categories of css:\n        // (1) normal properties,\n        // (2) custom property assignments (--foo: red;),\n        // (3) custom property usage: border: var(--foo); @apply(--foo);\n        // In elements, 1 and 3 are separated for efficiency; here they\n        // are not and this makes this case unique.\n        css = removeCustomPropAssignment(/** @type {string} */(css));\n        // replace with reified properties, scenario is same as mixin\n        rule['cssText'] = self.valueForProperties(css, properties);\n      }\n    });\n  }\n}\n\n/**\n * @param {number} n\n * @param {Array<number>} bits\n */\nfunction addToBitMask(n, bits) {\n  let o = parseInt(n / 32, 10);\n  let v = 1 << (n % 32);\n  bits[o] = (bits[o] || 0) | v;\n}\n\nexport default new StyleProperties();","/**\n@license\nCopyright (c) 2017 The Polymer Project Authors. All rights reserved.\nThis code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt\nThe complete set of authors may be found at http://polymer.github.io/AUTHORS.txt\nThe complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt\nCode distributed by Google as part of the polymer project is also\nsubject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt\n*/\n\n'use strict';\n\nimport {StyleNode} from './css-parse' // eslint-disable-line no-unused-vars\n\n/** @const {string} */\nconst infoKey = '__styleInfo';\n\nexport default class StyleInfo {\n  /**\n   * @param {Element} node\n   * @return {StyleInfo}\n   */\n  static get(node) {\n    if (node) {\n      return node[infoKey];\n    } else {\n      return null;\n    }\n  }\n  /**\n   * @param {!Element} node\n   * @param {StyleInfo} styleInfo\n   * @return {StyleInfo}\n   */\n  static set(node, styleInfo) {\n    node[infoKey] = styleInfo;\n    return styleInfo;\n  }\n  /**\n   * @param {StyleNode} ast\n   * @param {Node=} placeholder\n   * @param {Array<string>=} ownStylePropertyNames\n   * @param {string=} elementName\n   * @param {string=} typeExtension\n   * @param {string=} cssBuild\n   */\n  constructor(ast, placeholder, ownStylePropertyNames, elementName, typeExtension, cssBuild) {\n    /** @type {StyleNode} */\n    this.styleRules = ast || null;\n    /** @type {Node} */\n    this.placeholder = placeholder || null;\n    /** @type {!Array<string>} */\n    this.ownStylePropertyNames = ownStylePropertyNames || [];\n    /** @type {Array<Object>} */\n    this.overrideStyleProperties = null;\n    /** @type {string} */\n    this.elementName = elementName || '';\n    /** @type {string} */\n    this.cssBuild = cssBuild || '';\n    /** @type {string} */\n    this.typeExtension = typeExtension || '';\n    /** @type {Object<string, string>} */\n    this.styleProperties = null;\n    /** @type {?string} */\n    this.scopeSelector = null;\n    /** @type {HTMLStyleElement} */\n    this.customStyle = null;\n  }\n  _getStyleRules() {\n    return this.styleRules;\n  }\n}\n\nStyleInfo.prototype['_getStyleRules'] = StyleInfo.prototype._getStyleRules;","/**\n@license\nCopyright (c) 2017 The Polymer Project Authors. All rights reserved.\nThis code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt\nThe complete set of authors may be found at http://polymer.github.io/AUTHORS.txt\nThe complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt\nCode distributed by Google as part of the polymer project is also\nsubject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt\n*/\n\n'use strict';\n\nimport {StyleNode} from './css-parse' // eslint-disable-line no-unused-vars\nimport * as StyleUtil from './style-util'\nimport {nativeShadow} from './style-settings'\n\n/* Transforms ShadowDOM styling into ShadyDOM styling\n\n* scoping:\n\n  * elements in scope get scoping selector class=\"x-foo-scope\"\n  * selectors re-written as follows:\n\n    div button -> div.x-foo-scope button.x-foo-scope\n\n* :host -> scopeName\n\n* :host(...) -> scopeName...\n\n* ::slotted(...) -> scopeName > ...\n\n* ...:dir(ltr|rtl) -> [dir=\"ltr|rtl\"] ..., ...[dir=\"ltr|rtl\"]\n\n* :host(:dir[rtl]) -> scopeName:dir(rtl) -> [dir=\"rtl\"] scopeName, scopeName[dir=\"rtl\"]\n\n*/\nconst SCOPE_NAME = 'style-scope';\n\nclass StyleTransformer {\n  get SCOPE_NAME() {\n    return SCOPE_NAME;\n  }\n  // Given a node and scope name, add a scoping class to each node\n  // in the tree. This facilitates transforming css into scoped rules.\n  dom(node, scope, shouldRemoveScope) {\n    // one time optimization to skip scoping...\n    if (node['__styleScoped']) {\n      node['__styleScoped'] = null;\n    } else {\n      this._transformDom(node, scope || '', shouldRemoveScope);\n    }\n  }\n\n  _transformDom(node, selector, shouldRemoveScope) {\n    if (node.nodeType === Node.ELEMENT_NODE) {\n      this.element(node, selector, shouldRemoveScope);\n    }\n    let c$ = (node.localName === 'template') ?\n      (node.content || node._content).childNodes :\n      node.children || node.childNodes;\n    if (c$) {\n      for (let i=0; i<c$.length; i++) {\n        this._transformDom(c$[i], selector, shouldRemoveScope);\n      }\n    }\n  }\n\n  element(element, scope, shouldRemoveScope) {\n    // note: if using classes, we add both the general 'style-scope' class\n    // as well as the specific scope. This enables easy filtering of all\n    // `style-scope` elements\n    if (scope) {\n      // note: svg on IE does not have classList so fallback to class\n      if (element.classList) {\n        if (shouldRemoveScope) {\n          element.classList.remove(SCOPE_NAME);\n          element.classList.remove(scope);\n        } else {\n          element.classList.add(SCOPE_NAME);\n          element.classList.add(scope);\n        }\n      } else if (element.getAttribute) {\n        let c = element.getAttribute(CLASS);\n        if (shouldRemoveScope) {\n          if (c) {\n            let newValue = c.replace(SCOPE_NAME, '').replace(scope, '');\n            StyleUtil.setElementClassRaw(element, newValue);\n          }\n        } else {\n          let newValue = (c ? c + ' ' : '') + SCOPE_NAME + ' ' + scope;\n          StyleUtil.setElementClassRaw(element, newValue);\n        }\n      }\n    }\n  }\n\n  elementStyles(element, styleRules, callback) {\n    let cssBuildType = element['__cssBuild'];\n    // no need to shim selectors if settings.useNativeShadow, also\n    // a shady css build will already have transformed selectors\n    // NOTE: This method may be called as part of static or property shimming.\n    // When there is a targeted build it will not be called for static shimming,\n    // but when the property shim is used it is called and should opt out of\n    // static shimming work when a proper build exists.\n    let cssText = '';\n    if (nativeShadow || cssBuildType === 'shady') {\n      cssText = StyleUtil.toCssText(styleRules, callback);\n    } else {\n      let {is, typeExtension} = StyleUtil.getIsExtends(element);\n      cssText = this.css(styleRules, is, typeExtension, callback) + '\\n\\n';\n    }\n    return cssText.trim();\n  }\n\n  // Given a string of cssText and a scoping string (scope), returns\n  // a string of scoped css where each selector is transformed to include\n  // a class created from the scope. ShadowDOM selectors are also transformed\n  // (e.g. :host) to use the scoping selector.\n  css(rules, scope, ext, callback) {\n    let hostScope = this._calcHostScope(scope, ext);\n    scope = this._calcElementScope(scope);\n    let self = this;\n    return StyleUtil.toCssText(rules, function(/** StyleNode */rule) {\n      if (!rule.isScoped) {\n        self.rule(rule, scope, hostScope);\n        rule.isScoped = true;\n      }\n      if (callback) {\n        callback(rule, scope, hostScope);\n      }\n    });\n  }\n\n  _calcElementScope(scope) {\n    if (scope) {\n      return CSS_CLASS_PREFIX + scope;\n    } else {\n      return '';\n    }\n  }\n\n  _calcHostScope(scope, ext) {\n    return ext ? `[is=${scope}]` : scope;\n  }\n\n  rule(rule, scope, hostScope) {\n    this._transformRule(rule, this._transformComplexSelector,\n      scope, hostScope);\n  }\n\n  /**\n   * transforms a css rule to a scoped rule.\n   *\n   * @param {StyleNode} rule\n   * @param {Function} transformer\n   * @param {string=} scope\n   * @param {string=} hostScope\n   */\n  _transformRule(rule, transformer, scope, hostScope) {\n    // NOTE: save transformedSelector for subsequent matching of elements\n    // against selectors (e.g. when calculating style properties)\n    rule['selector'] = rule.transformedSelector =\n      this._transformRuleCss(rule, transformer, scope, hostScope);\n  }\n\n  /**\n   * @param {StyleNode} rule\n   * @param {Function} transformer\n   * @param {string=} scope\n   * @param {string=} hostScope\n   */\n  _transformRuleCss(rule, transformer, scope, hostScope) {\n    let p$ = rule['selector'].split(COMPLEX_SELECTOR_SEP);\n    // we want to skip transformation of rules that appear in keyframes,\n    // because they are keyframe selectors, not element selectors.\n    if (!StyleUtil.isKeyframesSelector(rule)) {\n      for (let i=0, l=p$.length, p; (i<l) && (p=p$[i]); i++) {\n        p$[i] = transformer.call(this, p, scope, hostScope);\n      }\n    }\n    return p$.join(COMPLEX_SELECTOR_SEP);\n  }\n\n/**\n * @param {string} selector\n * @param {string} scope\n * @param {string=} hostScope\n */\n  _transformComplexSelector(selector, scope, hostScope) {\n    let stop = false;\n    selector = selector.trim();\n    // Remove spaces inside of selectors like `:nth-of-type` because it confuses SIMPLE_SELECTOR_SEP\n    selector = selector.replace(NTH, (m, type, inner) => `:${type}(${inner.replace(/\\s/g, '')})`);\n    selector = selector.replace(SLOTTED_START, `${HOST} $1`);\n    selector = selector.replace(SIMPLE_SELECTOR_SEP, (m, c, s) => {\n      if (!stop) {\n        let info = this._transformCompoundSelector(s, c, scope, hostScope);\n        stop = stop || info.stop;\n        c = info.combinator;\n        s = info.value;\n      }\n      return c + s;\n    });\n    return selector;\n  }\n\n  _transformCompoundSelector(selector, combinator, scope, hostScope) {\n    // replace :host with host scoping class\n    let slottedIndex = selector.indexOf(SLOTTED);\n    if (selector.indexOf(HOST) >= 0) {\n      selector = this._transformHostSelector(selector, hostScope);\n    // replace other selectors with scoping class\n    } else if (slottedIndex !== 0) {\n      selector = scope ? this._transformSimpleSelector(selector, scope) :\n        selector;\n    }\n    // mark ::slotted() scope jump to replace with descendant selector + arg\n    // also ignore left-side combinator\n    let slotted = false;\n    if (slottedIndex >= 0) {\n      combinator = '';\n      slotted = true;\n    }\n    // process scope jumping selectors up to the scope jump and then stop\n    let stop;\n    if (slotted) {\n      stop = true;\n      if (slotted) {\n        // .zonk ::slotted(.foo) -> .zonk.scope > .foo\n        selector = selector.replace(SLOTTED_PAREN, (m, paren) => ` > ${paren}`);\n      }\n    }\n    selector = selector.replace(DIR_PAREN, (m, before, dir) =>\n      `[dir=\"${dir}\"] ${before}, ${before}[dir=\"${dir}\"]`);\n    return {value: selector, combinator, stop};\n  }\n\n  _transformSimpleSelector(selector, scope) {\n    let p$ = selector.split(PSEUDO_PREFIX);\n    p$[0] += scope;\n    return p$.join(PSEUDO_PREFIX);\n  }\n\n  // :host(...) -> scopeName...\n  _transformHostSelector(selector, hostScope) {\n    let m = selector.match(HOST_PAREN);\n    let paren = m && m[2].trim() || '';\n    if (paren) {\n      if (!paren[0].match(SIMPLE_SELECTOR_PREFIX)) {\n        // paren starts with a type selector\n        let typeSelector = paren.split(SIMPLE_SELECTOR_PREFIX)[0];\n        // if the type selector is our hostScope then avoid pre-pending it\n        if (typeSelector === hostScope) {\n          return paren;\n        // otherwise, this selector should not match in this scope so\n        // output a bogus selector.\n        } else {\n          return SELECTOR_NO_MATCH;\n        }\n      } else {\n        // make sure to do a replace here to catch selectors like:\n        // `:host(.foo)::before`\n        return selector.replace(HOST_PAREN, function(m, host, paren) {\n          return hostScope + paren;\n        });\n      }\n    // if no paren, do a straight :host replacement.\n    // TODO(sorvell): this should not strictly be necessary but\n    // it's needed to maintain support for `:host[foo]` type selectors\n    // which have been improperly used under Shady DOM. This should be\n    // deprecated.\n    } else {\n      return selector.replace(HOST, hostScope);\n    }\n  }\n\n  /**\n   * @param {StyleNode} rule\n   */\n  documentRule(rule) {\n    // reset selector in case this is redone.\n    rule['selector'] = rule['parsedSelector'];\n    this.normalizeRootSelector(rule);\n    this._transformRule(rule, this._transformDocumentSelector);\n  }\n\n  /**\n   * @param {StyleNode} rule\n   */\n  normalizeRootSelector(rule) {\n    if (rule['selector'] === ROOT) {\n      rule['selector'] = 'html';\n    }\n  }\n\n/**\n * @param {string} selector\n */\n  _transformDocumentSelector(selector) {\n    return selector.match(SLOTTED) ?\n      this._transformComplexSelector(selector, SCOPE_DOC_SELECTOR) :\n      this._transformSimpleSelector(selector.trim(), SCOPE_DOC_SELECTOR);\n  }\n}\n\nlet NTH = /:(nth[-\\w]+)\\(([^)]+)\\)/;\nlet SCOPE_DOC_SELECTOR = `:not(.${SCOPE_NAME})`;\nlet COMPLEX_SELECTOR_SEP = ',';\nlet SIMPLE_SELECTOR_SEP = /(^|[\\s>+~]+)((?:\\[.+?\\]|[^\\s>+~=\\[])+)/g;\nlet SIMPLE_SELECTOR_PREFIX = /[[.:#*]/;\nlet HOST = ':host';\nlet ROOT = ':root';\nlet SLOTTED = '::slotted';\nlet SLOTTED_START = new RegExp(`^(${SLOTTED})`);\n// NOTE: this supports 1 nested () pair for things like\n// :host(:not([selected]), more general support requires\n// parsing which seems like overkill\nlet HOST_PAREN = /(:host)(?:\\(((?:\\([^)(]*\\)|[^)(]*)+?)\\))/;\n// similar to HOST_PAREN\nlet SLOTTED_PAREN = /(?:::slotted)(?:\\(((?:\\([^)(]*\\)|[^)(]*)+?)\\))/;\nlet DIR_PAREN = /(.*):dir\\((?:(ltr|rtl))\\)/;\nlet CSS_CLASS_PREFIX = '.';\nlet PSEUDO_PREFIX = ':';\nlet CLASS = 'class';\nlet SELECTOR_NO_MATCH = 'should_not_match';\n\nexport default new StyleTransformer()","/**\n@license\nCopyright (c) 2017 The Polymer Project Authors. All rights reserved.\nThis code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt\nThe complete set of authors may be found at http://polymer.github.io/AUTHORS.txt\nThe complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt\nCode distributed by Google as part of the polymer project is also\nsubject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt\n*/\n\n/*\nExtremely simple css parser. Intended to be not more than what we need\nand definitely not necessarily correct =).\n*/\n\n'use strict';\n\n/** @unrestricted */\nclass StyleNode {\n  constructor() {\n    /** @type {number} */\n    this['start'] = 0;\n    /** @type {number} */\n    this['end'] = 0;\n    /** @type {StyleNode} */\n    this['previous'] = null;\n    /** @type {StyleNode} */\n    this['parent'] = null;\n    /** @type {Array<StyleNode>} */\n    this['rules'] = null;\n    /** @type {string} */\n    this['parsedCssText'] = '';\n    /** @type {string} */\n    this['cssText'] = '';\n    /** @type {boolean} */\n    this['atRule'] = false;\n    /** @type {number} */\n    this['type'] = 0;\n    /** @type {string} */\n    this['keyframesName'] = '';\n    /** @type {string} */\n    this['selector'] = '';\n    /** @type {string} */\n    this['parsedSelector'] = '';\n  }\n}\n\nexport {StyleNode}\n\n// given a string of css, return a simple rule tree\n/**\n * @param {string} text\n * @return {StyleNode}\n */\nexport function parse(text) {\n  text = clean(text);\n  return parseCss(lex(text), text);\n}\n\n// remove stuff we don't care about that may hinder parsing\n/**\n * @param {string} cssText\n * @return {string}\n */\nfunction clean(cssText) {\n  return cssText.replace(RX.comments, '').replace(RX.port, '');\n}\n\n// super simple {...} lexer that returns a node tree\n/**\n * @param {string} text\n * @return {StyleNode}\n */\nfunction lex(text) {\n  let root = new StyleNode();\n  root['start'] = 0;\n  root['end'] = text.length\n  let n = root;\n  for (let i = 0, l = text.length; i < l; i++) {\n    if (text[i] === OPEN_BRACE) {\n      if (!n['rules']) {\n        n['rules'] = [];\n      }\n      let p = n;\n      let previous = p['rules'][p['rules'].length - 1] || null;\n      n = new StyleNode();\n      n['start'] = i + 1;\n      n['parent'] = p;\n      n['previous'] = previous;\n      p['rules'].push(n);\n    } else if (text[i] === CLOSE_BRACE) {\n      n['end'] = i + 1;\n      n = n['parent'] || root;\n    }\n  }\n  return root;\n}\n\n// add selectors/cssText to node tree\n/**\n * @param {StyleNode} node\n * @param {string} text\n * @return {StyleNode}\n */\nfunction parseCss(node, text) {\n  let t = text.substring(node['start'], node['end'] - 1);\n  node['parsedCssText'] = node['cssText'] = t.trim();\n  if (node['parent']) {\n    let ss = node['previous'] ? node['previous']['end'] : node['parent']['start'];\n    t = text.substring(ss, node['start'] - 1);\n    t = _expandUnicodeEscapes(t);\n    t = t.replace(RX.multipleSpaces, ' ');\n    // TODO(sorvell): ad hoc; make selector include only after last ;\n    // helps with mixin syntax\n    t = t.substring(t.lastIndexOf(';') + 1);\n    let s = node['parsedSelector'] = node['selector'] = t.trim();\n    node['atRule'] = (s.indexOf(AT_START) === 0);\n    // note, support a subset of rule types...\n    if (node['atRule']) {\n      if (s.indexOf(MEDIA_START) === 0) {\n        node['type'] = types.MEDIA_RULE;\n      } else if (s.match(RX.keyframesRule)) {\n        node['type'] = types.KEYFRAMES_RULE;\n        node['keyframesName'] =\n          node['selector'].split(RX.multipleSpaces).pop();\n      }\n    } else {\n      if (s.indexOf(VAR_START) === 0) {\n        node['type'] = types.MIXIN_RULE;\n      } else {\n        node['type'] = types.STYLE_RULE;\n      }\n    }\n  }\n  let r$ = node['rules'];\n  if (r$) {\n    for (let i = 0, l = r$.length, r;\n      (i < l) && (r = r$[i]); i++) {\n      parseCss(r, text);\n    }\n  }\n  return node;\n}\n\n/**\n * conversion of sort unicode escapes with spaces like `\\33 ` (and longer) into\n * expanded form that doesn't require trailing space `\\000033`\n * @param {string} s\n * @return {string}\n */\nfunction _expandUnicodeEscapes(s) {\n  return s.replace(/\\\\([0-9a-f]{1,6})\\s/gi, function() {\n    let code = arguments[1],\n      repeat = 6 - code.length;\n    while (repeat--) {\n      code = '0' + code;\n    }\n    return '\\\\' + code;\n  });\n}\n\n/**\n * stringify parsed css.\n * @param {StyleNode} node\n * @param {boolean=} preserveProperties\n * @param {string=} text\n * @return {string}\n */\nexport function stringify(node, preserveProperties, text = '') {\n  // calc rule cssText\n  let cssText = '';\n  if (node['cssText'] || node['rules']) {\n    let r$ = node['rules'];\n    if (r$ && !_hasMixinRules(r$)) {\n      for (let i = 0, l = r$.length, r;\n        (i < l) && (r = r$[i]); i++) {\n        cssText = stringify(r, preserveProperties, cssText);\n      }\n    } else {\n      cssText = preserveProperties ? node['cssText'] :\n        removeCustomProps(node['cssText']);\n      cssText = cssText.trim();\n      if (cssText) {\n        cssText = '  ' + cssText + '\\n';\n      }\n    }\n  }\n  // emit rule if there is cssText\n  if (cssText) {\n    if (node['selector']) {\n      text += node['selector'] + ' ' + OPEN_BRACE + '\\n';\n    }\n    text += cssText;\n    if (node['selector']) {\n      text += CLOSE_BRACE + '\\n\\n';\n    }\n  }\n  return text;\n}\n\n/**\n * @param {Array<StyleNode>} rules\n * @return {boolean}\n */\nfunction _hasMixinRules(rules) {\n  let r = rules[0];\n  return Boolean(r) && Boolean(r['selector']) && r['selector'].indexOf(VAR_START) === 0;\n}\n\n/**\n * @param {string} cssText\n * @return {string}\n */\nfunction removeCustomProps(cssText) {\n  cssText = removeCustomPropAssignment(cssText);\n  return removeCustomPropApply(cssText);\n}\n\n/**\n * @param {string} cssText\n * @return {string}\n */\nexport function removeCustomPropAssignment(cssText) {\n  return cssText\n    .replace(RX.customProp, '')\n    .replace(RX.mixinProp, '');\n}\n\n/**\n * @param {string} cssText\n * @return {string}\n */\nfunction removeCustomPropApply(cssText) {\n  return cssText\n    .replace(RX.mixinApply, '')\n    .replace(RX.varApply, '');\n}\n\n/** @enum {number} */\nexport const types = {\n  STYLE_RULE: 1,\n  KEYFRAMES_RULE: 7,\n  MEDIA_RULE: 4,\n  MIXIN_RULE: 1000\n}\n\nconst OPEN_BRACE = '{';\nconst CLOSE_BRACE = '}';\n\n// helper regexp's\nconst RX = {\n  comments: /\\/\\*[^*]*\\*+([^/*][^*]*\\*+)*\\//gim,\n  port: /@import[^;]*;/gim,\n  customProp: /(?:^[^;\\-\\s}]+)?--[^;{}]*?:[^{};]*?(?:[;\\n]|$)/gim,\n  mixinProp: /(?:^[^;\\-\\s}]+)?--[^;{}]*?:[^{};]*?{[^}]*?}(?:[;\\n]|$)?/gim,\n  mixinApply: /@apply\\s*\\(?[^);]*\\)?\\s*(?:[;\\n]|$)?/gim,\n  varApply: /[^;:]*?:[^;]*?var\\([^;]*\\)(?:[;\\n]|$)?/gim,\n  keyframesRule: /^@[^\\s]*keyframes/,\n  multipleSpaces: /\\s+/g\n}\n\nconst VAR_START = '--';\nconst MEDIA_START = '@media';\nconst AT_START = '@';\n","import Native from './Native.js';\nimport CustomElementInternals from '../CustomElementInternals.js';\nimport CEState from '../CustomElementState.js';\nimport * as Utilities from '../Utilities.js';\n\nimport PatchParentNode from './Interface/ParentNode.js';\nimport PatchChildNode from './Interface/ChildNode.js';\n\n/**\n * @param {!CustomElementInternals} internals\n */\nexport default function(internals) {\n  if (Native.Element_attachShadow) {\n    Utilities.setPropertyUnchecked(Element.prototype, 'attachShadow',\n      /**\n       * @this {Element}\n       * @param {!{mode: string}} init\n       * @return {ShadowRoot}\n       */\n      function(init) {\n        const shadowRoot = Native.Element_attachShadow.call(this, init);\n        this.__CE_shadowRoot = shadowRoot;\n        return shadowRoot;\n      });\n  } else {\n    console.warn('Custom Elements: `Element#attachShadow` was not patched.');\n  }\n\n\n  function patch_innerHTML(destination, baseDescriptor) {\n    Object.defineProperty(destination, 'innerHTML', {\n      enumerable: baseDescriptor.enumerable,\n      configurable: true,\n      get: baseDescriptor.get,\n      set: /** @this {Element} */ function(htmlString) {\n        const isConnected = Utilities.isConnected(this);\n\n        // NOTE: In IE11, when using the native `innerHTML` setter, all nodes\n        // that were previously descendants of the context element have all of\n        // their children removed as part of the set - the entire subtree is\n        // 'disassembled'. This work around walks the subtree *before* using the\n        // native setter.\n        /** @type {!Array<!Element>|undefined} */\n        let removedElements = undefined;\n        if (isConnected) {\n          removedElements = [];\n          Utilities.walkDeepDescendantElements(this, element => {\n            if (element !== this) {\n              removedElements.push(element);\n            }\n          });\n        }\n\n        baseDescriptor.set.call(this, htmlString);\n\n        if (removedElements) {\n          for (let i = 0; i < removedElements.length; i++) {\n            const element = removedElements[i];\n            if (element.__CE_state === CEState.custom) {\n              internals.disconnectedCallback(element);\n            }\n          }\n        }\n\n        // Only create custom elements if this element's owner document is\n        // associated with the registry.\n        if (!this.ownerDocument.__CE_hasRegistry) {\n          internals.patchTree(this);\n        } else {\n          internals.patchAndUpgradeTree(this);\n        }\n        return htmlString;\n      },\n    });\n  }\n\n  if (Native.Element_innerHTML && Native.Element_innerHTML.get) {\n    patch_innerHTML(Element.prototype, Native.Element_innerHTML);\n  } else if (Native.HTMLElement_innerHTML && Native.HTMLElement_innerHTML.get) {\n    patch_innerHTML(HTMLElement.prototype, Native.HTMLElement_innerHTML);\n  } else {\n\n    /** @type {HTMLDivElement} */\n    const rawDiv = Native.Document_createElement.call(document, 'div');\n\n    internals.addPatch(function(element) {\n      patch_innerHTML(element, {\n        enumerable: true,\n        configurable: true,\n        // Implements getting `innerHTML` by performing an unpatched `cloneNode`\n        // of the element and returning the resulting element's `innerHTML`.\n        // TODO: Is this too expensive?\n        get: /** @this {Element} */ function() {\n          return Native.Node_cloneNode.call(this, true).innerHTML;\n        },\n        // Implements setting `innerHTML` by creating an unpatched element,\n        // setting `innerHTML` of that element and replacing the target\n        // element's children with those of the unpatched element.\n        set: /** @this {Element} */ function(assignedValue) {\n          // NOTE: re-route to `content` for `template` elements.\n          // We need to do this because `template.appendChild` does not\n          // route into `template.content`.\n          /** @type {!Node} */\n          const content = this.localName === 'template' ? (/** @type {!HTMLTemplateElement} */ (this)).content : this;\n          rawDiv.innerHTML = assignedValue;\n\n          while (content.childNodes.length > 0) {\n            Native.Node_removeChild.call(content, content.childNodes[0]);\n          }\n          while (rawDiv.childNodes.length > 0) {\n            Native.Node_appendChild.call(content, rawDiv.childNodes[0]);\n          }\n        },\n      });\n    });\n  }\n\n\n  Utilities.setPropertyUnchecked(Element.prototype, 'setAttribute',\n    /**\n     * @this {Element}\n     * @param {string} name\n     * @param {string} newValue\n     */\n    function(name, newValue) {\n      // Fast path for non-custom elements.\n      if (this.__CE_state !== CEState.custom) {\n        return Native.Element_setAttribute.call(this, name, newValue);\n      }\n\n      const oldValue = Native.Element_getAttribute.call(this, name);\n      Native.Element_setAttribute.call(this, name, newValue);\n      newValue = Native.Element_getAttribute.call(this, name);\n      internals.attributeChangedCallback(this, name, oldValue, newValue, null);\n    });\n\n  Utilities.setPropertyUnchecked(Element.prototype, 'setAttributeNS',\n    /**\n     * @this {Element}\n     * @param {?string} namespace\n     * @param {string} name\n     * @param {string} newValue\n     */\n    function(namespace, name, newValue) {\n      // Fast path for non-custom elements.\n      if (this.__CE_state !== CEState.custom) {\n        return Native.Element_setAttributeNS.call(this, namespace, name, newValue);\n      }\n\n      const oldValue = Native.Element_getAttributeNS.call(this, namespace, name);\n      Native.Element_setAttributeNS.call(this, namespace, name, newValue);\n      newValue = Native.Element_getAttributeNS.call(this, namespace, name);\n      internals.attributeChangedCallback(this, name, oldValue, newValue, namespace);\n    });\n\n  Utilities.setPropertyUnchecked(Element.prototype, 'removeAttribute',\n    /**\n     * @this {Element}\n     * @param {string} name\n     */\n    function(name) {\n      // Fast path for non-custom elements.\n      if (this.__CE_state !== CEState.custom) {\n        return Native.Element_removeAttribute.call(this, name);\n      }\n\n      const oldValue = Native.Element_getAttribute.call(this, name);\n      Native.Element_removeAttribute.call(this, name);\n      if (oldValue !== null) {\n        internals.attributeChangedCallback(this, name, oldValue, null, null);\n      }\n    });\n\n  Utilities.setPropertyUnchecked(Element.prototype, 'removeAttributeNS',\n    /**\n     * @this {Element}\n     * @param {?string} namespace\n     * @param {string} name\n     */\n    function(namespace, name) {\n      // Fast path for non-custom elements.\n      if (this.__CE_state !== CEState.custom) {\n        return Native.Element_removeAttributeNS.call(this, namespace, name);\n      }\n\n      const oldValue = Native.Element_getAttributeNS.call(this, namespace, name);\n      Native.Element_removeAttributeNS.call(this, namespace, name);\n      // In older browsers, `Element#getAttributeNS` may return the empty string\n      // instead of null if the attribute does not exist. For details, see;\n      // https://developer.mozilla.org/en-US/docs/Web/API/Element/getAttributeNS#Notes\n      const newValue = Native.Element_getAttributeNS.call(this, namespace, name);\n      if (oldValue !== newValue) {\n        internals.attributeChangedCallback(this, name, oldValue, newValue, namespace);\n      }\n    });\n\n\n  function patch_insertAdjacentElement(destination, baseMethod) {\n    Utilities.setPropertyUnchecked(destination, 'insertAdjacentElement',\n      /**\n       * @this {Element}\n       * @param {string} where\n       * @param {!Element} element\n       * @return {?Element}\n       */\n      function(where, element) {\n        const wasConnected = Utilities.isConnected(element);\n        const insertedElement = /** @type {!Element} */\n          (baseMethod.call(this, where, element));\n\n        if (wasConnected) {\n          internals.disconnectTree(element);\n        }\n\n        if (Utilities.isConnected(insertedElement)) {\n          internals.connectTree(element);\n        }\n        return insertedElement;\n      });\n  }\n\n  if (Native.HTMLElement_insertAdjacentElement) {\n    patch_insertAdjacentElement(HTMLElement.prototype, Native.HTMLElement_insertAdjacentElement);\n  } else if (Native.Element_insertAdjacentElement) {\n    patch_insertAdjacentElement(Element.prototype, Native.Element_insertAdjacentElement);\n  } else {\n    console.warn('Custom Elements: `Element#insertAdjacentElement` was not patched.');\n  }\n\n\n  PatchParentNode(internals, Element.prototype, {\n    prepend: Native.Element_prepend,\n    append: Native.Element_append,\n  });\n\n  PatchChildNode(internals, Element.prototype, {\n    before: Native.Element_before,\n    after: Native.Element_after,\n    replaceWith: Native.Element_replaceWith,\n    remove: Native.Element_remove,\n  });\n};\n","/**\n * @enum {number}\n */\nconst CustomElementState = {\n  custom: 1,\n  failed: 2,\n};\n\nexport default CustomElementState;\n","import CustomElementInternals from '../../CustomElementInternals.js';\nimport * as Utilities from '../../Utilities.js';\n\n/**\n * @typedef {{\n *   before: !function(...(!Node|string)),\n *   after: !function(...(!Node|string)),\n *   replaceWith: !function(...(!Node|string)),\n *   remove: !function(),\n * }}\n */\nlet ChildNodeNativeMethods;\n\n/**\n * @param {!CustomElementInternals} internals\n * @param {!Object} destination\n * @param {!ChildNodeNativeMethods} builtIn\n */\nexport default function(internals, destination, builtIn) {\n  /**\n   * @param {...(!Node|string)} nodes\n   */\n  destination['before'] = function(...nodes) {\n    // TODO: Fix this for when one of `nodes` is a DocumentFragment!\n    const connectedBefore = /** @type {!Array<!Node>} */ (nodes.filter(node => {\n      // DocumentFragments are not connected and will not be added to the list.\n      return node instanceof Node && Utilities.isConnected(node);\n    }));\n\n    builtIn.before.apply(this, nodes);\n\n    for (let i = 0; i < connectedBefore.length; i++) {\n      internals.disconnectTree(connectedBefore[i]);\n    }\n\n    if (Utilities.isConnected(this)) {\n      for (let i = 0; i < nodes.length; i++) {\n        const node = nodes[i];\n        if (node instanceof Element) {\n          internals.connectTree(node);\n        }\n      }\n    }\n  };\n\n  /**\n   * @param {...(!Node|string)} nodes\n   */\n  destination['after'] = function(...nodes) {\n    // TODO: Fix this for when one of `nodes` is a DocumentFragment!\n    const connectedBefore = /** @type {!Array<!Node>} */ (nodes.filter(node => {\n      // DocumentFragments are not connected and will not be added to the list.\n      return node instanceof Node && Utilities.isConnected(node);\n    }));\n\n    builtIn.after.apply(this, nodes);\n\n    for (let i = 0; i < connectedBefore.length; i++) {\n      internals.disconnectTree(connectedBefore[i]);\n    }\n\n    if (Utilities.isConnected(this)) {\n      for (let i = 0; i < nodes.length; i++) {\n        const node = nodes[i];\n        if (node instanceof Element) {\n          internals.connectTree(node);\n        }\n      }\n    }\n  };\n\n  /**\n   * @param {...(!Node|string)} nodes\n   */\n  destination['replaceWith'] = function(...nodes) {\n    // TODO: Fix this for when one of `nodes` is a DocumentFragment!\n    const connectedBefore = /** @type {!Array<!Node>} */ (nodes.filter(node => {\n      // DocumentFragments are not connected and will not be added to the list.\n      return node instanceof Node && Utilities.isConnected(node);\n    }));\n\n    const wasConnected = Utilities.isConnected(this);\n\n    builtIn.replaceWith.apply(this, nodes);\n\n    for (let i = 0; i < connectedBefore.length; i++) {\n      internals.disconnectTree(connectedBefore[i]);\n    }\n\n    if (wasConnected) {\n      internals.disconnectTree(this);\n      for (let i = 0; i < nodes.length; i++) {\n        const node = nodes[i];\n        if (node instanceof Element) {\n          internals.connectTree(node);\n        }\n      }\n    }\n  };\n\n  destination['remove'] = function() {\n    const wasConnected = Utilities.isConnected(this);\n\n    builtIn.remove.call(this);\n\n    if (wasConnected) {\n      internals.disconnectTree(this);\n    }\n  };\n};\n","import Native from './Native.js';\nimport CustomElementInternals from '../CustomElementInternals.js';\nimport * as Utilities from '../Utilities.js';\n\n/**\n * @param {!CustomElementInternals} internals\n */\nexport default function(internals) {\n  // `Node#nodeValue` is implemented on `Attr`.\n  // `Node#textContent` is implemented on `Attr`, `Element`.\n\n  Utilities.setPropertyUnchecked(Node.prototype, 'insertBefore',\n    /**\n     * @this {Node}\n     * @param {!Node} node\n     * @param {?Node} refNode\n     * @return {!Node}\n     */\n    function(node, refNode) {\n      if (node instanceof DocumentFragment) {\n        const insertedNodes = Array.prototype.slice.apply(node.childNodes);\n        const nativeResult = Native.Node_insertBefore.call(this, node, refNode);\n\n        // DocumentFragments can't be connected, so `disconnectTree` will never\n        // need to be called on a DocumentFragment's children after inserting it.\n\n        if (Utilities.isConnected(this)) {\n          for (let i = 0; i < insertedNodes.length; i++) {\n            internals.connectTree(insertedNodes[i]);\n          }\n        }\n\n        return nativeResult;\n      }\n\n      const nodeWasConnected = Utilities.isConnected(node);\n      const nativeResult = Native.Node_insertBefore.call(this, node, refNode);\n\n      if (nodeWasConnected) {\n        internals.disconnectTree(node);\n      }\n\n      if (Utilities.isConnected(this)) {\n        internals.connectTree(node);\n      }\n\n      return nativeResult;\n    });\n\n  Utilities.setPropertyUnchecked(Node.prototype, 'appendChild',\n    /**\n     * @this {Node}\n     * @param {!Node} node\n     * @return {!Node}\n     */\n    function(node) {\n      if (node instanceof DocumentFragment) {\n        const insertedNodes = Array.prototype.slice.apply(node.childNodes);\n        const nativeResult = Native.Node_appendChild.call(this, node);\n\n        // DocumentFragments can't be connected, so `disconnectTree` will never\n        // need to be called on a DocumentFragment's children after inserting it.\n\n        if (Utilities.isConnected(this)) {\n          for (let i = 0; i < insertedNodes.length; i++) {\n            internals.connectTree(insertedNodes[i]);\n          }\n        }\n\n        return nativeResult;\n      }\n\n      const nodeWasConnected = Utilities.isConnected(node);\n      const nativeResult = Native.Node_appendChild.call(this, node);\n\n      if (nodeWasConnected) {\n        internals.disconnectTree(node);\n      }\n\n      if (Utilities.isConnected(this)) {\n        internals.connectTree(node);\n      }\n\n      return nativeResult;\n    });\n\n  Utilities.setPropertyUnchecked(Node.prototype, 'cloneNode',\n    /**\n     * @this {Node}\n     * @param {boolean=} deep\n     * @return {!Node}\n     */\n    function(deep) {\n      const clone = Native.Node_cloneNode.call(this, deep);\n      // Only create custom elements if this element's owner document is\n      // associated with the registry.\n      if (!this.ownerDocument.__CE_hasRegistry) {\n        internals.patchTree(clone);\n      } else {\n        internals.patchAndUpgradeTree(clone);\n      }\n      return clone;\n    });\n\n  Utilities.setPropertyUnchecked(Node.prototype, 'removeChild',\n    /**\n     * @this {Node}\n     * @param {!Node} node\n     * @return {!Node}\n     */\n    function(node) {\n      const nodeWasConnected = Utilities.isConnected(node);\n      const nativeResult = Native.Node_removeChild.call(this, node);\n\n      if (nodeWasConnected) {\n        internals.disconnectTree(node);\n      }\n\n      return nativeResult;\n    });\n\n  Utilities.setPropertyUnchecked(Node.prototype, 'replaceChild',\n    /**\n     * @this {Node}\n     * @param {!Node} nodeToInsert\n     * @param {!Node} nodeToRemove\n     * @return {!Node}\n     */\n    function(nodeToInsert, nodeToRemove) {\n      if (nodeToInsert instanceof DocumentFragment) {\n        const insertedNodes = Array.prototype.slice.apply(nodeToInsert.childNodes);\n        const nativeResult = Native.Node_replaceChild.call(this, nodeToInsert, nodeToRemove);\n\n        // DocumentFragments can't be connected, so `disconnectTree` will never\n        // need to be called on a DocumentFragment's children after inserting it.\n\n        if (Utilities.isConnected(this)) {\n          internals.disconnectTree(nodeToRemove);\n          for (let i = 0; i < insertedNodes.length; i++) {\n            internals.connectTree(insertedNodes[i]);\n          }\n        }\n\n        return nativeResult;\n      }\n\n      const nodeToInsertWasConnected = Utilities.isConnected(nodeToInsert);\n      const nativeResult = Native.Node_replaceChild.call(this, nodeToInsert, nodeToRemove);\n      const thisIsConnected = Utilities.isConnected(this);\n\n      if (thisIsConnected) {\n        internals.disconnectTree(nodeToRemove);\n      }\n\n      if (nodeToInsertWasConnected) {\n        internals.disconnectTree(nodeToInsert);\n      }\n\n      if (thisIsConnected) {\n        internals.connectTree(nodeToInsert);\n      }\n\n      return nativeResult;\n    });\n\n\n  function patch_textContent(destination, baseDescriptor) {\n    Object.defineProperty(destination, 'textContent', {\n      enumerable: baseDescriptor.enumerable,\n      configurable: true,\n      get: baseDescriptor.get,\n      set: /** @this {Node} */ function(assignedValue) {\n        // If this is a text node then there are no nodes to disconnect.\n        if (this.nodeType === Node.TEXT_NODE) {\n          baseDescriptor.set.call(this, assignedValue);\n          return;\n        }\n\n        let removedNodes = undefined;\n        // Checking for `firstChild` is faster than reading `childNodes.length`\n        // to compare with 0.\n        if (this.firstChild) {\n          // Using `childNodes` is faster than `children`, even though we only\n          // care about elements.\n          const childNodes = this.childNodes;\n          const childNodesLength = childNodes.length;\n          if (childNodesLength > 0 && Utilities.isConnected(this)) {\n            // Copying an array by iterating is faster than using slice.\n            removedNodes = new Array(childNodesLength);\n            for (let i = 0; i < childNodesLength; i++) {\n              removedNodes[i] = childNodes[i];\n            }\n          }\n        }\n\n        baseDescriptor.set.call(this, assignedValue);\n\n        if (removedNodes) {\n          for (let i = 0; i < removedNodes.length; i++) {\n            internals.disconnectTree(removedNodes[i]);\n          }\n        }\n      },\n    });\n  }\n\n  if (Native.Node_textContent && Native.Node_textContent.get) {\n    patch_textContent(Node.prototype, Native.Node_textContent);\n  } else {\n    internals.addPatch(function(element) {\n      patch_textContent(element, {\n        enumerable: true,\n        configurable: true,\n        // NOTE: This implementation of the `textContent` getter assumes that\n        // text nodes' `textContent` getter will not be patched.\n        get: /** @this {Node} */ function() {\n          /** @type {!Array<string>} */\n          const parts = [];\n\n          for (let i = 0; i < this.childNodes.length; i++) {\n            parts.push(this.childNodes[i].textContent);\n          }\n\n          return parts.join('');\n        },\n        set: /** @this {Node} */ function(assignedValue) {\n          while (this.firstChild) {\n            Native.Node_removeChild.call(this, this.firstChild);\n          }\n          Native.Node_appendChild.call(this, document.createTextNode(assignedValue));\n        },\n      });\n    });\n  }\n};\n","import Native from './Native.js';\nimport CustomElementInternals from '../CustomElementInternals.js';\nimport * as Utilities from '../Utilities.js';\n\nimport PatchParentNode from './Interface/ParentNode.js';\n\n/**\n * @param {!CustomElementInternals} internals\n */\nexport default function(internals) {\n  Utilities.setPropertyUnchecked(Document.prototype, 'createElement',\n    /**\n     * @this {Document}\n     * @param {string} localName\n     * @return {!Element}\n     */\n    function(localName) {\n      // Only create custom elements if this document is associated with the registry.\n      if (this.__CE_hasRegistry) {\n        const definition = internals.localNameToDefinition(localName);\n        if (definition) {\n          return new (definition.constructor)();\n        }\n      }\n\n      const result = /** @type {!Element} */\n        (Native.Document_createElement.call(this, localName));\n      internals.patch(result);\n      return result;\n    });\n\n  Utilities.setPropertyUnchecked(Document.prototype, 'importNode',\n    /**\n     * @this {Document}\n     * @param {!Node} node\n     * @param {boolean=} deep\n     * @return {!Node}\n     */\n    function(node, deep) {\n      const clone = Native.Document_importNode.call(this, node, deep);\n      // Only create custom elements if this document is associated with the registry.\n      if (!this.__CE_hasRegistry) {\n        internals.patchTree(clone);\n      } else {\n        internals.patchAndUpgradeTree(clone);\n      }\n      return clone;\n    });\n\n  const NS_HTML = \"http://www.w3.org/1999/xhtml\";\n\n  Utilities.setPropertyUnchecked(Document.prototype, 'createElementNS',\n    /**\n     * @this {Document}\n     * @param {?string} namespace\n     * @param {string} localName\n     * @return {!Element}\n     */\n    function(namespace, localName) {\n      // Only create custom elements if this document is associated with the registry.\n      if (this.__CE_hasRegistry && (namespace === null || namespace === NS_HTML)) {\n        const definition = internals.localNameToDefinition(localName);\n        if (definition) {\n          return new (definition.constructor)();\n        }\n      }\n\n      const result = /** @type {!Element} */\n        (Native.Document_createElementNS.call(this, namespace, localName));\n      internals.patch(result);\n      return result;\n    });\n\n  PatchParentNode(internals, Document.prototype, {\n    prepend: Native.Document_prepend,\n    append: Native.Document_append,\n  });\n};\n","import CustomElementInternals from '../../CustomElementInternals.js';\nimport * as Utilities from '../../Utilities.js';\n\n/**\n * @typedef {{\n *   prepend: !function(...(!Node|string)),\n  *  append: !function(...(!Node|string)),\n * }}\n */\nlet ParentNodeNativeMethods;\n\n/**\n * @param {!CustomElementInternals} internals\n * @param {!Object} destination\n * @param {!ParentNodeNativeMethods} builtIn\n */\nexport default function(internals, destination, builtIn) {\n  /**\n   * @param {...(!Node|string)} nodes\n   */\n  destination['prepend'] = function(...nodes) {\n    // TODO: Fix this for when one of `nodes` is a DocumentFragment!\n    const connectedBefore = /** @type {!Array<!Node>} */ (nodes.filter(node => {\n      // DocumentFragments are not connected and will not be added to the list.\n      return node instanceof Node && Utilities.isConnected(node);\n    }));\n\n    builtIn.prepend.apply(this, nodes);\n\n    for (let i = 0; i < connectedBefore.length; i++) {\n      internals.disconnectTree(connectedBefore[i]);\n    }\n\n    if (Utilities.isConnected(this)) {\n      for (let i = 0; i < nodes.length; i++) {\n        const node = nodes[i];\n        if (node instanceof Element) {\n          internals.connectTree(node);\n        }\n      }\n    }\n  };\n\n  /**\n   * @param {...(!Node|string)} nodes\n   */\n  destination['append'] = function(...nodes) {\n    // TODO: Fix this for when one of `nodes` is a DocumentFragment!\n    const connectedBefore = /** @type {!Array<!Node>} */ (nodes.filter(node => {\n      // DocumentFragments are not connected and will not be added to the list.\n      return node instanceof Node && Utilities.isConnected(node);\n    }));\n\n    builtIn.append.apply(this, nodes);\n\n    for (let i = 0; i < connectedBefore.length; i++) {\n      internals.disconnectTree(connectedBefore[i]);\n    }\n\n    if (Utilities.isConnected(this)) {\n      for (let i = 0; i < nodes.length; i++) {\n        const node = nodes[i];\n        if (node instanceof Element) {\n          internals.connectTree(node);\n        }\n      }\n    }\n  };\n};\n","import Native from './Native.js';\nimport CustomElementInternals from '../CustomElementInternals.js';\nimport CEState from '../CustomElementState.js';\nimport AlreadyConstructedMarker from '../AlreadyConstructedMarker.js';\n\n/**\n * @param {!CustomElementInternals} internals\n */\nexport default function(internals) {\n  window['HTMLElement'] = (function() {\n    /**\n     * @type {function(new: HTMLElement): !HTMLElement}\n     */\n    function HTMLElement() {\n      // This should really be `new.target` but `new.target` can't be emulated\n      // in ES5. Assuming the user keeps the default value of the constructor's\n      // prototype's `constructor` property, this is equivalent.\n      /** @type {!Function} */\n      const constructor = this.constructor;\n\n      const definition = internals.constructorToDefinition(constructor);\n      if (!definition) {\n        throw new Error('The custom element being constructed was not registered with `customElements`.');\n      }\n\n      const constructionStack = definition.constructionStack;\n\n      if (constructionStack.length === 0) {\n        const element = Native.Document_createElement.call(document, definition.localName);\n        Object.setPrototypeOf(element, constructor.prototype);\n        element.__CE_state = CEState.custom;\n        element.__CE_definition = definition;\n        internals.patch(element);\n        return element;\n      }\n\n      const lastIndex = constructionStack.length - 1;\n      const element = constructionStack[lastIndex];\n      if (element === AlreadyConstructedMarker) {\n        throw new Error('The HTMLElement constructor was either called reentrantly for this constructor or called multiple times.');\n      }\n      constructionStack[lastIndex] = AlreadyConstructedMarker;\n\n      Object.setPrototypeOf(element, constructor.prototype);\n      internals.patch(/** @type {!HTMLElement} */ (element));\n\n      return element;\n    }\n\n    HTMLElement.prototype = Native.HTMLElement.prototype;\n\n    return HTMLElement;\n  })();\n};\n","import CustomElementInternals from './CustomElementInternals.js';\nimport DocumentConstructionObserver from './DocumentConstructionObserver.js';\nimport Deferred from './Deferred.js';\nimport * as Utilities from './Utilities.js';\n\n/**\n * @unrestricted\n */\nexport default class CustomElementRegistry {\n\n  /**\n   * @param {!CustomElementInternals} internals\n   */\n  constructor(internals) {\n    /**\n     * @private\n     * @type {boolean}\n     */\n    this._elementDefinitionIsRunning = false;\n\n    /**\n     * @private\n     * @type {!CustomElementInternals}\n     */\n    this._internals = internals;\n\n    /**\n     * @private\n     * @type {!Map<string, !Deferred<undefined>>}\n     */\n    this._whenDefinedDeferred = new Map();\n\n    /**\n     * The default flush callback triggers the document walk synchronously.\n     * @private\n     * @type {!Function}\n     */\n    this._flushCallback = fn => fn();\n\n    /**\n     * @private\n     * @type {boolean}\n     */\n    this._flushPending = false;\n\n    /**\n     * @private\n     * @type {!Array<string>}\n     */\n    this._unflushedLocalNames = [];\n\n    /**\n     * @private\n     * @type {!DocumentConstructionObserver}\n     */\n    this._documentConstructionObserver = new DocumentConstructionObserver(internals, document);\n  }\n\n  /**\n   * @param {string} localName\n   * @param {!Function} constructor\n   */\n  define(localName, constructor) {\n    if (!(constructor instanceof Function)) {\n      throw new TypeError('Custom element constructors must be functions.');\n    }\n\n    if (!Utilities.isValidCustomElementName(localName)) {\n      throw new SyntaxError(`The element name '${localName}' is not valid.`);\n    }\n\n    if (this._internals.localNameToDefinition(localName)) {\n      throw new Error(`A custom element with name '${localName}' has already been defined.`);\n    }\n\n    if (this._elementDefinitionIsRunning) {\n      throw new Error('A custom element is already being defined.');\n    }\n    this._elementDefinitionIsRunning = true;\n\n    let connectedCallback;\n    let disconnectedCallback;\n    let adoptedCallback;\n    let attributeChangedCallback;\n    let observedAttributes;\n    try {\n      /** @type {!Object} */\n      const prototype = constructor.prototype;\n      if (!(prototype instanceof Object)) {\n        throw new TypeError('The custom element constructor\\'s prototype is not an object.');\n      }\n\n      function getCallback(name) {\n        const callbackValue = prototype[name];\n        if (callbackValue !== undefined && !(callbackValue instanceof Function)) {\n          throw new Error(`The '${name}' callback must be a function.`);\n        }\n        return callbackValue;\n      }\n\n      connectedCallback = getCallback('connectedCallback');\n      disconnectedCallback = getCallback('disconnectedCallback');\n      adoptedCallback = getCallback('adoptedCallback');\n      attributeChangedCallback = getCallback('attributeChangedCallback');\n      observedAttributes = constructor['observedAttributes'] || [];\n    } catch (e) {\n      return;\n    } finally {\n      this._elementDefinitionIsRunning = false;\n    }\n\n    const definition = {\n      localName,\n      constructor,\n      connectedCallback,\n      disconnectedCallback,\n      adoptedCallback,\n      attributeChangedCallback,\n      observedAttributes,\n      constructionStack: [],\n    };\n\n    this._internals.setDefinition(localName, definition);\n\n    this._unflushedLocalNames.push(localName);\n\n    // If we've already called the flush callback and it hasn't called back yet,\n    // don't call it again.\n    if (!this._flushPending) {\n      this._flushPending = true;\n      this._flushCallback(() => this._flush());\n    }\n  }\n\n  _flush() {\n    // If no new definitions were defined, don't attempt to flush. This could\n    // happen if a flush callback keeps the function it is given and calls it\n    // multiple times.\n    if (this._flushPending === false) return;\n\n    this._flushPending = false;\n    this._internals.patchAndUpgradeTree(document);\n\n    while (this._unflushedLocalNames.length > 0) {\n      const localName = this._unflushedLocalNames.shift();\n      const deferred = this._whenDefinedDeferred.get(localName);\n      if (deferred) {\n        deferred.resolve(undefined);\n      }\n    }\n  }\n\n  /**\n   * @param {string} localName\n   * @return {Function|undefined}\n   */\n  get(localName) {\n    const definition = this._internals.localNameToDefinition(localName);\n    if (definition) {\n      return definition.constructor;\n    }\n\n    return undefined;\n  }\n\n  /**\n   * @param {string} localName\n   * @return {!Promise<undefined>}\n   */\n  whenDefined(localName) {\n    if (!Utilities.isValidCustomElementName(localName)) {\n      return Promise.reject(new SyntaxError(`'${localName}' is not a valid custom element name.`));\n    }\n\n    const prior = this._whenDefinedDeferred.get(localName);\n    if (prior) {\n      return prior.toPromise();\n    }\n\n    const deferred = new Deferred();\n    this._whenDefinedDeferred.set(localName, deferred);\n\n    const definition = this._internals.localNameToDefinition(localName);\n    // Resolve immediately only if the given local name has a definition *and*\n    // the full document walk to upgrade elements with that local name has\n    // already happened.\n    if (definition && this._unflushedLocalNames.indexOf(localName) === -1) {\n      deferred.resolve(undefined);\n    }\n\n    return deferred.toPromise();\n  }\n\n  polyfillWrapFlushCallback(outer) {\n    this._documentConstructionObserver.disconnect();\n    const inner = this._flushCallback;\n    this._flushCallback = flush => outer(() => inner(flush));\n  }\n}\n\n// Closure compiler exports.\nwindow['CustomElementRegistry'] = CustomElementRegistry;\nCustomElementRegistry.prototype['define'] = CustomElementRegistry.prototype.define;\nCustomElementRegistry.prototype['get'] = CustomElementRegistry.prototype.get;\nCustomElementRegistry.prototype['whenDefined'] = CustomElementRegistry.prototype.whenDefined;\nCustomElementRegistry.prototype['polyfillWrapFlushCallback'] = CustomElementRegistry.prototype.polyfillWrapFlushCallback;\n","/**\n * @template T\n */\nexport default class Deferred {\n  constructor() {\n    /**\n     * @private\n     * @type {T|undefined}\n     */\n    this._value = undefined;\n\n    /**\n     * @private\n     * @type {Function|undefined}\n     */\n    this._resolve = undefined;\n\n    /**\n     * @private\n     * @type {!Promise<T>}\n     */\n    this._promise = new Promise(resolve => {\n      this._resolve = resolve;\n\n      if (this._value) {\n        resolve(this._value);\n      }\n    });\n  }\n\n  /**\n   * @param {T} value\n   */\n  resolve(value) {\n    if (this._value) {\n      throw new Error('Already resolved.');\n    }\n\n    this._value = value;\n\n    if (this._resolve) {\n      this._resolve(value);\n    }\n  }\n\n  /**\n   * @return {!Promise<T>}\n   */\n  toPromise() {\n    return this._promise;\n  }\n}\n","import CustomElementInternals from './CustomElementInternals.js';\n\nexport default class DocumentConstructionObserver {\n  constructor(internals, doc) {\n    /**\n     * @type {!CustomElementInternals}\n     */\n    this._internals = internals;\n\n    /**\n     * @type {!Document}\n     */\n    this._document = doc;\n\n    /**\n     * @type {MutationObserver|undefined}\n     */\n    this._observer = undefined;\n\n\n    // Simulate tree construction for all currently accessible nodes in the\n    // document.\n    this._internals.patchAndUpgradeTree(this._document);\n\n    if (this._document.readyState === 'loading') {\n      this._observer = new MutationObserver(this._handleMutations.bind(this));\n\n      // Nodes created by the parser are given to the observer *before* the next\n      // task runs. Inline scripts are run in a new task. This means that the\n      // observer will be able to handle the newly parsed nodes before the inline\n      // script is run.\n      this._observer.observe(this._document, {\n        childList: true,\n        subtree: true,\n      });\n    }\n  }\n\n  disconnect() {\n    if (this._observer) {\n      this._observer.disconnect();\n    }\n  }\n\n  /**\n   * @param {!Array<!MutationRecord>} mutations\n   */\n  _handleMutations(mutations) {\n    // Once the document's `readyState` is 'interactive' or 'complete', all new\n    // nodes created within that document will be the result of script and\n    // should be handled by patching.\n    const readyState = this._document.readyState;\n    if (readyState === 'interactive' || readyState === 'complete') {\n      this.disconnect();\n    }\n\n    for (let i = 0; i < mutations.length; i++) {\n      const addedNodes = mutations[i].addedNodes;\n      for (let j = 0; j < addedNodes.length; j++) {\n        const node = addedNodes[j];\n        this._internals.patchAndUpgradeTree(node);\n      }\n    }\n  }\n}\n","import * as Utilities from './Utilities.js';\nimport CEState from './CustomElementState.js';\n\nexport default class CustomElementInternals {\n  constructor() {\n    /** @type {!Map<string, !CustomElementDefinition>} */\n    this._localNameToDefinition = new Map();\n\n    /** @type {!Map<!Function, !CustomElementDefinition>} */\n    this._constructorToDefinition = new Map();\n\n    /** @type {!Array<!function(!Node)>} */\n    this._patches = [];\n\n    /** @type {boolean} */\n    this._hasPatches = false;\n  }\n\n  /**\n   * @param {string} localName\n   * @param {!CustomElementDefinition} definition\n   */\n  setDefinition(localName, definition) {\n    this._localNameToDefinition.set(localName, definition);\n    this._constructorToDefinition.set(definition.constructor, definition);\n  }\n\n  /**\n   * @param {string} localName\n   * @return {!CustomElementDefinition|undefined}\n   */\n  localNameToDefinition(localName) {\n    return this._localNameToDefinition.get(localName);\n  }\n\n  /**\n   * @param {!Function} constructor\n   * @return {!CustomElementDefinition|undefined}\n   */\n  constructorToDefinition(constructor) {\n    return this._constructorToDefinition.get(constructor);\n  }\n\n  /**\n   * @param {!function(!Node)} listener\n   */\n  addPatch(listener) {\n    this._hasPatches = true;\n    this._patches.push(listener);\n  }\n\n  /**\n   * @param {!Node} node\n   */\n  patchTree(node) {\n    if (!this._hasPatches) return;\n\n    Utilities.walkDeepDescendantElements(node, element => this.patch(element));\n  }\n\n  /**\n   * @param {!Node} node\n   */\n  patch(node) {\n    if (!this._hasPatches) return;\n\n    if (node.__CE_patched) return;\n    node.__CE_patched = true;\n\n    for (let i = 0; i < this._patches.length; i++) {\n      this._patches[i](node);\n    }\n  }\n\n  /**\n   * @param {!Node} root\n   */\n  connectTree(root) {\n    const elements = [];\n\n    Utilities.walkDeepDescendantElements(root, element => elements.push(element));\n\n    for (let i = 0; i < elements.length; i++) {\n      const element = elements[i];\n      if (element.__CE_state === CEState.custom) {\n        this.connectedCallback(element);\n      } else {\n        this.upgradeElement(element);\n      }\n    }\n  }\n\n  /**\n   * @param {!Node} root\n   */\n  disconnectTree(root) {\n    const elements = [];\n\n    Utilities.walkDeepDescendantElements(root, element => elements.push(element));\n\n    for (let i = 0; i < elements.length; i++) {\n      const element = elements[i];\n      if (element.__CE_state === CEState.custom) {\n        this.disconnectedCallback(element);\n      }\n    }\n  }\n\n  /**\n   * Upgrades all uncustomized custom elements at and below a root node for\n   * which there is a definition. When custom element reaction callbacks are\n   * assumed to be called synchronously (which, by the current DOM / HTML spec\n   * definitions, they are *not*), callbacks for both elements customized\n   * synchronously by the parser and elements being upgraded occur in the same\n   * relative order.\n   *\n   * NOTE: This function, when used to simulate the construction of a tree that\n   * is already created but not customized (i.e. by the parser), does *not*\n   * prevent the element from reading the 'final' (true) state of the tree. For\n   * example, the element, during truly synchronous parsing / construction would\n   * see that it contains no children as they have not yet been inserted.\n   * However, this function does not modify the tree, the element will\n   * (incorrectly) have children. Additionally, self-modification restrictions\n   * for custom element constructors imposed by the DOM spec are *not* enforced.\n   *\n   *\n   * The following nested list shows the steps extending down from the HTML\n   * spec's parsing section that cause elements to be synchronously created and\n   * upgraded:\n   *\n   * The \"in body\" insertion mode:\n   * https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-inbody\n   * - Switch on token:\n   *   .. other cases ..\n   *   -> Any other start tag\n   *      - [Insert an HTML element](below) for the token.\n   *\n   * Insert an HTML element:\n   * https://html.spec.whatwg.org/multipage/syntax.html#insert-an-html-element\n   * - Insert a foreign element for the token in the HTML namespace:\n   *   https://html.spec.whatwg.org/multipage/syntax.html#insert-a-foreign-element\n   *   - Create an element for a token:\n   *     https://html.spec.whatwg.org/multipage/syntax.html#create-an-element-for-the-token\n   *     - Will execute script flag is true?\n   *       - (Element queue pushed to the custom element reactions stack.)\n   *     - Create an element:\n   *       https://dom.spec.whatwg.org/#concept-create-element\n   *       - Sync CE flag is true?\n   *         - Constructor called.\n   *         - Self-modification restrictions enforced.\n   *       - Sync CE flag is false?\n   *         - (Upgrade reaction enqueued.)\n   *     - Attributes appended to element.\n   *       (`attributeChangedCallback` reactions enqueued.)\n   *     - Will execute script flag is true?\n   *       - (Element queue popped from the custom element reactions stack.\n   *         Reactions in the popped stack are invoked.)\n   *   - (Element queue pushed to the custom element reactions stack.)\n   *   - Insert the element:\n   *     https://dom.spec.whatwg.org/#concept-node-insert\n   *     - Shadow-including descendants are connected. During parsing\n   *       construction, there are no shadow-*excluding* descendants.\n   *       However, the constructor may have validly attached a shadow\n   *       tree to itself and added descendants to that shadow tree.\n   *       (`connectedCallback` reactions enqueued.)\n   *   - (Element queue popped from the custom element reactions stack.\n   *     Reactions in the popped stack are invoked.)\n   *\n   * @param {!Node} root\n   * @param {!Set<Node>=} visitedImports\n   */\n  patchAndUpgradeTree(root, visitedImports = new Set()) {\n    const elements = [];\n\n    const gatherElements = element => {\n      if (element.localName === 'link' && element.getAttribute('rel') === 'import') {\n        // The HTML Imports polyfill sets a descendant element of the link to\n        // the `import` property, specifically this is *not* a Document.\n        const importNode = /** @type {?Node} */ (element.import);\n\n        if (importNode instanceof Node && importNode.readyState === 'complete') {\n          importNode.__CE_isImportDocument = true;\n\n          // Connected links are associated with the registry.\n          importNode.__CE_hasRegistry = true;\n        } else {\n          // If this link's import root is not available, its contents can't be\n          // walked. Wait for 'load' and walk it when it's ready.\n          element.addEventListener('load', () => {\n            const importNode = /** @type {!Node} */ (element.import);\n\n            if (importNode.__CE_documentLoadHandled) return;\n            importNode.__CE_documentLoadHandled = true;\n\n            importNode.__CE_isImportDocument = true;\n\n            // Connected links are associated with the registry.\n            importNode.__CE_hasRegistry = true;\n\n            // Clone the `visitedImports` set that was populated sync during\n            // the `patchAndUpgradeTree` call that caused this 'load' handler to\n            // be added. Then, remove *this* link's import node so that we can\n            // walk that import again, even if it was partially walked later\n            // during the same `patchAndUpgradeTree` call.\n            const clonedVisitedImports = new Set(visitedImports);\n            visitedImports.delete(importNode);\n\n            this.patchAndUpgradeTree(importNode, visitedImports);\n          });\n        }\n      } else {\n        elements.push(element);\n      }\n    };\n\n    // `walkDeepDescendantElements` populates (and internally checks against)\n    // `visitedImports` when traversing a loaded import.\n    Utilities.walkDeepDescendantElements(root, gatherElements, visitedImports);\n\n    if (this._hasPatches) {\n      for (let i = 0; i < elements.length; i++) {\n        this.patch(elements[i]);\n      }\n    }\n\n    for (let i = 0; i < elements.length; i++) {\n      this.upgradeElement(elements[i]);\n    }\n  }\n\n  /**\n   * @param {!Element} element\n   */\n  upgradeElement(element) {\n    const currentState = element.__CE_state;\n    if (currentState !== undefined) return;\n\n    const definition = this.localNameToDefinition(element.localName);\n    if (!definition) return;\n\n    definition.constructionStack.push(element);\n\n    const constructor = definition.constructor;\n    try {\n      try {\n        let result = new (constructor)();\n        if (result !== element) {\n          throw new Error('The custom element constructor did not produce the element being upgraded.');\n        }\n      } finally {\n        definition.constructionStack.pop();\n      }\n    } catch (e) {\n      element.__CE_state = CEState.failed;\n      throw e;\n    }\n\n    element.__CE_state = CEState.custom;\n    element.__CE_definition = definition;\n\n    if (definition.attributeChangedCallback) {\n      const observedAttributes = definition.observedAttributes;\n      for (let i = 0; i < observedAttributes.length; i++) {\n        const name = observedAttributes[i];\n        const value = element.getAttribute(name);\n        if (value !== null) {\n          this.attributeChangedCallback(element, name, null, value, null);\n        }\n      }\n    }\n\n    if (Utilities.isConnected(element)) {\n      this.connectedCallback(element);\n    }\n  }\n\n  /**\n   * @param {!Element} element\n   */\n  connectedCallback(element) {\n    const definition = element.__CE_definition;\n    if (definition.connectedCallback) {\n      definition.connectedCallback.call(element);\n    }\n  }\n\n  /**\n   * @param {!Element} element\n   */\n  disconnectedCallback(element) {\n    const definition = element.__CE_definition;\n    if (definition.disconnectedCallback) {\n      definition.disconnectedCallback.call(element);\n    }\n  }\n\n  /**\n   * @param {!Element} element\n   * @param {string} name\n   * @param {?string} oldValue\n   * @param {?string} newValue\n   * @param {?string} namespace\n   */\n  attributeChangedCallback(element, name, oldValue, newValue, namespace) {\n    const definition = element.__CE_definition;\n    if (\n      definition.attributeChangedCallback &&\n      definition.observedAttributes.indexOf(name) > -1\n    ) {\n      definition.attributeChangedCallback.call(element, name, oldValue, newValue, namespace);\n    }\n  }\n}\n","/**\n@license\nCopyright (c) 2016 The Polymer Project Authors. All rights reserved.\nThis code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt\nThe complete set of authors may be found at http://polymer.github.io/AUTHORS.txt\nThe complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt\nCode distributed by Google as part of the polymer project is also\nsubject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt\n*/\n\n'use strict';\n\nimport {calculateSplices} from './array-splice'\nimport * as utils from './utils'\nimport {enqueue} from './flush'\nimport {recordChildNodes} from './logical-tree'\nimport {removeChild, insertBefore} from './native-methods'\nimport {parentNode, childNodes} from './native-tree'\nimport {patchShadowRootAccessors} from './patch-accessors'\nimport Distributor from './distributor'\n\n// Do not export this object. It must be passed as the first argument to the\n// ShadyRoot constructor in `attachShadow` to prevent the constructor from\n// throwing. This prevents the user from being able to manually construct a\n// ShadyRoot (i.e. `new ShadowRoot()`).\nconst ShadyRootConstructionToken = {};\n\n/**\n * @constructor\n * @extends {ShadowRoot}\n */\nexport let ShadyRoot = function(token, host) {\n  if (token !== ShadyRootConstructionToken) {\n    throw new TypeError('Illegal constructor');\n  }\n  // NOTE: this strange construction is necessary because\n  // DocumentFragment cannot be subclassed on older browsers.\n  let shadowRoot = document.createDocumentFragment();\n  shadowRoot.__proto__ = ShadyRoot.prototype;\n  /** @type {ShadyRoot} */ (shadowRoot)._init(host);\n  return shadowRoot;\n};\n\nShadyRoot.prototype = Object.create(DocumentFragment.prototype);\n\nShadyRoot.prototype._init = function(host) {\n  // NOTE: set a fake local name so this element can be\n  // distinguished from a DocumentFragment when patching.\n  // FF doesn't allow this to be `localName`\n  this.__localName = 'ShadyRoot';\n  // logical dom setup\n  recordChildNodes(host);\n  recordChildNodes(this);\n  // root <=> host\n  host.shadowRoot = this;\n  this.host = host;\n  // state flags\n  this._renderPending = false;\n  this._hasRendered = false;\n  this._changePending = false;\n  this._distributor = new Distributor(this);\n  this.update();\n}\n\n\n// async render\nShadyRoot.prototype.update = function() {\n  if (!this._renderPending) {\n    this._renderPending = true;\n    enqueue(() => this.render());\n  }\n}\n\n// returns the oldest renderPending ancestor root.\nShadyRoot.prototype._getRenderRoot = function() {\n  let renderRoot = this;\n  let root = this;\n  while (root) {\n    if (root._renderPending) {\n      renderRoot = root;\n    }\n    root = root._rendererForHost();\n  }\n  return renderRoot;\n}\n\n// Returns the shadyRoot `this.host` if `this.host`\n// has children that require distribution.\nShadyRoot.prototype._rendererForHost = function() {\n  let root = this.host.getRootNode();\n  if (utils.isShadyRoot(root)) {\n    let c$ = this.host.childNodes;\n    for (let i=0, c; i < c$.length; i++) {\n      c = c$[i];\n      if (this._distributor.isInsertionPoint(c)) {\n        return root;\n      }\n    }\n  }\n}\n\nShadyRoot.prototype.render = function() {\n  if (this._renderPending) {\n    this._getRenderRoot()['_render']();\n  }\n}\n\n// NOTE: avoid renaming to ease testability.\nShadyRoot.prototype['_render'] = function() {\n  this._renderPending = false;\n  this._changePending = false;\n  if (!this._skipUpdateInsertionPoints) {\n    this.updateInsertionPoints();\n  } else if (!this._hasRendered) {\n    this.__insertionPoints = [];\n  }\n  this._skipUpdateInsertionPoints = false;\n  // TODO(sorvell): can add a first render optimization here\n  // to use if there are no insertion points\n  // 1. clear host node of composed children\n  // 2. appendChild the shadowRoot itself or (more robust) its logical children\n  // NOTE: this didn't seem worth it in perf testing\n  // but not ready to delete this info.\n  // logical\n  this.distribute();\n  // physical\n  this.compose();\n  this._hasRendered = true;\n}\n\nShadyRoot.prototype.forceRender = function() {\n  this._renderPending = true;\n  this.render();\n}\n\nShadyRoot.prototype.distribute = function() {\n  let dirtyRoots = this._distributor.distribute();\n  for (let i=0; i<dirtyRoots.length; i++) {\n    dirtyRoots[i]['_render']();\n  }\n}\n\nShadyRoot.prototype.updateInsertionPoints = function() {\n  let i$ = this._insertionPoints;\n  // if any insertion points have been removed, clear their distribution info\n  if (i$) {\n    for (let i=0, c; i < i$.length; i++) {\n      c = i$[i];\n      if (c.getRootNode() !== this) {\n        this._distributor.clearAssignedSlots(c);\n      }\n    }\n  }\n  i$ = this._insertionPoints = this._distributor.getInsertionPoints();\n  // ensure insertionPoints's and their parents have logical dom info.\n  // save logical tree info\n  // a. for shadyRoot\n  // b. for insertion points (fallback)\n  // c. for parents of insertion points\n  for (let i=0, c; i < i$.length; i++) {\n    c = i$[i];\n    c.__shady = c.__shady || {};\n    recordChildNodes(c);\n    recordChildNodes(c.parentNode);\n  }\n}\n\nShadyRoot.prototype.compose = function() {\n  // compose self\n  // note: it's important to mark this clean before distribution\n  // so that attachment that provokes additional distribution (e.g.\n  // adding something to your parentNode) works\n  this._composeTree();\n  // TODO(sorvell): See fast paths here in Polymer v1\n  // (these seem unnecessary)\n}\n\n// Reify dom such that it is at its correct rendering position\n// based on logical distribution.\nShadyRoot.prototype._composeTree = function() {\n  this._updateChildNodes(this.host, this._composeNode(this.host));\n  let p$ = this._getInsertionPoints();\n  for (let i=0, l=p$.length, p, parent; (i<l) && (p=p$[i]); i++) {\n    parent = p.parentNode;\n    if ((parent !== this.host) && (parent !== this)) {\n      this._updateChildNodes(parent, this._composeNode(parent));\n    }\n  }\n}\n\n// Returns the list of nodes which should be rendered inside `node`.\nShadyRoot.prototype._composeNode = function(node) {\n  let children = [];\n  let c$ = ((node.__shady && node.__shady.root) || node).childNodes;\n  for (let i = 0; i < c$.length; i++) {\n    let child = c$[i];\n    if (this._distributor.isInsertionPoint(child)) {\n      let distributedNodes = child.__shady.distributedNodes ||\n        (child.__shady.distributedNodes = []);\n      for (let j = 0; j < distributedNodes.length; j++) {\n        let distributedNode = distributedNodes[j];\n        if (this.isFinalDestination(child, distributedNode)) {\n          children.push(distributedNode);\n        }\n      }\n    } else {\n      children.push(child);\n    }\n  }\n  return children;\n}\n\nShadyRoot.prototype.isFinalDestination = function(insertionPoint, node) {\n  return this._distributor.isFinalDestination(\n    insertionPoint, node);\n}\n\n// Ensures that the rendered node list inside `container` is `children`.\nShadyRoot.prototype._updateChildNodes = function(container, children) {\n  let composed = childNodes(container);\n  let splices = calculateSplices(children, composed);\n  // process removals\n  for (let i=0, d=0, s; (i<splices.length) && (s=splices[i]); i++) {\n    for (let j=0, n; (j < s.removed.length) && (n=s.removed[j]); j++) {\n      // check if the node is still where we expect it is before trying\n      // to remove it; this can happen if we move a node and\n      // then schedule its previous host for distribution resulting in\n      // the node being removed here.\n      if (parentNode(n) === container) {\n        removeChild.call(container, n);\n      }\n      composed.splice(s.index + d, 1);\n    }\n    d -= s.addedCount;\n  }\n  // process adds\n  for (let i=0, s, next; (i<splices.length) && (s=splices[i]); i++) { //eslint-disable-line no-redeclare\n    next = composed[s.index];\n    for (let j=s.index, n; j < s.index + s.addedCount; j++) {\n      n = children[j];\n      insertBefore.call(container, n, next);\n      // TODO(sorvell): is this splice strictly needed?\n      composed.splice(j, 0, n);\n    }\n  }\n}\n\nShadyRoot.prototype.getInsertionPointTag = function() {\n  return this._distributor.insertionPointTag;\n}\n\nShadyRoot.prototype.hasInsertionPoint = function() {\n  return Boolean(this._insertionPoints && this._insertionPoints.length);\n}\n\nShadyRoot.prototype._getInsertionPoints = function() {\n  if (!this._insertionPoints) {\n    this.updateInsertionPoints();\n  }\n  return this._insertionPoints;\n}\n\nShadyRoot.prototype.addEventListener = function(type, fn, optionsOrCapture) {\n  if (typeof optionsOrCapture !== 'object') {\n    optionsOrCapture = {\n      capture: Boolean(optionsOrCapture)\n    }\n  }\n  optionsOrCapture.__shadyTarget = this;\n  this.host.addEventListener(type, fn, optionsOrCapture);\n}\n\nShadyRoot.prototype.removeEventListener = function(type, fn, optionsOrCapture) {\n  if (typeof optionsOrCapture !== 'object') {\n    optionsOrCapture = {\n      capture: Boolean(optionsOrCapture)\n    }\n  }\n  optionsOrCapture.__shadyTarget = this;\n  this.host.removeEventListener(type, fn, optionsOrCapture);\n}\n\n/**\n  Implements a pared down version of ShadowDOM's scoping, which is easy to\n  polyfill across browsers.\n*/\nexport function attachShadow(host, options) {\n  if (!host) {\n    throw 'Must provide a host.';\n  }\n  if (!options) {\n    throw 'Not enough arguments.'\n  }\n  return new ShadyRoot(ShadyRootConstructionToken, host);\n}\n\npatchShadowRootAccessors(ShadyRoot.prototype);\n","/**\n@license\nCopyright (c) 2016 The Polymer Project Authors. All rights reserved.\nThis code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt\nThe complete set of authors may be found at http://polymer.github.io/AUTHORS.txt\nThe complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt\nCode distributed by Google as part of the polymer project is also\nsubject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt\n*/\n\n'use strict';\n\nimport {removeChild} from './native-methods'\nimport {parentNode} from './native-tree'\n\n// NOTE: normalize event contruction where necessary (IE11)\nlet NormalizedEvent = typeof Event === 'function' ? Event :\n  function(inType, params) {\n    params = params || {};\n    var e = document.createEvent('Event');\n    e.initEvent(inType, Boolean(params.bubbles), Boolean(params.cancelable));\n    return e;\n  };\n\nexport default class {\n\n  constructor(root) {\n    this.root = root;\n    this.insertionPointTag = 'slot';\n  }\n\n  getInsertionPoints() {\n    return this.root.querySelectorAll(this.insertionPointTag);\n  }\n\n  isInsertionPoint(node) {\n    return node.localName && node.localName == this.insertionPointTag;\n  }\n\n  distribute() {\n    if (this.root.hasInsertionPoint()) {\n      return this.distributePool(this.root, this.collectPool());\n    }\n    return [];\n  }\n\n  // Gather the pool of nodes that should be distributed. We will combine\n  // these with the \"content root\" to arrive at the composed tree.\n  collectPool() {\n    let host = this.root.host;\n    let pool=[], i=0;\n    for (let n=host.firstChild; n; n=n.nextSibling) {\n      pool[i++] = n;\n    }\n    return pool;\n  }\n\n  // perform \"logical\" distribution; note, no actual dom is moved here,\n  // instead elements are distributed into storage\n  // array where applicable.\n  distributePool(node, pool) {\n    let dirtyRoots = [];\n    let p$ = this.root._getInsertionPoints();\n    for (let i=0, l=p$.length, p; (i<l) && (p=p$[i]); i++) {\n      this.distributeInsertionPoint(p, pool);\n      // provoke redistribution on insertion point parents\n      // must do this on all candidate hosts since distribution in this\n      // scope invalidates their distribution.\n      // only get logical parent.\n      let parent = p.parentNode;\n      let root = parent && parent.__shady && parent.__shady.root\n      if (root && root.hasInsertionPoint()) {\n        dirtyRoots.push(root);\n      }\n    }\n    for (let i=0; i < pool.length; i++) {\n      let p = pool[i];\n      if (p) {\n        p.__shady = p.__shady || {};\n        p.__shady.assignedSlot = undefined;\n        // remove undistributed elements from physical dom.\n        let parent = parentNode(p);\n        if (parent) {\n          removeChild.call(parent, p);\n        }\n      }\n    }\n    return dirtyRoots;\n  }\n\n  distributeInsertionPoint(insertionPoint, pool) {\n    let prevAssignedNodes = insertionPoint.__shady.assignedNodes;\n    if (prevAssignedNodes) {\n      this.clearAssignedSlots(insertionPoint, true);\n    }\n    insertionPoint.__shady.assignedNodes = [];\n    let needsSlotChange = false;\n    // distribute nodes from the pool that this selector matches\n    let anyDistributed = false;\n    for (let i=0, l=pool.length, node; i < l; i++) {\n      node=pool[i];\n      // skip nodes that were already used\n      if (!node) {\n        continue;\n      }\n      // distribute this node if it matches\n      if (this.matchesInsertionPoint(node, insertionPoint)) {\n        if (node.__shady._prevAssignedSlot != insertionPoint) {\n          needsSlotChange = true;\n        }\n        this.distributeNodeInto(node, insertionPoint)\n        // remove this node from the pool\n        pool[i] = undefined;\n        // since at least one node matched, we won't need fallback content\n        anyDistributed = true;\n      }\n    }\n    // Fallback content if nothing was distributed here\n    if (!anyDistributed) {\n      let children = insertionPoint.childNodes;\n      for (let j = 0, node; j < children.length; j++) {\n        node = children[j];\n        if (node.__shady._prevAssignedSlot != insertionPoint) {\n          needsSlotChange = true;\n        }\n        this.distributeNodeInto(node, insertionPoint);\n      }\n    }\n    // we're already dirty if a node was newly added to the slot\n    // and we're also dirty if the assigned count decreased.\n    if (prevAssignedNodes) {\n      // TODO(sorvell): the tracking of previously assigned slots\n      // could instead by done with a Set and then we could\n      // avoid needing to iterate here to clear the info.\n      for (let i=0; i < prevAssignedNodes.length; i++) {\n        prevAssignedNodes[i].__shady._prevAssignedSlot = null;\n      }\n      if (insertionPoint.__shady.assignedNodes.length < prevAssignedNodes.length) {\n        needsSlotChange = true;\n      }\n    }\n    this.setDistributedNodesOnInsertionPoint(insertionPoint);\n    if (needsSlotChange) {\n      this._fireSlotChange(insertionPoint);\n    }\n  }\n\n  clearAssignedSlots(slot, savePrevious) {\n    let n$ = slot.__shady.assignedNodes;\n    if (n$) {\n      for (let i=0; i < n$.length; i++) {\n        let n = n$[i];\n        if (savePrevious) {\n          n.__shady._prevAssignedSlot = n.__shady.assignedSlot;\n        }\n        // only clear if it was previously set to this slot;\n        // this helps ensure that if the node has otherwise been distributed\n        // ignore it.\n        if (n.__shady.assignedSlot === slot) {\n          n.__shady.assignedSlot = null;\n        }\n      }\n    }\n  }\n\n  matchesInsertionPoint(node, insertionPoint) {\n    let slotName = insertionPoint.getAttribute('name');\n    slotName = slotName ? slotName.trim() : '';\n    let slot = node.getAttribute && node.getAttribute('slot');\n    slot = slot ? slot.trim() : '';\n    return (slot == slotName);\n  }\n\n  distributeNodeInto(child, insertionPoint) {\n    insertionPoint.__shady.assignedNodes.push(child);\n    child.__shady.assignedSlot = insertionPoint;\n  }\n\n  setDistributedNodesOnInsertionPoint(insertionPoint) {\n    let n$ = insertionPoint.__shady.assignedNodes;\n    insertionPoint.__shady.distributedNodes = [];\n    for (let i=0, n; (i<n$.length) && (n=n$[i]) ; i++) {\n      if (this.isInsertionPoint(n)) {\n        let d$ = n.__shady.distributedNodes;\n        if (d$) {\n          for (let j=0; j < d$.length; j++) {\n            insertionPoint.__shady.distributedNodes.push(d$[j]);\n          }\n        }\n      } else {\n        insertionPoint.__shady.distributedNodes.push(n$[i]);\n      }\n    }\n  }\n\n  _fireSlotChange(insertionPoint) {\n    // NOTE: cannot bubble correctly here so not setting bubbles: true\n    // Safari tech preview does not bubble but chrome does\n    // Spec says it bubbles (https://dom.spec.whatwg.org/#mutation-observers)\n    insertionPoint.dispatchEvent(new NormalizedEvent('slotchange'));\n    if (insertionPoint.__shady.assignedSlot) {\n      this._fireSlotChange(insertionPoint.__shady.assignedSlot);\n    }\n  }\n\n  isFinalDestination(insertionPoint) {\n    return !(insertionPoint.__shady.assignedSlot);\n  }\n\n}","/**\n@license\nCopyright (c) 2016 The Polymer Project Authors. All rights reserved.\nThis code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt\nThe complete set of authors may be found at http://polymer.github.io/AUTHORS.txt\nThe complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt\nCode distributed by Google as part of the polymer project is also\nsubject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt\n*/\n\n'use strict';\n\nimport {patchInsideElementAccessors, patchOutsideElementAccessors} from './patch-accessors'\nimport {firstChild, lastChild, childNodes} from './native-tree'\n\nexport function recordInsertBefore(node, container, ref_node) {\n  patchInsideElementAccessors(container);\n  container.__shady = container.__shady || {};\n  if (container.__shady.firstChild !== undefined) {\n    container.__shady.childNodes = null;\n  }\n  // handle document fragments\n  if (node.nodeType === Node.DOCUMENT_FRAGMENT_NODE) {\n    let c$ = node.childNodes;\n    for (let i=0; i < c$.length; i++) {\n      linkNode(c$[i], container, ref_node);\n    }\n    // cleanup logical dom in doc fragment.\n    node.__shady = node.__shady || {};\n    let resetTo = (node.__shady.firstChild !== undefined) ? null : undefined;\n    node.__shady.firstChild = node.__shady.lastChild = resetTo;\n    node.__shady.childNodes = resetTo;\n  } else {\n    linkNode(node, container, ref_node);\n  }\n}\n\nfunction linkNode(node, container, ref_node) {\n  patchOutsideElementAccessors(node);\n  ref_node = ref_node || null;\n  node.__shady = node.__shady || {};\n  container.__shady = container.__shady || {};\n  if (ref_node) {\n    ref_node.__shady = ref_node.__shady || {};\n  }\n  // update ref_node.previousSibling <-> node\n  node.__shady.previousSibling = ref_node ? ref_node.__shady.previousSibling :\n    container.lastChild;\n  let ps = node.__shady.previousSibling;\n  if (ps && ps.__shady) {\n    ps.__shady.nextSibling = node;\n  }\n  // update node <-> ref_node\n  let ns = node.__shady.nextSibling = ref_node;\n  if (ns && ns.__shady) {\n    ns.__shady.previousSibling = node;\n  }\n  // update node <-> container\n  node.__shady.parentNode = container;\n  if (ref_node) {\n    if (ref_node === container.__shady.firstChild) {\n      container.__shady.firstChild = node;\n    }\n  } else {\n    container.__shady.lastChild = node;\n    if (!container.__shady.firstChild) {\n      container.__shady.firstChild = node;\n    }\n  }\n  // remove caching of childNodes\n  container.__shady.childNodes = null;\n}\n\nexport function recordRemoveChild(node, container) {\n  node.__shady = node.__shady || {};\n  container.__shady = container.__shady || {};\n  if (node === container.__shady.firstChild) {\n    container.__shady.firstChild = node.__shady.nextSibling;\n  }\n  if (node === container.__shady.lastChild) {\n    container.__shady.lastChild = node.__shady.previousSibling;\n  }\n  let p = node.__shady.previousSibling;\n  let n = node.__shady.nextSibling;\n  if (p) {\n    p.__shady = p.__shady || {};\n    p.__shady.nextSibling = n;\n  }\n  if (n) {\n    n.__shady = n.__shady || {};\n    n.__shady.previousSibling = p;\n  }\n  // When an element is removed, logical data is no longer tracked.\n  // Explicitly set `undefined` here to indicate this. This is disginguished\n  // from `null` which is set if info is null.\n  node.__shady.parentNode = node.__shady.previousSibling =\n    node.__shady.nextSibling = undefined;\n  if (container.__shady.childNodes !== undefined) {\n    // remove caching of childNodes\n    container.__shady.childNodes = null;\n  }\n}\n\nexport let recordChildNodes = function(node) {\n  if (!node.__shady || node.__shady.firstChild === undefined) {\n    node.__shady = node.__shady || {};\n    node.__shady.firstChild = firstChild(node);\n    node.__shady.lastChild = lastChild(node);\n    patchInsideElementAccessors(node);\n    let c$ = node.__shady.childNodes = childNodes(node);\n    for (let i=0, n; (i<c$.length) && (n=c$[i]); i++) {\n      n.__shady = n.__shady || {};\n      n.__shady.parentNode = node;\n      n.__shady.nextSibling = c$[i+1] || null;\n      n.__shady.previousSibling = c$[i-1] || null;\n      patchOutsideElementAccessors(n);\n    }\n  }\n}","/**\n@license\nCopyright (c) 2016 The Polymer Project Authors. All rights reserved.\nThis code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt\nThe complete set of authors may be found at http://polymer.github.io/AUTHORS.txt\nThe complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt\nCode distributed by Google as part of the polymer project is also\nsubject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt\n*/\n\n'use strict';\n\nimport * as utils from './utils'\n\nclass AsyncObserver {\n\n  constructor() {\n    this._scheduled = false;\n    this.addedNodes = [];\n    this.removedNodes = [];\n    this.callbacks = new Set();\n  }\n\n  schedule() {\n    if (!this._scheduled) {\n      this._scheduled = true;\n      utils.microtask(() => {\n        this.flush();\n      });\n    }\n  }\n\n  flush() {\n    if (this._scheduled) {\n      this._scheduled = false;\n      let mutations = this.takeRecords();\n      if (mutations.length) {\n        this.callbacks.forEach(function(cb) {\n          cb(mutations);\n        });\n      }\n    }\n  }\n\n  takeRecords() {\n    if (this.addedNodes.length || this.removedNodes.length) {\n      let mutations = [{\n        addedNodes: this.addedNodes,\n        removedNodes: this.removedNodes\n      }];\n      this.addedNodes = [];\n      this.removedNodes = [];\n      return mutations;\n    }\n    return [];\n  }\n\n}\n\n// TODO(sorvell): consider instead polyfilling MutationObserver\n// directly so that users do not have to fork their code.\n// Supporting the entire api may be challenging: e.g. filtering out\n// removed nodes in the wrong scope and seeing non-distributing\n// subtree child mutations.\nexport let observeChildren = function(node, callback) {\n  node.__shady = node.__shady || {};\n  if (!node.__shady.observer) {\n    node.__shady.observer = new AsyncObserver();\n  }\n  node.__shady.observer.callbacks.add(callback);\n  let observer = node.__shady.observer;\n  return {\n    _callback: callback,\n    _observer: observer,\n    _node: node,\n    takeRecords() {\n      return observer.takeRecords()\n    }\n  };\n}\n\nexport let unobserveChildren = function(handle) {\n  let observer = handle && handle._observer;\n  if (observer) {\n    observer.callbacks.delete(handle._callback);\n    if (!observer.callbacks.size) {\n      handle._node.__shady.observer = null;\n    }\n  }\n}\n\nexport function filterMutations(mutations, target) {\n  /** @const {Node} */\n  const targetRootNode = target.getRootNode();\n  return mutations.map(function(mutation) {\n    /** @const {boolean} */\n    const mutationInScope = (targetRootNode === mutation.target.getRootNode());\n    if (mutationInScope && mutation.addedNodes) {\n      let nodes = Array.from(mutation.addedNodes).filter(function(n) {\n        return (targetRootNode === n.getRootNode());\n      });\n      if (nodes.length) {\n        mutation = Object.create(mutation);\n        Object.defineProperty(mutation, 'addedNodes', {\n          value: nodes,\n          configurable: true\n        });\n        return mutation;\n      }\n    } else if (mutationInScope) {\n      return mutation;\n    }\n  }).filter(function(m) { return m});\n}","/**\n@license\nCopyright (c) 2016 The Polymer Project Authors. All rights reserved.\nThis code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt\nThe complete set of authors may be found at http://polymer.github.io/AUTHORS.txt\nThe complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt\nCode distributed by Google as part of the polymer project is also\nsubject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt\n*/\n\n'use strict';\n\nexport let settings = window['ShadyDOM'] || {};\n\nsettings.hasNativeShadowDOM = Boolean(Element.prototype.attachShadow && Node.prototype.getRootNode);\n\nlet desc = Object.getOwnPropertyDescriptor(Node.prototype, 'firstChild');\n\nsettings.hasDescriptors = Boolean(desc && desc.configurable && desc.get);\nsettings.inUse = settings['force'] || !settings.hasNativeShadowDOM;\n\nexport function isShadyRoot(obj) {\n  return Boolean(obj.__localName === 'ShadyRoot');\n}\n\nexport function ownerShadyRootForNode(node) {\n  let root = node.getRootNode();\n  if (isShadyRoot(root)) {\n    return root;\n  }\n}\n\nlet p = Element.prototype;\nlet matches = p.matches || p.matchesSelector ||\n  p.mozMatchesSelector || p.msMatchesSelector ||\n  p.oMatchesSelector || p.webkitMatchesSelector;\n\nexport function matchesSelector(element, selector) {\n  return matches.call(element, selector);\n}\n\nfunction copyOwnProperty(name, source, target) {\n  let pd = Object.getOwnPropertyDescriptor(source, name);\n  if (pd) {\n    Object.defineProperty(target, name, pd);\n  }\n}\n\nexport function extend(target, source) {\n  if (target && source) {\n    let n$ = Object.getOwnPropertyNames(source);\n    for (let i=0, n; (i<n$.length) && (n=n$[i]); i++) {\n      copyOwnProperty(n, source, target);\n    }\n  }\n  return target || source;\n}\n\nexport function extendAll(target, ...sources) {\n  for (let i=0; i < sources.length; i++) {\n    extend(target, sources[i]);\n  }\n  return target;\n}\n\nexport function mixin(target, source) {\n  for (var i in source) {\n    target[i] = source[i];\n  }\n  return target;\n}\n\nexport function patchPrototype(obj, mixin) {\n  let proto = Object.getPrototypeOf(obj);\n  if (!proto.hasOwnProperty('__patchProto')) {\n    let patchProto = Object.create(proto);\n    patchProto.__sourceProto = proto;\n    extend(patchProto, mixin);\n    proto['__patchProto'] = patchProto;\n  }\n  // old browsers don't have setPrototypeOf\n  obj.__proto__ = proto['__patchProto'];\n}\n\n\nlet twiddle = document.createTextNode('');\nlet content = 0;\nlet queue = [];\nnew MutationObserver(() => {\n  while (queue.length) {\n    // catch errors in user code...\n    try {\n      queue.shift()();\n    } catch(e) {\n      // enqueue another record and throw\n      twiddle.textContent = content++;\n      throw(e);\n    }\n  }\n}).observe(twiddle, {characterData: true});\n\n// use MutationObserver to get microtask async timing.\nexport function microtask(callback) {\n  queue.push(callback);\n  twiddle.textContent = content++;\n}","/**\n@license\nCopyright (c) 2016 The Polymer Project Authors. All rights reserved.\nThis code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt\nThe complete set of authors may be found at http://polymer.github.io/AUTHORS.txt\nThe complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt\nCode distributed by Google as part of the polymer project is also\nsubject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt\n*/\n\n'use strict';\n\nimport * as utils from './utils'\n\n// render enqueuer/flusher\nlet flushList = [];\nlet scheduled;\nexport function enqueue(callback) {\n  if (!scheduled) {\n    scheduled = true;\n    utils.microtask(flush);\n  }\n  flushList.push(callback);\n}\n\nexport function flush() {\n  scheduled = false;\n  let didFlush = Boolean(flushList.length);\n  while (flushList.length) {\n    flushList.shift()();\n  }\n  return didFlush;\n}\n\nflush['list'] = flushList;","/**\n@license\nCopyright (c) 2016 The Polymer Project Authors. All rights reserved.\nThis code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt\nThe complete set of authors may be found at http://polymer.github.io/AUTHORS.txt\nThe complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt\nCode distributed by Google as part of the polymer project is also\nsubject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt\n*/\n\n'use strict';\n\n// Cribbed from ShadowDOM polyfill\n// https://github.com/webcomponents/webcomponentsjs/blob/master/src/ShadowDOM/wrappers/HTMLElement.js#L28\n/////////////////////////////////////////////////////////////////////////////\n// innerHTML and outerHTML\n\n// http://www.whatwg.org/specs/web-apps/current-work/multipage/the-end.html#escapingString\nlet escapeAttrRegExp = /[&\\u00A0\"]/g;\nlet escapeDataRegExp = /[&\\u00A0<>]/g;\n\nfunction escapeReplace(c) {\n  switch (c) {\n    case '&':\n      return '&amp;';\n    case '<':\n      return '&lt;';\n    case '>':\n      return '&gt;';\n    case '\"':\n      return '&quot;';\n    case '\\u00A0':\n      return '&nbsp;';\n  }\n}\n\nfunction escapeAttr(s) {\n  return s.replace(escapeAttrRegExp, escapeReplace);\n}\n\nfunction escapeData(s) {\n  return s.replace(escapeDataRegExp, escapeReplace);\n}\n\nfunction makeSet(arr) {\n  let set = {};\n  for (let i = 0; i < arr.length; i++) {\n    set[arr[i]] = true;\n  }\n  return set;\n}\n\n// http://www.whatwg.org/specs/web-apps/current-work/#void-elements\nlet voidElements = makeSet([\n  'area',\n  'base',\n  'br',\n  'col',\n  'command',\n  'embed',\n  'hr',\n  'img',\n  'input',\n  'keygen',\n  'link',\n  'meta',\n  'param',\n  'source',\n  'track',\n  'wbr'\n]);\n\nlet plaintextParents = makeSet([\n  'style',\n  'script',\n  'xmp',\n  'iframe',\n  'noembed',\n  'noframes',\n  'plaintext',\n  'noscript'\n]);\n\n/**\n * @param {Node} node\n * @param {Node} parentNode\n * @param {Function=} callback\n */\nexport function getOuterHTML(node, parentNode, callback) {\n  switch (node.nodeType) {\n    case Node.ELEMENT_NODE: {\n      let tagName = node.localName;\n      let s = '<' + tagName;\n      let attrs = node.attributes;\n      for (let i = 0, attr; (attr = attrs[i]); i++) {\n        s += ' ' + attr.name + '=\"' + escapeAttr(attr.value) + '\"';\n      }\n      s += '>';\n      if (voidElements[tagName]) {\n        return s;\n      }\n      return s + getInnerHTML(node, callback) + '</' + tagName + '>';\n    }\n    case Node.TEXT_NODE: {\n      let data = /** @type {Text} */ (node).data;\n      if (parentNode && plaintextParents[parentNode.localName]) {\n        return data;\n      }\n      return escapeData(data);\n    }\n    case Node.COMMENT_NODE: {\n      return '<!--' + /** @type {Comment} */ (node).data + '-->';\n    }\n    default: {\n      window.console.error(node);\n      throw new Error('not implemented');\n    }\n  }\n}\n\n/**\n * @param {Node} node\n * @param {Function=} callback\n */\nexport function getInnerHTML(node, callback) {\n  if (node.localName === 'template') {\n    node =  /** @type {HTMLTemplateElement} */ (node).content;\n  }\n  let s = '';\n  let c$ = callback ? callback(node) : node.childNodes;\n  for (let i=0, l=c$.length, child; (i<l) && (child=c$[i]); i++) {\n    s += getOuterHTML(child, node, callback);\n  }\n  return s;\n}","/**\n@license\nCopyright (c) 2016 The Polymer Project Authors. All rights reserved.\nThis code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt\nThe complete set of authors may be found at http://polymer.github.io/AUTHORS.txt\nThe complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt\nCode distributed by Google as part of the polymer project is also\nsubject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt\n*/\n\n'use strict';\n\nimport {getInnerHTML} from './innerHTML'\n\nlet nodeWalker = document.createTreeWalker(document, NodeFilter.SHOW_ALL,\n  null, false);\n\nlet elementWalker = document.createTreeWalker(document, NodeFilter.SHOW_ELEMENT,\n  null, false);\n\nexport function parentNode(node) {\n  nodeWalker.currentNode = node;\n  return nodeWalker.parentNode();\n}\n\nexport function firstChild(node) {\n  nodeWalker.currentNode = node;\n  return nodeWalker.firstChild();\n}\n\nexport function lastChild(node) {\n  nodeWalker.currentNode = node;\n  return nodeWalker.lastChild();\n}\n\nexport function previousSibling(node) {\n  nodeWalker.currentNode = node;\n  return nodeWalker.previousSibling();\n}\n\nexport function nextSibling(node) {\n  nodeWalker.currentNode = node;\n  return nodeWalker.nextSibling();\n}\n\nexport function childNodes(node) {\n  let nodes = [];\n  nodeWalker.currentNode = node;\n  let n = nodeWalker.firstChild();\n  while (n) {\n    nodes.push(n);\n    n = nodeWalker.nextSibling();\n  }\n  return nodes;\n}\n\nexport function parentElement(node) {\n  elementWalker.currentNode = node;\n  return elementWalker.parentNode();\n}\n\nexport function firstElementChild(node) {\n  elementWalker.currentNode = node;\n  return elementWalker.firstChild();\n}\n\nexport function lastElementChild(node) {\n  elementWalker.currentNode = node;\n  return elementWalker.lastChild();\n}\n\nexport function previousElementSibling(node) {\n  elementWalker.currentNode = node;\n  return elementWalker.previousSibling();\n}\n\nexport function nextElementSibling(node) {\n  elementWalker.currentNode = node;\n  return elementWalker.nextSibling();\n}\n\nexport function children(node) {\n  let nodes = [];\n  elementWalker.currentNode = node;\n  let n = elementWalker.firstChild();\n  while (n) {\n    nodes.push(n);\n    n = elementWalker.nextSibling();\n  }\n  return nodes;\n}\n\nexport function innerHTML(node) {\n  return getInnerHTML(node, (n) => childNodes(n));\n}\n\nexport function textContent(node) {\n  if (node.nodeType !== Node.ELEMENT_NODE) {\n    return node.nodeValue;\n  }\n  let textWalker = document.createTreeWalker(node, NodeFilter.SHOW_TEXT,\n    null, false);\n  let content = '', n;\n  while ( (n = textWalker.nextNode()) ) {\n    // TODO(sorvell): can't use textContent since we patch it on Node.prototype!\n    // However, should probably patch it only on element.\n    content += n.nodeValue;\n  }\n  return content;\n}","/**\n@license\nCopyright (c) 2016 The Polymer Project Authors. All rights reserved.\nThis code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt\nThe complete set of authors may be found at http://polymer.github.io/AUTHORS.txt\nThe complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt\nCode distributed by Google as part of the polymer project is also\nsubject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt\n*/\n\n'use strict';\n\nimport * as utils from './utils'\nimport {getInnerHTML} from './innerHTML'\nimport * as nativeTree from './native-tree'\n\nfunction clearNode(node) {\n  while (node.firstChild) {\n    node.removeChild(node.firstChild);\n  }\n}\n\nconst nativeInnerHTMLDesc = /** @type {ObjectPropertyDescriptor} */(\n  Object.getOwnPropertyDescriptor(Element.prototype, 'innerHTML') ||\n  Object.getOwnPropertyDescriptor(HTMLElement.prototype, 'innerHTML'));\n\nconst inertDoc = document.implementation.createHTMLDocument('inert');\nconst htmlContainer = inertDoc.createElement('div');\n\nconst nativeActiveElementDescriptor =\n  /** @type {ObjectPropertyDescriptor} */(\n    Object.getOwnPropertyDescriptor(Document.prototype, 'activeElement')\n  );\nfunction getDocumentActiveElement() {\n  if (nativeActiveElementDescriptor && nativeActiveElementDescriptor.get) {\n    return nativeActiveElementDescriptor.get.call(document);\n  } else if (!utils.settings.hasDescriptors) {\n    return document.activeElement;\n  }\n}\n\nfunction activeElementForNode(node) {\n  let active = getDocumentActiveElement();\n  // In IE11, activeElement might be an empty object if the document is\n  // contained in an iframe.\n  // https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/10998788/\n  if (!active || !active.nodeType) {\n    return null;\n  }\n  let isShadyRoot = !!(utils.isShadyRoot(node));\n  if (node !== document) {\n    // If this node isn't a document or shady root, then it doesn't have\n    // an active element.\n    if (!isShadyRoot) {\n      return null;\n    }\n    // If this shady root's host is the active element or the active\n    // element is not a descendant of the host (in the composed tree),\n    // then it doesn't have an active element.\n    if (node.host === active ||\n        !node.host.contains(active)) {\n      return null;\n    }\n  }\n  // This node is either the document or a shady root of which the active\n  // element is a (composed) descendant of its host; iterate upwards to\n  // find the active element's most shallow host within it.\n  let activeRoot = utils.ownerShadyRootForNode(active);\n  while (activeRoot && activeRoot !== node) {\n    active = activeRoot.host;\n    activeRoot = utils.ownerShadyRootForNode(active);\n  }\n  if (node === document) {\n    // This node is the document, so activeRoot should be null.\n    return activeRoot ? null : active;\n  } else {\n    // This node is a non-document shady root, and it should be\n    // activeRoot.\n    return activeRoot === node ? active : null;\n  }\n}\n\nlet OutsideAccessors = {\n\n  parentElement: {\n    /** @this {Node} */\n    get() {\n      let l = this.__shady && this.__shady.parentElement;\n      return l !== undefined ? l : nativeTree.parentElement(this);\n    },\n    configurable: true\n  },\n\n  parentNode: {\n    /** @this {Node} */\n    get() {\n      let l = this.__shady && this.__shady.parentNode;\n      return l !== undefined ? l : nativeTree.parentNode(this);\n    },\n    configurable: true\n  },\n\n  nextSibling: {\n    /** @this {Node} */\n    get() {\n      let l = this.__shady && this.__shady.nextSibling;\n      return l !== undefined ? l : nativeTree.nextSibling(this);\n    },\n    configurable: true\n  },\n\n  previousSibling: {\n    /** @this {Node} */\n    get() {\n      let l = this.__shady && this.__shady.previousSibling;\n      return l !== undefined ? l : nativeTree.previousSibling(this);\n    },\n    configurable: true\n  },\n\n  className: {\n    /**\n     * @this {HTMLElement}\n     */\n    get() {\n      return this.getAttribute('class') || '';\n    },\n    /**\n     * @this {HTMLElement}\n     */\n    set(value) {\n      this.setAttribute('class', value);\n    },\n    configurable: true\n  },\n\n  // fragment, element, document\n  nextElementSibling: {\n    /**\n     * @this {HTMLElement}\n     */\n    get() {\n      if (this.__shady && this.__shady.nextSibling !== undefined) {\n        let n = this.nextSibling;\n        while (n && n.nodeType !== Node.ELEMENT_NODE) {\n          n = n.nextSibling;\n        }\n        return n;\n      } else {\n        return nativeTree.nextElementSibling(this);\n      }\n    },\n    configurable: true\n  },\n\n  previousElementSibling: {\n    /**\n     * @this {HTMLElement}\n     */\n    get() {\n      if (this.__shady && this.__shady.previousSibling !== undefined) {\n        let n = this.previousSibling;\n        while (n && n.nodeType !== Node.ELEMENT_NODE) {\n          n = n.previousSibling;\n        }\n        return n;\n      } else {\n        return nativeTree.previousElementSibling(this);\n      }\n    },\n    configurable: true\n  }\n\n};\n\nlet InsideAccessors = {\n\n  childNodes: {\n    /**\n     * @this {HTMLElement}\n     */\n    get() {\n      if (this.__shady && this.__shady.firstChild !== undefined) {\n        if (!this.__shady.childNodes) {\n          this.__shady.childNodes = [];\n          for (let n=this.firstChild; n; n=n.nextSibling) {\n            this.__shady.childNodes.push(n);\n          }\n        }\n        return this.__shady.childNodes;\n      } else {\n        return nativeTree.childNodes(this);\n      }\n    },\n    configurable: true\n  },\n\n  firstChild: {\n    /** @this {HTMLElement} */\n    get() {\n      let l = this.__shady && this.__shady.firstChild;\n      return l !== undefined ? l : nativeTree.firstChild(this);\n    },\n    configurable: true\n  },\n\n  lastChild: {\n  /** @this {HTMLElement} */\n    get() {\n      let l = this.__shady && this.__shady.lastChild;\n      return l !== undefined ? l : nativeTree.lastChild(this);\n    },\n    configurable: true\n  },\n\n  textContent: {\n    /**\n     * @this {HTMLElement}\n     */\n    get() {\n      if (this.__shady && this.__shady.firstChild !== undefined) {\n        let tc = [];\n        for (let i = 0, cn = this.childNodes, c; (c = cn[i]); i++) {\n          if (c.nodeType !== Node.COMMENT_NODE) {\n            tc.push(c.textContent);\n          }\n        }\n        return tc.join('');\n      } else {\n        return nativeTree.textContent(this);\n      }\n    },\n    /**\n     * @this {HTMLElement}\n     */\n    set(text) {\n      if (this.nodeType !== Node.ELEMENT_NODE) {\n        // TODO(sorvell): can't do this if patch nodeValue.\n        this.nodeValue = text;\n      } else {\n        clearNode(this);\n        if (text) {\n          this.appendChild(document.createTextNode(text));\n        }\n      }\n    },\n    configurable: true\n  },\n\n  // fragment, element, document\n  firstElementChild: {\n    /**\n     * @this {HTMLElement}\n     */\n    get() {\n      if (this.__shady && this.__shady.firstChild !== undefined) {\n        let n = this.firstChild;\n        while (n && n.nodeType !== Node.ELEMENT_NODE) {\n          n = n.nextSibling;\n        }\n        return n;\n      } else {\n        return nativeTree.firstElementChild(this);\n      }\n    },\n    configurable: true\n  },\n\n  lastElementChild: {\n    /**\n     * @this {HTMLElement}\n     */\n    get() {\n      if (this.__shady && this.__shady.lastChild !== undefined) {\n        let n = this.lastChild;\n        while (n && n.nodeType !== Node.ELEMENT_NODE) {\n          n = n.previousSibling;\n        }\n        return n;\n      } else {\n        return nativeTree.lastElementChild(this);\n      }\n    },\n    configurable: true\n  },\n\n  children: {\n    /**\n     * @this {HTMLElement}\n     */\n    get() {\n      if (this.__shady && this.__shady.firstChild !== undefined) {\n        return Array.prototype.filter.call(this.childNodes, function(n) {\n          return (n.nodeType === Node.ELEMENT_NODE);\n        });\n      } else {\n        return nativeTree.children(this);\n      }\n    },\n    configurable: true\n  },\n\n  // element (HTMLElement on IE11)\n  innerHTML: {\n    /**\n     * @this {HTMLElement}\n     */\n    get() {\n      let content = this.localName === 'template' ?\n        /** @type {HTMLTemplateElement} */(this).content : this;\n      if (this.__shady && this.__shady.firstChild !== undefined) {\n        return getInnerHTML(content);\n      } else {\n        return nativeTree.innerHTML(content);\n      }\n    },\n    /**\n     * @this {HTMLElement}\n     */\n    set(text) {\n      let content = this.localName === 'template' ?\n        /** @type {HTMLTemplateElement} */(this).content : this;\n      clearNode(content);\n      if (nativeInnerHTMLDesc && nativeInnerHTMLDesc.set) {\n        nativeInnerHTMLDesc.set.call(htmlContainer, text);\n      } else {\n        htmlContainer.innerHTML = text;\n      }\n      while (htmlContainer.firstChild) {\n        content.appendChild(htmlContainer.firstChild);\n      }\n    },\n    configurable: true\n  }\n\n};\n\n// Note: Can be patched on element prototype on all browsers.\n// Must be patched on instance on browsers that support native Shadow DOM\n// but do not have builtin accessors (old Chrome).\nexport let ShadowRootAccessor = {\n\n  shadowRoot: {\n    /**\n     * @this {HTMLElement}\n     */\n    get() {\n      return this.__shady && this.__shady.root || null;\n    },\n    /**\n     * @this {HTMLElement}\n     */\n    set(value) {\n      this.__shady = this.__shady || {};\n      this.__shady.root = value;\n    },\n    configurable: true\n  }\n};\n\n// Note: Can be patched on document prototype on browsers with builtin accessors.\n// Must be patched separately on simulated ShadowRoot.\n// Must be patched as `_activeElement` on browsers without builtin accessors.\nexport let ActiveElementAccessor = {\n\n  activeElement: {\n    /**\n     * @this {HTMLElement}\n     */\n    get() {\n      return activeElementForNode(this);\n    },\n    /**\n     * @this {HTMLElement}\n     */\n    set() {},\n    configurable: true\n  }\n\n};\n\n// patch a group of descriptors on an object only if it exists or if the `force`\n// argument is true.\n/**\n * @param {!Object} obj\n * @param {!Object} descriptors\n * @param {boolean=} force\n */\nfunction patchAccessorGroup(obj, descriptors, force) {\n  for (let p in descriptors) {\n    let objDesc = Object.getOwnPropertyDescriptor(obj, p);\n    if ((objDesc && objDesc.configurable) ||\n      (!objDesc && force)) {\n      Object.defineProperty(obj, p, descriptors[p]);\n    } else if (force) {\n      console.warn('Could not define', p, 'on', obj);\n    }\n  }\n}\n\n// patch dom accessors on proto where they exist\nexport function patchAccessors(proto) {\n  patchAccessorGroup(proto, OutsideAccessors);\n  patchAccessorGroup(proto, InsideAccessors);\n  patchAccessorGroup(proto, ActiveElementAccessor);\n}\n\n// ensure element descriptors (IE/Edge don't have em)\nexport function patchShadowRootAccessors(proto) {\n  patchAccessorGroup(proto, InsideAccessors, true);\n  patchAccessorGroup(proto, ActiveElementAccessor, true);\n}\n\n// ensure an element has patched \"outside\" accessors; no-op when not needed\nexport let patchOutsideElementAccessors = utils.settings.hasDescriptors ?\n  function() {} : function(element) {\n    if (!(element.__shady && element.__shady.__outsideAccessors)) {\n      element.__shady = element.__shady || {};\n      element.__shady.__outsideAccessors = true;\n      patchAccessorGroup(element, OutsideAccessors, true);\n    }\n  }\n\n// ensure an element has patched \"inside\" accessors; no-op when not needed\nexport let patchInsideElementAccessors = utils.settings.hasDescriptors ?\n  function() {} : function(element) {\n    if (!(element.__shady && element.__shady.__insideAccessors)) {\n      element.__shady = element.__shady || {};\n      element.__shady.__insideAccessors = true;\n      patchAccessorGroup(element, InsideAccessors, true);\n      patchAccessorGroup(element, ShadowRootAccessor, true);\n    }\n  }\n","/**\n@license\nCopyright (c) 2016 The Polymer Project Authors. All rights reserved.\nThis code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt\nThe complete set of authors may be found at http://polymer.github.io/AUTHORS.txt\nThe complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt\nCode distributed by Google as part of the polymer project is also\nsubject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt\n*/\n\n'use strict';\n\nimport * as utils from './utils'\nimport * as logicalTree from './logical-tree'\nimport * as nativeMethods from './native-methods'\nimport {parentNode} from './native-tree'\n\n/**\n * Try to add node. Record logical info, track insertion points, perform\n * distribution iff needed. Return true if the add is handled.\n * @param {Node} container\n * @param {Node} node\n * @param {Node} ref_node\n * @return {boolean}\n */\nfunction addNode(container, node, ref_node) {\n  let ownerRoot = utils.ownerShadyRootForNode(container);\n  let ipAdded;\n  if (ownerRoot) {\n    // optimization: special insertion point tracking\n    // TODO(sorvell): verify that the renderPending check here should not be needed.\n    if (node['__noInsertionPoint'] && !ownerRoot._changePending) {\n      ownerRoot._skipUpdateInsertionPoints = true;\n    }\n    // note: we always need to see if an insertion point is added\n    // since this saves logical tree info; however, invalidation state\n    // needs\n    ipAdded = _maybeAddInsertionPoint(node, container, ownerRoot);\n    // invalidate insertion points IFF not already invalid!\n    if (ipAdded) {\n      ownerRoot._skipUpdateInsertionPoints = false;\n    }\n  }\n  if (container.__shady && container.__shady.firstChild !== undefined) {\n    logicalTree.recordInsertBefore(node, container, ref_node);\n  }\n  // if not distributing and not adding to host, do a fast path addition\n  // TODO(sorvell): revisit flow since `ipAdded` needed here if\n  // node is a fragment that has a patched QSA.\n  let handled = _maybeDistribute(node, container, ownerRoot, ipAdded) ||\n    container.__shady.root ||\n    // TODO(sorvell): we *should* consider the add \"handled\"\n    // if the container or ownerRoot is `_renderPending`.\n    // However, this will regress performance right now and is blocked on a\n    // fix for https://github.com/webcomponents/shadydom/issues/95\n    // handled if ref_node parent is a root that is rendering.\n    (ref_node && utils.isShadyRoot(ref_node.parentNode) &&\n      ref_node.parentNode._renderPending);\n  return handled;\n}\n\n\n/**\n * Try to remove node: update logical info and perform distribution iff\n * needed. Return true if the removal has been handled.\n * note that it's possible for both the node's host and its parent\n * to require distribution... both cases are handled here.\n * @param {Node} node\n * @return {boolean}\n */\nfunction removeNode(node) {\n  // important that we want to do this only if the node has a logical parent\n  let logicalParent = node.__shady && node.__shady.parentNode;\n  let distributed;\n  let ownerRoot = utils.ownerShadyRootForNode(node);\n  if (logicalParent || ownerRoot) {\n    // distribute node's parent iff needed\n    distributed = maybeDistributeParent(node);\n    if (logicalParent) {\n      logicalTree.recordRemoveChild(node, logicalParent);\n    }\n    // remove node from root and distribute it iff needed\n    let removedDistributed = ownerRoot &&\n      _removeDistributedChildren(ownerRoot, node);\n    let addedInsertionPoint = (logicalParent && ownerRoot &&\n      logicalParent.localName === ownerRoot.getInsertionPointTag());\n    if (removedDistributed || addedInsertionPoint) {\n      ownerRoot._skipUpdateInsertionPoints = false;\n      updateRootViaContentChange(ownerRoot);\n    }\n  }\n  _removeOwnerShadyRoot(node);\n  return distributed;\n}\n\n/**\n * @param {Node} node\n * @param {Node=} addedNode\n * @param {Node=} removedNode\n */\nfunction _scheduleObserver(node, addedNode, removedNode) {\n  let observer = node.__shady && node.__shady.observer;\n  if (observer) {\n    if (addedNode) {\n      observer.addedNodes.push(addedNode);\n    }\n    if (removedNode) {\n      observer.removedNodes.push(removedNode);\n    }\n    observer.schedule();\n  }\n}\n\nfunction removeNodeFromParent(node, logicalParent) {\n  if (logicalParent) {\n    _scheduleObserver(logicalParent, null, node);\n    return removeNode(node);\n  } else {\n    // composed but not logical parent\n    if (node.parentNode) {\n      nativeMethods.removeChild.call(node.parentNode, node);\n    }\n    _removeOwnerShadyRoot(node);\n  }\n}\n\nfunction _hasCachedOwnerRoot(node) {\n  return Boolean(node.__shady && node.__shady.ownerShadyRoot !== undefined);\n}\n\n/**\n * @param {Node} node\n * @param {Object=} options\n */\nexport function getRootNode(node, options) { // eslint-disable-line no-unused-vars\n  if (!node || !node.nodeType) {\n    return;\n  }\n  node.__shady = node.__shady || {};\n  let root = node.__shady.ownerShadyRoot;\n  if (root === undefined) {\n    if (utils.isShadyRoot(node)) {\n      root = node;\n    } else {\n      let parent = node.parentNode;\n      root = parent ? getRootNode(parent) : node;\n    }\n    // memo-ize result for performance but only memo-ize\n    // result if node is in the document. This avoids a problem where a root\n    // can be cached while an element is inside a fragment.\n    // If this happens and we cache the result, the value can become stale\n    // because for perf we avoid processing the subtree of added fragments.\n    if (document.documentElement.contains(node)) {\n      node.__shady.ownerShadyRoot = root;\n    }\n  }\n  return root;\n}\n\nfunction _maybeDistribute(node, container, ownerRoot, ipAdded) {\n  // TODO(sorvell): technically we should check non-fragment nodes for\n  // <content> children but since this case is assumed to be exceedingly\n  // rare, we avoid the cost and will address with some specific api\n  // when the need arises.  For now, the user must call\n  // distributeContent(true), which updates insertion points manually\n  // and forces distribution.\n  let insertionPointTag = ownerRoot && ownerRoot.getInsertionPointTag() || '';\n  let fragContent = (node.nodeType === Node.DOCUMENT_FRAGMENT_NODE) &&\n    !node['__noInsertionPoint'] &&\n    insertionPointTag && node.querySelector(insertionPointTag);\n  let wrappedContent = fragContent &&\n    (fragContent.parentNode.nodeType !==\n    Node.DOCUMENT_FRAGMENT_NODE);\n  let hasContent = fragContent || (node.localName === insertionPointTag);\n  // There are 3 possible cases where a distribution may need to occur:\n  // 1. <content> being inserted (the host of the shady root where\n  //    content is inserted needs distribution)\n  // 2. children being inserted into parent with a shady root (parent\n  //    needs distribution)\n  // 3. container is an insertionPoint\n  if (hasContent || (container.localName === insertionPointTag) || ipAdded) {\n    if (ownerRoot) {\n      // note, insertion point list update is handled after node\n      // mutations are complete\n      updateRootViaContentChange(ownerRoot);\n    }\n  }\n  let needsDist = _nodeNeedsDistribution(container);\n  if (needsDist) {\n    let root = container.__shady && container.__shady.root;\n    updateRootViaContentChange(root);\n  }\n  // Return true when distribution will fully handle the composition\n  // Note that if a content was being inserted that was wrapped by a node,\n  // and the parent does not need distribution, return false to allow\n  // the nodes to be added directly, after which children may be\n  // distributed and composed into the wrapping node(s)\n  return needsDist || (hasContent && !wrappedContent);\n}\n\n/* note: parent argument is required since node may have an out\nof date parent at this point; returns true if a <content> is being added */\nfunction _maybeAddInsertionPoint(node, parent, root) {\n  let added;\n  let insertionPointTag = root.getInsertionPointTag();\n  if (node.nodeType === Node.DOCUMENT_FRAGMENT_NODE &&\n    !node['__noInsertionPoint']) {\n    let c$ = node.querySelectorAll(insertionPointTag);\n    for (let i=0, n, np, na; (i<c$.length) && (n=c$[i]); i++) {\n      np = n.parentNode;\n      // don't allow node's parent to be fragment itself\n      if (np === node) {\n        np = parent;\n      }\n      na = _maybeAddInsertionPoint(n, np, root);\n      added = added || na;\n    }\n  } else if (node.localName === insertionPointTag) {\n    logicalTree.recordChildNodes(parent);\n    logicalTree.recordChildNodes(node);\n    added = true;\n  }\n  return added;\n}\n\nfunction _nodeNeedsDistribution(node) {\n  let root = node && node.__shady && node.__shady.root;\n  return root && root.hasInsertionPoint();\n}\n\nfunction _removeDistributedChildren(root, container) {\n  let hostNeedsDist;\n  let ip$ = root._getInsertionPoints();\n  for (let i=0; i<ip$.length; i++) {\n    let insertionPoint = ip$[i];\n    if (_contains(container, insertionPoint)) {\n      let dc$ = insertionPoint.assignedNodes({flatten: true});\n      for (let j=0; j<dc$.length; j++) {\n        hostNeedsDist = true;\n        let node = dc$[j];\n        let parent = parentNode(node);\n        if (parent) {\n          nativeMethods.removeChild.call(parent, node);\n        }\n      }\n    }\n  }\n  return hostNeedsDist;\n}\n\nfunction _contains(container, node) {\n  while (node) {\n    if (node == container) {\n      return true;\n    }\n    node = node.parentNode;\n  }\n}\n\nfunction _removeOwnerShadyRoot(node) {\n  // optimization: only reset the tree if node is actually in a root\n  if (_hasCachedOwnerRoot(node)) {\n    let c$ = node.childNodes;\n    for (let i=0, l=c$.length, n; (i<l) && (n=c$[i]); i++) {\n      _removeOwnerShadyRoot(n);\n    }\n  }\n  node.__shady = node.__shady || {};\n  node.__shady.ownerShadyRoot = undefined;\n}\n\n// TODO(sorvell): This will fail if distribution that affects this\n// question is pending; this is expected to be exceedingly rare, but if\n// the issue comes up, we can force a flush in this case.\nfunction firstComposedNode(insertionPoint) {\n  let n$ = insertionPoint.assignedNodes({flatten: true});\n  let root = getRootNode(insertionPoint);\n  for (let i=0, l=n$.length, n; (i<l) && (n=n$[i]); i++) {\n    // means that we're composed to this spot.\n    if (root.isFinalDestination(insertionPoint, n)) {\n      return n;\n    }\n  }\n}\n\nfunction maybeDistributeParent(node) {\n  let parent = node.parentNode;\n  if (_nodeNeedsDistribution(parent)) {\n    updateRootViaContentChange(parent.__shady.root);\n    return true;\n  }\n}\n\nfunction updateRootViaContentChange(root) {\n  // mark root as mutation based on a mutation\n  root._changePending = true;\n  root.update();\n}\n\nfunction distributeAttributeChange(node, name) {\n  if (name === 'slot') {\n    maybeDistributeParent(node);\n  } else if (node.localName === 'slot' && name === 'name') {\n    let root = utils.ownerShadyRootForNode(node);\n    if (root) {\n      root.update();\n    }\n  }\n}\n\n// NOTE: `query` is used primarily for ShadyDOM's querySelector impl,\n// but it's also generally useful to recurse through the element tree\n// and is used by Polymer's styling system.\n/**\n * @param {Node} node\n * @param {Function} matcher\n * @param {Function=} halter\n */\nexport function query(node, matcher, halter) {\n  let list = [];\n  _queryElements(node.childNodes, matcher,\n    halter, list);\n  return list;\n}\n\nfunction _queryElements(elements, matcher, halter, list) {\n  for (let i=0, l=elements.length, c; (i<l) && (c=elements[i]); i++) {\n    if (c.nodeType === Node.ELEMENT_NODE &&\n        _queryElement(c, matcher, halter, list)) {\n      return true;\n    }\n  }\n}\n\nfunction _queryElement(node, matcher, halter, list) {\n  let result = matcher(node);\n  if (result) {\n    list.push(node);\n  }\n  if (halter && halter(result)) {\n    return result;\n  }\n  _queryElements(node.childNodes, matcher,\n    halter, list);\n}\n\nexport function renderRootNode(element) {\n  var root = element.getRootNode();\n  if (utils.isShadyRoot(root)) {\n    root.render();\n  }\n}\n\nlet scopingShim = null;\n\nexport function setAttribute(node, attr, value) {\n  if (!scopingShim) {\n    scopingShim = window['ShadyCSS'] && window['ShadyCSS']['ScopingShim'];\n  }\n  if (scopingShim && attr === 'class') {\n    scopingShim['setElementClass'](node, value);\n  } else {\n    nativeMethods.setAttribute.call(node, attr, value);\n    distributeAttributeChange(node, attr);\n  }\n}\n\nexport function removeAttribute(node, attr) {\n  nativeMethods.removeAttribute.call(node, attr);\n  distributeAttributeChange(node, attr);\n}\n\n// cases in which we may not be able to just do standard native call\n// 1. container has a shadyRoot (needsDistribution IFF the shadyRoot\n// has an insertion point)\n// 2. container is a shadyRoot (don't distribute, instead set\n// container to container.host.\n// 3. node is <content> (host of container needs distribution)\n/**\n * @param {Node} parent\n * @param {Node} node\n * @param {Node=} ref_node\n */\nexport function insertBefore(parent, node, ref_node) {\n  if (ref_node) {\n    let p = ref_node.__shady && ref_node.__shady.parentNode;\n    if ((p !== undefined && p !== parent) ||\n      (p === undefined && parentNode(ref_node) !== parent)) {\n      throw Error(`Failed to execute 'insertBefore' on 'Node': The node ` +\n       `before which the new node is to be inserted is not a child of this node.`);\n    }\n  }\n  if (ref_node === node) {\n    return node;\n  }\n  // remove node from its current position iff it's in a tree.\n  if (node.nodeType !== Node.DOCUMENT_FRAGMENT_NODE) {\n    let parent = node.__shady && node.__shady.parentNode;\n    removeNodeFromParent(node, parent);\n  }\n  if (!addNode(parent, node, ref_node)) {\n    if (ref_node) {\n      // if ref_node is an insertion point replace with first distributed node\n      let root = utils.ownerShadyRootForNode(ref_node);\n      if (root) {\n        ref_node = ref_node.localName === root.getInsertionPointTag() ?\n          firstComposedNode(/** @type {!HTMLSlotElement} */(ref_node)) : ref_node;\n      }\n    }\n    // if adding to a shadyRoot, add to host instead\n    let container = utils.isShadyRoot(parent) ? /** @type {ShadowRoot} */(parent).host : parent;\n    if (ref_node) {\n      nativeMethods.insertBefore.call(container, node, ref_node);\n    } else {\n      nativeMethods.appendChild.call(container, node);\n    }\n  }\n  _scheduleObserver(parent, node);\n  return node;\n}\n\n/**\n  Removes the given `node` from the element's `lightChildren`.\n  This method also performs dom composition.\n*/\nexport function removeChild(parent, node) {\n  if (node.parentNode !== parent) {\n    throw Error('The node to be removed is not a child of this node: ' +\n      node);\n  }\n  if (!removeNode(node)) {\n    // if removing from a shadyRoot, remove form host instead\n    let container = utils.isShadyRoot(parent) ?\n      parent.host :\n      parent;\n    // not guaranteed to physically be in container; e.g.\n    // undistributed nodes.\n    let nativeParent = parentNode(node);\n    if (container === nativeParent) {\n      nativeMethods.removeChild.call(container, node);\n    }\n  }\n  _scheduleObserver(parent, null, node);\n  return node;\n}\n\nexport function cloneNode(node, deep) {\n  if (node.localName == 'template') {\n    return nativeMethods.cloneNode.call(node, deep);\n  } else {\n    let n = nativeMethods.cloneNode.call(node, false);\n    if (deep) {\n      let c$ = node.childNodes;\n      for (let i=0, nc; i < c$.length; i++) {\n        nc = c$[i].cloneNode(true);\n        n.appendChild(nc);\n      }\n    }\n    return n;\n  }\n}\n\n// note: Though not technically correct, we fast path `importNode`\n// when called on a node not owned by the main document.\n// This allows, for example, elements that cannot\n// contain custom elements and are therefore not likely to contain shadowRoots\n// to cloned natively. This is a fairly significant performance win.\nexport function importNode(node, deep) {\n  if (node.ownerDocument !== document) {\n    return nativeMethods.importNode.call(document, node, deep);\n  }\n  let n = nativeMethods.importNode.call(document, node, false);\n  if (deep) {\n    let c$ = node.childNodes;\n    for (let i=0, nc; i < c$.length; i++) {\n      nc = importNode(c$[i], true);\n      n.appendChild(nc);\n    }\n  }\n  return n;\n}\n","/**\n@license\nCopyright (c) 2016 The Polymer Project Authors. All rights reserved.\nThis code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt\nThe complete set of authors may be found at http://polymer.github.io/AUTHORS.txt\nThe complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt\nCode distributed by Google as part of the polymer project is also\nsubject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt\n*/\n\n'use strict';\n\nimport * as utils from './utils'\nimport {addEventListener as nativeAddEventListener,\n  removeEventListener as nativeRemoveEventListener} from './native-methods'\n\n// https://github.com/w3c/webcomponents/issues/513#issuecomment-224183937\nlet alwaysComposed = {\n  'blur': true,\n  'focus': true,\n  'focusin': true,\n  'focusout': true,\n  'click': true,\n  'dblclick': true,\n  'mousedown': true,\n  'mouseenter': true,\n  'mouseleave': true,\n  'mousemove': true,\n  'mouseout': true,\n  'mouseover': true,\n  'mouseup': true,\n  'wheel': true,\n  'beforeinput': true,\n  'input': true,\n  'keydown': true,\n  'keyup': true,\n  'compositionstart': true,\n  'compositionupdate': true,\n  'compositionend': true,\n  'touchstart': true,\n  'touchend': true,\n  'touchmove': true,\n  'touchcancel': true,\n  'pointerover': true,\n  'pointerenter': true,\n  'pointerdown': true,\n  'pointermove': true,\n  'pointerup': true,\n  'pointercancel': true,\n  'pointerout': true,\n  'pointerleave': true,\n  'gotpointercapture': true,\n  'lostpointercapture': true,\n  'dragstart': true,\n  'drag': true,\n  'dragenter': true,\n  'dragleave': true,\n  'dragover': true,\n  'drop': true,\n  'dragend': true,\n  'DOMActivate': true,\n  'DOMFocusIn': true,\n  'DOMFocusOut': true,\n  'keypress': true\n};\n\nfunction pathComposer(startNode, composed) {\n  let composedPath = [];\n  let current = startNode;\n  let startRoot = startNode === window ? window : startNode.getRootNode();\n  while (current) {\n    composedPath.push(current);\n    if (current.assignedSlot) {\n      current = current.assignedSlot;\n    } else if (current.nodeType === Node.DOCUMENT_FRAGMENT_NODE && current.host && (composed || current !== startRoot)) {\n      current = current.host;\n    } else {\n      current = current.parentNode;\n    }\n  }\n  // event composedPath includes window when startNode's ownerRoot is document\n  if (composedPath[composedPath.length - 1] === document) {\n    composedPath.push(window);\n  }\n  return composedPath;\n}\n\nfunction retarget(refNode, path) {\n  if (!utils.isShadyRoot) {\n    return refNode;\n  }\n  // If ANCESTOR's root is not a shadow root or ANCESTOR's root is BASE's\n  // shadow-including inclusive ancestor, return ANCESTOR.\n  let refNodePath = pathComposer(refNode, true);\n  let p$ = path;\n  for (let i=0, ancestor, lastRoot, root, rootIdx; i < p$.length; i++) {\n    ancestor = p$[i];\n    root = ancestor === window ? window : ancestor.getRootNode();\n    if (root !== lastRoot) {\n      rootIdx = refNodePath.indexOf(root);\n      lastRoot = root;\n    }\n    if (!utils.isShadyRoot(root) || rootIdx > -1) {\n      return ancestor;\n    }\n  }\n}\n\nlet eventMixin = {\n\n  /**\n   * @this {Event}\n   */\n  get composed() {\n    // isTrusted may not exist in this browser, so just check if isTrusted is explicitly false\n    if (this.isTrusted !== false && this.__composed === undefined) {\n      this.__composed = alwaysComposed[this.type];\n    }\n    return this.__composed || false;\n  },\n\n  /**\n   * @this {Event}\n   */\n  composedPath() {\n    if (!this.__composedPath) {\n      this.__composedPath = pathComposer(this['__target'], this.composed);\n    }\n    return this.__composedPath;\n  },\n\n  /**\n   * @this {Event}\n   */\n  get target() {\n    return retarget(this.currentTarget, this.composedPath());\n  },\n\n  // http://w3c.github.io/webcomponents/spec/shadow/#event-relatedtarget-retargeting\n  /**\n   * @this {Event}\n   */\n  get relatedTarget() {\n    if (!this.__relatedTarget) {\n      return null;\n    }\n    if (!this.__relatedTargetComposedPath) {\n      this.__relatedTargetComposedPath = pathComposer(this.__relatedTarget, true);\n    }\n    // find the deepest node in relatedTarget composed path that is in the same root with the currentTarget\n    return retarget(this.currentTarget, this.__relatedTargetComposedPath);\n  },\n  /**\n   * @this {Event}\n   */\n  stopPropagation() {\n    Event.prototype.stopPropagation.call(this);\n    this.__propagationStopped = true;\n  },\n  /**\n   * @this {Event}\n   */\n  stopImmediatePropagation() {\n    Event.prototype.stopImmediatePropagation.call(this);\n    this.__immediatePropagationStopped = true;\n    this.__propagationStopped = true;\n  }\n\n};\n\nfunction mixinComposedFlag(Base) {\n  // NOTE: avoiding use of `class` here so that transpiled output does not\n  // try to do `Base.call` with a dom construtor.\n  let klazz = function(type, options) {\n    let event = new Base(type, options);\n    event.__composed = options && Boolean(options['composed']);\n    return event;\n  }\n  // put constructor properties on subclass\n  utils.mixin(klazz, Base);\n  klazz.prototype = Base.prototype;\n  return klazz;\n}\n\nlet nonBubblingEventsToRetarget = {\n  'focus': true,\n  'blur': true\n};\n\n\nfunction fireHandlers(event, node, phase) {\n  let hs = node.__handlers && node.__handlers[event.type] &&\n    node.__handlers[event.type][phase];\n  if (hs) {\n    for (let i = 0, fn; (fn = hs[i]); i++) {\n      if (event.target === event.relatedTarget) {\n        return;\n      }\n      fn.call(node, event);\n      if (event.__immediatePropagationStopped) {\n        return;\n      }\n    }\n  }\n}\n\nfunction retargetNonBubblingEvent(e) {\n  let path = e.composedPath();\n  let node;\n  // override `currentTarget` to let patched `target` calculate correctly\n  Object.defineProperty(e, 'currentTarget', {\n    get: function() {\n      return node;\n    },\n    configurable: true\n  });\n  for (let i = path.length - 1; i >= 0; i--) {\n    node = path[i];\n    // capture phase fires all capture handlers\n    fireHandlers(e, node, 'capture');\n    if (e.__propagationStopped) {\n      return;\n    }\n  }\n\n  // set the event phase to `AT_TARGET` as in spec\n  Object.defineProperty(e, 'eventPhase', {get() { return Event.AT_TARGET }});\n\n  // the event only needs to be fired when owner roots change when iterating the event path\n  // keep track of the last seen owner root\n  let lastFiredRoot;\n  for (let i = 0; i < path.length; i++) {\n    node = path[i];\n    if (i === 0 || (node.shadowRoot && node.shadowRoot === lastFiredRoot)) {\n      fireHandlers(e, node, 'bubble');\n      // don't bother with window, it doesn't have `getRootNode` and will be last in the path anyway\n      if (node !== window) {\n        lastFiredRoot = node.getRootNode();\n      }\n      if (e.__propagationStopped) {\n        return;\n      }\n    }\n  }\n}\n\nfunction listenerSettingsEqual(savedListener, node, type, capture, once, passive) {\n  let {\n    node: savedNode,\n    type: savedType,\n    capture: savedCapture,\n    once: savedOnce,\n    passive: savedPassive\n  } = savedListener;\n  return node === savedNode &&\n    type === savedType &&\n    capture === savedCapture &&\n    once === savedOnce &&\n    passive === savedPassive;\n}\n\nexport function findListener(wrappers, node, type, capture, once, passive) {\n  for (let i = 0; i < wrappers.length; i++) {\n    if (listenerSettingsEqual(wrappers[i], node, type, capture, once, passive)) {\n      return i;\n    }\n  }\n  return -1;\n}\n\n/**\n * @this {Event}\n */\nexport function addEventListener(type, fn, optionsOrCapture) {\n  if (!fn) {\n    return;\n  }\n\n  // The callback `fn` might be used for multiple nodes/events. Since we generate\n  // a wrapper function, we need to keep track of it when we remove the listener.\n  // It's more efficient to store the node/type/options information as Array in\n  // `fn` itself rather than the node (we assume that the same callback is used\n  // for few nodes at most, whereas a node will likely have many event listeners).\n  // NOTE(valdrin) invoking external functions is costly, inline has better perf.\n  let capture, once, passive;\n  if (typeof optionsOrCapture === 'object') {\n    capture = Boolean(optionsOrCapture.capture);\n    once = Boolean(optionsOrCapture.once);\n    passive = Boolean(optionsOrCapture.passive);\n  } else {\n    capture = Boolean(optionsOrCapture);\n    once = false;\n    passive = false;\n  }\n  // hack to let ShadyRoots have event listeners\n  // event listener will be on host, but `currentTarget`\n  // will be set to shadyroot for event listener\n  let target = optionsOrCapture && optionsOrCapture.__shadyTarget || this;\n\n  if (fn.__eventWrappers) {\n    // Stop if the wrapper function has already been created.\n    if (findListener(fn.__eventWrappers, target, type, capture, once, passive) > -1) {\n      return;\n    }\n  } else {\n    fn.__eventWrappers = [];\n  }\n\n  /**\n   * @this {HTMLElement}\n   */\n  const wrapperFn = function(e) {\n    // Support `once` option.\n    if (once) {\n      this.removeEventListener(type, fn, optionsOrCapture);\n    }\n    if (!e['__target']) {\n      patchEvent(e);\n    }\n    let lastCurrentTargetDesc;\n    if (target !== this) {\n      // replace `currentTarget` to make `target` and `relatedTarget` correct for inside the shadowroot\n      lastCurrentTargetDesc = Object.getOwnPropertyDescriptor(e, 'currentTarget');\n      Object.defineProperty(e, 'currentTarget', {get() { return target }, configurable: true});\n    }\n    // There are two critera that should stop events from firing on this node\n    // 1. the event is not composed and the current node is not in the same root as the target\n    // 2. when bubbling, if after retargeting, relatedTarget and target point to the same node\n    if (e.composed || e.composedPath().indexOf(target) > -1) {\n      if (e.target === e.relatedTarget) {\n        if (e.eventPhase === Event.BUBBLING_PHASE) {\n          e.stopImmediatePropagation();\n        }\n        return;\n      }\n      // prevent non-bubbling events from triggering bubbling handlers on shadowroot, but only if not in capture phase\n      if (e.eventPhase !== Event.CAPTURING_PHASE && !e.bubbles && e.target !== target) {\n        return;\n      }\n      let ret = fn.call(target, e);\n      if (target !== this) {\n        // replace the \"correct\" `currentTarget`\n        if (lastCurrentTargetDesc) {\n          Object.defineProperty(e, 'currentTarget', lastCurrentTargetDesc);\n          lastCurrentTargetDesc = null;\n        } else {\n          delete e['currentTarget'];\n        }\n      }\n      return ret;\n    }\n  };\n  // Store the wrapper information.\n  fn.__eventWrappers.push({\n    node: this,\n    type: type,\n    capture: capture,\n    once: once,\n    passive: passive,\n    wrapperFn: wrapperFn\n  });\n\n  if (nonBubblingEventsToRetarget[type]) {\n    this.__handlers = this.__handlers || {};\n    this.__handlers[type] = this.__handlers[type] ||\n      {'capture': [], 'bubble': []};\n    this.__handlers[type][capture ? 'capture' : 'bubble'].push(wrapperFn);\n  } else {\n    nativeAddEventListener.call(this, type, wrapperFn, optionsOrCapture);\n  }\n}\n\n/**\n * @this {Event}\n */\nexport function removeEventListener(type, fn, optionsOrCapture) {\n  if (!fn) {\n    return;\n  }\n\n  // NOTE(valdrin) invoking external functions is costly, inline has better perf.\n  let capture, once, passive;\n  if (typeof optionsOrCapture === 'object') {\n    capture = Boolean(optionsOrCapture.capture);\n    once = Boolean(optionsOrCapture.once);\n    passive = Boolean(optionsOrCapture.passive);\n  } else {\n    capture = Boolean(optionsOrCapture);\n    once = false;\n    passive = false;\n  }\n  let target = optionsOrCapture && optionsOrCapture.__shadyTarget || this;\n  // Search the wrapped function.\n  let wrapperFn = undefined;\n  if (fn.__eventWrappers) {\n    let idx = findListener(fn.__eventWrappers, target, type, capture, once, passive);\n    if (idx > -1) {\n      wrapperFn = fn.__eventWrappers.splice(idx, 1)[0].wrapperFn;\n      // Cleanup.\n      if (!fn.__eventWrappers.length) {\n        fn.__eventWrappers = undefined;\n      }\n    }\n  }\n\n  nativeRemoveEventListener.call(this, type, wrapperFn || fn, optionsOrCapture);\n  if (wrapperFn && nonBubblingEventsToRetarget[type] &&\n      this.__handlers && this.__handlers[type]) {\n    const arr = this.__handlers[type][capture ? 'capture' : 'bubble'];\n    const idx = arr.indexOf(wrapperFn);\n    if (idx > -1) {\n      arr.splice(idx, 1);\n    }\n  }\n}\n\nfunction activateFocusEventOverrides() {\n  for (let ev in nonBubblingEventsToRetarget) {\n    window.addEventListener(ev, function(e) {\n      if (!e['__target']) {\n        patchEvent(e);\n        retargetNonBubblingEvent(e);\n      }\n    }, true);\n  }\n}\n\nfunction patchEvent(event) {\n  event['__target'] = event.target;\n  event.__relatedTarget = event.relatedTarget;\n  // patch event prototype if we can\n  if (utils.settings.hasDescriptors) {\n    utils.patchPrototype(event, eventMixin);\n  // and fallback to patching instance\n  } else {\n    utils.extend(event, eventMixin);\n  }\n}\n\nlet PatchedEvent = mixinComposedFlag(window.Event);\nlet PatchedCustomEvent = mixinComposedFlag(window.CustomEvent);\nlet PatchedMouseEvent = mixinComposedFlag(window.MouseEvent);\n\nexport function patchEvents() {\n  window.Event = PatchedEvent;\n  window.CustomEvent = PatchedCustomEvent;\n  window.MouseEvent = PatchedMouseEvent;\n  activateFocusEventOverrides();\n}\n","/**\n@license\nCopyright (c) 2016 The Polymer Project Authors. All rights reserved.\nThis code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt\nThe complete set of authors may be found at http://polymer.github.io/AUTHORS.txt\nThe complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt\nCode distributed by Google as part of the polymer project is also\nsubject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt\n*/\n\n'use strict';\n\nfunction newSplice(index, removed, addedCount) {\n  return {\n    index: index,\n    removed: removed,\n    addedCount: addedCount\n  };\n}\n\nconst EDIT_LEAVE = 0;\nconst EDIT_UPDATE = 1;\nconst EDIT_ADD = 2;\nconst EDIT_DELETE = 3;\n\n// Note: This function is *based* on the computation of the Levenshtein\n// \"edit\" distance. The one change is that \"updates\" are treated as two\n// edits - not one. With Array splices, an update is really a delete\n// followed by an add. By retaining this, we optimize for \"keeping\" the\n// maximum array items in the original array. For example:\n//\n//   'xxxx123' -> '123yyyy'\n//\n// With 1-edit updates, the shortest path would be just to update all seven\n// characters. With 2-edit updates, we delete 4, leave 3, and add 4. This\n// leaves the substring '123' intact.\nfunction calcEditDistances(current, currentStart, currentEnd,\n                            old, oldStart, oldEnd) {\n  // \"Deletion\" columns\n  let rowCount = oldEnd - oldStart + 1;\n  let columnCount = currentEnd - currentStart + 1;\n  let distances = new Array(rowCount);\n\n  // \"Addition\" rows. Initialize null column.\n  for (let i = 0; i < rowCount; i++) {\n    distances[i] = new Array(columnCount);\n    distances[i][0] = i;\n  }\n\n  // Initialize null row\n  for (let j = 0; j < columnCount; j++)\n    distances[0][j] = j;\n\n  for (let i = 1; i < rowCount; i++) {\n    for (let j = 1; j < columnCount; j++) {\n      if (equals(current[currentStart + j - 1], old[oldStart + i - 1]))\n        distances[i][j] = distances[i - 1][j - 1];\n      else {\n        let north = distances[i - 1][j] + 1;\n        let west = distances[i][j - 1] + 1;\n        distances[i][j] = north < west ? north : west;\n      }\n    }\n  }\n\n  return distances;\n}\n\n// This starts at the final weight, and walks \"backward\" by finding\n// the minimum previous weight recursively until the origin of the weight\n// matrix.\nfunction spliceOperationsFromEditDistances(distances) {\n  let i = distances.length - 1;\n  let j = distances[0].length - 1;\n  let current = distances[i][j];\n  let edits = [];\n  while (i > 0 || j > 0) {\n    if (i == 0) {\n      edits.push(EDIT_ADD);\n      j--;\n      continue;\n    }\n    if (j == 0) {\n      edits.push(EDIT_DELETE);\n      i--;\n      continue;\n    }\n    let northWest = distances[i - 1][j - 1];\n    let west = distances[i - 1][j];\n    let north = distances[i][j - 1];\n\n    let min;\n    if (west < north)\n      min = west < northWest ? west : northWest;\n    else\n      min = north < northWest ? north : northWest;\n\n    if (min == northWest) {\n      if (northWest == current) {\n        edits.push(EDIT_LEAVE);\n      } else {\n        edits.push(EDIT_UPDATE);\n        current = northWest;\n      }\n      i--;\n      j--;\n    } else if (min == west) {\n      edits.push(EDIT_DELETE);\n      i--;\n      current = west;\n    } else {\n      edits.push(EDIT_ADD);\n      j--;\n      current = north;\n    }\n  }\n\n  edits.reverse();\n  return edits;\n}\n\n/**\n * Splice Projection functions:\n *\n * A splice map is a representation of how a previous array of items\n * was transformed into a new array of items. Conceptually it is a list of\n * tuples of\n *\n *   <index, removed, addedCount>\n *\n * which are kept in ascending index order of. The tuple represents that at\n * the |index|, |removed| sequence of items were removed, and counting forward\n * from |index|, |addedCount| items were added.\n */\n\n/**\n * Lacking individual splice mutation information, the minimal set of\n * splices can be synthesized given the previous state and final state of an\n * array. The basic approach is to calculate the edit distance matrix and\n * choose the shortest path through it.\n *\n * Complexity: O(l * p)\n *   l: The length of the current array\n *   p: The length of the old array\n */\nfunction calcSplices(current, currentStart, currentEnd,\n                      old, oldStart, oldEnd) {\n  let prefixCount = 0;\n  let suffixCount = 0;\n  let splice;\n\n  let minLength = Math.min(currentEnd - currentStart, oldEnd - oldStart);\n  if (currentStart == 0 && oldStart == 0)\n    prefixCount = sharedPrefix(current, old, minLength);\n\n  if (currentEnd == current.length && oldEnd == old.length)\n    suffixCount = sharedSuffix(current, old, minLength - prefixCount);\n\n  currentStart += prefixCount;\n  oldStart += prefixCount;\n  currentEnd -= suffixCount;\n  oldEnd -= suffixCount;\n\n  if (currentEnd - currentStart == 0 && oldEnd - oldStart == 0)\n    return [];\n\n  if (currentStart == currentEnd) {\n    splice = newSplice(currentStart, [], 0);\n    while (oldStart < oldEnd)\n      splice.removed.push(old[oldStart++]);\n\n    return [ splice ];\n  } else if (oldStart == oldEnd)\n    return [ newSplice(currentStart, [], currentEnd - currentStart) ];\n\n  let ops = spliceOperationsFromEditDistances(\n      calcEditDistances(current, currentStart, currentEnd,\n                             old, oldStart, oldEnd));\n\n  splice = undefined;\n  let splices = [];\n  let index = currentStart;\n  let oldIndex = oldStart;\n  for (let i = 0; i < ops.length; i++) {\n    switch(ops[i]) {\n      case EDIT_LEAVE:\n        if (splice) {\n          splices.push(splice);\n          splice = undefined;\n        }\n\n        index++;\n        oldIndex++;\n        break;\n      case EDIT_UPDATE:\n        if (!splice)\n          splice = newSplice(index, [], 0);\n\n        splice.addedCount++;\n        index++;\n\n        splice.removed.push(old[oldIndex]);\n        oldIndex++;\n        break;\n      case EDIT_ADD:\n        if (!splice)\n          splice = newSplice(index, [], 0);\n\n        splice.addedCount++;\n        index++;\n        break;\n      case EDIT_DELETE:\n        if (!splice)\n          splice = newSplice(index, [], 0);\n\n        splice.removed.push(old[oldIndex]);\n        oldIndex++;\n        break;\n    }\n  }\n\n  if (splice) {\n    splices.push(splice);\n  }\n  return splices;\n}\n\nfunction sharedPrefix(current, old, searchLength) {\n  for (let i = 0; i < searchLength; i++)\n    if (!equals(current[i], old[i]))\n      return i;\n  return searchLength;\n}\n\nfunction sharedSuffix(current, old, searchLength) {\n  let index1 = current.length;\n  let index2 = old.length;\n  let count = 0;\n  while (count < searchLength && equals(current[--index1], old[--index2]))\n    count++;\n\n  return count;\n}\n\nfunction equals(currentValue, previousValue) {\n  return currentValue === previousValue;\n}\n\nexport function calculateSplices(current, previous) {\n  return calcSplices(current, 0, current.length, previous, 0,\n                          previous.length);\n}\n\n","/**\n@license\nCopyright (c) 2016 The Polymer Project Authors. All rights reserved.\nThis code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt\nThe complete set of authors may be found at http://polymer.github.io/AUTHORS.txt\nThe complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt\nCode distributed by Google as part of the polymer project is also\nsubject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt\n*/\n\n'use strict';\n\nimport * as utils from './utils'\nimport * as mutation from './logical-mutation'\nimport {ActiveElementAccessor, ShadowRootAccessor, patchAccessors} from './patch-accessors'\nimport {addEventListener, removeEventListener} from './patch-events'\nimport {attachShadow, ShadyRoot} from './attach-shadow'\n\nfunction getAssignedSlot(node) {\n  mutation.renderRootNode(node);\n  return node.__shady && node.__shady.assignedSlot || null;\n}\n\nlet nodeMixin = {\n\n  addEventListener: addEventListener,\n\n  removeEventListener: removeEventListener,\n\n  appendChild(node) {\n    return mutation.insertBefore(this, node);\n  },\n\n  insertBefore(node, ref_node) {\n    return mutation.insertBefore(this, node, ref_node);\n  },\n\n  removeChild(node) {\n    return mutation.removeChild(this, node);\n  },\n\n  /**\n   * @this {Node}\n   */\n  replaceChild(node, ref_node) {\n    this.insertBefore(node, ref_node);\n    this.removeChild(ref_node);\n    return node;\n  },\n\n  /**\n   * @this {Node}\n   */\n  cloneNode(deep) {\n    return mutation.cloneNode(this, deep);\n  },\n\n  /**\n   * @this {Node}\n   */\n  getRootNode(options) {\n    return mutation.getRootNode(this, options);\n  },\n\n  /**\n   * @this {Node}\n   */\n  get isConnected() {\n    // Fast path for distributed nodes.\n    const ownerDocument = this.ownerDocument;\n    if (ownerDocument && ownerDocument.contains && ownerDocument.contains(this)) return true;\n    const ownerDocumentElement = ownerDocument.documentElement;\n    if (ownerDocumentElement && ownerDocumentElement.contains && ownerDocumentElement.contains(this)) return true;\n\n    let node = this;\n    while (node && !(node instanceof Document)) {\n      node = node.parentNode || (node instanceof ShadyRoot ? /** @type {ShadowRoot} */(node).host : undefined);\n    }\n    return !!(node && node instanceof Document);\n  }\n\n};\n\n// NOTE: For some reason `Text` redefines `assignedSlot`\nlet textMixin = {\n  /**\n   * @this {Text}\n   */\n  get assignedSlot() {\n    return getAssignedSlot(this);\n  }\n};\n\nlet fragmentMixin = {\n\n  // TODO(sorvell): consider doing native QSA and filtering results.\n  /**\n   * @this {DocumentFragment}\n   */\n  querySelector(selector) {\n    // match selector and halt on first result.\n    let result = mutation.query(this, function(n) {\n      return utils.matchesSelector(n, selector);\n    }, function(n) {\n      return Boolean(n);\n    })[0];\n    return result || null;\n  },\n\n  /**\n   * @this {DocumentFragment}\n   */\n  querySelectorAll(selector) {\n    return mutation.query(this, function(n) {\n      return utils.matchesSelector(n, selector);\n    });\n  }\n\n};\n\nlet slotMixin = {\n\n  /**\n   * @this {HTMLSlotElement}\n   */\n  assignedNodes(options) {\n    if (this.localName === 'slot') {\n      mutation.renderRootNode(this);\n      return this.__shady ?\n        ((options && options.flatten ? this.__shady.distributedNodes :\n        this.__shady.assignedNodes) || []) :\n        [];\n    }\n  }\n\n};\n\nlet elementMixin = utils.extendAll({\n\n  /**\n   * @this {HTMLElement}\n   */\n  setAttribute(name, value) {\n    mutation.setAttribute(this, name, value);\n  },\n\n  /**\n   * @this {HTMLElement}\n   */\n  removeAttribute(name) {\n    mutation.removeAttribute(this, name);\n  },\n\n  /**\n   * @this {HTMLElement}\n   */\n  attachShadow(options) {\n    return attachShadow(this, options);\n  },\n\n  /**\n   * @this {HTMLElement}\n   */\n  get slot() {\n    return this.getAttribute('slot');\n  },\n\n  /**\n   * @this {HTMLElement}\n   */\n  set slot(value) {\n    this.setAttribute('slot', value);\n  },\n\n  /**\n   * @this {HTMLElement}\n   */\n  get assignedSlot() {\n    return getAssignedSlot(this);\n  }\n\n}, fragmentMixin, slotMixin);\n\nObject.defineProperties(elementMixin, ShadowRootAccessor);\n\nlet documentMixin = utils.extendAll({\n  /**\n   * @this {Document}\n   */\n  importNode(node, deep) {\n    return mutation.importNode(node, deep);\n  }\n}, fragmentMixin);\n\nObject.defineProperties(documentMixin, {\n  '_activeElement': ActiveElementAccessor.activeElement\n});\n\nlet nativeBlur = HTMLElement.prototype.blur;\n\nlet htmlElementMixin = utils.extendAll({\n  /**\n   * @this {HTMLElement}\n   */\n  blur() {\n    let root = this.shadowRoot;\n    let shadowActive = root && root.activeElement;\n    if (shadowActive) {\n      shadowActive.blur();\n    } else {\n      nativeBlur.call(this);\n    }\n  }\n})\n\nfunction patchBuiltin(proto, obj) {\n  let n$ = Object.getOwnPropertyNames(obj);\n  for (let i=0; i < n$.length; i++) {\n    let n = n$[i];\n    let d = Object.getOwnPropertyDescriptor(obj, n);\n    // NOTE: we prefer writing directly here because some browsers\n    // have descriptors that are writable but not configurable (e.g.\n    // `appendChild` on older browsers)\n    if (d.value) {\n      proto[n] = d.value;\n    } else {\n      Object.defineProperty(proto, n, d);\n    }\n  }\n}\n\n\n// Apply patches to builtins (e.g. Element.prototype). Some of these patches\n// can be done unconditionally (mostly methods like\n// `Element.prototype.appendChild`) and some can only be done when the browser\n// has proper descriptors on the builtin prototype\n// (e.g. `Element.prototype.firstChild`)`. When descriptors are not available,\n// elements are individually patched when needed (see e.g.\n// `patchInside/OutsideElementAccessors` in `patch-accessors.js`).\nexport function patchBuiltins() {\n  let nativeHTMLElement =\n    (window['customElements'] && window['customElements']['nativeHTMLElement']) ||\n    HTMLElement;\n  // These patches can always be done, for all supported browsers.\n  patchBuiltin(window.Node.prototype, nodeMixin);\n  patchBuiltin(window.Text.prototype, textMixin);\n  patchBuiltin(window.DocumentFragment.prototype, fragmentMixin);\n  patchBuiltin(window.Element.prototype, elementMixin);\n  patchBuiltin(window.Document.prototype, documentMixin);\n  if (window.HTMLSlotElement) {\n    patchBuiltin(window.HTMLSlotElement.prototype, slotMixin);\n  }\n  patchBuiltin(nativeHTMLElement.prototype, htmlElementMixin);\n  // These patches can *only* be done\n  // on browsers that have proper property descriptors on builtin prototypes.\n  // This includes: IE11, Edge, Chrome >= 4?; Safari >= 10, Firefox\n  // On older browsers (Chrome <= 4?, Safari 9), a per element patching\n  // strategy is used for patching accessors.\n  if (utils.settings.hasDescriptors) {\n    patchAccessors(window.Node.prototype);\n    patchAccessors(window.Text.prototype);\n    patchAccessors(window.DocumentFragment.prototype);\n    patchAccessors(window.Element.prototype);\n    patchAccessors(nativeHTMLElement.prototype);\n    patchAccessors(window.Document.prototype);\n    if (window.HTMLSlotElement) {\n      patchAccessors(window.HTMLSlotElement.prototype);\n    }\n  }\n}\n","const reservedTagList = new Set([\n  'annotation-xml',\n  'color-profile',\n  'font-face',\n  'font-face-src',\n  'font-face-uri',\n  'font-face-format',\n  'font-face-name',\n  'missing-glyph',\n]);\n\n/**\n * @param {string} localName\n * @returns {boolean}\n */\nexport function isValidCustomElementName(localName) {\n  const reserved = reservedTagList.has(localName);\n  const validForm = /^[a-z][.0-9_a-z]*-[\\-.0-9_a-z]*$/.test(localName);\n  return !reserved && validForm;\n}\n\n/**\n * @private\n * @param {!Node} node\n * @return {boolean}\n */\nexport function isConnected(node) {\n  // Use `Node#isConnected`, if defined.\n  const nativeValue = node.isConnected;\n  if (nativeValue !== undefined) {\n    return nativeValue;\n  }\n\n  /** @type {?Node|undefined} */\n  let current = node;\n  while (current && !(current.__CE_isImportDocument || current instanceof Document)) {\n    current = current.parentNode || (window.ShadowRoot && current instanceof ShadowRoot ? current.host : undefined);\n  }\n  return !!(current && (current.__CE_isImportDocument || current instanceof Document));\n}\n\n/**\n * @param {!Node} root\n * @param {!Node} start\n * @return {?Node}\n */\nfunction nextSiblingOrAncestorSibling(root, start) {\n  let node = start;\n  while (node && node !== root && !node.nextSibling) {\n    node = node.parentNode;\n  }\n  return (!node || node === root) ? null : node.nextSibling;\n}\n\n/**\n * @param {!Node} root\n * @param {!Node} start\n * @return {?Node}\n */\nfunction nextNode(root, start) {\n  return start.firstChild ? start.firstChild : nextSiblingOrAncestorSibling(root, start);\n}\n\n/**\n * @param {!Node} root\n * @param {!function(!Element)} callback\n * @param {!Set<Node>=} visitedImports\n */\nexport function walkDeepDescendantElements(root, callback, visitedImports = new Set()) {\n  let node = root;\n  while (node) {\n    if (node.nodeType === Node.ELEMENT_NODE) {\n      const element = /** @type {!Element} */(node);\n\n      callback(element);\n\n      const localName = element.localName;\n      if (localName === 'link' && element.getAttribute('rel') === 'import') {\n        // If this import (polyfilled or not) has it's root node available,\n        // walk it.\n        const importNode = /** @type {!Node} */ (element.import);\n        if (importNode instanceof Node && !visitedImports.has(importNode)) {\n          // Prevent multiple walks of the same import root.\n          visitedImports.add(importNode);\n\n          for (let child = importNode.firstChild; child; child = child.nextSibling) {\n            walkDeepDescendantElements(child, callback, visitedImports);\n          }\n        }\n\n        // Ignore descendants of import links to prevent attempting to walk the\n        // elements created by the HTML Imports polyfill that we just walked\n        // above.\n        node = nextSiblingOrAncestorSibling(root, element);\n        continue;\n      } else if (localName === 'template') {\n        // Ignore descendants of templates. There shouldn't be any descendants\n        // because they will be moved into `.content` during construction in\n        // browsers that support template but, in case they exist and are still\n        // waiting to be moved by a polyfill, they will be ignored.\n        node = nextSiblingOrAncestorSibling(root, element);\n        continue;\n      }\n\n      // Walk shadow roots.\n      const shadowRoot = element.__CE_shadowRoot;\n      if (shadowRoot) {\n        for (let child = shadowRoot.firstChild; child; child = child.nextSibling) {\n          walkDeepDescendantElements(child, callback, visitedImports);\n        }\n      }\n    }\n\n    node = nextNode(root, node);\n  }\n}\n\n/**\n * Used to suppress Closure's \"Modifying the prototype is only allowed if the\n * constructor is in the same scope\" warning without using\n * `@suppress {newCheckTypes, duplicate}` because `newCheckTypes` is too broad.\n *\n * @param {!Object} destination\n * @param {string} name\n * @param {*} value\n */\nexport function setPropertyUnchecked(destination, name, value) {\n  destination[name] = value;\n}\n","/**\n@license\nCopyright (c) 2017 The Polymer Project Authors. All rights reserved.\nThis code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt\nThe complete set of authors may be found at http://polymer.github.io/AUTHORS.txt\nThe complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt\nCode distributed by Google as part of the polymer project is also\nsubject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt\n*/\n\n'use strict';\n\nexport let nativeShadow = !(window['ShadyDOM'] && window['ShadyDOM']['inUse']);\n// chrome 49 has semi-working css vars, check if box-shadow works\n// safari 9.1 has a recalc bug: https://bugs.webkit.org/show_bug.cgi?id=155782\nexport let nativeCssVariables = (!navigator.userAgent.match('AppleWebKit/601') &&\nwindow.CSS && CSS.supports && CSS.supports('box-shadow', '0 0 0 var(--foo)'));\n\n/**\n * @param {ShadyCSSOptions | ShadyCSSInterface | undefined} settings\n */\nfunction parseSettings(settings) {\n  if (settings) {\n    nativeCssVariables = nativeCssVariables && !settings['nativeCss'] && !settings['shimcssproperties'];\n    nativeShadow = nativeShadow && !settings['nativeShadow'] && !settings['shimshadow'];\n  }\n}\n\nif (window.ShadyCSS) {\n  parseSettings(window.ShadyCSS);\n} else if (window['WebComponents']) {\n  parseSettings(window['WebComponents']['flags']);\n}\n","/**\n@license\nCopyright (c) 2017 The Polymer Project Authors. All rights reserved.\nThis code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt\nThe complete set of authors may be found at http://polymer.github.io/AUTHORS.txt\nThe complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt\nCode distributed by Google as part of the polymer project is also\nsubject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt\n*/\n\n'use strict';\n\nimport {nativeShadow, nativeCssVariables} from './style-settings'\nimport {parse, stringify, types, StyleNode} from './css-parse' // eslint-disable-line no-unused-vars\nimport {MEDIA_MATCH} from './common-regex';\n\n/**\n * @param {string|StyleNode} rules\n * @param {function(StyleNode)=} callback\n * @return {string}\n */\nexport function toCssText (rules, callback) {\n  if (!rules) {\n    return '';\n  }\n  if (typeof rules === 'string') {\n    rules = parse(rules);\n  }\n  if (callback) {\n    forEachRule(rules, callback);\n  }\n  return stringify(rules, nativeCssVariables);\n}\n\n/**\n * @param {HTMLStyleElement} style\n * @return {StyleNode}\n */\nexport function rulesForStyle(style) {\n  if (!style['__cssRules'] && style.textContent) {\n    style['__cssRules'] = parse(style.textContent);\n  }\n  return style['__cssRules'] || null;\n}\n\n// Tests if a rule is a keyframes selector, which looks almost exactly\n// like a normal selector but is not (it has nothing to do with scoping\n// for example).\n/**\n * @param {StyleNode} rule\n * @return {boolean}\n */\nexport function isKeyframesSelector(rule) {\n  return Boolean(rule['parent']) &&\n  rule['parent']['type'] === types.KEYFRAMES_RULE;\n}\n\n/**\n * @param {StyleNode} node\n * @param {Function=} styleRuleCallback\n * @param {Function=} keyframesRuleCallback\n * @param {boolean=} onlyActiveRules\n */\nexport function forEachRule(node, styleRuleCallback, keyframesRuleCallback, onlyActiveRules) {\n  if (!node) {\n    return;\n  }\n  let skipRules = false;\n  let type = node['type'];\n  if (onlyActiveRules) {\n    if (type === types.MEDIA_RULE) {\n      let matchMedia = node['selector'].match(MEDIA_MATCH);\n      if (matchMedia) {\n        // if rule is a non matching @media rule, skip subrules\n        if (!window.matchMedia(matchMedia[1]).matches) {\n          skipRules = true;\n        }\n      }\n    }\n  }\n  if (type === types.STYLE_RULE) {\n    styleRuleCallback(node);\n  } else if (keyframesRuleCallback &&\n    type === types.KEYFRAMES_RULE) {\n    keyframesRuleCallback(node);\n  } else if (type === types.MIXIN_RULE) {\n    skipRules = true;\n  }\n  let r$ = node['rules'];\n  if (r$ && !skipRules) {\n    for (let i=0, l=r$.length, r; (i<l) && (r=r$[i]); i++) {\n      forEachRule(r, styleRuleCallback, keyframesRuleCallback, onlyActiveRules);\n    }\n  }\n}\n\n// add a string of cssText to the document.\n/**\n * @param {string} cssText\n * @param {string} moniker\n * @param {Node} target\n * @param {Node} contextNode\n * @return {HTMLStyleElement}\n */\nexport function applyCss(cssText, moniker, target, contextNode) {\n  let style = createScopeStyle(cssText, moniker);\n  applyStyle(style, target, contextNode);\n  return style;\n}\n\n/**\n * @param {string} cssText\n * @param {string} moniker\n * @return {HTMLStyleElement}\n */\nexport function createScopeStyle(cssText, moniker) {\n  let style = /** @type {HTMLStyleElement} */(document.createElement('style'));\n  if (moniker) {\n    style.setAttribute('scope', moniker);\n  }\n  style.textContent = cssText;\n  return style;\n}\n\n/**\n * Track the position of the last added style for placing placeholders\n * @type {Node}\n */\nlet lastHeadApplyNode = null;\n\n// insert a comment node as a styling position placeholder.\n/**\n * @param {string} moniker\n * @return {!Comment}\n */\nexport function applyStylePlaceHolder(moniker) {\n  let placeHolder = document.createComment(' Shady DOM styles for ' +\n    moniker + ' ');\n  let after = lastHeadApplyNode ?\n    lastHeadApplyNode['nextSibling'] : null;\n  let scope = document.head;\n  scope.insertBefore(placeHolder, after || scope.firstChild);\n  lastHeadApplyNode = placeHolder;\n  return placeHolder;\n}\n\n/**\n * @param {HTMLStyleElement} style\n * @param {?Node} target\n * @param {?Node} contextNode\n */\nexport function applyStyle(style, target, contextNode) {\n  target = target || document.head;\n  let after = (contextNode && contextNode.nextSibling) ||\n    target.firstChild;\n  target.insertBefore(style, after);\n  if (!lastHeadApplyNode) {\n    lastHeadApplyNode = style;\n  } else {\n    // only update lastHeadApplyNode if the new style is inserted after the old lastHeadApplyNode\n    let position = style.compareDocumentPosition(lastHeadApplyNode);\n    if (position === Node.DOCUMENT_POSITION_PRECEDING) {\n      lastHeadApplyNode = style;\n    }\n  }\n}\n\n/**\n * @param {string} buildType\n * @return {boolean}\n */\nexport function isTargetedBuild(buildType) {\n  return nativeShadow ? buildType === 'shadow' : buildType === 'shady';\n}\n\n/**\n * @param {Element} element\n * @return {?string}\n */\nexport function getCssBuildType(element) {\n  return element.getAttribute('css-build');\n}\n\n/**\n * Walk from text[start] matching parens and\n * returns position of the outer end paren\n * @param {string} text\n * @param {number} start\n * @return {number}\n */\nfunction findMatchingParen(text, start) {\n  let level = 0;\n  for (let i=start, l=text.length; i < l; i++) {\n    if (text[i] === '(') {\n      level++;\n    } else if (text[i] === ')') {\n      if (--level === 0) {\n        return i;\n      }\n    }\n  }\n  return -1;\n}\n\n/**\n * @param {string} str\n * @param {function(string, string, string, string)} callback\n */\nexport function processVariableAndFallback(str, callback) {\n  // find 'var('\n  let start = str.indexOf('var(');\n  if (start === -1) {\n    // no var?, everything is prefix\n    return callback(str, '', '', '');\n  }\n  //${prefix}var(${inner})${suffix}\n  let end = findMatchingParen(str, start + 3);\n  let inner = str.substring(start + 4, end);\n  let prefix = str.substring(0, start);\n  // suffix may have other variables\n  let suffix = processVariableAndFallback(str.substring(end + 1), callback);\n  let comma = inner.indexOf(',');\n  // value and fallback args should be trimmed to match in property lookup\n  if (comma === -1) {\n    // variable, no fallback\n    return callback(prefix, inner.trim(), '', suffix);\n  }\n  // var(${value},${fallback})\n  let value = inner.substring(0, comma).trim();\n  let fallback = inner.substring(comma + 1).trim();\n  return callback(prefix, value, fallback, suffix);\n}\n\n/**\n * @param {Element} element\n * @param {string} value\n */\nexport function setElementClassRaw(element, value) {\n  // use native setAttribute provided by ShadyDOM when setAttribute is patched\n  if (nativeShadow) {\n    element.setAttribute('class', value);\n  } else {\n    window['ShadyDOM']['nativeMethods']['setAttribute'].call(element, 'class', value);\n  }\n}\n\n/**\n * @param {Element | {is: string, extends: string}} element\n * @return {{is: string, typeExtension: string}}\n */\nexport function getIsExtends(element) {\n  let localName = element['localName'];\n  let is = '', typeExtension = '';\n  /*\n  NOTE: technically, this can be wrong for certain svg elements\n  with `-` in the name like `<font-face>`\n  */\n  if (localName) {\n    if (localName.indexOf('-') > -1) {\n      is = localName;\n    } else {\n      typeExtension = localName;\n      is = (element.getAttribute && element.getAttribute('is')) || '';\n    }\n  } else {\n    is = /** @type {?} */(element).is;\n    typeExtension = /** @type {?} */(element).extends;\n  }\n  return {is, typeExtension};\n}","/**\n@license\nCopyright (c) 2017 The Polymer Project Authors. All rights reserved.\nThis code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt\nThe complete set of authors may be found at http://polymer.github.io/AUTHORS.txt\nThe complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt\nCode distributed by Google as part of the polymer project is also\nsubject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt\n*/\n\n'use strict';\nimport templateMap from './template-map'\nimport {StyleNode} from './css-parse' // eslint-disable-line no-unused-vars\n\n/*\n * Utilities for handling invalidating apply-shim mixins for a given template.\n *\n * The invalidation strategy involves keeping track of the \"current\" version of a template's mixins, and updating that count when a mixin is invalidated.\n * The template\n */\n\n/** @const {string} */\nconst CURRENT_VERSION = '_applyShimCurrentVersion';\n\n/** @const {string} */\nconst NEXT_VERSION = '_applyShimNextVersion';\n\n/** @const {string} */\nconst VALIDATING_VERSION = '_applyShimValidatingVersion';\n\n/**\n * @const {Promise<void>}\n */\nconst promise = Promise.resolve();\n\n/**\n * @param {string} elementName\n */\nexport function invalidate(elementName){\n  let template = templateMap[elementName];\n  if (template) {\n    invalidateTemplate(template);\n  }\n}\n\n/**\n * This function can be called multiple times to mark a template invalid\n * and signal that the style inside must be regenerated.\n *\n * Use `startValidatingTemplate` to begin an asynchronous validation cycle.\n * During that cycle, call `templateIsValidating` to see if the template must\n * be revalidated\n * @param {HTMLTemplateElement} template\n */\nexport function invalidateTemplate(template) {\n  // default the current version to 0\n  template[CURRENT_VERSION] = template[CURRENT_VERSION] || 0;\n  // ensure the \"validating for\" flag exists\n  template[VALIDATING_VERSION] = template[VALIDATING_VERSION] || 0;\n  // increment the next version\n  template[NEXT_VERSION] = (template[NEXT_VERSION] || 0) + 1;\n}\n\n/**\n * @param {string} elementName\n * @return {boolean}\n */\nexport function isValid(elementName) {\n  let template = templateMap[elementName];\n  if (template) {\n    return templateIsValid(template);\n  }\n  return true;\n}\n\n/**\n * @param {HTMLTemplateElement} template\n * @return {boolean}\n */\nexport function templateIsValid(template) {\n  return template[CURRENT_VERSION] === template[NEXT_VERSION];\n}\n\n/**\n * @param {string} elementName\n * @return {boolean}\n */\nexport function isValidating(elementName) {\n  let template = templateMap[elementName];\n  if (template) {\n    return templateIsValidating(template);\n  }\n  return false;\n}\n\n/**\n * Returns true if the template is currently invalid and `startValidating` has been called since the last invalidation.\n * If false, the template must be validated.\n * @param {HTMLTemplateElement} template\n * @return {boolean}\n */\nexport function templateIsValidating(template) {\n  return !templateIsValid(template) && template[VALIDATING_VERSION] === template[NEXT_VERSION];\n}\n\n/**\n * the template is marked as `validating` for one microtask so that all instances\n * found in the tree crawl of `applyStyle` will update themselves,\n * but the template will only be updated once.\n * @param {string} elementName\n*/\nexport function startValidating(elementName) {\n  let template = templateMap[elementName];\n  startValidatingTemplate(template);\n}\n\n/**\n * Begin an asynchronous invalidation cycle.\n * This should be called after every validation of a template\n *\n * After one microtask, the template will be marked as valid until the next call to `invalidateTemplate`\n * @param {HTMLTemplateElement} template\n */\nexport function startValidatingTemplate(template) {\n  // remember that the current \"next version\" is the reason for this validation cycle\n  template[VALIDATING_VERSION] = template[NEXT_VERSION];\n  // however, there only needs to be one async task to clear the counters\n  if (!template._validating) {\n    template._validating = true;\n    promise.then(function() {\n      // sync the current version to let future invalidations cause a refresh cycle\n      template[CURRENT_VERSION] = template[NEXT_VERSION];\n      template._validating = false;\n    });\n  }\n}\n\n/**\n * @return {boolean}\n */\nexport function elementsAreInvalid() {\n  for (let elementName in templateMap) {\n    let template = templateMap[elementName];\n    if (!templateIsValid(template)) {\n      return true;\n    }\n  }\n  return false;\n}","/**\n@license\nCopyright (c) 2017 The Polymer Project Authors. All rights reserved.\nThis code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt\nThe complete set of authors may be found at http://polymer.github.io/AUTHORS.txt\nThe complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt\nCode distributed by Google as part of the polymer project is also\nsubject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt\n*/\n\n'use strict';\n\n/** @type {Promise<void>} */\nlet readyPromise = null;\n\n/** @type {?function(?function())} */\nlet whenReady = window['HTMLImports'] && window['HTMLImports']['whenReady'] || null;\n\n/** @type {function()} */\nlet resolveFn;\n\n/**\n * @param {?function()} callback\n */\nexport default function documentWait(callback) {\n  requestAnimationFrame(function() {\n    if (whenReady) {\n      whenReady(callback)\n    } else {\n      if (!readyPromise) {\n        readyPromise = new Promise((resolve) => {resolveFn = resolve});\n        if (document.readyState === 'complete') {\n          resolveFn();\n        } else {\n          document.addEventListener('readystatechange', () => {\n            if (document.readyState === 'complete') {\n              resolveFn();\n            }\n          });\n        }\n      }\n      readyPromise.then(function(){ callback && callback(); });\n    }\n  });\n}\n","/**\n * @license\n * Copyright (c) 2016 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt\n */\n\n(function(scope) {\n\n  'use strict';\n\n  // defaultPrevented is broken in IE.\n  // https://connect.microsoft.com/IE/feedback/details/790389/event-defaultprevented-returns-false-after-preventdefault-was-called\n  var workingDefaultPrevented = (function() {\n    var e = document.createEvent('Event');\n    e.initEvent('foo', true, true);\n    e.preventDefault();\n    return e.defaultPrevented;\n  })();\n\n  if (!workingDefaultPrevented) {\n    var origPreventDefault = Event.prototype.preventDefault;\n    Event.prototype.preventDefault = function() {\n      if (!this.cancelable) {\n        return;\n      }\n\n      origPreventDefault.call(this);\n\n      Object.defineProperty(this, 'defaultPrevented', {\n        get: function() {\n          return true;\n        },\n        configurable: true\n      });\n    };\n  }\n\n  var isIE = /Trident/.test(navigator.userAgent);\n\n  // CustomEvent constructor shim\n  if (!window.CustomEvent || isIE && (typeof window.CustomEvent !== 'function')) {\n    window.CustomEvent = function(inType, params) {\n      params = params || {};\n      var e = document.createEvent('CustomEvent');\n      e.initCustomEvent(inType, Boolean(params.bubbles), Boolean(params.cancelable), params.detail);\n      return e;\n    };\n    window.CustomEvent.prototype = window.Event.prototype;\n  }\n\n  // Event constructor shim\n  if (!window.Event || isIE && (typeof window.Event !== 'function')) {\n    var origEvent = window.Event;\n    window.Event = function(inType, params) {\n      params = params || {};\n      var e = document.createEvent('Event');\n      e.initEvent(inType, Boolean(params.bubbles), Boolean(params.cancelable));\n      return e;\n    };\n    if (origEvent) {\n      for (var i in origEvent) {\n        window.Event[i] = origEvent[i];\n      }\n    }\n    window.Event.prototype = origEvent.prototype;\n  }\n\n  if (!window.MouseEvent || isIE && (typeof window.MouseEvent !== 'function')) {\n    var origMouseEvent = window.MouseEvent;\n    window.MouseEvent = function(inType, params) {\n      params = params || {};\n      var e = document.createEvent('MouseEvent');\n      e.initMouseEvent(inType,\n        Boolean(params.bubbles), Boolean(params.cancelable),\n        params.view || window, params.detail,\n        params.screenX, params.screenY, params.clientX, params.clientY,\n        params.ctrlKey, params.altKey, params.shiftKey, params.metaKey,\n        params.button, params.relatedTarget);\n      return e;\n    };\n    if (origMouseEvent) {\n      for (var i in origMouseEvent) {\n        window.MouseEvent[i] = origMouseEvent[i];\n      }\n    }\n    window.MouseEvent.prototype = origMouseEvent.prototype;\n  }\n\n  // ES6 stuff\n  if (!Array.from) {\n    Array.from = function (object) {\n      return [].slice.call(object);\n    };\n  }\n\n  if (!Object.assign) {\n    var assign = function(target, source) {\n      var n$ = Object.getOwnPropertyNames(source);\n      for (var i=0, p; i < n$.length; i++) {\n        p = n$[i];\n        target[p] = source[p];\n      }\n    }\n\n    Object.assign = function(target, sources) {\n      var args = [].slice.call(arguments, 1);\n      for (var i=0, s; i < args.length; i++) {\n        s = args[i];\n        if (s) {\n          assign(target, s);\n        }\n      }\n      return target;\n    }\n  }\n\n})(window.WebComponents);\n","/**\n * @license\n * Copyright (c) 2016 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt\n */\n\n// minimal template polyfill\n(function() {\n\n  var needsTemplate = (typeof HTMLTemplateElement === 'undefined');\n\n  // NOTE: Patch document.importNode to work around IE11 bug that\n  // casues children of a document fragment imported while\n  // there is a mutation observer to not have a parentNode (!?!)\n  // It's important that this is the first patch to `importNode` so that\n  // dom produced for later patches is correct.\n  if (/Trident/.test(navigator.userAgent)) {\n    (function() {\n      var Native_importNode = Document.prototype.importNode;\n      Document.prototype.importNode = function() {\n        var n = Native_importNode.apply(this, arguments);\n        // Copy all children to a new document fragment since\n        // this one may be broken\n        if (n.nodeType === Node.DOCUMENT_FRAGMENT_NODE) {\n          var f = this.createDocumentFragment();\n          f.appendChild(n);\n          return f;\n        } else {\n          return n;\n        }\n      };\n    })();\n  }\n\n  // NOTE: we rely on this cloneNode not causing element upgrade.\n  // This means this polyfill must load before the CE polyfill and\n  // this would need to be re-worked if a browser supports native CE\n  // but not <template>.\n  var Native_cloneNode = Node.prototype.cloneNode;\n  var Native_createElement = Document.prototype.createElement;\n  var Native_importNode = Document.prototype.importNode;\n\n  // returns true if nested templates cannot be cloned (they cannot be on\n  // some impl's like Safari 8 and Edge)\n  // OR if cloning a document fragment does not result in a document fragment\n  var needsCloning = (function() {\n    if (!needsTemplate) {\n      var t = document.createElement('template');\n      var t2 = document.createElement('template');\n      t2.content.appendChild(document.createElement('div'));\n      t.content.appendChild(t2);\n      var clone = t.cloneNode(true);\n      return (clone.content.childNodes.length === 0 || clone.content.firstChild.content.childNodes.length === 0\n        || !(document.createDocumentFragment().cloneNode() instanceof DocumentFragment));\n    }\n  })();\n\n  var TEMPLATE_TAG = 'template';\n  var PolyfilledHTMLTemplateElement = function() {};\n\n  if (needsTemplate) {\n\n    var contentDoc = document.implementation.createHTMLDocument('template');\n    var canDecorate = true;\n\n    var templateStyle = document.createElement('style');\n    templateStyle.textContent = TEMPLATE_TAG + '{display:none;}';\n\n    var head = document.head;\n    head.insertBefore(templateStyle, head.firstElementChild);\n\n    /**\n      Provides a minimal shim for the <template> element.\n    */\n    PolyfilledHTMLTemplateElement.prototype = Object.create(HTMLElement.prototype);\n\n\n    // if elements do not have `innerHTML` on instances, then\n    // templates can be patched by swizzling their prototypes.\n    var canProtoPatch =\n      !(document.createElement('div').hasOwnProperty('innerHTML'));\n\n    /**\n      The `decorate` method moves element children to the template's `content`.\n      NOTE: there is no support for dynamically adding elements to templates.\n    */\n    PolyfilledHTMLTemplateElement.decorate = function(template) {\n      // if the template is decorated, return fast\n      if (template.content) {\n        return;\n      }\n      template.content = contentDoc.createDocumentFragment();\n      var child;\n      while (child = template.firstChild) {\n        template.content.appendChild(child);\n      }\n      // NOTE: prefer prototype patching for performance and\n      // because on some browsers (IE11), re-defining `innerHTML`\n      // can result in intermittent errors.\n      if (canProtoPatch) {\n        template.__proto__ = PolyfilledHTMLTemplateElement.prototype;\n      } else {\n        template.cloneNode = function(deep) {\n          return PolyfilledHTMLTemplateElement._cloneNode(this, deep);\n        };\n        // add innerHTML to template, if possible\n        // Note: this throws on Safari 7\n        if (canDecorate) {\n          try {\n            defineInnerHTML(template);\n          } catch (err) {\n            canDecorate = false;\n          }\n        }\n      }\n      // bootstrap recursively\n      PolyfilledHTMLTemplateElement.bootstrap(template.content);\n    };\n\n    function defineInnerHTML(obj) {\n      Object.defineProperty(obj, 'innerHTML', {\n        get: function() {\n          var o = '';\n          for (var e = this.content.firstChild; e; e = e.nextSibling) {\n            o += e.outerHTML || escapeData(e.data);\n          }\n          return o;\n        },\n        set: function(text) {\n          contentDoc.body.innerHTML = text;\n          PolyfilledHTMLTemplateElement.bootstrap(contentDoc);\n          while (this.content.firstChild) {\n            this.content.removeChild(this.content.firstChild);\n          }\n          while (contentDoc.body.firstChild) {\n            this.content.appendChild(contentDoc.body.firstChild);\n          }\n        },\n        configurable: true\n      });\n    }\n\n    defineInnerHTML(PolyfilledHTMLTemplateElement.prototype);\n\n    /**\n      The `bootstrap` method is called automatically and \"fixes\" all\n      <template> elements in the document referenced by the `doc` argument.\n    */\n    PolyfilledHTMLTemplateElement.bootstrap = function(doc) {\n      var templates = doc.querySelectorAll(TEMPLATE_TAG);\n      for (var i=0, l=templates.length, t; (i<l) && (t=templates[i]); i++) {\n        PolyfilledHTMLTemplateElement.decorate(t);\n      }\n    };\n\n    // auto-bootstrapping for main document\n    document.addEventListener('DOMContentLoaded', function() {\n      PolyfilledHTMLTemplateElement.bootstrap(document);\n    });\n\n    // Patch document.createElement to ensure newly created templates have content\n    Document.prototype.createElement = function() {\n      'use strict';\n      var el = Native_createElement.apply(this, arguments);\n      if (el.localName === 'template') {\n        PolyfilledHTMLTemplateElement.decorate(el);\n      }\n      return el;\n    };\n\n    var escapeDataRegExp = /[&\\u00A0<>]/g;\n\n    function escapeReplace(c) {\n      switch (c) {\n        case '&':\n          return '&amp;';\n        case '<':\n          return '&lt;';\n        case '>':\n          return '&gt;';\n        case '\\u00A0':\n          return '&nbsp;';\n      }\n    }\n\n    function escapeData(s) {\n      return s.replace(escapeDataRegExp, escapeReplace);\n    }\n  }\n\n  // make cloning/importing work!\n  if (needsTemplate || needsCloning) {\n\n    PolyfilledHTMLTemplateElement._cloneNode = function(template, deep) {\n      var clone = Native_cloneNode.call(template, false);\n      // NOTE: decorate doesn't auto-fix children because they are already\n      // decorated so they need special clone fixup.\n      if (this.decorate) {\n        this.decorate(clone);\n      }\n      if (deep) {\n        // NOTE: use native clone node to make sure CE's wrapped\n        // cloneNode does not cause elements to upgrade.\n        clone.content.appendChild(\n            Native_cloneNode.call(template.content, true));\n        // now ensure nested templates are cloned correctly.\n        this.fixClonedDom(clone.content, template.content);\n      }\n      return clone;\n    };\n\n    PolyfilledHTMLTemplateElement.prototype.cloneNode = function(deep) {\n      return PolyfilledHTMLTemplateElement._cloneNode(this, deep);\n    }\n\n    // Given a source and cloned subtree, find <template>'s in the cloned\n    // subtree and replace them with cloned <template>'s from source.\n    // We must do this because only the source templates have proper .content.\n    PolyfilledHTMLTemplateElement.fixClonedDom = function(clone, source) {\n      // do nothing if cloned node is not an element\n      if (!source.querySelectorAll) return;\n      // these two lists should be coincident\n      var s$ = source.querySelectorAll(TEMPLATE_TAG);\n      var t$ = clone.querySelectorAll(TEMPLATE_TAG);\n      for (var i=0, l=t$.length, t, s; i<l; i++) {\n        s = s$[i];\n        t = t$[i];\n        if (this.decorate) {\n          this.decorate(s);\n        }\n        t.parentNode.replaceChild(s.cloneNode(true), t);\n      }\n    };\n\n    // override all cloning to fix the cloned subtree to contain properly\n    // cloned templates.\n    Node.prototype.cloneNode = function(deep) {\n      var dom;\n      // workaround for Edge bug cloning documentFragments\n      // https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/8619646/\n      if (this instanceof DocumentFragment) {\n        if (!deep) {\n          return this.ownerDocument.createDocumentFragment();\n        } else {\n          dom = this.ownerDocument.importNode(this, true);\n        }\n      } else {\n        dom = Native_cloneNode.call(this, deep);\n      }\n      // template.content is cloned iff `deep`.\n      if (deep) {\n        PolyfilledHTMLTemplateElement.fixClonedDom(dom, this);\n      }\n      return dom;\n    };\n\n    // NOTE: we are cloning instead of importing <template>'s.\n    // However, the ownerDocument of the cloned template will be correct!\n    // This is because the native import node creates the right document owned\n    // subtree and `fixClonedDom` inserts cloned templates into this subtree,\n    // thus updating the owner doc.\n    Document.prototype.importNode = function(element, deep) {\n      if (element.localName === TEMPLATE_TAG) {\n        return PolyfilledHTMLTemplateElement._cloneNode(element, deep);\n      } else {\n        var dom = Native_importNode.call(this, element, deep);\n        if (deep) {\n          PolyfilledHTMLTemplateElement.fixClonedDom(dom, element);\n        }\n        return dom;\n      }\n    };\n\n    if (needsCloning) {\n      window.HTMLTemplateElement.prototype.cloneNode = function(deep) {\n        return PolyfilledHTMLTemplateElement._cloneNode(this, deep);\n      };\n    }\n  }\n\n  if (needsTemplate) {\n    window.HTMLTemplateElement = PolyfilledHTMLTemplateElement;\n  }\n\n})();\n","!function(t,e){\"object\"==typeof exports&&\"undefined\"!=typeof module?module.exports=e():\"function\"==typeof define&&define.amd?define(e):t.ES6Promise=e()}(this,function(){\"use strict\";function t(t){return\"function\"==typeof t||\"object\"==typeof t&&null!==t}function e(t){return\"function\"==typeof t}function n(t){I=t}function r(t){J=t}function o(){return function(){return process.nextTick(a)}}function i(){return\"undefined\"!=typeof H?function(){H(a)}:c()}function s(){var t=0,e=new V(a),n=document.createTextNode(\"\");return e.observe(n,{characterData:!0}),function(){n.data=t=++t%2}}function u(){var t=new MessageChannel;return t.port1.onmessage=a,function(){return t.port2.postMessage(0)}}function c(){var t=setTimeout;return function(){return t(a,1)}}function a(){for(var t=0;t<G;t+=2){var e=$[t],n=$[t+1];e(n),$[t]=void 0,$[t+1]=void 0}G=0}function f(){try{var t=require,e=t(\"vertx\");return H=e.runOnLoop||e.runOnContext,i()}catch(n){return c()}}function l(t,e){var n=arguments,r=this,o=new this.constructor(p);void 0===o[et]&&k(o);var i=r._state;return i?!function(){var t=n[i-1];J(function(){return x(i,o,t,r._result)})}():E(r,o,t,e),o}function h(t){var e=this;if(t&&\"object\"==typeof t&&t.constructor===e)return t;var n=new e(p);return g(n,t),n}function p(){}function v(){return new TypeError(\"You cannot resolve a promise with itself\")}function d(){return new TypeError(\"A promises callback cannot return that same promise.\")}function _(t){try{return t.then}catch(e){return it.error=e,it}}function y(t,e,n,r){try{t.call(e,n,r)}catch(o){return o}}function m(t,e,n){J(function(t){var r=!1,o=y(n,e,function(n){r||(r=!0,e!==n?g(t,n):S(t,n))},function(e){r||(r=!0,j(t,e))},\"Settle: \"+(t._label||\" unknown promise\"));!r&&o&&(r=!0,j(t,o))},t)}function b(t,e){e._state===rt?S(t,e._result):e._state===ot?j(t,e._result):E(e,void 0,function(e){return g(t,e)},function(e){return j(t,e)})}function w(t,n,r){n.constructor===t.constructor&&r===l&&n.constructor.resolve===h?b(t,n):r===it?(j(t,it.error),it.error=null):void 0===r?S(t,n):e(r)?m(t,n,r):S(t,n)}function g(e,n){e===n?j(e,v()):t(n)?w(e,n,_(n)):S(e,n)}function A(t){t._onerror&&t._onerror(t._result),T(t)}function S(t,e){t._state===nt&&(t._result=e,t._state=rt,0!==t._subscribers.length&&J(T,t))}function j(t,e){t._state===nt&&(t._state=ot,t._result=e,J(A,t))}function E(t,e,n,r){var o=t._subscribers,i=o.length;t._onerror=null,o[i]=e,o[i+rt]=n,o[i+ot]=r,0===i&&t._state&&J(T,t)}function T(t){var e=t._subscribers,n=t._state;if(0!==e.length){for(var r=void 0,o=void 0,i=t._result,s=0;s<e.length;s+=3)r=e[s],o=e[s+n],r?x(n,r,o,i):o(i);t._subscribers.length=0}}function M(){this.error=null}function P(t,e){try{return t(e)}catch(n){return st.error=n,st}}function x(t,n,r,o){var i=e(r),s=void 0,u=void 0,c=void 0,a=void 0;if(i){if(s=P(r,o),s===st?(a=!0,u=s.error,s.error=null):c=!0,n===s)return void j(n,d())}else s=o,c=!0;n._state!==nt||(i&&c?g(n,s):a?j(n,u):t===rt?S(n,s):t===ot&&j(n,s))}function C(t,e){try{e(function(e){g(t,e)},function(e){j(t,e)})}catch(n){j(t,n)}}function O(){return ut++}function k(t){t[et]=ut++,t._state=void 0,t._result=void 0,t._subscribers=[]}function Y(t,e){this._instanceConstructor=t,this.promise=new t(p),this.promise[et]||k(this.promise),B(e)?(this._input=e,this.length=e.length,this._remaining=e.length,this._result=new Array(this.length),0===this.length?S(this.promise,this._result):(this.length=this.length||0,this._enumerate(),0===this._remaining&&S(this.promise,this._result))):j(this.promise,q())}function q(){return new Error(\"Array Methods must be provided an Array\")}function F(t){return new Y(this,t).promise}function D(t){var e=this;return new e(B(t)?function(n,r){for(var o=t.length,i=0;i<o;i++)e.resolve(t[i]).then(n,r)}:function(t,e){return e(new TypeError(\"You must pass an array to race.\"))})}function K(t){var e=this,n=new e(p);return j(n,t),n}function L(){throw new TypeError(\"You must pass a resolver function as the first argument to the promise constructor\")}function N(){throw new TypeError(\"Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.\")}function U(t){this[et]=O(),this._result=this._state=void 0,this._subscribers=[],p!==t&&(\"function\"!=typeof t&&L(),this instanceof U?C(this,t):N())}function W(){var t=void 0;if(\"undefined\"!=typeof global)t=global;else if(\"undefined\"!=typeof self)t=self;else try{t=Function(\"return this\")()}catch(e){throw new Error(\"polyfill failed because global object is unavailable in this environment\")}var n=t.Promise;if(n){var r=null;try{r=Object.prototype.toString.call(n.resolve())}catch(e){}if(\"[object Promise]\"===r&&!n.cast)return}t.Promise=U}var z=void 0;z=Array.isArray?Array.isArray:function(t){return\"[object Array]\"===Object.prototype.toString.call(t)};var B=z,G=0,H=void 0,I=void 0,J=function(t,e){$[G]=t,$[G+1]=e,G+=2,2===G&&(I?I(a):tt())},Q=\"undefined\"!=typeof window?window:void 0,R=Q||{},V=R.MutationObserver||R.WebKitMutationObserver,X=\"undefined\"==typeof self&&\"undefined\"!=typeof process&&\"[object process]\"==={}.toString.call(process),Z=\"undefined\"!=typeof Uint8ClampedArray&&\"undefined\"!=typeof importScripts&&\"undefined\"!=typeof MessageChannel,$=new Array(1e3),tt=void 0;tt=X?o():V?s():Z?u():void 0===Q&&\"function\"==typeof require?f():c();var et=Math.random().toString(36).substring(16),nt=void 0,rt=1,ot=2,it=new M,st=new M,ut=0;return Y.prototype._enumerate=function(){for(var t=this.length,e=this._input,n=0;this._state===nt&&n<t;n++)this._eachEntry(e[n],n)},Y.prototype._eachEntry=function(t,e){var n=this._instanceConstructor,r=n.resolve;if(r===h){var o=_(t);if(o===l&&t._state!==nt)this._settledAt(t._state,e,t._result);else if(\"function\"!=typeof o)this._remaining--,this._result[e]=t;else if(n===U){var i=new n(p);w(i,t,o),this._willSettleAt(i,e)}else this._willSettleAt(new n(function(e){return e(t)}),e)}else this._willSettleAt(r(t),e)},Y.prototype._settledAt=function(t,e,n){var r=this.promise;r._state===nt&&(this._remaining--,t===ot?j(r,n):this._result[e]=n),0===this._remaining&&S(r,this._result)},Y.prototype._willSettleAt=function(t,e){var n=this;E(t,void 0,function(t){return n._settledAt(rt,e,t)},function(t){return n._settledAt(ot,e,t)})},U.all=F,U.race=D,U.resolve=h,U.reject=K,U._setScheduler=n,U._setAsap=r,U._asap=J,U.prototype={constructor:U,then:l,\"catch\":function(t){return this.then(null,t)}},U.polyfill=W,U.Promise=U,U.polyfill(),U});","/**\n * @license\n * Copyright (c) 2016 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt\n */\n(scope => {\n\n  /********************* base setup *********************/\n  const useNative = Boolean('import' in document.createElement('link'));\n\n  // Polyfill `currentScript` for browsers without it.\n  let currentScript = null;\n  if ('currentScript' in document === false) {\n    Object.defineProperty(document, 'currentScript', {\n      get() {\n        return currentScript ||\n          // NOTE: only works when called in synchronously executing code.\n          // readyState should check if `loading` but IE10 is\n          // interactive when scripts run so we cheat. This is not needed by\n          // html-imports polyfill but helps generally polyfill `currentScript`.\n          (document.readyState !== 'complete' ?\n            document.scripts[document.scripts.length - 1] : null);\n      },\n      configurable: true\n    });\n  }\n\n  /********************* path fixup *********************/\n  const ABS_URL_TEST = /(^\\/)|(^#)|(^[\\w-\\d]*:)/;\n  const CSS_URL_REGEXP = /(url\\()([^)]*)(\\))/g;\n  const CSS_IMPORT_REGEXP = /(@import[\\s]+(?!url\\())([^;]*)(;)/g;\n  const STYLESHEET_REGEXP = /(<link[^>]*)(rel=['|\"]?stylesheet['|\"]?[^>]*>)/g;\n\n  // path fixup: style elements in imports must be made relative to the main\n  // document. We fixup url's in url() and @import.\n  const Path = {\n\n    fixUrls(element, base) {\n      if (element.href) {\n        element.setAttribute('href',\n          Path.replaceAttrUrl(element.getAttribute('href'), base));\n      }\n      if (element.src) {\n        element.setAttribute('src',\n          Path.replaceAttrUrl(element.getAttribute('src'), base));\n      }\n      if (element.localName === 'style') {\n        const r = Path.replaceUrls(element.textContent, base, CSS_URL_REGEXP);\n        element.textContent = Path.replaceUrls(r, base, CSS_IMPORT_REGEXP);\n      }\n    },\n\n    replaceUrls(text, linkUrl, regexp) {\n      return text.replace(regexp, (m, pre, url, post) => {\n        let urlPath = url.replace(/[\"']/g, '');\n        if (linkUrl) {\n          urlPath = Path.resolveUrl(urlPath, linkUrl);\n        }\n        return pre + '\\'' + urlPath + '\\'' + post;\n      });\n    },\n\n    replaceAttrUrl(text, linkUrl) {\n      if (text && ABS_URL_TEST.test(text)) {\n        return text;\n      } else {\n        return Path.resolveUrl(text, linkUrl);\n      }\n    },\n\n    resolveUrl(url, base) {\n      // Lazy feature detection.\n      if (Path.__workingURL === undefined) {\n        Path.__workingURL = false;\n        try {\n          const u = new URL('b', 'http://a');\n          u.pathname = 'c%20d';\n          Path.__workingURL = (u.href === 'http://a/c%20d');\n        } catch (e) {}\n      }\n\n      if (Path.__workingURL) {\n        return (new URL(url, base)).href;\n      }\n\n      // Fallback to creating an anchor into a disconnected document.\n      let doc = Path.__tempDoc;\n      if (!doc) {\n        doc = document.implementation.createHTMLDocument('temp');\n        Path.__tempDoc = doc;\n        doc.__base = doc.createElement('base');\n        doc.head.appendChild(doc.__base);\n        doc.__anchor = doc.createElement('a');\n      }\n      doc.__base.href = base;\n      doc.__anchor.href = url;\n      return doc.__anchor.href || url;\n    }\n  };\n\n  /********************* Xhr processor *********************/\n  const Xhr = {\n\n    async: true,\n\n    /**\n     * @param {!string} url\n     * @param {!function(!string, string=)} success\n     * @param {!function(!string)} fail\n     */\n    load(url, success, fail) {\n      if (!url) {\n        fail('error: href must be specified');\n      } else if (url.match(/^data:/)) {\n        // Handle Data URI Scheme\n        const pieces = url.split(',');\n        const header = pieces[0];\n        let resource = pieces[1];\n        if (header.indexOf(';base64') > -1) {\n          resource = atob(resource);\n        } else {\n          resource = decodeURIComponent(resource);\n        }\n        success(resource);\n      } else {\n        const request = new XMLHttpRequest();\n        request.open('GET', url, Xhr.async);\n        request.onload = () => {\n          // Servers redirecting an import can add a Location header to help us\n          // polyfill correctly. Handle relative and full paths.\n          let redirectedUrl = request.getResponseHeader('Location');\n          if (redirectedUrl && redirectedUrl.indexOf('/') === 0) {\n            // In IE location.origin might not work\n            // https://connect.microsoft.com/IE/feedback/details/1763802/location-origin-is-undefined-in-ie-11-on-windows-10-but-works-on-windows-7\n            const origin = (location.origin || location.protocol + '//' + location.host);\n            redirectedUrl = origin + redirectedUrl;\n          }\n          const resource = /** @type {string} */ (request.response || request.responseText);\n          if (request.status === 304 || request.status === 0 ||\n            request.status >= 200 && request.status < 300) {\n            success(resource, redirectedUrl);\n          } else {\n            fail(resource);\n          }\n        };\n        request.send();\n      }\n    }\n  };\n\n  /********************* importer *********************/\n\n  const isIE = /Trident/.test(navigator.userAgent) ||\n    /Edge\\/\\d./i.test(navigator.userAgent);\n\n  const importSelector = 'link[rel=import]';\n\n  // Used to disable loading of resources.\n  const importDisableType = 'import-disable';\n\n  const disabledLinkSelector = `link[rel=stylesheet][href][type=${importDisableType}]`;\n\n  const importDependenciesSelector = `${importSelector}, ${disabledLinkSelector},\n    style:not([type]), link[rel=stylesheet][href]:not([type]),\n    script:not([type]), script[type=\"application/javascript\"],\n    script[type=\"text/javascript\"]`;\n\n  const importDependencyAttr = 'import-dependency';\n\n  const rootImportSelector = `${importSelector}:not(${importDependencyAttr})`;\n\n  const pendingScriptsSelector = `script[${importDependencyAttr}]`;\n\n  const pendingStylesSelector = `style[${importDependencyAttr}],\n    link[rel=stylesheet][${importDependencyAttr}]`;\n\n  /**\n   * Importer will:\n   * - load any linked import documents (with deduping)\n   * - whenever an import is loaded, prompt the parser to try to parse\n   * - observe imported documents for new elements (these are handled via the\n   *   dynamic importer)\n   */\n  class Importer {\n    constructor() {\n      this.documents = {};\n      // Used to keep track of pending loads, so that flattening and firing of\n      // events can be done when all resources are ready.\n      this.inflight = 0;\n      this.dynamicImportsMO = new MutationObserver(m => this.handleMutations(m));\n      // Observe changes on <head>.\n      this.dynamicImportsMO.observe(document.head, {\n        childList: true,\n        subtree: true\n      });\n      // 1. Load imports contents\n      // 2. Assign them to first import links on the document\n      // 3. Wait for import styles & scripts to be done loading/running\n      // 4. Fire load/error events\n      this.loadImports(document);\n    }\n\n    /**\n     * @param {!(HTMLDocument|DocumentFragment|Element)} doc\n     */\n    loadImports(doc) {\n      const links = /** @type {!NodeList<!HTMLLinkElement>} */\n        (doc.querySelectorAll(importSelector));\n      for (let i = 0, l = links.length; i < l; i++) {\n        this.loadImport(links[i]);\n      }\n    }\n\n    /**\n     * @param {!HTMLLinkElement} link\n     */\n    loadImport(link) {\n      const url = link.href;\n      // This resource is already being handled by another import.\n      if (this.documents[url] !== undefined) {\n        // If import is already loaded, we can safely associate it to the link\n        // and fire the load/error event.\n        const imp = this.documents[url];\n        if (imp && imp['__loaded']) {\n          link.import = imp;\n          this.fireEventIfNeeded(link);\n        }\n        return;\n      }\n      this.inflight++;\n      // Mark it as pending to notify others this url is being loaded.\n      this.documents[url] = 'pending';\n      Xhr.load(url, (resource, redirectedUrl) => {\n        const doc = this.makeDocument(resource, redirectedUrl || url);\n        this.documents[url] = doc;\n        this.inflight--;\n        // Load subtree.\n        this.loadImports(doc);\n        this.processImportsIfLoadingDone();\n      }, () => {\n        // If load fails, handle error.\n        this.documents[url] = null;\n        this.inflight--;\n        this.processImportsIfLoadingDone();\n      });\n    }\n\n    /**\n     * Creates a new document containing resource and normalizes urls accordingly.\n     * @param {string=} resource\n     * @param {string=} url\n     * @return {!DocumentFragment}\n     */\n    makeDocument(resource, url) {\n      if (!resource) {\n        return document.createDocumentFragment();\n      }\n\n      if (isIE) {\n        // <link rel=stylesheet> should be appended to <head>. Not doing so\n        // in IE/Edge breaks the cascading order. We disable the loading by\n        // setting the type before setting innerHTML to avoid loading\n        // resources twice.\n        resource = resource.replace(STYLESHEET_REGEXP, (match, p1, p2) => {\n          if (match.indexOf('type=') === -1) {\n            return `${p1} type=${importDisableType} ${p2}`;\n          }\n          return match;\n        });\n      }\n\n      let content;\n      const template = /** @type {!HTMLTemplateElement} */\n        (document.createElement('template'));\n      template.innerHTML = resource;\n      if (template.content) {\n        // This creates issues in Safari10 when used with shadydom (see #12).\n        content = template.content;\n      } else {\n        // <template> not supported, create fragment and move content into it.\n        content = document.createDocumentFragment();\n        while (template.firstChild) {\n          content.appendChild(template.firstChild);\n        }\n      }\n\n      // Support <base> in imported docs. Resolve url and remove its href.\n      const baseEl = content.querySelector('base');\n      if (baseEl) {\n        url = Path.replaceAttrUrl(baseEl.getAttribute('href'), url);\n        baseEl.removeAttribute('href');\n      }\n\n      const n$ = /** @type {!NodeList<!(HTMLLinkElement|HTMLScriptElement|HTMLStyleElement)>} */\n        (content.querySelectorAll(importDependenciesSelector));\n      // For source map hints.\n      let inlineScriptIndex = 0;\n      for (let i = 0, l = n$.length, n; i < l && (n = n$[i]); i++) {\n        // Listen for load/error events, then fix urls.\n        whenElementLoaded(n);\n        Path.fixUrls(n, url);\n        // Mark for easier selectors.\n        n.setAttribute(importDependencyAttr, '');\n        // Generate source map hints for inline scripts.\n        if (n.localName === 'script' && !n.src && n.textContent) {\n          const num = inlineScriptIndex ? `-${inlineScriptIndex}` : '';\n          const content = n.textContent + `\\n//# sourceURL=${url}${num}.js\\n`;\n          // We use the src attribute so it triggers load/error events, and it's\n          // easier to capture errors (e.g. parsing) like this.\n          n.setAttribute('src', 'data:text/javascript;charset=utf-8,' + encodeURIComponent(content));\n          n.textContent = '';\n          inlineScriptIndex++;\n        }\n      }\n      return content;\n    }\n\n    /**\n     * Waits for loaded imports to finish loading scripts and styles, then fires\n     * the load/error events.\n     */\n    processImportsIfLoadingDone() {\n      // Wait until all resources are ready, then load import resources.\n      if (this.inflight) return;\n\n      // Stop observing, flatten & load resource, then restart observing <head>.\n      this.dynamicImportsMO.disconnect();\n      this.flatten(document);\n      // We wait for styles to load, and at the same time we execute the scripts,\n      // then fire the load/error events for imports to have faster whenReady\n      // callback execution.\n      // NOTE: This is different for native behavior where scripts would be\n      // executed after the styles before them are loaded.\n      // To achieve that, we could select pending styles and scripts in the\n      // document and execute them sequentially in their dom order.\n      let scriptsOk = false,\n        stylesOk = false;\n      const onLoadingDone = () => {\n        if (stylesOk && scriptsOk) {\n          // Catch any imports that might have been added while we\n          // weren't looking, wait for them as well.\n          this.loadImports(document);\n          if (this.inflight) return;\n\n          // Restart observing.\n          this.dynamicImportsMO.observe(document.head, {\n            childList: true,\n            subtree: true\n          });\n          this.fireEvents();\n        }\n      }\n      this.waitForStyles(() => {\n        stylesOk = true;\n        onLoadingDone();\n      });\n      this.runScripts(() => {\n        scriptsOk = true;\n        onLoadingDone();\n      });\n    }\n\n    /**\n     * @param {!HTMLDocument} doc\n     */\n    flatten(doc) {\n      const n$ = /** @type {!NodeList<!HTMLLinkElement>} */\n        (doc.querySelectorAll(importSelector));\n      for (let i = 0, l = n$.length, n; i < l && (n = n$[i]); i++) {\n        const imp = this.documents[n.href];\n        n.import = /** @type {!Document} */ (imp);\n        if (imp && imp.nodeType === Node.DOCUMENT_FRAGMENT_NODE) {\n          // We set the .import to be the link itself, and update its readyState.\n          // Other links with the same href will point to this link.\n          this.documents[n.href] = n;\n          n.readyState = 'loading';\n          // Suppress Closure warning about incompatible subtype assignment.\n          ( /** @type {!HTMLElement} */ (n).import = n);\n          this.flatten(imp);\n          n.appendChild(imp);\n        }\n      }\n    }\n\n    /**\n     * Replaces all the imported scripts with a clone in order to execute them.\n     * Updates the `currentScript`.\n     * @param {!function()} callback\n     */\n    runScripts(callback) {\n      const s$ = document.querySelectorAll(pendingScriptsSelector);\n      const l = s$.length;\n      const cloneScript = i => {\n        if (i < l) {\n          // The pending scripts have been generated through innerHTML and\n          // browsers won't execute them for security reasons. We cannot use\n          // s.cloneNode(true) either, the only way to run the script is manually\n          // creating a new element and copying its attributes.\n          const s = s$[i];\n          const clone = /** @type {!HTMLScriptElement} */\n            (document.createElement('script'));\n          // Remove import-dependency attribute to avoid double cloning.\n          s.removeAttribute(importDependencyAttr);\n          for (let j = 0, ll = s.attributes.length; j < ll; j++) {\n            clone.setAttribute(s.attributes[j].name, s.attributes[j].value);\n          }\n          // Update currentScript and replace original with clone script.\n          currentScript = clone;\n          s.parentNode.replaceChild(clone, s);\n          whenElementLoaded(clone, () => {\n            currentScript = null;\n            cloneScript(i + 1);\n          });\n        } else {\n          callback();\n        }\n      };\n      cloneScript(0);\n    }\n\n    /**\n     * Waits for all the imported stylesheets/styles to be loaded.\n     * @param {!function()} callback\n     */\n    waitForStyles(callback) {\n      const s$ = /** @type {!NodeList<!(HTMLLinkElement|HTMLStyleElement)>} */\n        (document.querySelectorAll(pendingStylesSelector));\n      let pending = s$.length;\n      if (!pending) {\n        callback();\n        return;\n      }\n      // <link rel=stylesheet> should be appended to <head>. Not doing so\n      // in IE/Edge breaks the cascading order\n      // https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/10472273/\n      // If there is one <link rel=stylesheet> imported, we must move all imported\n      // links and styles to <head>.\n      const needsMove = isIE && !!document.querySelector(disabledLinkSelector);\n      for (let i = 0, l = s$.length, s; i < l && (s = s$[i]); i++) {\n        // Listen for load/error events, remove selector once is done loading.\n        whenElementLoaded(s, () => {\n          s.removeAttribute(importDependencyAttr);\n          if (--pending === 0) {\n            callback();\n          }\n        });\n        // Check if was already moved to head, to handle the case where the element\n        // has already been moved but it is still loading.\n        if (needsMove && s.parentNode !== document.head) {\n          // Replace the element we're about to move with a placeholder.\n          const placeholder = document.createElement(s.localName);\n          // Add reference of the moved element.\n          placeholder['__appliedElement'] = s;\n          // Disable this from appearing in document.styleSheets.\n          placeholder.setAttribute('type', 'import-placeholder');\n          // Append placeholder next to the sibling, and move original to <head>.\n          s.parentNode.insertBefore(placeholder, s.nextSibling);\n          let newSibling = importForElement(s);\n          while (newSibling && importForElement(newSibling)) {\n            newSibling = importForElement(newSibling);\n          }\n          if (newSibling.parentNode !== document.head) {\n            newSibling = null;\n          }\n          document.head.insertBefore(s, newSibling);\n          // Enable the loading of <link rel=stylesheet>.\n          s.removeAttribute('type');\n        }\n      }\n    }\n\n    /**\n     * Fires load/error events for imports in the right order .\n     */\n    fireEvents() {\n      const n$ = /** @type {!NodeList<!HTMLLinkElement>} */\n        (document.querySelectorAll(importSelector));\n      // Inverse order to have events firing bottom-up.\n      for (let i = n$.length - 1, n; i >= 0 && (n = n$[i]); i--) {\n        this.fireEventIfNeeded(n);\n      }\n    }\n\n    /**\n     * Fires load/error event for the import if this wasn't done already.\n     * @param {!HTMLLinkElement} link\n     */\n    fireEventIfNeeded(link) {\n      // Don't fire twice same event.\n      if (!link['__loaded']) {\n        link['__loaded'] = true;\n        // Update link's import readyState.\n        link.import && (link.import.readyState = 'complete');\n        const eventType = link.import ? 'load' : 'error';\n        link.dispatchEvent(newCustomEvent(eventType, {\n          bubbles: false,\n          cancelable: false,\n          detail: undefined\n        }));\n      }\n    }\n\n    /**\n     * @param {Array<MutationRecord>} mutations\n     */\n    handleMutations(mutations) {\n      for (let i = 0; i < mutations.length; i++) {\n        const m = mutations[i];\n        if (!m.addedNodes) {\n          continue;\n        }\n        for (let ii = 0; ii < m.addedNodes.length; ii++) {\n          const elem = m.addedNodes[ii];\n          if (!elem || elem.nodeType !== Node.ELEMENT_NODE) {\n            continue;\n          }\n          // NOTE: added scripts are not updating currentScript in IE.\n          if (isImportLink(elem)) {\n            this.loadImport( /** @type {!HTMLLinkElement} */ (elem));\n          } else {\n            this.loadImports( /** @type {!Element} */ (elem));\n          }\n        }\n      }\n    }\n  }\n\n  /**\n   * @param {!Node} node\n   * @return {boolean}\n   */\n  const isImportLink = node => {\n    return node.nodeType === Node.ELEMENT_NODE && node.localName === 'link' &&\n      ( /** @type {!HTMLLinkElement} */ (node).rel === 'import');\n  };\n\n  /**\n   * Waits for an element to finish loading. If already done loading, it will\n   * mark the element accordingly.\n   * @param {!(HTMLLinkElement|HTMLScriptElement|HTMLStyleElement)} element\n   * @param {function()=} callback\n   */\n  const whenElementLoaded = (element, callback) => {\n    if (element['__loaded']) {\n      callback && callback();\n    } else if (isImportLink(element) &&\n      (!useNative && /** @type {!HTMLLinkElement}*/ (element).import === null) ||\n      (element.import && /** @type {!HTMLLinkElement}*/ (element).import.readyState === 'complete')) {\n      // This import has already been loaded but its __loaded property got removed. Ensure\n      // we set it back!\n      element['__loaded'] = true;\n      callback && callback();\n    } else if (element.localName === 'script' && !element.src) {\n      // Inline scripts don't trigger load/error events, consider them already loaded.\n      element['__loaded'] = true;\n      callback && callback();\n    } else {\n      const onLoadingDone = event => {\n        element.removeEventListener(event.type, onLoadingDone);\n        element['__loaded'] = true;\n        callback && callback();\n      };\n      element.addEventListener('load', onLoadingDone);\n      // NOTE: We listen only for load events in IE/Edge, because in IE/Edge\n      // <style> with @import will fire error events for each failing @import,\n      // and finally will trigger the load event when all @import are\n      // finished (even if all fail).\n      if (!isIE || element.localName !== 'style') {\n        element.addEventListener('error', onLoadingDone);\n      }\n    }\n  }\n\n  /**\n   * Calls the callback when all imports in the document at call time\n   * (or at least document ready) have loaded. Callback is called synchronously\n   * if imports are already done loading.\n   * @param {function()=} callback\n   */\n  const whenReady = callback => {\n    // 1. ensure the document is in a ready state (has dom), then\n    // 2. watch for loading of imports and call callback when done\n    whenDocumentReady(() => whenImportsReady(() => callback && callback()));\n  }\n\n  /**\n   * Invokes the callback when document is in ready state. Callback is called\n   *  synchronously if document is already done loading.\n   * @param {!function()} callback\n   */\n  const whenDocumentReady = callback => {\n    if (document.readyState !== 'loading') {\n      callback();\n    } else {\n      const stateChanged = () => {\n        if (document.readyState !== 'loading') {\n          document.removeEventListener('readystatechange', stateChanged);\n          callback();\n        }\n      }\n      document.addEventListener('readystatechange', stateChanged);\n    }\n  }\n\n  /**\n   * Invokes the callback after all imports are loaded. Callback is called\n   * synchronously if imports are already done loading.\n   * @param {!function()} callback\n   */\n  const whenImportsReady = callback => {\n    let imports = /** @type {!NodeList<!HTMLLinkElement>} */\n      (document.querySelectorAll(rootImportSelector));\n    let pending = imports.length;\n    if (!pending) {\n      callback();\n      return;\n    }\n    for (let i = 0, l = imports.length, imp; i < l && (imp = imports[i]); i++) {\n      whenElementLoaded(imp, () => {\n        if (--pending === 0) {\n          callback();\n        }\n      });\n    }\n  }\n\n  /**\n   * Returns the import document containing the element.\n   * @param {!Node} element\n   * @return {HTMLLinkElement|Document|undefined}\n   */\n  const importForElement = element => {\n    if (useNative) {\n      // Return only if not in the main doc!\n      return element.ownerDocument !== document ? element.ownerDocument : null;\n    }\n    let doc = element['__importDoc'];\n    if (!doc && element.parentNode) {\n      doc = /** @type {!Element} */ (element.parentNode);\n      if (typeof doc.closest === 'function') {\n        // Element.closest returns the element itself if it matches the selector,\n        // so we search the closest import starting from the parent.\n        doc = doc.closest(importSelector);\n      } else {\n        // Walk up the parent tree until we find an import.\n        while (!isImportLink(doc) && (doc = doc.parentNode)) {}\n      }\n      element['__importDoc'] = doc;\n    }\n    return doc;\n  }\n\n  const newCustomEvent = (type, params) => {\n    if (typeof window.CustomEvent === 'function') {\n      return new CustomEvent(type, params);\n    }\n    const event = /** @type {!CustomEvent} */ (document.createEvent('CustomEvent'));\n    event.initCustomEvent(type, Boolean(params.bubbles), Boolean(params.cancelable), params.detail);\n    return event;\n  };\n\n  if (useNative) {\n    // Check for imports that might already be done loading by the time this\n    // script is actually executed. Native imports are blocking, so the ones\n    // available in the document by this time should already have failed\n    // or have .import defined.\n    const imps = /** @type {!NodeList<!HTMLLinkElement>} */\n      (document.querySelectorAll(importSelector));\n    for (let i = 0, l = imps.length, imp; i < l && (imp = imps[i]); i++) {\n      if (!imp.import || imp.import.readyState !== 'loading') {\n        imp['__loaded'] = true;\n      }\n    }\n    // Listen for load/error events to capture dynamically added scripts.\n    /**\n     * @type {!function(!Event)}\n     */\n    const onLoadingDone = event => {\n      const elem = /** @type {!Element} */ (event.target);\n      if (isImportLink(elem)) {\n        elem['__loaded'] = true;\n      }\n    };\n    document.addEventListener('load', onLoadingDone, true /* useCapture */ );\n    document.addEventListener('error', onLoadingDone, true /* useCapture */ );\n  } else {\n    // Override baseURI so that imported elements' baseURI can be used seemlessly\n    // on native or polyfilled html-imports.\n    // NOTE: a <link rel=import> will have `link.baseURI === link.href`, as the link\n    // itself is used as the `import` document.\n    /** @type {Object|undefined} */\n    const native_baseURI = Object.getOwnPropertyDescriptor(Node.prototype, 'baseURI');\n    // NOTE: if not configurable (e.g. safari9), set it on the Element prototype. \n    const klass = !native_baseURI || native_baseURI.configurable ? Node : Element;\n    Object.defineProperty(klass.prototype, 'baseURI', {\n      get() {\n        const ownerDoc = /** @type {HTMLLinkElement} */ (isImportLink(this) ? this : importForElement(this));\n        if (ownerDoc) return ownerDoc.href;\n        // Use native baseURI if possible.\n        if (native_baseURI && native_baseURI.get) return native_baseURI.get.call(this);\n        // Polyfill it if not available.\n        const base = /** @type {HTMLBaseElement} */ (document.querySelector('base'));\n        return (base || window.location).href;\n      },\n      configurable: true,\n      enumerable: true\n    });\n\n    whenDocumentReady(() => new Importer());\n  }\n\n  /**\n    Add support for the `HTMLImportsLoaded` event and the `HTMLImports.whenReady`\n    method. This api is necessary because unlike the native implementation,\n    script elements do not force imports to resolve. Instead, users should wrap\n    code in either an `HTMLImportsLoaded` handler or after load time in an\n    `HTMLImports.whenReady(callback)` call.\n\n    NOTE: This module also supports these apis under the native implementation.\n    Therefore, if this file is loaded, the same code can be used under both\n    the polyfill and native implementation.\n   */\n  whenReady(() => document.dispatchEvent(newCustomEvent('HTMLImportsLoaded', {\n    cancelable: true,\n    bubbles: true,\n    detail: undefined\n  })));\n\n  // exports\n  scope.useNative = useNative;\n  scope.whenReady = whenReady;\n  scope.importForElement = importForElement;\n\n})(window.HTMLImports = (window.HTMLImports || {}));","/**\n * @license\n * Copyright (c) 2014 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt\n */\n\n(function() {\n\n  'use strict';\n\n  // Establish scope.\n  window['WebComponents'] = window['WebComponents'] || {'flags':{}};\n\n  // loading script\n  var file = 'webcomponents-lite.js';\n  var script = document.querySelector('script[src*=\"' + file + '\"]');\n  var flagMatcher = /wc-(.+)/;\n\n  // Flags. Convert url arguments to flags\n  var flags = {};\n  if (!flags['noOpts']) {\n    // from url\n    location.search.slice(1).split('&').forEach(function(option) {\n      var parts = option.split('=');\n      var match;\n      if (parts[0] && (match = parts[0].match(flagMatcher))) {\n        flags[match[1]] = parts[1] || true;\n      }\n    });\n    // from script\n    if (script) {\n      for (var i=0, a; (a=script.attributes[i]); i++) {\n        if (a.name !== 'src') {\n          flags[a.name] = a.value || true;\n        }\n      }\n    }\n    // log flags\n    if (flags['log'] && flags['log']['split']) {\n      var parts = flags['log'].split(',');\n      flags['log'] = {};\n      parts.forEach(function(f) {\n        flags['log'][f] = true;\n      });\n    } else {\n      flags['log'] = {};\n    }\n  }\n\n  // exports\n  window['WebComponents']['flags'] = flags;\n  var forceShady = flags['shadydom'];\n  if (forceShady) {\n    window['ShadyDOM'] = window['ShadyDOM'] || {};\n    window['ShadyDOM']['force'] = forceShady;\n  }\n\n  var forceCE = flags['register'] || flags['ce'];\n  if (forceCE && window['customElements']) {\n    window['customElements']['forcePolyfill'] = forceCE;\n  }\n\n})();\n","/**\n@license\nCopyright (c) 2016 The Polymer Project Authors. All rights reserved.\nThis code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt\nThe complete set of authors may be found at http://polymer.github.io/AUTHORS.txt\nThe complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt\nCode distributed by Google as part of the polymer project is also\nsubject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt\n*/\n\n'use strict';\n\nexport let appendChild = Element.prototype.appendChild;\nexport let insertBefore = Element.prototype.insertBefore;\nexport let removeChild = Element.prototype.removeChild;\nexport let setAttribute = Element.prototype.setAttribute;\nexport let removeAttribute = Element.prototype.removeAttribute;\nexport let cloneNode = Element.prototype.cloneNode;\nexport let importNode = Document.prototype.importNode;\nexport let addEventListener = Element.prototype.addEventListener;\nexport let removeEventListener = Element.prototype.removeEventListener;\n","/**\n@license\nCopyright (c) 2016 The Polymer Project Authors. All rights reserved.\nThis code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt\nThe complete set of authors may be found at http://polymer.github.io/AUTHORS.txt\nThe complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt\nCode distributed by Google as part of the polymer project is also\nsubject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt\n*/\n\n/**\n * Patches elements that interacts with ShadyDOM\n * such that tree traversal and mutation apis act like they would under\n * ShadowDOM.\n *\n * This import enables seemless interaction with ShadyDOM powered\n * custom elements, enabling better interoperation with 3rd party code,\n * libraries, and frameworks that use DOM tree manipulation apis.\n */\n\n'use strict';\nimport * as utils from './utils'\nimport {flush, enqueue} from './flush'\nimport {observeChildren, unobserveChildren, filterMutations} from './observe-changes'\nimport * as nativeMethods from './native-methods'\nimport * as nativeTree from './native-tree'\nimport {patchBuiltins} from './patch-builtins'\nimport {patchEvents} from './patch-events'\nimport {ShadyRoot} from './attach-shadow'\n\nif (utils.settings.inUse) {\n  let ShadyDOM = {\n    // TODO(sorvell): remove when Polymer does not depend on this.\n    'inUse': utils.settings.inUse,\n    // TODO(sorvell): remove when Polymer does not depend on this\n    'patch': (node) => node,\n    'isShadyRoot': utils.isShadyRoot,\n    'enqueue': enqueue,\n    'flush': flush,\n    'settings': utils.settings,\n    'filterMutations': filterMutations,\n    'observeChildren': observeChildren,\n    'unobserveChildren': unobserveChildren,\n    'nativeMethods': nativeMethods,\n    'nativeTree': nativeTree\n  };\n\n  window['ShadyDOM'] = ShadyDOM;\n\n  // Apply patches to events...\n  patchEvents();\n  // Apply patches to builtins (e.g. Element.prototype) where applicable.\n  patchBuiltins();\n\n  window.ShadowRoot = ShadyRoot;\n}","export default {\n  Document_createElement: window.Document.prototype.createElement,\n  Document_createElementNS: window.Document.prototype.createElementNS,\n  Document_importNode: window.Document.prototype.importNode,\n  Document_prepend: window.Document.prototype['prepend'],\n  Document_append: window.Document.prototype['append'],\n  Node_cloneNode: window.Node.prototype.cloneNode,\n  Node_appendChild: window.Node.prototype.appendChild,\n  Node_insertBefore: window.Node.prototype.insertBefore,\n  Node_removeChild: window.Node.prototype.removeChild,\n  Node_replaceChild: window.Node.prototype.replaceChild,\n  Node_textContent: Object.getOwnPropertyDescriptor(window.Node.prototype, 'textContent'),\n  Element_attachShadow: window.Element.prototype['attachShadow'],\n  Element_innerHTML: Object.getOwnPropertyDescriptor(window.Element.prototype, 'innerHTML'),\n  Element_getAttribute: window.Element.prototype.getAttribute,\n  Element_setAttribute: window.Element.prototype.setAttribute,\n  Element_removeAttribute: window.Element.prototype.removeAttribute,\n  Element_getAttributeNS: window.Element.prototype.getAttributeNS,\n  Element_setAttributeNS: window.Element.prototype.setAttributeNS,\n  Element_removeAttributeNS: window.Element.prototype.removeAttributeNS,\n  Element_insertAdjacentElement: window.Element.prototype['insertAdjacentElement'],\n  Element_prepend: window.Element.prototype['prepend'],\n  Element_append: window.Element.prototype['append'],\n  Element_before: window.Element.prototype['before'],\n  Element_after: window.Element.prototype['after'],\n  Element_replaceWith: window.Element.prototype['replaceWith'],\n  Element_remove: window.Element.prototype['remove'],\n  HTMLElement: window.HTMLElement,\n  HTMLElement_innerHTML: Object.getOwnPropertyDescriptor(window.HTMLElement.prototype, 'innerHTML'),\n  HTMLElement_insertAdjacentElement: window.HTMLElement.prototype['insertAdjacentElement'],\n};\n","/**\n * This class exists only to work around Closure's lack of a way to describe\n * singletons. It represents the 'already constructed marker' used in custom\n * element construction stacks.\n *\n * https://html.spec.whatwg.org/#concept-already-constructed-marker\n */\nclass AlreadyConstructedMarker {}\n\nexport default new AlreadyConstructedMarker();\n","/**\n * @license\n * Copyright (c) 2016 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt\n */\n\nimport CustomElementInternals from './CustomElementInternals.js';\nimport CustomElementRegistry from './CustomElementRegistry.js';\n\nimport PatchHTMLElement from './Patch/HTMLElement.js';\nimport PatchDocument from './Patch/Document.js';\nimport PatchNode from './Patch/Node.js';\nimport PatchElement from './Patch/Element.js';\n\nconst priorCustomElements = window['customElements'];\n\nif (!priorCustomElements ||\n     priorCustomElements['forcePolyfill'] ||\n     (typeof priorCustomElements['define'] != 'function') ||\n     (typeof priorCustomElements['get'] != 'function')) {\n  /** @type {!CustomElementInternals} */\n  const internals = new CustomElementInternals();\n\n  PatchHTMLElement(internals);\n  PatchDocument(internals);\n  PatchNode(internals);\n  PatchElement(internals);\n\n  // The main document is always associated with the registry.\n  document.__CE_hasRegistry = true;\n\n  /** @type {!CustomElementRegistry} */\n  const customElements = new CustomElementRegistry(internals);\n\n  Object.defineProperty(window, 'customElements', {\n    configurable: true,\n    enumerable: true,\n    value: customElements,\n  });\n}\n","/**\n@license\nCopyright (c) 2017 The Polymer Project Authors. All rights reserved.\nThis code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt\nThe complete set of authors may be found at http://polymer.github.io/AUTHORS.txt\nThe complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt\nCode distributed by Google as part of the polymer project is also\nsubject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt\n*/\n\nexport const VAR_ASSIGN = /(?:^|[;\\s{]\\s*)(--[\\w-]*?)\\s*:\\s*(?:([^;{]*)|{([^}]*)})(?:(?=[;\\s}])|$)/gi;\nexport const MIXIN_MATCH = /(?:^|\\W+)@apply\\s*\\(?([^);\\n]*)\\)?/gi;\nexport const VAR_CONSUMED = /(--[\\w-]+)\\s*([:,;)]|$)/gi;\nexport const ANIMATION_MATCH = /(animation\\s*:)|(animation-name\\s*:)/;\nexport const MEDIA_MATCH = /@media[^(]*(\\([^)]*\\))/;\nexport const IS_VAR = /^--/;\nexport const BRACKETED = /\\{[^}]*\\}/g;\nexport const HOST_PREFIX = '(?:^|[^.#[:])';\nexport const HOST_SUFFIX = '($|[.:[\\\\s>+~])';","/**\n@license\nCopyright (c) 2017 The Polymer Project Authors. All rights reserved.\nThis code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt\nThe complete set of authors may be found at http://polymer.github.io/AUTHORS.txt\nThe complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt\nCode distributed by Google as part of the polymer project is also\nsubject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt\n*/\n\n'use strict';\n\nimport {applyStylePlaceHolder} from './style-util'\nimport {nativeShadow} from './style-settings'\n\n/** @type {Object<string, !Node>} */\nlet placeholderMap = {};\n\n/**\n * @const {CustomElementRegistry}\n */\nconst ce = window['customElements'];\nif (ce && !nativeShadow) {\n  /**\n   * @const {function(this:CustomElementRegistry, string,function(new:HTMLElement),{extends: string}=)}\n   */\n  const origDefine = ce['define'];\n  /**\n   * @param {string} name\n   * @param {function(new:HTMLElement)} clazz\n   * @param {{extends: string}=} options\n   * @return {function(new:HTMLElement)}\n   */\n  const wrappedDefine = (name, clazz, options) => {\n    placeholderMap[name] = applyStylePlaceHolder(name);\n    return origDefine.call(/** @type {!CustomElementRegistry} */(ce), name, clazz, options);\n  }\n  ce['define'] = wrappedDefine;\n}\n\nexport default placeholderMap;\n","/**\n@license\nCopyright (c) 2017 The Polymer Project Authors. All rights reserved.\nThis code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt\nThe complete set of authors may be found at http://polymer.github.io/AUTHORS.txt\nThe complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt\nCode distributed by Google as part of the polymer project is also\nsubject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt\n*/\n\n'use strict';\n\n/**\n * @const {!Object<string, !HTMLTemplateElement>}\n */\nconst templateMap = {};\nexport default templateMap;\n","/**\n@license\nCopyright (c) 2017 The Polymer Project Authors. All rights reserved.\nThis code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt\nThe complete set of authors may be found at http://polymer.github.io/AUTHORS.txt\nThe complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt\nCode distributed by Google as part of the polymer project is also\nsubject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt\n*/\n\n'use strict';\n\n/**\n * @param {Element} element\n * @param {Object=} properties\n */\nexport function updateNativeProperties(element, properties) {\n  // remove previous properties\n  for (let p in properties) {\n    // NOTE: for bc with shim, don't apply null values.\n    if (p === null) {\n      element.style.removeProperty(p);\n    } else {\n      element.style.setProperty(p, properties[p]);\n    }\n  }\n}\n\n/**\n * @param {Element} element\n * @param {string} property\n * @return {string}\n */\nexport function getComputedStyleValue(element, property) {\n  /**\n   * @const {string}\n   */\n  const value = window.getComputedStyle(element).getPropertyValue(property);\n  if (!value) {\n    return '';\n  } else {\n    return value.trim();\n  }\n}","/**\n@license\nCopyright (c) 2017 The Polymer Project Authors. All rights reserved.\nThis code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt\nThe complete set of authors may be found at http://polymer.github.io/AUTHORS.txt\nThe complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt\nCode distributed by Google as part of the polymer project is also\nsubject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt\n*/\n\n'use strict';\n\nimport ScopingShim from '../src/scoping-shim'\nimport {nativeCssVariables, nativeShadow} from '../src/style-settings'\n\n/** @const {ScopingShim} */\nconst scopingShim = new ScopingShim();\n\nlet ApplyShim, CustomStyleInterface;\n\nif (window['ShadyCSS']) {\n  ApplyShim = window['ShadyCSS']['ApplyShim'];\n  CustomStyleInterface = window['ShadyCSS']['CustomStyleInterface'];\n}\n\nwindow.ShadyCSS = {\n  ScopingShim: scopingShim,\n  /**\n   * @param {!HTMLTemplateElement} template\n   * @param {string} elementName\n   * @param {string=} elementExtends\n   */\n  prepareTemplate(template, elementName, elementExtends) {\n    scopingShim.flushCustomStyles();\n    scopingShim.prepareTemplate(template, elementName, elementExtends)\n  },\n\n  /**\n   * @param {!HTMLElement} element\n   * @param {Object=} properties\n   */\n  styleSubtree(element, properties) {\n    scopingShim.flushCustomStyles();\n    scopingShim.styleSubtree(element, properties);\n  },\n\n  /**\n   * @param {!HTMLElement} element\n   */\n  styleElement(element) {\n    scopingShim.flushCustomStyles();\n    scopingShim.styleElement(element);\n  },\n\n  /**\n   * @param {Object=} properties\n   */\n  styleDocument(properties) {\n    scopingShim.flushCustomStyles();\n    scopingShim.styleDocument(properties);\n  },\n\n  /**\n   * @param {Element} element\n   * @param {string} property\n   * @return {string}\n   */\n  getComputedStyleValue(element, property) {\n    return scopingShim.getComputedStyleValue(element, property);\n  },\n\n  nativeCss: nativeCssVariables,\n\n  nativeShadow: nativeShadow\n};\n\nif (ApplyShim) {\n  window.ShadyCSS.ApplyShim = ApplyShim;\n}\n\nif (CustomStyleInterface) {\n  window.ShadyCSS.CustomStyleInterface = CustomStyleInterface;\n}","/**\n * @license\n * Copyright (c) 2014 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt\n */\n\n(function() {\n\n  'use strict';\n\n  var customElements = window['customElements'];\n  var HTMLImports = window['HTMLImports'];\n\n  if (customElements && customElements['polyfillWrapFlushCallback']) {\n    // Here we ensure that the public `HTMLImports.whenReady`\n    // always comes *after* custom elements have upgraded.\n    var flushCallback;\n    var runAndClearCallback = function runAndClearCallback() {\n      if (flushCallback) {\n        var cb = flushCallback;\n        flushCallback = null;\n        cb();\n        return true;\n      }\n    }\n    var origWhenReady = HTMLImports['whenReady'];\n    customElements['polyfillWrapFlushCallback'](function(cb) {\n      flushCallback = cb;\n      origWhenReady(runAndClearCallback);\n    });\n\n    HTMLImports['whenReady'] = function(cb) {\n      origWhenReady(function() {\n        // custom element code may add dynamic imports\n        // to match processing of native custom elements before\n        // domContentLoaded, we wait for these imports to resolve first.\n        if (runAndClearCallback()) {\n          HTMLImports['whenReady'](cb);\n        } else {\n          cb();\n        }\n      });\n    }\n\n  }\n\n  HTMLImports['whenReady'](function() {\n    requestAnimationFrame(function() {\n      document.dispatchEvent(new CustomEvent('WebComponentsReady', {bubbles: true}));\n    });\n  });\n\n})();","/**\n * @license\n * Copyright (c) 2014 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt\n */\n\n(function() {\n  'use strict';\n  // It's desireable to provide a default stylesheet\n  // that's convenient for styling unresolved elements, but\n  // it's cumbersome to have to include this manually in every page.\n  // It would make sense to put inside some HTMLImport but\n  // the HTMLImports polyfill does not allow loading of stylesheets\n  // that block rendering. Therefore this injection is tolerated here.\n  //\n  // NOTE: position: relative fixes IE's failure to inherit opacity\n  // when a child is not statically positioned.\n  var style = document.createElement('style');\n  style.textContent = ''\n      + 'body {'\n      + 'transition: opacity ease-in 0.2s;'\n      + ' } \\n'\n      + 'body[unresolved] {'\n      + 'opacity: 0; display: block; overflow: hidden; position: relative;'\n      + ' } \\n'\n      ;\n  var head = document.querySelector('head');\n  head.insertBefore(style, head.firstChild);\n\n})();\n"]}
\ No newline at end of file
diff --git a/src/main/resources/static/gltf-viewer/gltf-viewer.html b/src/main/resources/static/gltf-viewer/gltf-viewer.html
deleted file mode 100644 (file)
index 5144512..0000000
+++ /dev/null
@@ -1,176 +0,0 @@
-<link rel="import" href="bower_components/polymer/polymer-element.html">
-<script src="js/three.js"></script>
-<script src="js/three-examples.js"></script>
-<script src="js/OrbitControls.js"></script>
-<!--<link rel="import" href="../polymer/lib/elements/dom-if.html">-->
-<!--<link rel="import" href="../polymer/lib/elements/dom-repeat.html">-->
-
-<!--
-`gltf-viewer`
-Displays a 3D representation of a glTF file
--->
-
-<dom-module id="gltf-viewer">
-       <template>
-               <style>
-                       :host {
-                               display: inline-block;
-                               padding: 0;
-                               margin: 0;
-                       }
-
-                       canvas {
-                               display: table-cell;
-                               display: flex;
-                               padding: 0;
-                       }
-               </style>
-               <canvas id="canvas"></canvas>
-       </template>
-
-       <script>
-               const clock = new THREE.Clock()
-
-               /** @polymerElement */
-               class GltfViewer extends Polymer.Element {
-                       static get is() {
-                               return 'gltf-viewer';
-                       }
-
-                       static get properties() {
-                               return {
-                                       src: {
-                                               type: String,
-                                               observer: 'load'
-                                       },
-                                       isRunning: {
-                                               type: Boolean,
-                                               readOnly: true
-                                       },
-                                       interactive: {
-                                               type: Boolean,
-                                               value: false,
-                                               reflectToAttribute: true,
-                                               observer: '_changedInteractive'
-                                       },
-                                       width: Number,
-                                       height: Number
-                               };
-                       }
-
-                       start() {
-                               if (this.isRunning) return
-
-                               requestAnimationFrame(this._render.bind(this))
-                               this._setIsRunning(true)
-                       }
-
-                       stop() {
-                               this._setIsRunning(false)
-                       }
-
-                       _render() {
-                               if (!this.isRunning) return
-                               this._controls.update()
-                               if (this._mixer) this._mixer.update(clock.getDelta())
-
-                               this._renderer.render(this._scene, this._camera)
-                               requestAnimationFrame(this._render.bind(this))
-                       }
-
-                       _changedInteractive(newValue) {
-                               if (!this._controls) return
-                               this._controls.enabled = newValue
-                       }
-
-                       load(src) {
-                               (async () => {
-                                       const scene = this._scene
-                                       if (!scene) return
-
-                                       const len = scene.children.length
-                                       for (let i = len - 1; i > 0; i--) scene.remove(scene.children[i])
-
-                                       let srcDir = src.replace(/\/[^\/]+\.obj$/, "/")
-                                       let matLoader = new THREE.MTLLoader().setResourcePath(srcDir)
-
-                                       const matSrc = src.replace(/\.obj$/i, ".mtl")
-                                       let mtlFile = await matLoader.loadAsync(matSrc)
-                                       mtlFile.preload()
-
-                                       let loader = new THREE.OBJLoader().setResourcePath(srcDir)
-                                       loader.setMaterials(mtlFile)
-                                       loader.setCrossOrigin('')
-
-                                       let obj = await loader.loadAsync(src)
-
-                                       scene.add(obj)
-                                       // FIT CAM
-                                       const bbox = new THREE.Box3().setFromObject(this._scene)
-                                       bbox.dimensions = {
-                                               x: bbox.max.x - bbox.min.x,
-                                               y: bbox.max.y - bbox.min.y,
-                                               z: bbox.max.z - bbox.min.z
-                                       }
-                                       obj.position.sub(new THREE.Vector3(bbox.min.x + bbox.dimensions.x / 2, bbox.min.y + bbox.dimensions.y / 2, bbox.min.z + bbox.dimensions.z / 2))
-
-                                       this._camera.position.set(bbox.dimensions.x / 2, bbox.dimensions.y / 2, Math.max(bbox.dimensions.x, bbox.dimensions.y, bbox.dimensions.z))
-
-                                       this._light = new THREE.PointLight(0xBBBBBB)
-                                       this._scene.add(this._camera)
-                                       this._camera.add(this._light)
-                                       this._light.position.set(0, 0, 0)
-
-                                       this.dispatchEvent(new CustomEvent('load'))
-
-                               })()
-                       }
-
-                       ready() {
-                               super.ready()
-
-                               const canvas = this.$.canvas
-
-                               this._camera = new THREE.PerspectiveCamera(75, 1, 0.1, 1000)
-                               this._scene = new THREE.Scene()
-                               this._renderer = new THREE.WebGLRenderer({
-                                       canvas
-                               })
-                               this._renderer.shadowMap.enabled = true
-                               this._isRunning = false
-
-                               this._scene.add(new THREE.AmbientLight(0x444444))
-
-                               this._controls = new THREE.OrbitControls(this._camera, canvas)
-                               if (!this.interactive) this._controls.enabled = false
-
-                               if (this.width && this.height) {
-                                       this._camera.aspect = this.width / this.height
-                                       this._camera.updateProjectionMatrix()
-                                       this._renderer.setSize(this.width, this.height, false)
-                                       if (this.src) this.load(this.src)
-                                       this.start()
-                               } else {
-                                       console.log('Auto dimensions')
-                                       requestAnimationFrame(() => {
-                                               const dimensions = this.getBoundingClientRect();
-                                               this._camera.aspect = dimensions.width / dimensions.height
-                                               this._camera.updateProjectionMatrix()
-                                               this._renderer.setSize(dimensions.width, dimensions.height, false)
-                                               if (this.src) this.load(this.src)
-                                               this.start()
-                                       })
-                               }
-
-                               window.addEventListener('resize', () => {
-                                       const dimensions = this.getBoundingClientRect()
-                                       this._camera.aspect = dimensions.width / dimensions.height
-                                       this._camera.updateProjectionMatrix()
-                                       this._renderer.setSize(dimensions.width, dimensions.height, false)
-                               })
-                       }
-               }
-
-               window.customElements.define(GltfViewer.is, GltfViewer);
-       </script>
-</dom-module>
diff --git a/src/main/resources/static/gltf-viewer/js/OrbitControls.js b/src/main/resources/static/gltf-viewer/js/OrbitControls.js
deleted file mode 100644 (file)
index 151f0c8..0000000
+++ /dev/null
@@ -1,1042 +0,0 @@
-/**
- * @author qiao / https://github.com/qiao
- * @author mrdoob / http://mrdoob.com
- * @author alteredq / http://alteredqualia.com/
- * @author WestLangley / http://github.com/WestLangley
- * @author erich666 / http://erichaines.com
- */
-
-// This set of controls performs orbiting, dollying (zooming), and panning.
-// Unlike TrackballControls, it maintains the "up" direction object.up (+Y by default).
-//
-//    Orbit - left mouse / touch: one finger move
-//    Zoom - middle mouse, or mousewheel / touch: two finger spread or squish
-//    Pan - right mouse, or arrow keys / touch: three finger swipe
-
-THREE.OrbitControls = function ( object, domElement ) {
-
-       this.object = object;
-
-       this.domElement = ( domElement !== undefined ) ? domElement : document;
-
-       // Set to false to disable this control
-       this.enabled = true;
-
-       // "target" sets the location of focus, where the object orbits around
-       this.target = new THREE.Vector3();
-
-       // How far you can dolly in and out ( PerspectiveCamera only )
-       this.minDistance = 0;
-       this.maxDistance = Infinity;
-
-       // How far you can zoom in and out ( OrthographicCamera only )
-       this.minZoom = 0;
-       this.maxZoom = Infinity;
-
-       // How far you can orbit vertically, upper and lower limits.
-       // Range is 0 to Math.PI radians.
-       this.minPolarAngle = 0; // radians
-       this.maxPolarAngle = Math.PI; // radians
-
-       // How far you can orbit horizontally, upper and lower limits.
-       // If set, must be a sub-interval of the interval [ - Math.PI, Math.PI ].
-       this.minAzimuthAngle = - Infinity; // radians
-       this.maxAzimuthAngle = Infinity; // radians
-
-       // Set to true to enable damping (inertia)
-       // If damping is enabled, you must call controls.update() in your animation loop
-       this.enableDamping = false;
-       this.dampingFactor = 0.25;
-
-       // This option actually enables dollying in and out; left as "zoom" for backwards compatibility.
-       // Set to false to disable zooming
-       this.enableZoom = true;
-       this.zoomSpeed = 1.0;
-
-       // Set to false to disable rotating
-       this.enableRotate = true;
-       this.rotateSpeed = 1.0;
-
-       // Set to false to disable panning
-       this.enablePan = true;
-       this.keyPanSpeed = 7.0; // pixels moved per arrow key push
-
-       // Set to true to automatically rotate around the target
-       // If auto-rotate is enabled, you must call controls.update() in your animation loop
-       this.autoRotate = false;
-       this.autoRotateSpeed = 2.0; // 30 seconds per round when fps is 60
-
-       // Set to false to disable use of the keys
-       this.enableKeys = true;
-
-       // The four arrow keys
-       this.keys = { LEFT: 37, UP: 38, RIGHT: 39, BOTTOM: 40 };
-
-       // Mouse buttons
-       this.mouseButtons = { ORBIT: THREE.MOUSE.LEFT, ZOOM: THREE.MOUSE.MIDDLE, PAN: THREE.MOUSE.RIGHT };
-
-       // for reset
-       this.target0 = this.target.clone();
-       this.position0 = this.object.position.clone();
-       this.zoom0 = this.object.zoom;
-
-       //
-       // public methods
-       //
-
-       this.getPolarAngle = function () {
-
-               return spherical.phi;
-
-       };
-
-       this.getAzimuthalAngle = function () {
-
-               return spherical.theta;
-
-       };
-
-       this.saveState = function () {
-
-               scope.target0.copy( scope.target );
-               scope.position0.copy( scope.object.position );
-               scope.zoom0 = scope.object.zoom;
-
-       };
-
-       this.reset = function () {
-
-               scope.target.copy( scope.target0 );
-               scope.object.position.copy( scope.position0 );
-               scope.object.zoom = scope.zoom0;
-
-               scope.object.updateProjectionMatrix();
-               scope.dispatchEvent( changeEvent );
-
-               scope.update();
-
-               state = STATE.NONE;
-
-       };
-
-       // this method is exposed, but perhaps it would be better if we can make it private...
-       this.update = function () {
-
-               var offset = new THREE.Vector3();
-
-               // so camera.up is the orbit axis
-               var quat = new THREE.Quaternion().setFromUnitVectors( object.up, new THREE.Vector3( 0, 1, 0 ) );
-               var quatInverse = quat.clone().inverse();
-
-               var lastPosition = new THREE.Vector3();
-               var lastQuaternion = new THREE.Quaternion();
-
-               return function update() {
-
-                       var position = scope.object.position;
-
-                       offset.copy( position ).sub( scope.target );
-
-                       // rotate offset to "y-axis-is-up" space
-                       offset.applyQuaternion( quat );
-
-                       // angle from z-axis around y-axis
-                       spherical.setFromVector3( offset );
-
-                       if ( scope.autoRotate && state === STATE.NONE ) {
-
-                               rotateLeft( getAutoRotationAngle() );
-
-                       }
-
-                       spherical.theta += sphericalDelta.theta;
-                       spherical.phi += sphericalDelta.phi;
-
-                       // restrict theta to be between desired limits
-                       spherical.theta = Math.max( scope.minAzimuthAngle, Math.min( scope.maxAzimuthAngle, spherical.theta ) );
-
-                       // restrict phi to be between desired limits
-                       spherical.phi = Math.max( scope.minPolarAngle, Math.min( scope.maxPolarAngle, spherical.phi ) );
-
-                       spherical.makeSafe();
-
-
-                       spherical.radius *= scale;
-
-                       // restrict radius to be between desired limits
-                       spherical.radius = Math.max( scope.minDistance, Math.min( scope.maxDistance, spherical.radius ) );
-
-                       // move target to panned location
-                       scope.target.add( panOffset );
-
-                       offset.setFromSpherical( spherical );
-
-                       // rotate offset back to "camera-up-vector-is-up" space
-                       offset.applyQuaternion( quatInverse );
-
-                       position.copy( scope.target ).add( offset );
-
-                       scope.object.lookAt( scope.target );
-
-                       if ( scope.enableDamping === true ) {
-
-                               sphericalDelta.theta *= ( 1 - scope.dampingFactor );
-                               sphericalDelta.phi *= ( 1 - scope.dampingFactor );
-
-                       } else {
-
-                               sphericalDelta.set( 0, 0, 0 );
-
-                       }
-
-                       scale = 1;
-                       panOffset.set( 0, 0, 0 );
-
-                       // update condition is:
-                       // min(camera displacement, camera rotation in radians)^2 > EPS
-                       // using small-angle approximation cos(x/2) = 1 - x^2 / 8
-
-                       if ( zoomChanged ||
-                               lastPosition.distanceToSquared( scope.object.position ) > EPS ||
-                               8 * ( 1 - lastQuaternion.dot( scope.object.quaternion ) ) > EPS ) {
-
-                               scope.dispatchEvent( changeEvent );
-
-                               lastPosition.copy( scope.object.position );
-                               lastQuaternion.copy( scope.object.quaternion );
-                               zoomChanged = false;
-
-                               return true;
-
-                       }
-
-                       return false;
-
-               };
-
-       }();
-
-       this.dispose = function () {
-
-               scope.domElement.removeEventListener( 'contextmenu', onContextMenu, false );
-               scope.domElement.removeEventListener( 'mousedown', onMouseDown, false );
-               scope.domElement.removeEventListener( 'wheel', onMouseWheel, false );
-
-               scope.domElement.removeEventListener( 'touchstart', onTouchStart, false );
-               scope.domElement.removeEventListener( 'touchend', onTouchEnd, false );
-               scope.domElement.removeEventListener( 'touchmove', onTouchMove, false );
-
-               document.removeEventListener( 'mousemove', onMouseMove, false );
-               document.removeEventListener( 'mouseup', onMouseUp, false );
-
-               window.removeEventListener( 'keydown', onKeyDown, false );
-
-               //scope.dispatchEvent( { type: 'dispose' } ); // should this be added here?
-
-       };
-
-       //
-       // internals
-       //
-
-       var scope = this;
-
-       var changeEvent = { type: 'change' };
-       var startEvent = { type: 'start' };
-       var endEvent = { type: 'end' };
-
-       var STATE = { NONE: - 1, ROTATE: 0, DOLLY: 1, PAN: 2, TOUCH_ROTATE: 3, TOUCH_DOLLY: 4, TOUCH_PAN: 5 };
-
-       var state = STATE.NONE;
-
-       var EPS = 0.000001;
-
-       // current position in spherical coordinates
-       var spherical = new THREE.Spherical();
-       var sphericalDelta = new THREE.Spherical();
-
-       var scale = 1;
-       var panOffset = new THREE.Vector3();
-       var zoomChanged = false;
-
-       var rotateStart = new THREE.Vector2();
-       var rotateEnd = new THREE.Vector2();
-       var rotateDelta = new THREE.Vector2();
-
-       var panStart = new THREE.Vector2();
-       var panEnd = new THREE.Vector2();
-       var panDelta = new THREE.Vector2();
-
-       var dollyStart = new THREE.Vector2();
-       var dollyEnd = new THREE.Vector2();
-       var dollyDelta = new THREE.Vector2();
-
-       function getAutoRotationAngle() {
-
-               return 2 * Math.PI / 60 / 60 * scope.autoRotateSpeed;
-
-       }
-
-       function getZoomScale() {
-
-               return Math.pow( 0.95, scope.zoomSpeed );
-
-       }
-
-       function rotateLeft( angle ) {
-
-               sphericalDelta.theta -= angle;
-
-       }
-
-       function rotateUp( angle ) {
-
-               sphericalDelta.phi -= angle;
-
-       }
-
-       var panLeft = function () {
-
-               var v = new THREE.Vector3();
-
-               return function panLeft( distance, objectMatrix ) {
-
-                       v.setFromMatrixColumn( objectMatrix, 0 ); // get X column of objectMatrix
-                       v.multiplyScalar( - distance );
-
-                       panOffset.add( v );
-
-               };
-
-       }();
-
-       var panUp = function () {
-
-               var v = new THREE.Vector3();
-
-               return function panUp( distance, objectMatrix ) {
-
-                       v.setFromMatrixColumn( objectMatrix, 1 ); // get Y column of objectMatrix
-                       v.multiplyScalar( distance );
-
-                       panOffset.add( v );
-
-               };
-
-       }();
-
-       // deltaX and deltaY are in pixels; right and down are positive
-       var pan = function () {
-
-               var offset = new THREE.Vector3();
-
-               return function pan( deltaX, deltaY ) {
-
-                       var element = scope.domElement === document ? scope.domElement.body : scope.domElement;
-
-                       if ( scope.object instanceof THREE.PerspectiveCamera ) {
-
-                               // perspective
-                               var position = scope.object.position;
-                               offset.copy( position ).sub( scope.target );
-                               var targetDistance = offset.length();
-
-                               // half of the fov is center to top of screen
-                               targetDistance *= Math.tan( ( scope.object.fov / 2 ) * Math.PI / 180.0 );
-
-                               // we actually don't use screenWidth, since perspective camera is fixed to screen height
-                               panLeft( 2 * deltaX * targetDistance / element.clientHeight, scope.object.matrix );
-                               panUp( 2 * deltaY * targetDistance / element.clientHeight, scope.object.matrix );
-
-                       } else if ( scope.object instanceof THREE.OrthographicCamera ) {
-
-                               // orthographic
-                               panLeft( deltaX * ( scope.object.right - scope.object.left ) / scope.object.zoom / element.clientWidth, scope.object.matrix );
-                               panUp( deltaY * ( scope.object.top - scope.object.bottom ) / scope.object.zoom / element.clientHeight, scope.object.matrix );
-
-                       } else {
-
-                               // camera neither orthographic nor perspective
-                               console.warn( 'WARNING: OrbitControls.js encountered an unknown camera type - pan disabled.' );
-                               scope.enablePan = false;
-
-                       }
-
-               };
-
-       }();
-
-       function dollyIn( dollyScale ) {
-
-               if ( scope.object instanceof THREE.PerspectiveCamera ) {
-
-                       scale /= dollyScale;
-
-               } else if ( scope.object instanceof THREE.OrthographicCamera ) {
-
-                       scope.object.zoom = Math.max( scope.minZoom, Math.min( scope.maxZoom, scope.object.zoom * dollyScale ) );
-                       scope.object.updateProjectionMatrix();
-                       zoomChanged = true;
-
-               } else {
-
-                       console.warn( 'WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled.' );
-                       scope.enableZoom = false;
-
-               }
-
-       }
-
-       function dollyOut( dollyScale ) {
-
-               if ( scope.object instanceof THREE.PerspectiveCamera ) {
-
-                       scale *= dollyScale;
-
-               } else if ( scope.object instanceof THREE.OrthographicCamera ) {
-
-                       scope.object.zoom = Math.max( scope.minZoom, Math.min( scope.maxZoom, scope.object.zoom / dollyScale ) );
-                       scope.object.updateProjectionMatrix();
-                       zoomChanged = true;
-
-               } else {
-
-                       console.warn( 'WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled.' );
-                       scope.enableZoom = false;
-
-               }
-
-       }
-
-       //
-       // event callbacks - update the object state
-       //
-
-       function handleMouseDownRotate( event ) {
-
-               //console.log( 'handleMouseDownRotate' );
-
-               rotateStart.set( event.clientX, event.clientY );
-
-       }
-
-       function handleMouseDownDolly( event ) {
-
-               //console.log( 'handleMouseDownDolly' );
-
-               dollyStart.set( event.clientX, event.clientY );
-
-       }
-
-       function handleMouseDownPan( event ) {
-
-               //console.log( 'handleMouseDownPan' );
-
-               panStart.set( event.clientX, event.clientY );
-
-       }
-
-       function handleMouseMoveRotate( event ) {
-
-               //console.log( 'handleMouseMoveRotate' );
-
-               rotateEnd.set( event.clientX, event.clientY );
-               rotateDelta.subVectors( rotateEnd, rotateStart );
-
-               var element = scope.domElement === document ? scope.domElement.body : scope.domElement;
-
-               // rotating across whole screen goes 360 degrees around
-               rotateLeft( 2 * Math.PI * rotateDelta.x / element.clientWidth * scope.rotateSpeed );
-
-               // rotating up and down along whole screen attempts to go 360, but limited to 180
-               rotateUp( 2 * Math.PI * rotateDelta.y / element.clientHeight * scope.rotateSpeed );
-
-               rotateStart.copy( rotateEnd );
-
-               scope.update();
-
-       }
-
-       function handleMouseMoveDolly( event ) {
-
-               //console.log( 'handleMouseMoveDolly' );
-
-               dollyEnd.set( event.clientX, event.clientY );
-
-               dollyDelta.subVectors( dollyEnd, dollyStart );
-
-               if ( dollyDelta.y > 0 ) {
-
-                       dollyIn( getZoomScale() );
-
-               } else if ( dollyDelta.y < 0 ) {
-
-                       dollyOut( getZoomScale() );
-
-               }
-
-               dollyStart.copy( dollyEnd );
-
-               scope.update();
-
-       }
-
-       function handleMouseMovePan( event ) {
-
-               //console.log( 'handleMouseMovePan' );
-
-               panEnd.set( event.clientX, event.clientY );
-
-               panDelta.subVectors( panEnd, panStart );
-
-               pan( panDelta.x, panDelta.y );
-
-               panStart.copy( panEnd );
-
-               scope.update();
-
-       }
-
-       function handleMouseUp( event ) {
-
-               // console.log( 'handleMouseUp' );
-
-       }
-
-       function handleMouseWheel( event ) {
-
-               // console.log( 'handleMouseWheel' );
-
-               if ( event.deltaY < 0 ) {
-
-                       dollyOut( getZoomScale() );
-
-               } else if ( event.deltaY > 0 ) {
-
-                       dollyIn( getZoomScale() );
-
-               }
-
-               scope.update();
-
-       }
-
-       function handleKeyDown( event ) {
-
-               //console.log( 'handleKeyDown' );
-
-               switch ( event.keyCode ) {
-
-                       case scope.keys.UP:
-                               pan( 0, scope.keyPanSpeed );
-                               scope.update();
-                               break;
-
-                       case scope.keys.BOTTOM:
-                               pan( 0, - scope.keyPanSpeed );
-                               scope.update();
-                               break;
-
-                       case scope.keys.LEFT:
-                               pan( scope.keyPanSpeed, 0 );
-                               scope.update();
-                               break;
-
-                       case scope.keys.RIGHT:
-                               pan( - scope.keyPanSpeed, 0 );
-                               scope.update();
-                               break;
-
-               }
-
-       }
-
-       function handleTouchStartRotate( event ) {
-
-               //console.log( 'handleTouchStartRotate' );
-
-               rotateStart.set( event.touches[ 0 ].pageX, event.touches[ 0 ].pageY );
-
-       }
-
-       function handleTouchStartDolly( event ) {
-
-               //console.log( 'handleTouchStartDolly' );
-
-               var dx = event.touches[ 0 ].pageX - event.touches[ 1 ].pageX;
-               var dy = event.touches[ 0 ].pageY - event.touches[ 1 ].pageY;
-
-               var distance = Math.sqrt( dx * dx + dy * dy );
-
-               dollyStart.set( 0, distance );
-
-       }
-
-       function handleTouchStartPan( event ) {
-
-               //console.log( 'handleTouchStartPan' );
-
-               panStart.set( event.touches[ 0 ].pageX, event.touches[ 0 ].pageY );
-
-       }
-
-       function handleTouchMoveRotate( event ) {
-
-               //console.log( 'handleTouchMoveRotate' );
-
-               rotateEnd.set( event.touches[ 0 ].pageX, event.touches[ 0 ].pageY );
-               rotateDelta.subVectors( rotateEnd, rotateStart );
-
-               var element = scope.domElement === document ? scope.domElement.body : scope.domElement;
-
-               // rotating across whole screen goes 360 degrees around
-               rotateLeft( 2 * Math.PI * rotateDelta.x / element.clientWidth * scope.rotateSpeed );
-
-               // rotating up and down along whole screen attempts to go 360, but limited to 180
-               rotateUp( 2 * Math.PI * rotateDelta.y / element.clientHeight * scope.rotateSpeed );
-
-               rotateStart.copy( rotateEnd );
-
-               scope.update();
-
-       }
-
-       function handleTouchMoveDolly( event ) {
-
-               //console.log( 'handleTouchMoveDolly' );
-
-               var dx = event.touches[ 0 ].pageX - event.touches[ 1 ].pageX;
-               var dy = event.touches[ 0 ].pageY - event.touches[ 1 ].pageY;
-
-               var distance = Math.sqrt( dx * dx + dy * dy );
-
-               dollyEnd.set( 0, distance );
-
-               dollyDelta.subVectors( dollyEnd, dollyStart );
-
-               if ( dollyDelta.y > 0 ) {
-
-                       dollyOut( getZoomScale() );
-
-               } else if ( dollyDelta.y < 0 ) {
-
-                       dollyIn( getZoomScale() );
-
-               }
-
-               dollyStart.copy( dollyEnd );
-
-               scope.update();
-
-       }
-
-       function handleTouchMovePan( event ) {
-
-               //console.log( 'handleTouchMovePan' );
-
-               panEnd.set( event.touches[ 0 ].pageX, event.touches[ 0 ].pageY );
-
-               panDelta.subVectors( panEnd, panStart );
-
-               pan( panDelta.x, panDelta.y );
-
-               panStart.copy( panEnd );
-
-               scope.update();
-
-       }
-
-       function handleTouchEnd( event ) {
-
-               //console.log( 'handleTouchEnd' );
-
-       }
-
-       //
-       // event handlers - FSM: listen for events and reset state
-       //
-
-       function onMouseDown( event ) {
-
-               if ( scope.enabled === false ) return;
-
-               event.preventDefault();
-
-               switch ( event.button ) {
-
-                       case scope.mouseButtons.ORBIT:
-
-                               if ( scope.enableRotate === false ) return;
-
-                               handleMouseDownRotate( event );
-
-                               state = STATE.ROTATE;
-
-                               break;
-
-                       case scope.mouseButtons.ZOOM:
-
-                               if ( scope.enableZoom === false ) return;
-
-                               handleMouseDownDolly( event );
-
-                               state = STATE.DOLLY;
-
-                               break;
-
-                       case scope.mouseButtons.PAN:
-
-                               if ( scope.enablePan === false ) return;
-
-                               handleMouseDownPan( event );
-
-                               state = STATE.PAN;
-
-                               break;
-
-               }
-
-               if ( state !== STATE.NONE ) {
-
-                       document.addEventListener( 'mousemove', onMouseMove, false );
-                       document.addEventListener( 'mouseup', onMouseUp, false );
-
-                       scope.dispatchEvent( startEvent );
-
-               }
-
-       }
-
-       function onMouseMove( event ) {
-
-               if ( scope.enabled === false ) return;
-
-               event.preventDefault();
-
-               switch ( state ) {
-
-                       case STATE.ROTATE:
-
-                               if ( scope.enableRotate === false ) return;
-
-                               handleMouseMoveRotate( event );
-
-                               break;
-
-                       case STATE.DOLLY:
-
-                               if ( scope.enableZoom === false ) return;
-
-                               handleMouseMoveDolly( event );
-
-                               break;
-
-                       case STATE.PAN:
-
-                               if ( scope.enablePan === false ) return;
-
-                               handleMouseMovePan( event );
-
-                               break;
-
-               }
-
-       }
-
-       function onMouseUp( event ) {
-
-               if ( scope.enabled === false ) return;
-
-               handleMouseUp( event );
-
-               document.removeEventListener( 'mousemove', onMouseMove, false );
-               document.removeEventListener( 'mouseup', onMouseUp, false );
-
-               scope.dispatchEvent( endEvent );
-
-               state = STATE.NONE;
-
-       }
-
-       function onMouseWheel( event ) {
-
-               if ( scope.enabled === false || scope.enableZoom === false || ( state !== STATE.NONE && state !== STATE.ROTATE ) ) return;
-
-               event.preventDefault();
-               event.stopPropagation();
-
-               handleMouseWheel( event );
-
-               scope.dispatchEvent( startEvent ); // not sure why these are here...
-               scope.dispatchEvent( endEvent );
-
-       }
-
-       function onKeyDown( event ) {
-
-               if ( scope.enabled === false || scope.enableKeys === false || scope.enablePan === false ) return;
-
-               handleKeyDown( event );
-
-       }
-
-       function onTouchStart( event ) {
-
-               if ( scope.enabled === false ) return;
-
-               switch ( event.touches.length ) {
-
-                       case 1: // one-fingered touch: rotate
-
-                               if ( scope.enableRotate === false ) return;
-
-                               handleTouchStartRotate( event );
-
-                               state = STATE.TOUCH_ROTATE;
-
-                               break;
-
-                       case 2: // two-fingered touch: dolly
-
-                               if ( scope.enableZoom === false ) return;
-
-                               handleTouchStartDolly( event );
-
-                               state = STATE.TOUCH_DOLLY;
-
-                               break;
-
-                       case 3: // three-fingered touch: pan
-
-                               if ( scope.enablePan === false ) return;
-
-                               handleTouchStartPan( event );
-
-                               state = STATE.TOUCH_PAN;
-
-                               break;
-
-                       default:
-
-                               state = STATE.NONE;
-
-               }
-
-               if ( state !== STATE.NONE ) {
-
-                       scope.dispatchEvent( startEvent );
-
-               }
-
-       }
-
-       function onTouchMove( event ) {
-
-               if ( scope.enabled === false ) return;
-
-               event.preventDefault();
-               event.stopPropagation();
-
-               switch ( event.touches.length ) {
-
-                       case 1: // one-fingered touch: rotate
-
-                               if ( scope.enableRotate === false ) return;
-                               if ( state !== STATE.TOUCH_ROTATE ) return; // is this needed?...
-
-                               handleTouchMoveRotate( event );
-
-                               break;
-
-                       case 2: // two-fingered touch: dolly
-
-                               if ( scope.enableZoom === false ) return;
-                               if ( state !== STATE.TOUCH_DOLLY ) return; // is this needed?...
-
-                               handleTouchMoveDolly( event );
-
-                               break;
-
-                       case 3: // three-fingered touch: pan
-
-                               if ( scope.enablePan === false ) return;
-                               if ( state !== STATE.TOUCH_PAN ) return; // is this needed?...
-
-                               handleTouchMovePan( event );
-
-                               break;
-
-                       default:
-
-                               state = STATE.NONE;
-
-               }
-
-       }
-
-       function onTouchEnd( event ) {
-
-               if ( scope.enabled === false ) return;
-
-               handleTouchEnd( event );
-
-               scope.dispatchEvent( endEvent );
-
-               state = STATE.NONE;
-
-       }
-
-       function onContextMenu( event ) {
-
-               if ( scope.enabled === false ) return;
-
-               event.preventDefault();
-
-       }
-
-       //
-
-       scope.domElement.addEventListener( 'contextmenu', onContextMenu, false );
-
-       scope.domElement.addEventListener( 'mousedown', onMouseDown, false );
-       scope.domElement.addEventListener( 'wheel', onMouseWheel, false );
-
-       scope.domElement.addEventListener( 'touchstart', onTouchStart, false );
-       scope.domElement.addEventListener( 'touchend', onTouchEnd, false );
-       scope.domElement.addEventListener( 'touchmove', onTouchMove, false );
-
-       window.addEventListener( 'keydown', onKeyDown, false );
-
-       // force an update at start
-
-       this.update();
-
-};
-
-THREE.OrbitControls.prototype = Object.create( THREE.EventDispatcher.prototype );
-THREE.OrbitControls.prototype.constructor = THREE.OrbitControls;
-
-Object.defineProperties( THREE.OrbitControls.prototype, {
-
-       center: {
-
-               get: function () {
-
-                       console.warn( 'THREE.OrbitControls: .center has been renamed to .target' );
-                       return this.target;
-
-               }
-
-       },
-
-       // backward compatibility
-
-       noZoom: {
-
-               get: function () {
-
-                       console.warn( 'THREE.OrbitControls: .noZoom has been deprecated. Use .enableZoom instead.' );
-                       return ! this.enableZoom;
-
-               },
-
-               set: function ( value ) {
-
-                       console.warn( 'THREE.OrbitControls: .noZoom has been deprecated. Use .enableZoom instead.' );
-                       this.enableZoom = ! value;
-
-               }
-
-       },
-
-       noRotate: {
-
-               get: function () {
-
-                       console.warn( 'THREE.OrbitControls: .noRotate has been deprecated. Use .enableRotate instead.' );
-                       return ! this.enableRotate;
-
-               },
-
-               set: function ( value ) {
-
-                       console.warn( 'THREE.OrbitControls: .noRotate has been deprecated. Use .enableRotate instead.' );
-                       this.enableRotate = ! value;
-
-               }
-
-       },
-
-       noPan: {
-
-               get: function () {
-
-                       console.warn( 'THREE.OrbitControls: .noPan has been deprecated. Use .enablePan instead.' );
-                       return ! this.enablePan;
-
-               },
-
-               set: function ( value ) {
-
-                       console.warn( 'THREE.OrbitControls: .noPan has been deprecated. Use .enablePan instead.' );
-                       this.enablePan = ! value;
-
-               }
-
-       },
-
-       noKeys: {
-
-               get: function () {
-
-                       console.warn( 'THREE.OrbitControls: .noKeys has been deprecated. Use .enableKeys instead.' );
-                       return ! this.enableKeys;
-
-               },
-
-               set: function ( value ) {
-
-                       console.warn( 'THREE.OrbitControls: .noKeys has been deprecated. Use .enableKeys instead.' );
-                       this.enableKeys = ! value;
-
-               }
-
-       },
-
-       staticMoving: {
-
-               get: function () {
-
-                       console.warn( 'THREE.OrbitControls: .staticMoving has been deprecated. Use .enableDamping instead.' );
-                       return ! this.enableDamping;
-
-               },
-
-               set: function ( value ) {
-
-                       console.warn( 'THREE.OrbitControls: .staticMoving has been deprecated. Use .enableDamping instead.' );
-                       this.enableDamping = ! value;
-
-               }
-
-       },
-
-       dynamicDampingFactor: {
-
-               get: function () {
-
-                       console.warn( 'THREE.OrbitControls: .dynamicDampingFactor has been renamed. Use .dampingFactor instead.' );
-                       return this.dampingFactor;
-
-               },
-
-               set: function ( value ) {
-
-                       console.warn( 'THREE.OrbitControls: .dynamicDampingFactor has been renamed. Use .dampingFactor instead.' );
-                       this.dampingFactor = value;
-
-               }
-
-       }
-
-} );
diff --git a/src/main/resources/static/gltf-viewer/js/three-examples.js b/src/main/resources/static/gltf-viewer/js/three-examples.js
deleted file mode 100644 (file)
index 7892ef1..0000000
+++ /dev/null
@@ -1,1452 +0,0 @@
-(function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){
-window.THREE.MTLLoader = require("./MTLLoader").MTLLoader;
-
-},{"./MTLLoader":2}],2:[function(require,module,exports){
-/**
- * Loads a Wavefront .mtl file specifying materials
- */
-
-class MTLLoader extends THREE.Loader {
-
-       constructor(manager) {
-
-               super(manager);
-
-       }
-
-       /**
-        * Loads and parses a MTL asset from a URL.
-        *
-        * @param {String} url - URL to the MTL file.
-        * @param {Function} [onLoad] - Callback invoked with the loaded object.
-        * @param {Function} [onProgress] - Callback for download progress.
-        * @param {Function} [onError] - Callback for download errors.
-        *
-        * @see setPath setResourcePath
-        *
-        * @note In order for relative texture references to resolve correctly
-        * you must call setResourcePath() explicitly prior to load.
-        */
-       load(url, onLoad, onProgress, onError) {
-
-               const scope = this;
-
-               const path = (this.path === '') ? THREE.LoaderUtils.extractUrlBase(url) : this.path;
-
-               const loader = new THREE.FileLoader(this.manager);
-               loader.setPath(this.path);
-               loader.setRequestHeader(this.requestHeader);
-               loader.setWithCredentials(this.withCredentials);
-               loader.load(url, function (text) {
-
-                       try {
-
-                               onLoad(scope.parse(text, path));
-
-                       } catch (e) {
-
-                               if (onError) {
-
-                                       onError(e);
-
-                               } else {
-
-                                       console.error(e);
-
-                               }
-
-                               scope.manager.itemError(url);
-
-                       }
-
-               }, onProgress, onError);
-
-       }
-
-       setMaterialOptions(value) {
-
-               this.materialOptions = value;
-               return this;
-
-       }
-
-       /**
-        * Parses a MTL file.
-        *
-        * @param {String} text - Content of MTL file
-        * @return {MaterialCreator}
-        *
-        * @see setPath setResourcePath
-        *
-        * @note In order for relative texture references to resolve correctly
-        * you must call setResourcePath() explicitly prior to parse.
-        */
-       parse(text, path) {
-
-               const lines = text.split('\n');
-               let info = {};
-               const delimiter_pattern = /\s+/;
-               const materialsInfo = {};
-
-               for (let i = 0; i < lines.length; i++) {
-
-                       let line = lines[i];
-                       line = line.trim();
-
-                       if (line.length === 0 || line.charAt(0) === '#') {
-
-                               // Blank line or comment ignore
-                               continue;
-
-                       }
-
-                       const pos = line.indexOf(' ');
-
-                       let key = (pos >= 0) ? line.substring(0, pos) : line;
-                       key = key.toLowerCase();
-
-                       let value = (pos >= 0) ? line.substring(pos + 1) : '';
-                       value = value.trim();
-
-                       if (key === 'newmtl') {
-
-                               // New material
-
-                               info = {name: value};
-                               materialsInfo[value] = info;
-
-                       } else {
-
-                               if (key === 'ka' || key === 'kd' || key === 'ks' || key === 'ke') {
-
-                                       const ss = value.split(delimiter_pattern, 3);
-                                       info[key] = [parseFloat(ss[0]), parseFloat(ss[1]), parseFloat(ss[2])];
-
-                               } else {
-
-                                       info[key] = value;
-
-                               }
-
-                       }
-
-               }
-
-               const materialCreator = new MaterialCreator(this.resourcePath || path, this.materialOptions);
-               materialCreator.setCrossOrigin(this.crossOrigin);
-               materialCreator.setManager(this.manager);
-               materialCreator.setMaterials(materialsInfo);
-               return materialCreator;
-
-       }
-
-}
-
-/**
- * Create a new MTLLoader.MaterialCreator
- * @param baseUrl - Url relative to which textures are loaded
- * @param options - Set of options on how to construct the materials
- *                  side: Which side to apply the material
- *                        THREE.FrontSide (default), THREE.BackSide, THREE.DoubleSide
- *                  wrap: What type of wrapping to apply for textures
- *                        THREE.RepeatWrapping (default), THREE.ClampToEdgeWrapping, THREE.MirroredRepeatWrapping
- *                  normalizeRGB: RGBs need to be normalized to 0-1 from 0-255
- *                                Default: false, assumed to be already normalized
- *                  ignoreZeroRGBs: Ignore values of RGBs (Ka,Kd,Ks) that are all 0's
- *                                  Default: false
- * @constructor
- */
-
-class MaterialCreator {
-
-       constructor(baseUrl = '', options = {}) {
-
-               this.baseUrl = baseUrl;
-               this.options = options;
-               this.materialsInfo = {};
-               this.materials = {};
-               this.materialsArray = [];
-               this.nameLookup = {};
-
-               this.crossOrigin = 'anonymous';
-
-               this.side = (this.options.side !== undefined) ? this.options.side : THREE.FrontSide;
-               this.wrap = (this.options.wrap !== undefined) ? this.options.wrap : THREE.RepeatWrapping;
-
-       }
-
-       setCrossOrigin(value) {
-
-               this.crossOrigin = value;
-               return this;
-
-       }
-
-       setManager(value) {
-
-               this.manager = value;
-
-       }
-
-       setMaterials(materialsInfo) {
-
-               this.materialsInfo = this.convert(materialsInfo);
-               this.materials = {};
-               this.materialsArray = [];
-               this.nameLookup = {};
-
-       }
-
-       convert(materialsInfo) {
-
-               if (!this.options) return materialsInfo;
-
-               const converted = {};
-
-               for (const mn in materialsInfo) {
-
-                       // Convert materials info into normalized form based on options
-
-                       const mat = materialsInfo[mn];
-
-                       const covmat = {};
-
-                       converted[mn] = covmat;
-
-                       for (const prop in mat) {
-
-                               let save = true;
-                               let value = mat[prop];
-                               const lprop = prop.toLowerCase();
-
-                               switch (lprop) {
-
-                                       case 'kd':
-                                       case 'ka':
-                                       case 'ks':
-
-                                               // Diffuse color (color under white light) using RGB values
-
-                                               if (this.options && this.options.normalizeRGB) {
-
-                                                       value = [value[0] / 255, value[1] / 255, value[2] / 255];
-
-                                               }
-
-                                               if (this.options && this.options.ignoreZeroRGBs) {
-
-                                                       if (value[0] === 0 && value[1] === 0 && value[2] === 0) {
-
-                                                               // ignore
-
-                                                               save = false;
-
-                                                       }
-
-                                               }
-
-                                               break;
-
-                                       default:
-
-                                               break;
-
-                               }
-
-                               if (save) {
-
-                                       covmat[lprop] = value;
-
-                               }
-
-                       }
-
-               }
-
-               return converted;
-
-       }
-
-       preload() {
-
-               for (const mn in this.materialsInfo) {
-
-                       this.create(mn);
-
-               }
-
-       }
-
-       getIndex(materialName) {
-
-               return this.nameLookup[materialName];
-
-       }
-
-       getAsArray() {
-
-               let index = 0;
-
-               for (const mn in this.materialsInfo) {
-
-                       this.materialsArray[index] = this.create(mn);
-                       this.nameLookup[mn] = index;
-                       index++;
-
-               }
-
-               return this.materialsArray;
-
-       }
-
-       create(materialName) {
-
-               if (this.materials[materialName] === undefined) {
-
-                       this.createMaterial_(materialName);
-
-               }
-
-               return this.materials[materialName];
-
-       }
-
-       createMaterial_(materialName) {
-
-               // Create material
-
-               const scope = this;
-               const mat = this.materialsInfo[materialName];
-               const params = {
-
-                       name: materialName,
-                       side: this.side
-
-               };
-
-               function resolveURL(baseUrl, url) {
-
-                       if (typeof url !== 'string' || url === '')
-                               return '';
-
-                       // Absolute URL
-                       if (/^https?:\/\//i.test(url)) return url;
-
-                       return baseUrl + url;
-
-               }
-
-               function setMapForType(mapType, value) {
-
-                       if (params[mapType]) return; // Keep the first encountered texture
-
-                       const texParams = scope.getTextureParams(value, params);
-                       const map = scope.loadTexture(resolveURL(scope.baseUrl, texParams.url));
-
-                       map.repeat.copy(texParams.scale);
-                       map.offset.copy(texParams.offset);
-
-                       map.wrapS = scope.wrap;
-                       map.wrapT = scope.wrap;
-
-                       params[mapType] = map;
-
-               }
-
-               for (const prop in mat) {
-
-                       const value = mat[prop];
-                       let n;
-
-                       if (value === '') continue;
-
-                       switch (prop.toLowerCase()) {
-
-                               // Ns is material specular exponent
-
-                               case 'kd':
-
-                                       // Diffuse color (color under white light) using RGB values
-
-                                       params.color = new THREE.Color().fromArray(value);
-
-                                       break;
-
-                               case 'ks':
-
-                                       // Specular color (color when light is reflected from shiny surface) using RGB values
-                                       params.specular = new THREE.Color().fromArray(value);
-
-                                       break;
-
-                               case 'ke':
-
-                                       // Emissive using RGB values
-                                       params.emissive = new THREE.Color().fromArray(value);
-
-                                       break;
-
-                               case 'map_kd':
-
-                                       // Diffuse texture map
-
-                                       setMapForType('map', value);
-
-                                       break;
-
-                               case 'map_ks':
-
-                                       // Specular map
-
-                                       setMapForType('specularMap', value);
-
-                                       break;
-
-                               case 'map_ke':
-
-                                       // Emissive map
-
-                                       setMapForType('emissiveMap', value);
-
-                                       break;
-
-                               case 'norm':
-
-                                       setMapForType('normalMap', value);
-
-                                       break;
-
-                               case 'map_bump':
-                               case 'bump':
-
-                                       // Bump texture map
-
-                                       setMapForType('bumpMap', value);
-
-                                       break;
-
-                               case 'map_d':
-
-                                       // Alpha map
-
-                                       setMapForType('alphaMap', value);
-                                       params.transparent = true;
-
-                                       break;
-
-                               case 'ns':
-
-                                       // The specular exponent (defines the focus of the specular highlight)
-                                       // A high exponent results in a tight, concentrated highlight. Ns values normally range from 0 to 1000.
-
-                                       params.shininess = parseFloat(value);
-
-                                       break;
-
-                               case 'd':
-                                       n = parseFloat(value);
-
-                                       if (n < 1) {
-
-                                               params.opacity = n;
-                                               params.transparent = true;
-
-                                       }
-
-                                       break;
-
-                               case 'tr':
-                                       n = parseFloat(value);
-
-                                       if (this.options && this.options.invertTrProperty) n = 1 - n;
-
-                                       if (n > 0) {
-
-                                               params.opacity = 1 - n;
-                                               params.transparent = true;
-
-                                       }
-
-                                       break;
-
-                               default:
-                                       break;
-
-                       }
-
-               }
-
-               this.materials[materialName] = new THREE.MeshPhongMaterial(params);
-               return this.materials[materialName];
-
-       }
-
-       getTextureParams(value, matParams) {
-
-               const texParams = {
-
-                       scale: new THREE.Vector2(1, 1),
-                       offset: new THREE.Vector2(0, 0)
-
-               };
-
-               const items = value.split(/\s+/);
-               let pos;
-
-               pos = items.indexOf('-bm');
-
-               if (pos >= 0) {
-
-                       matParams.bumpScale = parseFloat(items[pos + 1]);
-                       items.splice(pos, 2);
-
-               }
-
-               pos = items.indexOf('-s');
-
-               if (pos >= 0) {
-
-                       texParams.scale.set(parseFloat(items[pos + 1]), parseFloat(items[pos + 2]));
-                       items.splice(pos, 4); // we expect 3 parameters here!
-
-               }
-
-               pos = items.indexOf('-o');
-
-               if (pos >= 0) {
-
-                       texParams.offset.set(parseFloat(items[pos + 1]), parseFloat(items[pos + 2]));
-                       items.splice(pos, 4); // we expect 3 parameters here!
-
-               }
-
-               texParams.url = items.join(' ').trim();
-               return texParams;
-
-       }
-
-       loadTexture(url, mapping, onLoad, onProgress, onError) {
-
-               const manager = (this.manager !== undefined) ? this.manager : THREE.DefaultLoadingManager;
-               let loader = manager.getHandler(url);
-
-               if (loader === null) {
-
-                       loader = new THREE.TextureLoader(manager);
-
-               }
-
-               if (loader.setCrossOrigin) loader.setCrossOrigin(this.crossOrigin);
-
-               const texture = loader.load(url, onLoad, onProgress, onError);
-
-               if (mapping !== undefined) texture.mapping = mapping;
-
-               return texture;
-
-       }
-
-}
-
-module.exports = {MTLLoader: MTLLoader};
-
-},{}],3:[function(require,module,exports){
-window.THREE.OBJLoader = require("./OBJLoader").OBJLoader;
-
-},{"./OBJLoader":4}],4:[function(require,module,exports){
-// o object_name | g group_name
-const _object_pattern = /^[og]\s*(.+)?/;
-// mtllib file_reference
-const _material_library_pattern = /^mtllib /;
-// usemtl material_name
-const _material_use_pattern = /^usemtl /;
-// usemap map_name
-const _map_use_pattern = /^usemap /;
-
-const _vA = new THREE.Vector3();
-const _vB = new THREE.Vector3();
-const _vC = new THREE.Vector3();
-
-const _ab = new THREE.Vector3();
-const _cb = new THREE.Vector3();
-
-function ParserState() {
-
-       const state = {
-               objects: [],
-               object: {},
-
-               vertices: [],
-               normals: [],
-               colors: [],
-               uvs: [],
-
-               materials: {},
-               materialLibraries: [],
-
-               startObject: function (name, fromDeclaration) {
-
-                       // If the current object (initial from reset) is not from a g/o declaration in the parsed
-                       // file. We need to use it for the first parsed g/o to keep things in sync.
-                       if (this.object && this.object.fromDeclaration === false) {
-
-                               this.object.name = name;
-                               this.object.fromDeclaration = (fromDeclaration !== false);
-                               return;
-
-                       }
-
-                       const previousMaterial = (this.object && typeof this.object.currentMaterial === 'function' ? this.object.currentMaterial() : undefined);
-
-                       if (this.object && typeof this.object._finalize === 'function') {
-
-                               this.object._finalize(true);
-
-                       }
-
-                       this.object = {
-                               name: name || '',
-                               fromDeclaration: (fromDeclaration !== false),
-
-                               geometry: {
-                                       vertices: [],
-                                       normals: [],
-                                       colors: [],
-                                       uvs: [],
-                                       hasUVIndices: false
-                               },
-                               materials: [],
-                               smooth: true,
-
-                               startMaterial: function (name, libraries) {
-
-                                       const previous = this._finalize(false);
-
-                                       // New usemtl declaration overwrites an inherited material, except if faces were declared
-                                       // after the material, then it must be preserved for proper MultiMaterial continuation.
-                                       if (previous && (previous.inherited || previous.groupCount <= 0)) {
-
-                                               this.materials.splice(previous.index, 1);
-
-                                       }
-
-                                       const material = {
-                                               index: this.materials.length,
-                                               name: name || '',
-                                               mtllib: (Array.isArray(libraries) && libraries.length > 0 ? libraries[libraries.length - 1] : ''),
-                                               smooth: (previous !== undefined ? previous.smooth : this.smooth),
-                                               groupStart: (previous !== undefined ? previous.groupEnd : 0),
-                                               groupEnd: -1,
-                                               groupCount: -1,
-                                               inherited: false,
-
-                                               clone: function (index) {
-
-                                                       const cloned = {
-                                                               index: (typeof index === 'number' ? index : this.index),
-                                                               name: this.name,
-                                                               mtllib: this.mtllib,
-                                                               smooth: this.smooth,
-                                                               groupStart: 0,
-                                                               groupEnd: -1,
-                                                               groupCount: -1,
-                                                               inherited: false
-                                                       };
-                                                       cloned.clone = this.clone.bind(cloned);
-                                                       return cloned;
-
-                                               }
-                                       };
-
-                                       this.materials.push(material);
-
-                                       return material;
-
-                               },
-
-                               currentMaterial: function () {
-
-                                       if (this.materials.length > 0) {
-
-                                               return this.materials[this.materials.length - 1];
-
-                                       }
-
-                                       return undefined;
-
-                               },
-
-                               _finalize: function (end) {
-
-                                       const lastMultiMaterial = this.currentMaterial();
-                                       if (lastMultiMaterial && lastMultiMaterial.groupEnd === -1) {
-
-                                               lastMultiMaterial.groupEnd = this.geometry.vertices.length / 3;
-                                               lastMultiMaterial.groupCount = lastMultiMaterial.groupEnd - lastMultiMaterial.groupStart;
-                                               lastMultiMaterial.inherited = false;
-
-                                       }
-
-                                       // Ignore objects tail materials if no face declarations followed them before a new o/g started.
-                                       if (end && this.materials.length > 1) {
-
-                                               for (let mi = this.materials.length - 1; mi >= 0; mi--) {
-
-                                                       if (this.materials[mi].groupCount <= 0) {
-
-                                                               this.materials.splice(mi, 1);
-
-                                                       }
-
-                                               }
-
-                                       }
-
-                                       // Guarantee at least one empty material, this makes the creation later more straight forward.
-                                       if (end && this.materials.length === 0) {
-
-                                               this.materials.push({
-                                                       name: '',
-                                                       smooth: this.smooth
-                                               });
-
-                                       }
-
-                                       return lastMultiMaterial;
-
-                               }
-                       };
-
-                       // Inherit previous objects material.
-                       // Spec tells us that a declared material must be set to all objects until a new material is declared.
-                       // If a usemtl declaration is encountered while this new object is being parsed, it will
-                       // overwrite the inherited material. Exception being that there was already face declarations
-                       // to the inherited material, then it will be preserved for proper MultiMaterial continuation.
-
-                       if (previousMaterial && previousMaterial.name && typeof previousMaterial.clone === 'function') {
-
-                               const declared = previousMaterial.clone(0);
-                               declared.inherited = true;
-                               this.object.materials.push(declared);
-
-                       }
-
-                       this.objects.push(this.object);
-
-               },
-
-               finalize: function () {
-
-                       if (this.object && typeof this.object._finalize === 'function') {
-
-                               this.object._finalize(true);
-
-                       }
-
-               },
-
-               parseVertexIndex: function (value, len) {
-
-                       const index = parseInt(value, 10);
-                       return (index >= 0 ? index - 1 : index + len / 3) * 3;
-
-               },
-
-               parseNormalIndex: function (value, len) {
-
-                       const index = parseInt(value, 10);
-                       return (index >= 0 ? index - 1 : index + len / 3) * 3;
-
-               },
-
-               parseUVIndex: function (value, len) {
-
-                       const index = parseInt(value, 10);
-                       return (index >= 0 ? index - 1 : index + len / 2) * 2;
-
-               },
-
-               addVertex: function (a, b, c) {
-
-                       const src = this.vertices;
-                       const dst = this.object.geometry.vertices;
-
-                       dst.push(src[a + 0], src[a + 1], src[a + 2]);
-                       dst.push(src[b + 0], src[b + 1], src[b + 2]);
-                       dst.push(src[c + 0], src[c + 1], src[c + 2]);
-
-               },
-
-               addVertexPoint: function (a) {
-
-                       const src = this.vertices;
-                       const dst = this.object.geometry.vertices;
-
-                       dst.push(src[a + 0], src[a + 1], src[a + 2]);
-
-               },
-
-               addVertexLine: function (a) {
-
-                       const src = this.vertices;
-                       const dst = this.object.geometry.vertices;
-
-                       dst.push(src[a + 0], src[a + 1], src[a + 2]);
-
-               },
-
-               addNormal: function (a, b, c) {
-
-                       const src = this.normals;
-                       const dst = this.object.geometry.normals;
-
-                       dst.push(src[a + 0], src[a + 1], src[a + 2]);
-                       dst.push(src[b + 0], src[b + 1], src[b + 2]);
-                       dst.push(src[c + 0], src[c + 1], src[c + 2]);
-
-               },
-
-               addFaceNormal: function (a, b, c) {
-
-                       const src = this.vertices;
-                       const dst = this.object.geometry.normals;
-
-                       _vA.fromArray(src, a);
-                       _vB.fromArray(src, b);
-                       _vC.fromArray(src, c);
-
-                       _cb.subVectors(_vC, _vB);
-                       _ab.subVectors(_vA, _vB);
-                       _cb.cross(_ab);
-
-                       _cb.normalize();
-
-                       dst.push(_cb.x, _cb.y, _cb.z);
-                       dst.push(_cb.x, _cb.y, _cb.z);
-                       dst.push(_cb.x, _cb.y, _cb.z);
-
-               },
-
-               addColor: function (a, b, c) {
-
-                       const src = this.colors;
-                       const dst = this.object.geometry.colors;
-
-                       if (src[a] !== undefined) dst.push(src[a + 0], src[a + 1], src[a + 2]);
-                       if (src[b] !== undefined) dst.push(src[b + 0], src[b + 1], src[b + 2]);
-                       if (src[c] !== undefined) dst.push(src[c + 0], src[c + 1], src[c + 2]);
-
-               },
-
-               addUV: function (a, b, c) {
-
-                       const src = this.uvs;
-                       const dst = this.object.geometry.uvs;
-
-                       dst.push(src[a + 0], src[a + 1]);
-                       dst.push(src[b + 0], src[b + 1]);
-                       dst.push(src[c + 0], src[c + 1]);
-
-               },
-
-               addDefaultUV: function () {
-
-                       const dst = this.object.geometry.uvs;
-
-                       dst.push(0, 0);
-                       dst.push(0, 0);
-                       dst.push(0, 0);
-
-               },
-
-               addUVLine: function (a) {
-
-                       const src = this.uvs;
-                       const dst = this.object.geometry.uvs;
-
-                       dst.push(src[a + 0], src[a + 1]);
-
-               },
-
-               addFace: function (a, b, c, ua, ub, uc, na, nb, nc) {
-
-                       const vLen = this.vertices.length;
-
-                       let ia = this.parseVertexIndex(a, vLen);
-                       let ib = this.parseVertexIndex(b, vLen);
-                       let ic = this.parseVertexIndex(c, vLen);
-
-                       this.addVertex(ia, ib, ic);
-                       this.addColor(ia, ib, ic);
-
-                       // normals
-
-                       if (na !== undefined && na !== '') {
-
-                               const nLen = this.normals.length;
-
-                               ia = this.parseNormalIndex(na, nLen);
-                               ib = this.parseNormalIndex(nb, nLen);
-                               ic = this.parseNormalIndex(nc, nLen);
-
-                               this.addNormal(ia, ib, ic);
-
-                       } else {
-
-                               this.addFaceNormal(ia, ib, ic);
-
-                       }
-
-                       // uvs
-
-                       if (ua !== undefined && ua !== '') {
-
-                               const uvLen = this.uvs.length;
-
-                               ia = this.parseUVIndex(ua, uvLen);
-                               ib = this.parseUVIndex(ub, uvLen);
-                               ic = this.parseUVIndex(uc, uvLen);
-
-                               this.addUV(ia, ib, ic);
-
-                               this.object.geometry.hasUVIndices = true;
-
-                       } else {
-
-                               // add placeholder values (for inconsistent face definitions)
-
-                               this.addDefaultUV();
-
-                       }
-
-               },
-
-               addPointGeometry: function (vertices) {
-
-                       this.object.geometry.type = 'THREE.Points';
-
-                       const vLen = this.vertices.length;
-
-                       for (let vi = 0, l = vertices.length; vi < l; vi++) {
-
-                               const index = this.parseVertexIndex(vertices[vi], vLen);
-
-                               this.addVertexPoint(index);
-                               this.addColor(index);
-
-                       }
-
-               },
-
-               addLineGeometry: function (vertices, uvs) {
-
-                       this.object.geometry.type = 'Line';
-
-                       const vLen = this.vertices.length;
-                       const uvLen = this.uvs.length;
-
-                       for (let vi = 0, l = vertices.length; vi < l; vi++) {
-
-                               this.addVertexLine(this.parseVertexIndex(vertices[vi], vLen));
-
-                       }
-
-                       for (let uvi = 0, l = uvs.length; uvi < l; uvi++) {
-
-                               this.addUVLine(this.parseUVIndex(uvs[uvi], uvLen));
-
-                       }
-
-               }
-
-       };
-
-       state.startObject('', false);
-
-       return state;
-
-}
-
-//
-
-class OBJLoader extends THREE.Loader {
-
-       constructor(manager) {
-
-               super(manager);
-
-               this.materials = null;
-
-       }
-
-       load(url, onLoad, onProgress, onError) {
-
-               const scope = this;
-
-               const loader = new THREE.FileLoader(this.manager);
-               loader.setPath(this.path);
-               loader.setRequestHeader(this.requestHeader);
-               loader.setWithCredentials(this.withCredentials);
-               loader.load(url, function (text) {
-
-                       try {
-
-                               onLoad(scope.parse(text));
-
-                       } catch (e) {
-
-                               if (onError) {
-
-                                       onError(e);
-
-                               } else {
-
-                                       console.error(e);
-
-                               }
-
-                               scope.manager.itemError(url);
-
-                       }
-
-               }, onProgress, onError);
-
-       }
-
-       setMaterials(materials) {
-
-               this.materials = materials;
-
-               return this;
-
-       }
-
-       parse(text) {
-
-               const state = new ParserState();
-
-               if (text.indexOf('\r\n') !== -1) {
-
-                       // This is faster than String.split with regex that splits on both
-                       text = text.replace(/\r\n/g, '\n');
-
-               }
-
-               if (text.indexOf('\\\n') !== -1) {
-
-                       // join lines separated by a line continuation character (\)
-                       text = text.replace(/\\\n/g, '');
-
-               }
-
-               const lines = text.split('\n');
-               let line = '', lineFirstChar = '';
-               let lineLength = 0;
-               let result = [];
-
-               // Faster to just trim left side of the line. Use if available.
-               const trimLeft = (typeof ''.trimLeft === 'function');
-
-               for (let i = 0, l = lines.length; i < l; i++) {
-
-                       line = lines[i];
-
-                       line = trimLeft ? line.trimLeft() : line.trim();
-
-                       lineLength = line.length;
-
-                       if (lineLength === 0) continue;
-
-                       lineFirstChar = line.charAt(0);
-
-                       // @todo invoke passed in handler if any
-                       if (lineFirstChar === '#') continue;
-
-                       if (lineFirstChar === 'v') {
-
-                               const data = line.split(/\s+/);
-
-                               switch (data[0]) {
-
-                                       case 'v':
-                                               state.vertices.push(
-                                                       parseFloat(data[1]),
-                                                       parseFloat(data[2]),
-                                                       parseFloat(data[3])
-                                               );
-                                               if (data.length >= 7) {
-
-                                                       state.colors.push(
-                                                               parseFloat(data[4]),
-                                                               parseFloat(data[5]),
-                                                               parseFloat(data[6])
-                                                       );
-
-                                               } else {
-
-                                                       // if no colors are defined, add placeholders so color and vertex indices match
-
-                                                       state.colors.push(undefined, undefined, undefined);
-
-                                               }
-
-                                               break;
-                                       case 'vn':
-                                               state.normals.push(
-                                                       parseFloat(data[1]),
-                                                       parseFloat(data[2]),
-                                                       parseFloat(data[3])
-                                               );
-                                               break;
-                                       case 'vt':
-                                               state.uvs.push(
-                                                       parseFloat(data[1]),
-                                                       parseFloat(data[2])
-                                               );
-                                               break;
-
-                               }
-
-                       } else if (lineFirstChar === 'f') {
-
-                               const lineData = line.substr(1).trim();
-                               const vertexData = lineData.split(/\s+/);
-                               const faceVertices = [];
-
-                               // Parse the face vertex data into an easy to work with format
-
-                               for (let j = 0, jl = vertexData.length; j < jl; j++) {
-
-                                       const vertex = vertexData[j];
-
-                                       if (vertex.length > 0) {
-
-                                               const vertexParts = vertex.split('/');
-                                               faceVertices.push(vertexParts);
-
-                                       }
-
-                               }
-
-                               // Draw an edge between the first vertex and all subsequent vertices to form an n-gon
-
-                               const v1 = faceVertices[0];
-
-                               for (let j = 1, jl = faceVertices.length - 1; j < jl; j++) {
-
-                                       const v2 = faceVertices[j];
-                                       const v3 = faceVertices[j + 1];
-
-                                       state.addFace(
-                                               v1[0], v2[0], v3[0],
-                                               v1[1], v2[1], v3[1],
-                                               v1[2], v2[2], v3[2]
-                                       );
-
-                               }
-
-                       } else if (lineFirstChar === 'l') {
-
-                               const lineParts = line.substring(1).trim().split(' ');
-                               let lineVertices = [];
-                               const lineUVs = [];
-
-                               if (line.indexOf('/') === -1) {
-
-                                       lineVertices = lineParts;
-
-                               } else {
-
-                                       for (let li = 0, llen = lineParts.length; li < llen; li++) {
-
-                                               const parts = lineParts[li].split('/');
-
-                                               if (parts[0] !== '') lineVertices.push(parts[0]);
-                                               if (parts[1] !== '') lineUVs.push(parts[1]);
-
-                                       }
-
-                               }
-
-                               state.addLineGeometry(lineVertices, lineUVs);
-
-                       } else if (lineFirstChar === 'p') {
-
-                               const lineData = line.substr(1).trim();
-                               const pointData = lineData.split(' ');
-
-                               state.addPointGeometry(pointData);
-
-                       } else if ((result = _object_pattern.exec(line)) !== null) {
-
-                               // o object_name
-                               // or
-                               // g group_name
-
-                               // WORKAROUND: https://bugs.chromium.org/p/v8/issues/detail?id=2869
-                               // let name = result[ 0 ].substr( 1 ).trim();
-                               const name = (' ' + result[0].substr(1).trim()).substr(1);
-
-                               state.startObject(name);
-
-                       } else if (_material_use_pattern.test(line)) {
-
-                               // material
-
-                               state.object.startMaterial(line.substring(7).trim(), state.materialLibraries);
-
-                       } else if (_material_library_pattern.test(line)) {
-
-                               // mtl file
-
-                               state.materialLibraries.push(line.substring(7).trim());
-
-                       } else if (_map_use_pattern.test(line)) {
-
-                               // the line is parsed but ignored since the loader assumes textures are defined MTL files
-                               // (according to https://www.okino.com/conv/imp_wave.htm, 'usemap' is the old-style Wavefront texture reference method)
-
-                               console.warn('THREE.OBJLoader: Rendering identifier "usemap" not supported. Textures must be defined in MTL files.');
-
-                       } else if (lineFirstChar === 's') {
-
-                               result = line.split(' ');
-
-                               // smooth shading
-
-                               // @todo Handle files that have varying smooth values for a set of faces inside one geometry,
-                               // but does not define a usemtl for each face set.
-                               // This should be detected and a dummy material created (later MultiMaterial and geometry groups).
-                               // This requires some care to not create extra material on each smooth value for "normal" obj files.
-                               // where explicit usemtl defines geometry groups.
-                               // Example asset: examples/models/obj/cerberus/Cerberus.obj
-
-                               /*
-                                        * http://paulbourke.net/dataformats/obj/
-                                        * or
-                                        * http://www.cs.utah.edu/~boulos/cs3505/obj_spec.pdf
-                                        *
-                                        * From chapter "Grouping" Syntax explanation "s group_number":
-                                        * "group_number is the smoothing group number. To turn off smoothing groups, use a value of 0 or off.
-                                        * Polygonal elements use group numbers to put elements in different smoothing groups. For free-form
-                                        * surfaces, smoothing groups are either turned on or off; there is no difference between values greater
-                                        * than 0."
-                                        */
-                               if (result.length > 1) {
-
-                                       const value = result[1].trim().toLowerCase();
-                                       state.object.smooth = (value !== '0' && value !== 'off');
-
-                               } else {
-
-                                       // ZBrush can produce "s" lines #11707
-                                       state.object.smooth = true;
-
-                               }
-
-                               const material = state.object.currentMaterial();
-                               if (material) material.smooth = state.object.smooth;
-
-                       } else {
-
-                               // Handle null terminated files without exception
-                               if (line === '\0') continue;
-
-                               console.warn('THREE.OBJLoader: Unexpected line: "' + line + '"');
-
-                       }
-
-               }
-
-               state.finalize();
-
-               const container = new THREE.Group();
-               container.materialLibraries = [].concat(state.materialLibraries);
-
-               const hasPrimitives = !(state.objects.length === 1 && state.objects[0].geometry.vertices.length === 0);
-
-               if (hasPrimitives === true) {
-
-                       for (let i = 0, l = state.objects.length; i < l; i++) {
-
-                               const object = state.objects[i];
-                               const geometry = object.geometry;
-                               const materials = object.materials;
-                               const isLine = (geometry.type === 'Line');
-                               const isPoints = (geometry.type === 'THREE.Points');
-                               let hasVertexColors = false;
-
-                               // Skip o/g line declarations that did not follow with any faces
-                               if (geometry.vertices.length === 0) continue;
-
-                               const buffergeometry = new THREE.BufferGeometry();
-
-                               buffergeometry.setAttribute('position', new THREE.Float32BufferAttribute(geometry.vertices, 3));
-
-                               if (geometry.normals.length > 0) {
-
-                                       buffergeometry.setAttribute('normal', new THREE.Float32BufferAttribute(geometry.normals, 3));
-
-                               }
-
-                               if (geometry.colors.length > 0) {
-
-                                       hasVertexColors = true;
-                                       buffergeometry.setAttribute('color', new THREE.Float32BufferAttribute(geometry.colors, 3));
-
-                               }
-
-                               if (geometry.hasUVIndices === true) {
-
-                                       buffergeometry.setAttribute('uv', new THREE.Float32BufferAttribute(geometry.uvs, 2));
-
-                               }
-
-                               // Create materials
-
-                               const createdMaterials = [];
-
-                               for (let mi = 0, miLen = materials.length; mi < miLen; mi++) {
-
-                                       const sourceMaterial = materials[mi];
-                                       const materialHash = sourceMaterial.name + '_' + sourceMaterial.smooth + '_' + hasVertexColors;
-                                       let material = state.materials[materialHash];
-
-                                       if (this.materials !== null) {
-
-                                               material = this.materials.create(sourceMaterial.name);
-
-                                               // mtl etc. loaders probably can't create line materials correctly, copy properties to a line material.
-                                               if (isLine && material && !(material instanceof THREE.LineBasicMaterial)) {
-
-                                                       const materialLine = new THREE.LineBasicMaterial();
-                                                       THREE.Material.prototype.copy.call(materialLine, material);
-                                                       materialLine.color.copy(material.color);
-                                                       material = materialLine;
-
-                                               } else if (isPoints && material && !(material instanceof THREE.PointsMaterial)) {
-
-                                                       const materialPoints = new THREE.PointsMaterial({size: 10, sizeAttenuation: false});
-                                                       THREE.Material.prototype.copy.call(materialPoints, material);
-                                                       materialPoints.color.copy(material.color);
-                                                       materialPoints.map = material.map;
-                                                       material = materialPoints;
-
-                                               }
-
-                                       }
-
-                                       if (material === undefined) {
-
-                                               if (isLine) {
-
-                                                       material = new THREE.LineBasicMaterial();
-
-                                               } else if (isPoints) {
-
-                                                       material = new THREE.PointsMaterial({size: 1, sizeAttenuation: false});
-
-                                               } else {
-
-                                                       material = new THREE.MeshPhongMaterial();
-
-                                               }
-
-                                               material.name = sourceMaterial.name;
-                                               material.flatShading = sourceMaterial.smooth ? false : true;
-                                               material.vertexColors = hasVertexColors;
-
-                                               state.materials[materialHash] = material;
-
-                                       }
-
-                                       createdMaterials.push(material);
-
-                               }
-
-                               // Create mesh
-
-                               let mesh;
-
-                               if (createdMaterials.length > 1) {
-
-                                       for (let mi = 0, miLen = materials.length; mi < miLen; mi++) {
-
-                                               const sourceMaterial = materials[mi];
-                                               buffergeometry.addGroup(sourceMaterial.groupStart, sourceMaterial.groupCount, mi);
-
-                                       }
-
-                                       if (isLine) {
-
-                                               mesh = new THREE.LineSegments(buffergeometry, createdMaterials);
-
-                                       } else if (isPoints) {
-
-                                               mesh = new THREE.Points(buffergeometry, createdMaterials);
-
-                                       } else {
-
-                                               mesh = new THREE.Mesh(buffergeometry, createdMaterials);
-
-                                       }
-
-                               } else {
-
-                                       if (isLine) {
-
-                                               mesh = new THREE.LineSegments(buffergeometry, createdMaterials[0]);
-
-                                       } else if (isPoints) {
-
-                                               mesh = new THREE.Points(buffergeometry, createdMaterials[0]);
-
-                                       } else {
-
-                                               mesh = new THREE.Mesh(buffergeometry, createdMaterials[0]);
-
-                                       }
-
-                               }
-
-                               mesh.name = object.name;
-
-                               container.add(mesh);
-
-                       }
-
-               } else {
-
-                       // if there is only the default parser state object with no geometry data, interpret data as point cloud
-
-                       if (state.vertices.length > 0) {
-
-                               const material = new THREE.PointsMaterial({size: 1, sizeAttenuation: false});
-
-                               const buffergeometry = new THREE.BufferGeometry();
-
-                               buffergeometry.setAttribute('position', new THREE.Float32BufferAttribute(state.vertices, 3));
-
-                               if (state.colors.length > 0 && state.colors[0] !== undefined) {
-
-                                       buffergeometry.setAttribute('color', new THREE.Float32BufferAttribute(state.colors, 3));
-                                       material.vertexColors = true;
-
-                               }
-
-                               const points = new THREE.Points(buffergeometry, material);
-                               container.add(points);
-
-                       }
-
-               }
-
-               return container;
-
-       }
-
-}
-
-module.exports = {OBJLoader: OBJLoader};
-
-},{}]},{},[1,3]);
diff --git a/src/main/resources/static/gltf-viewer/js/three.js b/src/main/resources/static/gltf-viewer/js/three.js
deleted file mode 100644 (file)
index 595636b..0000000
+++ /dev/null
@@ -1,36493 +0,0 @@
-(function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){
-window["THREE"] = require("three");
-},{"three":2}],2:[function(require,module,exports){
-/**
- * @license
- * Copyright 2010-2021 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 = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.THREE = {}));
-}(this, (function (exports) { 'use strict';
-
-       const REVISION = '132';
-       const MOUSE = {
-               LEFT: 0,
-               MIDDLE: 1,
-               RIGHT: 2,
-               ROTATE: 0,
-               DOLLY: 1,
-               PAN: 2
-       };
-       const TOUCH = {
-               ROTATE: 0,
-               PAN: 1,
-               DOLLY_PAN: 2,
-               DOLLY_ROTATE: 3
-       };
-       const CullFaceNone = 0;
-       const CullFaceBack = 1;
-       const CullFaceFront = 2;
-       const CullFaceFrontBack = 3;
-       const BasicShadowMap = 0;
-       const PCFShadowMap = 1;
-       const PCFSoftShadowMap = 2;
-       const VSMShadowMap = 3;
-       const FrontSide = 0;
-       const BackSide = 1;
-       const DoubleSide = 2;
-       const FlatShading = 1;
-       const SmoothShading = 2;
-       const NoBlending = 0;
-       const NormalBlending = 1;
-       const AdditiveBlending = 2;
-       const SubtractiveBlending = 3;
-       const MultiplyBlending = 4;
-       const CustomBlending = 5;
-       const AddEquation = 100;
-       const SubtractEquation = 101;
-       const ReverseSubtractEquation = 102;
-       const MinEquation = 103;
-       const MaxEquation = 104;
-       const ZeroFactor = 200;
-       const OneFactor = 201;
-       const SrcColorFactor = 202;
-       const OneMinusSrcColorFactor = 203;
-       const SrcAlphaFactor = 204;
-       const OneMinusSrcAlphaFactor = 205;
-       const DstAlphaFactor = 206;
-       const OneMinusDstAlphaFactor = 207;
-       const DstColorFactor = 208;
-       const OneMinusDstColorFactor = 209;
-       const SrcAlphaSaturateFactor = 210;
-       const NeverDepth = 0;
-       const AlwaysDepth = 1;
-       const LessDepth = 2;
-       const LessEqualDepth = 3;
-       const EqualDepth = 4;
-       const GreaterEqualDepth = 5;
-       const GreaterDepth = 6;
-       const NotEqualDepth = 7;
-       const MultiplyOperation = 0;
-       const MixOperation = 1;
-       const AddOperation = 2;
-       const NoToneMapping = 0;
-       const LinearToneMapping = 1;
-       const ReinhardToneMapping = 2;
-       const CineonToneMapping = 3;
-       const ACESFilmicToneMapping = 4;
-       const CustomToneMapping = 5;
-       const UVMapping = 300;
-       const CubeReflectionMapping = 301;
-       const CubeRefractionMapping = 302;
-       const EquirectangularReflectionMapping = 303;
-       const EquirectangularRefractionMapping = 304;
-       const CubeUVReflectionMapping = 306;
-       const CubeUVRefractionMapping = 307;
-       const RepeatWrapping = 1000;
-       const ClampToEdgeWrapping = 1001;
-       const MirroredRepeatWrapping = 1002;
-       const NearestFilter = 1003;
-       const NearestMipmapNearestFilter = 1004;
-       const NearestMipMapNearestFilter = 1004;
-       const NearestMipmapLinearFilter = 1005;
-       const NearestMipMapLinearFilter = 1005;
-       const LinearFilter = 1006;
-       const LinearMipmapNearestFilter = 1007;
-       const LinearMipMapNearestFilter = 1007;
-       const LinearMipmapLinearFilter = 1008;
-       const LinearMipMapLinearFilter = 1008;
-       const UnsignedByteType = 1009;
-       const ByteType = 1010;
-       const ShortType = 1011;
-       const UnsignedShortType = 1012;
-       const IntType = 1013;
-       const UnsignedIntType = 1014;
-       const FloatType = 1015;
-       const HalfFloatType = 1016;
-       const UnsignedShort4444Type = 1017;
-       const UnsignedShort5551Type = 1018;
-       const UnsignedShort565Type = 1019;
-       const UnsignedInt248Type = 1020;
-       const AlphaFormat = 1021;
-       const RGBFormat = 1022;
-       const RGBAFormat = 1023;
-       const LuminanceFormat = 1024;
-       const LuminanceAlphaFormat = 1025;
-       const RGBEFormat = RGBAFormat;
-       const DepthFormat = 1026;
-       const DepthStencilFormat = 1027;
-       const RedFormat = 1028;
-       const RedIntegerFormat = 1029;
-       const RGFormat = 1030;
-       const RGIntegerFormat = 1031;
-       const RGBIntegerFormat = 1032;
-       const RGBAIntegerFormat = 1033;
-       const RGB_S3TC_DXT1_Format = 33776;
-       const RGBA_S3TC_DXT1_Format = 33777;
-       const RGBA_S3TC_DXT3_Format = 33778;
-       const RGBA_S3TC_DXT5_Format = 33779;
-       const RGB_PVRTC_4BPPV1_Format = 35840;
-       const RGB_PVRTC_2BPPV1_Format = 35841;
-       const RGBA_PVRTC_4BPPV1_Format = 35842;
-       const RGBA_PVRTC_2BPPV1_Format = 35843;
-       const RGB_ETC1_Format = 36196;
-       const RGB_ETC2_Format = 37492;
-       const RGBA_ETC2_EAC_Format = 37496;
-       const RGBA_ASTC_4x4_Format = 37808;
-       const RGBA_ASTC_5x4_Format = 37809;
-       const RGBA_ASTC_5x5_Format = 37810;
-       const RGBA_ASTC_6x5_Format = 37811;
-       const RGBA_ASTC_6x6_Format = 37812;
-       const RGBA_ASTC_8x5_Format = 37813;
-       const RGBA_ASTC_8x6_Format = 37814;
-       const RGBA_ASTC_8x8_Format = 37815;
-       const RGBA_ASTC_10x5_Format = 37816;
-       const RGBA_ASTC_10x6_Format = 37817;
-       const RGBA_ASTC_10x8_Format = 37818;
-       const RGBA_ASTC_10x10_Format = 37819;
-       const RGBA_ASTC_12x10_Format = 37820;
-       const RGBA_ASTC_12x12_Format = 37821;
-       const RGBA_BPTC_Format = 36492;
-       const SRGB8_ALPHA8_ASTC_4x4_Format = 37840;
-       const SRGB8_ALPHA8_ASTC_5x4_Format = 37841;
-       const SRGB8_ALPHA8_ASTC_5x5_Format = 37842;
-       const SRGB8_ALPHA8_ASTC_6x5_Format = 37843;
-       const SRGB8_ALPHA8_ASTC_6x6_Format = 37844;
-       const SRGB8_ALPHA8_ASTC_8x5_Format = 37845;
-       const SRGB8_ALPHA8_ASTC_8x6_Format = 37846;
-       const SRGB8_ALPHA8_ASTC_8x8_Format = 37847;
-       const SRGB8_ALPHA8_ASTC_10x5_Format = 37848;
-       const SRGB8_ALPHA8_ASTC_10x6_Format = 37849;
-       const SRGB8_ALPHA8_ASTC_10x8_Format = 37850;
-       const SRGB8_ALPHA8_ASTC_10x10_Format = 37851;
-       const SRGB8_ALPHA8_ASTC_12x10_Format = 37852;
-       const SRGB8_ALPHA8_ASTC_12x12_Format = 37853;
-       const LoopOnce = 2200;
-       const LoopRepeat = 2201;
-       const LoopPingPong = 2202;
-       const InterpolateDiscrete = 2300;
-       const InterpolateLinear = 2301;
-       const InterpolateSmooth = 2302;
-       const ZeroCurvatureEnding = 2400;
-       const ZeroSlopeEnding = 2401;
-       const WrapAroundEnding = 2402;
-       const NormalAnimationBlendMode = 2500;
-       const AdditiveAnimationBlendMode = 2501;
-       const TrianglesDrawMode = 0;
-       const TriangleStripDrawMode = 1;
-       const TriangleFanDrawMode = 2;
-       const LinearEncoding = 3000;
-       const sRGBEncoding = 3001;
-       const GammaEncoding = 3007;
-       const RGBEEncoding = 3002;
-       const LogLuvEncoding = 3003;
-       const RGBM7Encoding = 3004;
-       const RGBM16Encoding = 3005;
-       const RGBDEncoding = 3006;
-       const BasicDepthPacking = 3200;
-       const RGBADepthPacking = 3201;
-       const TangentSpaceNormalMap = 0;
-       const ObjectSpaceNormalMap = 1;
-       const ZeroStencilOp = 0;
-       const KeepStencilOp = 7680;
-       const ReplaceStencilOp = 7681;
-       const IncrementStencilOp = 7682;
-       const DecrementStencilOp = 7683;
-       const IncrementWrapStencilOp = 34055;
-       const DecrementWrapStencilOp = 34056;
-       const InvertStencilOp = 5386;
-       const NeverStencilFunc = 512;
-       const LessStencilFunc = 513;
-       const EqualStencilFunc = 514;
-       const LessEqualStencilFunc = 515;
-       const GreaterStencilFunc = 516;
-       const NotEqualStencilFunc = 517;
-       const GreaterEqualStencilFunc = 518;
-       const AlwaysStencilFunc = 519;
-       const StaticDrawUsage = 35044;
-       const DynamicDrawUsage = 35048;
-       const StreamDrawUsage = 35040;
-       const StaticReadUsage = 35045;
-       const DynamicReadUsage = 35049;
-       const StreamReadUsage = 35041;
-       const StaticCopyUsage = 35046;
-       const DynamicCopyUsage = 35050;
-       const StreamCopyUsage = 35042;
-       const GLSL1 = '100';
-       const GLSL3 = '300 es';
-
-       /**
-        * https://github.com/mrdoob/eventdispatcher.js/
-        */
-       class EventDispatcher {
-               addEventListener(type, listener) {
-                       if (this._listeners === undefined) this._listeners = {};
-                       const listeners = this._listeners;
-
-                       if (listeners[type] === undefined) {
-                               listeners[type] = [];
-                       }
-
-                       if (listeners[type].indexOf(listener) === -1) {
-                               listeners[type].push(listener);
-                       }
-               }
-
-               hasEventListener(type, listener) {
-                       if (this._listeners === undefined) return false;
-                       const listeners = this._listeners;
-                       return listeners[type] !== undefined && listeners[type].indexOf(listener) !== -1;
-               }
-
-               removeEventListener(type, listener) {
-                       if (this._listeners === undefined) return;
-                       const listeners = this._listeners;
-                       const listenerArray = listeners[type];
-
-                       if (listenerArray !== undefined) {
-                               const index = listenerArray.indexOf(listener);
-
-                               if (index !== -1) {
-                                       listenerArray.splice(index, 1);
-                               }
-                       }
-               }
-
-               dispatchEvent(event) {
-                       if (this._listeners === undefined) return;
-                       const listeners = this._listeners;
-                       const listenerArray = listeners[event.type];
-
-                       if (listenerArray !== undefined) {
-                               event.target = this; // Make a copy, in case listeners are removed while iterating.
-
-                               const array = listenerArray.slice(0);
-
-                               for (let i = 0, l = array.length; i < l; i++) {
-                                       array[i].call(this, event);
-                               }
-
-                               event.target = null;
-                       }
-               }
-
-       }
-
-       const _lut = [];
-
-       for (let i = 0; i < 256; i++) {
-               _lut[i] = (i < 16 ? '0' : '') + i.toString(16);
-       }
-
-       let _seed = 1234567;
-       const DEG2RAD = Math.PI / 180;
-       const RAD2DEG = 180 / Math.PI; // http://stackoverflow.com/questions/105034/how-to-create-a-guid-uuid-in-javascript/21963136#21963136
-
-       function generateUUID() {
-               const d0 = Math.random() * 0xffffffff | 0;
-               const d1 = Math.random() * 0xffffffff | 0;
-               const d2 = Math.random() * 0xffffffff | 0;
-               const d3 = Math.random() * 0xffffffff | 0;
-               const uuid = _lut[d0 & 0xff] + _lut[d0 >> 8 & 0xff] + _lut[d0 >> 16 & 0xff] + _lut[d0 >> 24 & 0xff] + '-' + _lut[d1 & 0xff] + _lut[d1 >> 8 & 0xff] + '-' + _lut[d1 >> 16 & 0x0f | 0x40] + _lut[d1 >> 24 & 0xff] + '-' + _lut[d2 & 0x3f | 0x80] + _lut[d2 >> 8 & 0xff] + '-' + _lut[d2 >> 16 & 0xff] + _lut[d2 >> 24 & 0xff] + _lut[d3 & 0xff] + _lut[d3 >> 8 & 0xff] + _lut[d3 >> 16 & 0xff] + _lut[d3 >> 24 & 0xff]; // .toUpperCase() here flattens concatenated strings to save heap memory space.
-
-               return uuid.toUpperCase();
-       }
-
-       function clamp(value, min, max) {
-               return Math.max(min, Math.min(max, value));
-       } // compute euclidian modulo of m % n
-       // https://en.wikipedia.org/wiki/Modulo_operation
-
-
-       function euclideanModulo(n, m) {
-               return (n % m + m) % m;
-       } // Linear mapping from range <a1, a2> to range <b1, b2>
-
-
-       function mapLinear(x, a1, a2, b1, b2) {
-               return b1 + (x - a1) * (b2 - b1) / (a2 - a1);
-       } // https://www.gamedev.net/tutorials/programming/general-and-gameplay-programming/inverse-lerp-a-super-useful-yet-often-overlooked-function-r5230/
-
-
-       function inverseLerp(x, y, value) {
-               if (x !== y) {
-                       return (value - x) / (y - x);
-               } else {
-                       return 0;
-               }
-       } // https://en.wikipedia.org/wiki/Linear_interpolation
-
-
-       function lerp(x, y, t) {
-               return (1 - t) * x + t * y;
-       } // http://www.rorydriscoll.com/2016/03/07/frame-rate-independent-damping-using-lerp/
-
-
-       function damp(x, y, lambda, dt) {
-               return lerp(x, y, 1 - Math.exp(-lambda * dt));
-       } // https://www.desmos.com/calculator/vcsjnyz7x4
-
-
-       function pingpong(x, length = 1) {
-               return length - Math.abs(euclideanModulo(x, length * 2) - length);
-       } // http://en.wikipedia.org/wiki/Smoothstep
-
-
-       function smoothstep(x, min, max) {
-               if (x <= min) return 0;
-               if (x >= max) return 1;
-               x = (x - min) / (max - min);
-               return x * x * (3 - 2 * x);
-       }
-
-       function smootherstep(x, min, max) {
-               if (x <= min) return 0;
-               if (x >= max) return 1;
-               x = (x - min) / (max - min);
-               return x * x * x * (x * (x * 6 - 15) + 10);
-       } // Random integer from <low, high> interval
-
-
-       function randInt(low, high) {
-               return low + Math.floor(Math.random() * (high - low + 1));
-       } // Random float from <low, high> interval
-
-
-       function randFloat(low, high) {
-               return low + Math.random() * (high - low);
-       } // Random float from <-range/2, range/2> interval
-
-
-       function randFloatSpread(range) {
-               return range * (0.5 - Math.random());
-       } // Deterministic pseudo-random float in the interval [ 0, 1 ]
-
-
-       function seededRandom(s) {
-               if (s !== undefined) _seed = s % 2147483647; // Park-Miller algorithm
-
-               _seed = _seed * 16807 % 2147483647;
-               return (_seed - 1) / 2147483646;
-       }
-
-       function degToRad(degrees) {
-               return degrees * DEG2RAD;
-       }
-
-       function radToDeg(radians) {
-               return radians * RAD2DEG;
-       }
-
-       function isPowerOfTwo(value) {
-               return (value & value - 1) === 0 && value !== 0;
-       }
-
-       function ceilPowerOfTwo(value) {
-               return Math.pow(2, Math.ceil(Math.log(value) / Math.LN2));
-       }
-
-       function floorPowerOfTwo(value) {
-               return Math.pow(2, Math.floor(Math.log(value) / Math.LN2));
-       }
-
-       function setQuaternionFromProperEuler(q, a, b, c, order) {
-               // Intrinsic Proper Euler Angles - see https://en.wikipedia.org/wiki/Euler_angles
-               // rotations are applied to the axes in the order specified by 'order'
-               // rotation by angle 'a' is applied first, then by angle 'b', then by angle 'c'
-               // angles are in radians
-               const cos = Math.cos;
-               const sin = Math.sin;
-               const c2 = cos(b / 2);
-               const s2 = sin(b / 2);
-               const c13 = cos((a + c) / 2);
-               const s13 = sin((a + c) / 2);
-               const c1_3 = cos((a - c) / 2);
-               const s1_3 = sin((a - c) / 2);
-               const c3_1 = cos((c - a) / 2);
-               const s3_1 = sin((c - a) / 2);
-
-               switch (order) {
-                       case 'XYX':
-                               q.set(c2 * s13, s2 * c1_3, s2 * s1_3, c2 * c13);
-                               break;
-
-                       case 'YZY':
-                               q.set(s2 * s1_3, c2 * s13, s2 * c1_3, c2 * c13);
-                               break;
-
-                       case 'ZXZ':
-                               q.set(s2 * c1_3, s2 * s1_3, c2 * s13, c2 * c13);
-                               break;
-
-                       case 'XZX':
-                               q.set(c2 * s13, s2 * s3_1, s2 * c3_1, c2 * c13);
-                               break;
-
-                       case 'YXY':
-                               q.set(s2 * c3_1, c2 * s13, s2 * s3_1, c2 * c13);
-                               break;
-
-                       case 'ZYZ':
-                               q.set(s2 * s3_1, s2 * c3_1, c2 * s13, c2 * c13);
-                               break;
-
-                       default:
-                               console.warn('THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: ' + order);
-               }
-       }
-
-       var MathUtils = /*#__PURE__*/Object.freeze({
-               __proto__: null,
-               DEG2RAD: DEG2RAD,
-               RAD2DEG: RAD2DEG,
-               generateUUID: generateUUID,
-               clamp: clamp,
-               euclideanModulo: euclideanModulo,
-               mapLinear: mapLinear,
-               inverseLerp: inverseLerp,
-               lerp: lerp,
-               damp: damp,
-               pingpong: pingpong,
-               smoothstep: smoothstep,
-               smootherstep: smootherstep,
-               randInt: randInt,
-               randFloat: randFloat,
-               randFloatSpread: randFloatSpread,
-               seededRandom: seededRandom,
-               degToRad: degToRad,
-               radToDeg: radToDeg,
-               isPowerOfTwo: isPowerOfTwo,
-               ceilPowerOfTwo: ceilPowerOfTwo,
-               floorPowerOfTwo: floorPowerOfTwo,
-               setQuaternionFromProperEuler: setQuaternionFromProperEuler
-       });
-
-       class Vector2 {
-               constructor(x = 0, y = 0) {
-                       this.x = x;
-                       this.y = y;
-               }
-
-               get width() {
-                       return this.x;
-               }
-
-               set width(value) {
-                       this.x = value;
-               }
-
-               get height() {
-                       return this.y;
-               }
-
-               set height(value) {
-                       this.y = value;
-               }
-
-               set(x, y) {
-                       this.x = x;
-                       this.y = y;
-                       return this;
-               }
-
-               setScalar(scalar) {
-                       this.x = scalar;
-                       this.y = scalar;
-                       return this;
-               }
-
-               setX(x) {
-                       this.x = x;
-                       return this;
-               }
-
-               setY(y) {
-                       this.y = y;
-                       return this;
-               }
-
-               setComponent(index, value) {
-                       switch (index) {
-                               case 0:
-                                       this.x = value;
-                                       break;
-
-                               case 1:
-                                       this.y = value;
-                                       break;
-
-                               default:
-                                       throw new Error('index is out of range: ' + index);
-                       }
-
-                       return this;
-               }
-
-               getComponent(index) {
-                       switch (index) {
-                               case 0:
-                                       return this.x;
-
-                               case 1:
-                                       return this.y;
-
-                               default:
-                                       throw new Error('index is out of range: ' + index);
-                       }
-               }
-
-               clone() {
-                       return new this.constructor(this.x, this.y);
-               }
-
-               copy(v) {
-                       this.x = v.x;
-                       this.y = v.y;
-                       return this;
-               }
-
-               add(v, w) {
-                       if (w !== undefined) {
-                               console.warn('THREE.Vector2: .add() now only accepts one argument. Use .addVectors( a, b ) instead.');
-                               return this.addVectors(v, w);
-                       }
-
-                       this.x += v.x;
-                       this.y += v.y;
-                       return this;
-               }
-
-               addScalar(s) {
-                       this.x += s;
-                       this.y += s;
-                       return this;
-               }
-
-               addVectors(a, b) {
-                       this.x = a.x + b.x;
-                       this.y = a.y + b.y;
-                       return this;
-               }
-
-               addScaledVector(v, s) {
-                       this.x += v.x * s;
-                       this.y += v.y * s;
-                       return this;
-               }
-
-               sub(v, w) {
-                       if (w !== undefined) {
-                               console.warn('THREE.Vector2: .sub() now only accepts one argument. Use .subVectors( a, b ) instead.');
-                               return this.subVectors(v, w);
-                       }
-
-                       this.x -= v.x;
-                       this.y -= v.y;
-                       return this;
-               }
-
-               subScalar(s) {
-                       this.x -= s;
-                       this.y -= s;
-                       return this;
-               }
-
-               subVectors(a, b) {
-                       this.x = a.x - b.x;
-                       this.y = a.y - b.y;
-                       return this;
-               }
-
-               multiply(v) {
-                       this.x *= v.x;
-                       this.y *= v.y;
-                       return this;
-               }
-
-               multiplyScalar(scalar) {
-                       this.x *= scalar;
-                       this.y *= scalar;
-                       return this;
-               }
-
-               divide(v) {
-                       this.x /= v.x;
-                       this.y /= v.y;
-                       return this;
-               }
-
-               divideScalar(scalar) {
-                       return this.multiplyScalar(1 / scalar);
-               }
-
-               applyMatrix3(m) {
-                       const x = this.x,
-                                               y = this.y;
-                       const e = m.elements;
-                       this.x = e[0] * x + e[3] * y + e[6];
-                       this.y = e[1] * x + e[4] * y + e[7];
-                       return this;
-               }
-
-               min(v) {
-                       this.x = Math.min(this.x, v.x);
-                       this.y = Math.min(this.y, v.y);
-                       return this;
-               }
-
-               max(v) {
-                       this.x = Math.max(this.x, v.x);
-                       this.y = Math.max(this.y, v.y);
-                       return this;
-               }
-
-               clamp(min, max) {
-                       // assumes min < max, componentwise
-                       this.x = Math.max(min.x, Math.min(max.x, this.x));
-                       this.y = Math.max(min.y, Math.min(max.y, this.y));
-                       return this;
-               }
-
-               clampScalar(minVal, maxVal) {
-                       this.x = Math.max(minVal, Math.min(maxVal, this.x));
-                       this.y = Math.max(minVal, Math.min(maxVal, this.y));
-                       return this;
-               }
-
-               clampLength(min, max) {
-                       const length = this.length();
-                       return this.divideScalar(length || 1).multiplyScalar(Math.max(min, Math.min(max, length)));
-               }
-
-               floor() {
-                       this.x = Math.floor(this.x);
-                       this.y = Math.floor(this.y);
-                       return this;
-               }
-
-               ceil() {
-                       this.x = Math.ceil(this.x);
-                       this.y = Math.ceil(this.y);
-                       return this;
-               }
-
-               round() {
-                       this.x = Math.round(this.x);
-                       this.y = Math.round(this.y);
-                       return this;
-               }
-
-               roundToZero() {
-                       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);
-                       return this;
-               }
-
-               negate() {
-                       this.x = -this.x;
-                       this.y = -this.y;
-                       return this;
-               }
-
-               dot(v) {
-                       return this.x * v.x + this.y * v.y;
-               }
-
-               cross(v) {
-                       return this.x * v.y - this.y * v.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() {
-                       // computes the angle in radians with respect to the positive x-axis
-                       const angle = Math.atan2(-this.y, -this.x) + Math.PI;
-                       return angle;
-               }
-
-               distanceTo(v) {
-                       return Math.sqrt(this.distanceToSquared(v));
-               }
-
-               distanceToSquared(v) {
-                       const dx = this.x - v.x,
-                                               dy = this.y - v.y;
-                       return dx * dx + dy * dy;
-               }
-
-               manhattanDistanceTo(v) {
-                       return Math.abs(this.x - v.x) + Math.abs(this.y - v.y);
-               }
-
-               setLength(length) {
-                       return this.normalize().multiplyScalar(length);
-               }
-
-               lerp(v, alpha) {
-                       this.x += (v.x - this.x) * alpha;
-                       this.y += (v.y - this.y) * alpha;
-                       return this;
-               }
-
-               lerpVectors(v1, v2, alpha) {
-                       this.x = v1.x + (v2.x - v1.x) * alpha;
-                       this.y = v1.y + (v2.y - v1.y) * alpha;
-                       return this;
-               }
-
-               equals(v) {
-                       return v.x === this.x && v.y === this.y;
-               }
-
-               fromArray(array, offset = 0) {
-                       this.x = array[offset];
-                       this.y = array[offset + 1];
-                       return this;
-               }
-
-               toArray(array = [], offset = 0) {
-                       array[offset] = this.x;
-                       array[offset + 1] = this.y;
-                       return array;
-               }
-
-               fromBufferAttribute(attribute, index, offset) {
-                       if (offset !== undefined) {
-                               console.warn('THREE.Vector2: offset has been removed from .fromBufferAttribute().');
-                       }
-
-                       this.x = attribute.getX(index);
-                       this.y = attribute.getY(index);
-                       return this;
-               }
-
-               rotateAround(center, angle) {
-                       const c = Math.cos(angle),
-                                               s = Math.sin(angle);
-                       const x = this.x - center.x;
-                       const y = this.y - center.y;
-                       this.x = x * c - y * s + center.x;
-                       this.y = x * s + y * c + center.y;
-                       return this;
-               }
-
-               random() {
-                       this.x = Math.random();
-                       this.y = Math.random();
-                       return this;
-               }
-
-       }
-
-       Vector2.prototype.isVector2 = true;
-
-       class Matrix3 {
-               constructor() {
-                       this.elements = [1, 0, 0, 0, 1, 0, 0, 0, 1];
-
-                       if (arguments.length > 0) {
-                               console.error('THREE.Matrix3: the constructor no longer reads arguments. use .set() instead.');
-                       }
-               }
-
-               set(n11, n12, n13, n21, n22, n23, n31, n32, n33) {
-                       const te = this.elements;
-                       te[0] = n11;
-                       te[1] = n21;
-                       te[2] = n31;
-                       te[3] = n12;
-                       te[4] = n22;
-                       te[5] = n32;
-                       te[6] = n13;
-                       te[7] = n23;
-                       te[8] = n33;
-                       return this;
-               }
-
-               identity() {
-                       this.set(1, 0, 0, 0, 1, 0, 0, 0, 1);
-                       return this;
-               }
-
-               copy(m) {
-                       const te = this.elements;
-                       const me = m.elements;
-                       te[0] = me[0];
-                       te[1] = me[1];
-                       te[2] = me[2];
-                       te[3] = me[3];
-                       te[4] = me[4];
-                       te[5] = me[5];
-                       te[6] = me[6];
-                       te[7] = me[7];
-                       te[8] = me[8];
-                       return this;
-               }
-
-               extractBasis(xAxis, yAxis, zAxis) {
-                       xAxis.setFromMatrix3Column(this, 0);
-                       yAxis.setFromMatrix3Column(this, 1);
-                       zAxis.setFromMatrix3Column(this, 2);
-                       return this;
-               }
-
-               setFromMatrix4(m) {
-                       const me = m.elements;
-                       this.set(me[0], me[4], me[8], me[1], me[5], me[9], me[2], me[6], me[10]);
-                       return this;
-               }
-
-               multiply(m) {
-                       return this.multiplyMatrices(this, m);
-               }
-
-               premultiply(m) {
-                       return this.multiplyMatrices(m, this);
-               }
-
-               multiplyMatrices(a, b) {
-                       const ae = a.elements;
-                       const be = b.elements;
-                       const te = this.elements;
-                       const a11 = ae[0],
-                                               a12 = ae[3],
-                                               a13 = ae[6];
-                       const a21 = ae[1],
-                                               a22 = ae[4],
-                                               a23 = ae[7];
-                       const a31 = ae[2],
-                                               a32 = ae[5],
-                                               a33 = ae[8];
-                       const b11 = be[0],
-                                               b12 = be[3],
-                                               b13 = be[6];
-                       const b21 = be[1],
-                                               b22 = be[4],
-                                               b23 = be[7];
-                       const b31 = be[2],
-                                               b32 = be[5],
-                                               b33 = be[8];
-                       te[0] = a11 * b11 + a12 * b21 + a13 * b31;
-                       te[3] = a11 * b12 + a12 * b22 + a13 * b32;
-                       te[6] = a11 * b13 + a12 * b23 + a13 * b33;
-                       te[1] = a21 * b11 + a22 * b21 + a23 * b31;
-                       te[4] = a21 * b12 + a22 * b22 + a23 * b32;
-                       te[7] = a21 * b13 + a22 * b23 + a23 * b33;
-                       te[2] = a31 * b11 + a32 * b21 + a33 * b31;
-                       te[5] = a31 * b12 + a32 * b22 + a33 * b32;
-                       te[8] = a31 * b13 + a32 * b23 + a33 * b33;
-                       return this;
-               }
-
-               multiplyScalar(s) {
-                       const te = this.elements;
-                       te[0] *= s;
-                       te[3] *= s;
-                       te[6] *= s;
-                       te[1] *= s;
-                       te[4] *= s;
-                       te[7] *= s;
-                       te[2] *= s;
-                       te[5] *= s;
-                       te[8] *= s;
-                       return this;
-               }
-
-               determinant() {
-                       const te = this.elements;
-                       const a = te[0],
-                                               b = te[1],
-                                               c = te[2],
-                                               d = te[3],
-                                               e = te[4],
-                                               f = te[5],
-                                               g = te[6],
-                                               h = te[7],
-                                               i = te[8];
-                       return a * e * i - a * f * h - b * d * i + b * f * g + c * d * h - c * e * g;
-               }
-
-               invert() {
-                       const te = this.elements,
-                                               n11 = te[0],
-                                               n21 = te[1],
-                                               n31 = te[2],
-                                               n12 = te[3],
-                                               n22 = te[4],
-                                               n32 = te[5],
-                                               n13 = te[6],
-                                               n23 = te[7],
-                                               n33 = te[8],
-                                               t11 = n33 * n22 - n32 * n23,
-                                               t12 = n32 * n13 - n33 * n12,
-                                               t13 = n23 * n12 - n22 * n13,
-                                               det = n11 * t11 + n21 * t12 + n31 * t13;
-                       if (det === 0) return this.set(0, 0, 0, 0, 0, 0, 0, 0, 0);
-                       const detInv = 1 / det;
-                       te[0] = t11 * detInv;
-                       te[1] = (n31 * n23 - n33 * n21) * detInv;
-                       te[2] = (n32 * n21 - n31 * n22) * detInv;
-                       te[3] = t12 * detInv;
-                       te[4] = (n33 * n11 - n31 * n13) * detInv;
-                       te[5] = (n31 * n12 - n32 * n11) * detInv;
-                       te[6] = t13 * detInv;
-                       te[7] = (n21 * n13 - n23 * n11) * detInv;
-                       te[8] = (n22 * n11 - n21 * n12) * detInv;
-                       return this;
-               }
-
-               transpose() {
-                       let tmp;
-                       const m = this.elements;
-                       tmp = m[1];
-                       m[1] = m[3];
-                       m[3] = tmp;
-                       tmp = m[2];
-                       m[2] = m[6];
-                       m[6] = tmp;
-                       tmp = m[5];
-                       m[5] = m[7];
-                       m[7] = tmp;
-                       return this;
-               }
-
-               getNormalMatrix(matrix4) {
-                       return this.setFromMatrix4(matrix4).invert().transpose();
-               }
-
-               transposeIntoArray(r) {
-                       const m = this.elements;
-                       r[0] = m[0];
-                       r[1] = m[3];
-                       r[2] = m[6];
-                       r[3] = m[1];
-                       r[4] = m[4];
-                       r[5] = m[7];
-                       r[6] = m[2];
-                       r[7] = m[5];
-                       r[8] = m[8];
-                       return this;
-               }
-
-               setUvTransform(tx, ty, sx, sy, rotation, cx, cy) {
-                       const c = Math.cos(rotation);
-                       const s = Math.sin(rotation);
-                       this.set(sx * c, sx * s, -sx * (c * cx + s * cy) + cx + tx, -sy * s, sy * c, -sy * (-s * cx + c * cy) + cy + ty, 0, 0, 1);
-                       return this;
-               }
-
-               scale(sx, sy) {
-                       const te = this.elements;
-                       te[0] *= sx;
-                       te[3] *= sx;
-                       te[6] *= sx;
-                       te[1] *= sy;
-                       te[4] *= sy;
-                       te[7] *= sy;
-                       return this;
-               }
-
-               rotate(theta) {
-                       const c = Math.cos(theta);
-                       const s = Math.sin(theta);
-                       const te = this.elements;
-                       const a11 = te[0],
-                                               a12 = te[3],
-                                               a13 = te[6];
-                       const a21 = te[1],
-                                               a22 = te[4],
-                                               a23 = te[7];
-                       te[0] = c * a11 + s * a21;
-                       te[3] = c * a12 + s * a22;
-                       te[6] = c * a13 + s * a23;
-                       te[1] = -s * a11 + c * a21;
-                       te[4] = -s * a12 + c * a22;
-                       te[7] = -s * a13 + c * a23;
-                       return this;
-               }
-
-               translate(tx, ty) {
-                       const te = this.elements;
-                       te[0] += tx * te[2];
-                       te[3] += tx * te[5];
-                       te[6] += tx * te[8];
-                       te[1] += ty * te[2];
-                       te[4] += ty * te[5];
-                       te[7] += ty * te[8];
-                       return this;
-               }
-
-               equals(matrix) {
-                       const te = this.elements;
-                       const me = matrix.elements;
-
-                       for (let i = 0; i < 9; i++) {
-                               if (te[i] !== me[i]) return false;
-                       }
-
-                       return true;
-               }
-
-               fromArray(array, offset = 0) {
-                       for (let i = 0; i < 9; i++) {
-                               this.elements[i] = array[i + offset];
-                       }
-
-                       return this;
-               }
-
-               toArray(array = [], offset = 0) {
-                       const te = this.elements;
-                       array[offset] = te[0];
-                       array[offset + 1] = te[1];
-                       array[offset + 2] = te[2];
-                       array[offset + 3] = te[3];
-                       array[offset + 4] = te[4];
-                       array[offset + 5] = te[5];
-                       array[offset + 6] = te[6];
-                       array[offset + 7] = te[7];
-                       array[offset + 8] = te[8];
-                       return array;
-               }
-
-               clone() {
-                       return new this.constructor().fromArray(this.elements);
-               }
-
-       }
-
-       Matrix3.prototype.isMatrix3 = true;
-
-       let _canvas;
-
-       class ImageUtils {
-               static getDataURL(image) {
-                       if (/^data:/i.test(image.src)) {
-                               return image.src;
-                       }
-
-                       if (typeof HTMLCanvasElement == 'undefined') {
-                               return image.src;
-                       }
-
-                       let canvas;
-
-                       if (image instanceof HTMLCanvasElement) {
-                               canvas = image;
-                       } else {
-                               if (_canvas === undefined) _canvas = document.createElementNS('http://www.w3.org/1999/xhtml', 'canvas');
-                               _canvas.width = image.width;
-                               _canvas.height = image.height;
-
-                               const context = _canvas.getContext('2d');
-
-                               if (image instanceof ImageData) {
-                                       context.putImageData(image, 0, 0);
-                               } else {
-                                       context.drawImage(image, 0, 0, image.width, image.height);
-                               }
-
-                               canvas = _canvas;
-                       }
-
-                       if (canvas.width > 2048 || canvas.height > 2048) {
-                               console.warn('THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons', image);
-                               return canvas.toDataURL('image/jpeg', 0.6);
-                       } else {
-                               return canvas.toDataURL('image/png');
-                       }
-               }
-
-       }
-
-       let textureId = 0;
-
-       class Texture extends EventDispatcher {
-               constructor(image = Texture.DEFAULT_IMAGE, mapping = Texture.DEFAULT_MAPPING, wrapS = ClampToEdgeWrapping, wrapT = ClampToEdgeWrapping, magFilter = LinearFilter, minFilter = LinearMipmapLinearFilter, format = RGBAFormat, type = UnsignedByteType, anisotropy = 1, encoding = LinearEncoding) {
-                       super();
-                       Object.defineProperty(this, 'id', {
-                               value: textureId++
-                       });
-                       this.uuid = generateUUID();
-                       this.name = '';
-                       this.image = image;
-                       this.mipmaps = [];
-                       this.mapping = mapping;
-                       this.wrapS = wrapS;
-                       this.wrapT = wrapT;
-                       this.magFilter = magFilter;
-                       this.minFilter = minFilter;
-                       this.anisotropy = anisotropy;
-                       this.format = format;
-                       this.internalFormat = null;
-                       this.type = type;
-                       this.offset = new Vector2(0, 0);
-                       this.repeat = new Vector2(1, 1);
-                       this.center = new Vector2(0, 0);
-                       this.rotation = 0;
-                       this.matrixAutoUpdate = true;
-                       this.matrix = new Matrix3();
-                       this.generateMipmaps = true;
-                       this.premultiplyAlpha = false;
-                       this.flipY = true;
-                       this.unpackAlignment = 4; // valid values: 1, 2, 4, 8 (see http://www.khronos.org/opengles/sdk/docs/man/xhtml/glPixelStorei.xml)
-                       // Values of encoding !== THREE.LinearEncoding only supported on map, envMap and emissiveMap.
-                       //
-                       // Also changing the encoding after already used by a Material will not automatically make the Material
-                       // update. You need to explicitly call Material.needsUpdate to trigger it to recompile.
-
-                       this.encoding = encoding;
-                       this.version = 0;
-                       this.onUpdate = null;
-                       this.isRenderTargetTexture = false;
-               }
-
-               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(source) {
-                       this.name = source.name;
-                       this.image = source.image;
-                       this.mipmaps = source.mipmaps.slice(0);
-                       this.mapping = source.mapping;
-                       this.wrapS = source.wrapS;
-                       this.wrapT = source.wrapT;
-                       this.magFilter = source.magFilter;
-                       this.minFilter = source.minFilter;
-                       this.anisotropy = source.anisotropy;
-                       this.format = source.format;
-                       this.internalFormat = source.internalFormat;
-                       this.type = source.type;
-                       this.offset.copy(source.offset);
-                       this.repeat.copy(source.repeat);
-                       this.center.copy(source.center);
-                       this.rotation = source.rotation;
-                       this.matrixAutoUpdate = source.matrixAutoUpdate;
-                       this.matrix.copy(source.matrix);
-                       this.generateMipmaps = source.generateMipmaps;
-                       this.premultiplyAlpha = source.premultiplyAlpha;
-                       this.flipY = source.flipY;
-                       this.unpackAlignment = source.unpackAlignment;
-                       this.encoding = source.encoding;
-                       return this;
-               }
-
-               toJSON(meta) {
-                       const isRootObject = meta === undefined || typeof meta === 'string';
-
-                       if (!isRootObject && meta.textures[this.uuid] !== undefined) {
-                               return meta.textures[this.uuid];
-                       }
-
-                       const output = {
-                               metadata: {
-                                       version: 4.5,
-                                       type: 'Texture',
-                                       generator: 'Texture.toJSON'
-                               },
-                               uuid: this.uuid,
-                               name: this.name,
-                               mapping: this.mapping,
-                               repeat: [this.repeat.x, this.repeat.y],
-                               offset: [this.offset.x, this.offset.y],
-                               center: [this.center.x, this.center.y],
-                               rotation: this.rotation,
-                               wrap: [this.wrapS, this.wrapT],
-                               format: this.format,
-                               type: this.type,
-                               encoding: this.encoding,
-                               minFilter: this.minFilter,
-                               magFilter: this.magFilter,
-                               anisotropy: this.anisotropy,
-                               flipY: this.flipY,
-                               premultiplyAlpha: this.premultiplyAlpha,
-                               unpackAlignment: this.unpackAlignment
-                       };
-
-                       if (this.image !== undefined) {
-                               // TODO: Move to THREE.Image
-                               const image = this.image;
-
-                               if (image.uuid === undefined) {
-                                       image.uuid = generateUUID(); // UGH
-                               }
-
-                               if (!isRootObject && meta.images[image.uuid] === undefined) {
-                                       let url;
-
-                                       if (Array.isArray(image)) {
-                                               // process array of images e.g. CubeTexture
-                                               url = [];
-
-                                               for (let i = 0, l = image.length; i < l; i++) {
-                                                       // check cube texture with data textures
-                                                       if (image[i].isDataTexture) {
-                                                               url.push(serializeImage(image[i].image));
-                                                       } else {
-                                                               url.push(serializeImage(image[i]));
-                                                       }
-                                               }
-                                       } else {
-                                               // process single image
-                                               url = serializeImage(image);
-                                       }
-
-                                       meta.images[image.uuid] = {
-                                               uuid: image.uuid,
-                                               url: url
-                                       };
-                               }
-
-                               output.image = image.uuid;
-                       }
-
-                       if (!isRootObject) {
-                               meta.textures[this.uuid] = output;
-                       }
-
-                       return output;
-               }
-
-               dispose() {
-                       this.dispatchEvent({
-                               type: 'dispose'
-                       });
-               }
-
-               transformUv(uv) {
-                       if (this.mapping !== UVMapping) return uv;
-                       uv.applyMatrix3(this.matrix);
-
-                       if (uv.x < 0 || uv.x > 1) {
-                               switch (this.wrapS) {
-                                       case RepeatWrapping:
-                                               uv.x = uv.x - Math.floor(uv.x);
-                                               break;
-
-                                       case ClampToEdgeWrapping:
-                                               uv.x = uv.x < 0 ? 0 : 1;
-                                               break;
-
-                                       case MirroredRepeatWrapping:
-                                               if (Math.abs(Math.floor(uv.x) % 2) === 1) {
-                                                       uv.x = Math.ceil(uv.x) - uv.x;
-                                               } else {
-                                                       uv.x = uv.x - Math.floor(uv.x);
-                                               }
-
-                                               break;
-                               }
-                       }
-
-                       if (uv.y < 0 || uv.y > 1) {
-                               switch (this.wrapT) {
-                                       case RepeatWrapping:
-                                               uv.y = uv.y - Math.floor(uv.y);
-                                               break;
-
-                                       case ClampToEdgeWrapping:
-                                               uv.y = uv.y < 0 ? 0 : 1;
-                                               break;
-
-                                       case MirroredRepeatWrapping:
-                                               if (Math.abs(Math.floor(uv.y) % 2) === 1) {
-                                                       uv.y = Math.ceil(uv.y) - uv.y;
-                                               } else {
-                                                       uv.y = uv.y - Math.floor(uv.y);
-                                               }
-
-                                               break;
-                               }
-                       }
-
-                       if (this.flipY) {
-                               uv.y = 1 - uv.y;
-                       }
-
-                       return uv;
-               }
-
-               set needsUpdate(value) {
-                       if (value === true) this.version++;
-               }
-
-       }
-
-       Texture.DEFAULT_IMAGE = undefined;
-       Texture.DEFAULT_MAPPING = UVMapping;
-       Texture.prototype.isTexture = true;
-
-       function serializeImage(image) {
-               if (typeof HTMLImageElement !== 'undefined' && image instanceof HTMLImageElement || typeof HTMLCanvasElement !== 'undefined' && image instanceof HTMLCanvasElement || typeof ImageBitmap !== 'undefined' && image instanceof ImageBitmap) {
-                       // default images
-                       return ImageUtils.getDataURL(image);
-               } else {
-                       if (image.data) {
-                               // images of DataTexture
-                               return {
-                                       data: Array.prototype.slice.call(image.data),
-                                       width: image.width,
-                                       height: image.height,
-                                       type: image.data.constructor.name
-                               };
-                       } else {
-                               console.warn('THREE.Texture: Unable to serialize Texture.');
-                               return {};
-                       }
-               }
-       }
-
-       class Vector4 {
-               constructor(x = 0, y = 0, z = 0, w = 1) {
-                       this.x = x;
-                       this.y = y;
-                       this.z = z;
-                       this.w = w;
-               }
-
-               get width() {
-                       return this.z;
-               }
-
-               set width(value) {
-                       this.z = value;
-               }
-
-               get height() {
-                       return this.w;
-               }
-
-               set height(value) {
-                       this.w = value;
-               }
-
-               set(x, y, z, w) {
-                       this.x = x;
-                       this.y = y;
-                       this.z = z;
-                       this.w = w;
-                       return this;
-               }
-
-               setScalar(scalar) {
-                       this.x = scalar;
-                       this.y = scalar;
-                       this.z = scalar;
-                       this.w = scalar;
-                       return this;
-               }
-
-               setX(x) {
-                       this.x = x;
-                       return this;
-               }
-
-               setY(y) {
-                       this.y = y;
-                       return this;
-               }
-
-               setZ(z) {
-                       this.z = z;
-                       return this;
-               }
-
-               setW(w) {
-                       this.w = w;
-                       return this;
-               }
-
-               setComponent(index, value) {
-                       switch (index) {
-                               case 0:
-                                       this.x = value;
-                                       break;
-
-                               case 1:
-                                       this.y = value;
-                                       break;
-
-                               case 2:
-                                       this.z = value;
-                                       break;
-
-                               case 3:
-                                       this.w = value;
-                                       break;
-
-                               default:
-                                       throw new Error('index is out of range: ' + index);
-                       }
-
-                       return this;
-               }
-
-               getComponent(index) {
-                       switch (index) {
-                               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: ' + index);
-                       }
-               }
-
-               clone() {
-                       return new this.constructor(this.x, this.y, this.z, this.w);
-               }
-
-               copy(v) {
-                       this.x = v.x;
-                       this.y = v.y;
-                       this.z = v.z;
-                       this.w = v.w !== undefined ? v.w : 1;
-                       return this;
-               }
-
-               add(v, w) {
-                       if (w !== undefined) {
-                               console.warn('THREE.Vector4: .add() now only accepts one argument. Use .addVectors( a, b ) instead.');
-                               return this.addVectors(v, w);
-                       }
-
-                       this.x += v.x;
-                       this.y += v.y;
-                       this.z += v.z;
-                       this.w += v.w;
-                       return this;
-               }
-
-               addScalar(s) {
-                       this.x += s;
-                       this.y += s;
-                       this.z += s;
-                       this.w += s;
-                       return this;
-               }
-
-               addVectors(a, b) {
-                       this.x = a.x + b.x;
-                       this.y = a.y + b.y;
-                       this.z = a.z + b.z;
-                       this.w = a.w + b.w;
-                       return this;
-               }
-
-               addScaledVector(v, s) {
-                       this.x += v.x * s;
-                       this.y += v.y * s;
-                       this.z += v.z * s;
-                       this.w += v.w * s;
-                       return this;
-               }
-
-               sub(v, w) {
-                       if (w !== undefined) {
-                               console.warn('THREE.Vector4: .sub() now only accepts one argument. Use .subVectors( a, b ) instead.');
-                               return this.subVectors(v, w);
-                       }
-
-                       this.x -= v.x;
-                       this.y -= v.y;
-                       this.z -= v.z;
-                       this.w -= v.w;
-                       return this;
-               }
-
-               subScalar(s) {
-                       this.x -= s;
-                       this.y -= s;
-                       this.z -= s;
-                       this.w -= s;
-                       return this;
-               }
-
-               subVectors(a, b) {
-                       this.x = a.x - b.x;
-                       this.y = a.y - b.y;
-                       this.z = a.z - b.z;
-                       this.w = a.w - b.w;
-                       return this;
-               }
-
-               multiply(v) {
-                       this.x *= v.x;
-                       this.y *= v.y;
-                       this.z *= v.z;
-                       this.w *= v.w;
-                       return this;
-               }
-
-               multiplyScalar(scalar) {
-                       this.x *= scalar;
-                       this.y *= scalar;
-                       this.z *= scalar;
-                       this.w *= scalar;
-                       return this;
-               }
-
-               applyMatrix4(m) {
-                       const x = this.x,
-                                               y = this.y,
-                                               z = this.z,
-                                               w = this.w;
-                       const e = m.elements;
-                       this.x = e[0] * x + e[4] * y + e[8] * z + e[12] * w;
-                       this.y = e[1] * x + e[5] * y + e[9] * z + e[13] * w;
-                       this.z = e[2] * x + e[6] * y + e[10] * z + e[14] * w;
-                       this.w = e[3] * x + e[7] * y + e[11] * z + e[15] * w;
-                       return this;
-               }
-
-               divideScalar(scalar) {
-                       return this.multiplyScalar(1 / scalar);
-               }
-
-               setAxisAngleFromQuaternion(q) {
-                       // http://www.euclideanspace.com/maths/geometry/rotations/conversions/quaternionToAngle/index.htm
-                       // q is assumed to be normalized
-                       this.w = 2 * Math.acos(q.w);
-                       const s = Math.sqrt(1 - q.w * q.w);
-
-                       if (s < 0.0001) {
-                               this.x = 1;
-                               this.y = 0;
-                               this.z = 0;
-                       } else {
-                               this.x = q.x / s;
-                               this.y = q.y / s;
-                               this.z = q.z / s;
-                       }
-
-                       return this;
-               }
-
-               setAxisAngleFromRotationMatrix(m) {
-                       // http://www.euclideanspace.com/maths/geometry/rotations/conversions/matrixToAngle/index.htm
-                       // assumes the upper 3x3 of m is a pure rotation matrix (i.e, unscaled)
-                       let angle, x, y, z; // variables for result
-
-                       const epsilon = 0.01,
-                                               // margin to allow for rounding errors
-                       epsilon2 = 0.1,
-                                               // margin to distinguish between 0 and 180 degrees
-                       te = m.elements,
-                                               m11 = te[0],
-                                               m12 = te[4],
-                                               m13 = te[8],
-                                               m21 = te[1],
-                                               m22 = te[5],
-                                               m23 = te[9],
-                                               m31 = te[2],
-                                               m32 = te[6],
-                                               m33 = te[10];
-
-                       if (Math.abs(m12 - m21) < epsilon && Math.abs(m13 - m31) < epsilon && Math.abs(m23 - m32) < epsilon) {
-                               // singularity found
-                               // first check for identity matrix which must have +1 for all terms
-                               // in leading diagonal and zero in other terms
-                               if (Math.abs(m12 + m21) < epsilon2 && Math.abs(m13 + m31) < epsilon2 && Math.abs(m23 + m32) < epsilon2 && Math.abs(m11 + m22 + m33 - 3) < epsilon2) {
-                                       // this singularity is identity matrix so angle = 0
-                                       this.set(1, 0, 0, 0);
-                                       return this; // zero angle, arbitrary axis
-                               } // otherwise this singularity is angle = 180
-
-
-                               angle = Math.PI;
-                               const xx = (m11 + 1) / 2;
-                               const yy = (m22 + 1) / 2;
-                               const zz = (m33 + 1) / 2;
-                               const xy = (m12 + m21) / 4;
-                               const xz = (m13 + m31) / 4;
-                               const yz = (m23 + m32) / 4;
-
-                               if (xx > yy && xx > zz) {
-                                       // m11 is the largest diagonal term
-                                       if (xx < epsilon) {
-                                               x = 0;
-                                               y = 0.707106781;
-                                               z = 0.707106781;
-                                       } else {
-                                               x = Math.sqrt(xx);
-                                               y = xy / x;
-                                               z = xz / x;
-                                       }
-                               } else if (yy > zz) {
-                                       // m22 is the largest diagonal term
-                                       if (yy < epsilon) {
-                                               x = 0.707106781;
-                                               y = 0;
-                                               z = 0.707106781;
-                                       } else {
-                                               y = Math.sqrt(yy);
-                                               x = xy / y;
-                                               z = yz / y;
-                                       }
-                               } else {
-                                       // m33 is the largest diagonal term so base result on this
-                                       if (zz < epsilon) {
-                                               x = 0.707106781;
-                                               y = 0.707106781;
-                                               z = 0;
-                                       } else {
-                                               z = Math.sqrt(zz);
-                                               x = xz / z;
-                                               y = yz / z;
-                                       }
-                               }
-
-                               this.set(x, y, z, angle);
-                               return this; // return 180 deg rotation
-                       } // as we have reached here there are no singularities so we can handle normally
-
-
-                       let s = Math.sqrt((m32 - m23) * (m32 - m23) + (m13 - m31) * (m13 - m31) + (m21 - m12) * (m21 - m12)); // used to normalize
-
-                       if (Math.abs(s) < 0.001) s = 1; // prevent divide by zero, should not happen if matrix is orthogonal and should be
-                       // caught by singularity test above, but I've left it in just in case
-
-                       this.x = (m32 - m23) / s;
-                       this.y = (m13 - m31) / s;
-                       this.z = (m21 - m12) / s;
-                       this.w = Math.acos((m11 + m22 + m33 - 1) / 2);
-                       return this;
-               }
-
-               min(v) {
-                       this.x = Math.min(this.x, v.x);
-                       this.y = Math.min(this.y, v.y);
-                       this.z = Math.min(this.z, v.z);
-                       this.w = Math.min(this.w, v.w);
-                       return this;
-               }
-
-               max(v) {
-                       this.x = Math.max(this.x, v.x);
-                       this.y = Math.max(this.y, v.y);
-                       this.z = Math.max(this.z, v.z);
-                       this.w = Math.max(this.w, v.w);
-                       return this;
-               }
-
-               clamp(min, max) {
-                       // assumes min < max, componentwise
-                       this.x = Math.max(min.x, Math.min(max.x, this.x));
-                       this.y = Math.max(min.y, Math.min(max.y, this.y));
-                       this.z = Math.max(min.z, Math.min(max.z, this.z));
-                       this.w = Math.max(min.w, Math.min(max.w, this.w));
-                       return this;
-               }
-
-               clampScalar(minVal, maxVal) {
-                       this.x = Math.max(minVal, Math.min(maxVal, this.x));
-                       this.y = Math.max(minVal, Math.min(maxVal, this.y));
-                       this.z = Math.max(minVal, Math.min(maxVal, this.z));
-                       this.w = Math.max(minVal, Math.min(maxVal, this.w));
-                       return this;
-               }
-
-               clampLength(min, max) {
-                       const length = this.length();
-                       return this.divideScalar(length || 1).multiplyScalar(Math.max(min, Math.min(max, length)));
-               }
-
-               floor() {
-                       this.x = Math.floor(this.x);
-                       this.y = Math.floor(this.y);
-                       this.z = Math.floor(this.z);
-                       this.w = Math.floor(this.w);
-                       return this;
-               }
-
-               ceil() {
-                       this.x = Math.ceil(this.x);
-                       this.y = Math.ceil(this.y);
-                       this.z = Math.ceil(this.z);
-                       this.w = Math.ceil(this.w);
-                       return this;
-               }
-
-               round() {
-                       this.x = Math.round(this.x);
-                       this.y = Math.round(this.y);
-                       this.z = Math.round(this.z);
-                       this.w = Math.round(this.w);
-                       return this;
-               }
-
-               roundToZero() {
-                       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);
-                       return this;
-               }
-
-               negate() {
-                       this.x = -this.x;
-                       this.y = -this.y;
-                       this.z = -this.z;
-                       this.w = -this.w;
-                       return this;
-               }
-
-               dot(v) {
-                       return this.x * v.x + this.y * v.y + this.z * v.z + this.w * v.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(length) {
-                       return this.normalize().multiplyScalar(length);
-               }
-
-               lerp(v, alpha) {
-                       this.x += (v.x - this.x) * alpha;
-                       this.y += (v.y - this.y) * alpha;
-                       this.z += (v.z - this.z) * alpha;
-                       this.w += (v.w - this.w) * alpha;
-                       return this;
-               }
-
-               lerpVectors(v1, v2, alpha) {
-                       this.x = v1.x + (v2.x - v1.x) * alpha;
-                       this.y = v1.y + (v2.y - v1.y) * alpha;
-                       this.z = v1.z + (v2.z - v1.z) * alpha;
-                       this.w = v1.w + (v2.w - v1.w) * alpha;
-                       return this;
-               }
-
-               equals(v) {
-                       return v.x === this.x && v.y === this.y && v.z === this.z && v.w === this.w;
-               }
-
-               fromArray(array, offset = 0) {
-                       this.x = array[offset];
-                       this.y = array[offset + 1];
-                       this.z = array[offset + 2];
-                       this.w = array[offset + 3];
-                       return this;
-               }
-
-               toArray(array = [], offset = 0) {
-                       array[offset] = this.x;
-                       array[offset + 1] = this.y;
-                       array[offset + 2] = this.z;
-                       array[offset + 3] = this.w;
-                       return array;
-               }
-
-               fromBufferAttribute(attribute, index, offset) {
-                       if (offset !== undefined) {
-                               console.warn('THREE.Vector4: offset has been removed from .fromBufferAttribute().');
-                       }
-
-                       this.x = attribute.getX(index);
-                       this.y = attribute.getY(index);
-                       this.z = attribute.getZ(index);
-                       this.w = attribute.getW(index);
-                       return this;
-               }
-
-               random() {
-                       this.x = Math.random();
-                       this.y = Math.random();
-                       this.z = Math.random();
-                       this.w = Math.random();
-                       return this;
-               }
-
-       }
-
-       Vector4.prototype.isVector4 = true;
-
-       /*
-        In options, we can specify:
-        * Texture parameters for an auto-generated target texture
-        * depthBuffer/stencilBuffer: Booleans to indicate if we should generate these buffers
-       */
-
-       class WebGLRenderTarget extends EventDispatcher {
-               constructor(width, height, options = {}) {
-                       super();
-                       this.width = width;
-                       this.height = height;
-                       this.depth = 1;
-                       this.scissor = new Vector4(0, 0, width, height);
-                       this.scissorTest = false;
-                       this.viewport = new Vector4(0, 0, width, height);
-                       this.texture = new Texture(undefined, options.mapping, options.wrapS, options.wrapT, options.magFilter, options.minFilter, options.format, options.type, options.anisotropy, options.encoding);
-                       this.texture.isRenderTargetTexture = true;
-                       this.texture.image = {
-                               width: width,
-                               height: height,
-                               depth: 1
-                       };
-                       this.texture.generateMipmaps = options.generateMipmaps !== undefined ? options.generateMipmaps : false;
-                       this.texture.internalFormat = options.internalFormat !== undefined ? options.internalFormat : null;
-                       this.texture.minFilter = options.minFilter !== undefined ? options.minFilter : LinearFilter;
-                       this.depthBuffer = options.depthBuffer !== undefined ? options.depthBuffer : true;
-                       this.stencilBuffer = options.stencilBuffer !== undefined ? options.stencilBuffer : false;
-                       this.depthTexture = options.depthTexture !== undefined ? options.depthTexture : null;
-               }
-
-               setTexture(texture) {
-                       texture.image = {
-                               width: this.width,
-                               height: this.height,
-                               depth: this.depth
-                       };
-                       this.texture = texture;
-               }
-
-               setSize(width, height, depth = 1) {
-                       if (this.width !== width || this.height !== height || this.depth !== depth) {
-                               this.width = width;
-                               this.height = height;
-                               this.depth = depth;
-                               this.texture.image.width = width;
-                               this.texture.image.height = height;
-                               this.texture.image.depth = depth;
-                               this.dispose();
-                       }
-
-                       this.viewport.set(0, 0, width, height);
-                       this.scissor.set(0, 0, width, height);
-               }
-
-               clone() {
-                       return new this.constructor().copy(this);
-               }
-
-               copy(source) {
-                       this.width = source.width;
-                       this.height = source.height;
-                       this.depth = source.depth;
-                       this.viewport.copy(source.viewport);
-                       this.texture = source.texture.clone();
-                       this.texture.image = { ...this.texture.image
-                       }; // See #20328.
-
-                       this.depthBuffer = source.depthBuffer;
-                       this.stencilBuffer = source.stencilBuffer;
-                       this.depthTexture = source.depthTexture;
-                       return this;
-               }
-
-               dispose() {
-                       this.dispatchEvent({
-                               type: 'dispose'
-                       });
-               }
-
-       }
-
-       WebGLRenderTarget.prototype.isWebGLRenderTarget = true;
-
-       class WebGLMultipleRenderTargets extends WebGLRenderTarget {
-               constructor(width, height, count) {
-                       super(width, height);
-                       const texture = this.texture;
-                       this.texture = [];
-
-                       for (let i = 0; i < count; i++) {
-                               this.texture[i] = texture.clone();
-                       }
-               }
-
-               setSize(width, height, depth = 1) {
-                       if (this.width !== width || this.height !== height || this.depth !== depth) {
-                               this.width = width;
-                               this.height = height;
-                               this.depth = depth;
-
-                               for (let i = 0, il = this.texture.length; i < il; i++) {
-                                       this.texture[i].image.width = width;
-                                       this.texture[i].image.height = height;
-                                       this.texture[i].image.depth = depth;
-                               }
-
-                               this.dispose();
-                       }
-
-                       this.viewport.set(0, 0, width, height);
-                       this.scissor.set(0, 0, width, height);
-                       return this;
-               }
-
-               copy(source) {
-                       this.dispose();
-                       this.width = source.width;
-                       this.height = source.height;
-                       this.depth = source.depth;
-                       this.viewport.set(0, 0, this.width, this.height);
-                       this.scissor.set(0, 0, this.width, this.height);
-                       this.depthBuffer = source.depthBuffer;
-                       this.stencilBuffer = source.stencilBuffer;
-                       this.depthTexture = source.depthTexture;
-                       this.texture.length = 0;
-
-                       for (let i = 0, il = source.texture.length; i < il; i++) {
-                               this.texture[i] = source.texture[i].clone();
-                       }
-
-                       return this;
-               }
-
-       }
-
-       WebGLMultipleRenderTargets.prototype.isWebGLMultipleRenderTargets = true;
-
-       class WebGLMultisampleRenderTarget extends WebGLRenderTarget {
-               constructor(width, height, options) {
-                       super(width, height, options);
-                       this.samples = 4;
-               }
-
-               copy(source) {
-                       super.copy.call(this, source);
-                       this.samples = source.samples;
-                       return this;
-               }
-
-       }
-
-       WebGLMultisampleRenderTarget.prototype.isWebGLMultisampleRenderTarget = true;
-
-       class Quaternion {
-               constructor(x = 0, y = 0, z = 0, w = 1) {
-                       this._x = x;
-                       this._y = y;
-                       this._z = z;
-                       this._w = w;
-               }
-
-               static slerp(qa, qb, qm, t) {
-                       console.warn('THREE.Quaternion: Static .slerp() has been deprecated. Use qm.slerpQuaternions( qa, qb, t ) instead.');
-                       return qm.slerpQuaternions(qa, qb, t);
-               }
-
-               static slerpFlat(dst, dstOffset, src0, srcOffset0, src1, srcOffset1, t) {
-                       // fuzz-free, array-based Quaternion SLERP operation
-                       let x0 = src0[srcOffset0 + 0],
-                                       y0 = src0[srcOffset0 + 1],
-                                       z0 = src0[srcOffset0 + 2],
-                                       w0 = src0[srcOffset0 + 3];
-                       const x1 = src1[srcOffset1 + 0],
-                                               y1 = src1[srcOffset1 + 1],
-                                               z1 = src1[srcOffset1 + 2],
-                                               w1 = src1[srcOffset1 + 3];
-
-                       if (t === 0) {
-                               dst[dstOffset + 0] = x0;
-                               dst[dstOffset + 1] = y0;
-                               dst[dstOffset + 2] = z0;
-                               dst[dstOffset + 3] = w0;
-                               return;
-                       }
-
-                       if (t === 1) {
-                               dst[dstOffset + 0] = x1;
-                               dst[dstOffset + 1] = y1;
-                               dst[dstOffset + 2] = z1;
-                               dst[dstOffset + 3] = w1;
-                               return;
-                       }
-
-                       if (w0 !== w1 || x0 !== x1 || y0 !== y1 || z0 !== z1) {
-                               let s = 1 - t;
-                               const cos = x0 * x1 + y0 * y1 + z0 * z1 + w0 * w1,
-                                                       dir = cos >= 0 ? 1 : -1,
-                                                       sqrSin = 1 - cos * cos; // Skip the Slerp for tiny steps to avoid numeric problems:
-
-                               if (sqrSin > Number.EPSILON) {
-                                       const sin = Math.sqrt(sqrSin),
-                                                               len = Math.atan2(sin, cos * dir);
-                                       s = Math.sin(s * len) / sin;
-                                       t = Math.sin(t * len) / sin;
-                               }
-
-                               const tDir = t * dir;
-                               x0 = x0 * s + x1 * tDir;
-                               y0 = y0 * s + y1 * tDir;
-                               z0 = z0 * s + z1 * tDir;
-                               w0 = w0 * s + w1 * tDir; // Normalize in case we just did a lerp:
-
-                               if (s === 1 - t) {
-                                       const f = 1 / Math.sqrt(x0 * x0 + y0 * y0 + z0 * z0 + w0 * w0);
-                                       x0 *= f;
-                                       y0 *= f;
-                                       z0 *= f;
-                                       w0 *= f;
-                               }
-                       }
-
-                       dst[dstOffset] = x0;
-                       dst[dstOffset + 1] = y0;
-                       dst[dstOffset + 2] = z0;
-                       dst[dstOffset + 3] = w0;
-               }
-
-               static multiplyQuaternionsFlat(dst, dstOffset, src0, srcOffset0, src1, srcOffset1) {
-                       const x0 = src0[srcOffset0];
-                       const y0 = src0[srcOffset0 + 1];
-                       const z0 = src0[srcOffset0 + 2];
-                       const w0 = src0[srcOffset0 + 3];
-                       const x1 = src1[srcOffset1];
-                       const y1 = src1[srcOffset1 + 1];
-                       const z1 = src1[srcOffset1 + 2];
-                       const w1 = src1[srcOffset1 + 3];
-                       dst[dstOffset] = x0 * w1 + w0 * x1 + y0 * z1 - z0 * y1;
-                       dst[dstOffset + 1] = y0 * w1 + w0 * y1 + z0 * x1 - x0 * z1;
-                       dst[dstOffset + 2] = z0 * w1 + w0 * z1 + x0 * y1 - y0 * x1;
-                       dst[dstOffset + 3] = w0 * w1 - x0 * x1 - y0 * y1 - z0 * z1;
-                       return dst;
-               }
-
-               get x() {
-                       return this._x;
-               }
-
-               set x(value) {
-                       this._x = value;
-
-                       this._onChangeCallback();
-               }
-
-               get y() {
-                       return this._y;
-               }
-
-               set y(value) {
-                       this._y = value;
-
-                       this._onChangeCallback();
-               }
-
-               get z() {
-                       return this._z;
-               }
-
-               set z(value) {
-                       this._z = value;
-
-                       this._onChangeCallback();
-               }
-
-               get w() {
-                       return this._w;
-               }
-
-               set w(value) {
-                       this._w = value;
-
-                       this._onChangeCallback();
-               }
-
-               set(x, y, z, w) {
-                       this._x = x;
-                       this._y = y;
-                       this._z = z;
-                       this._w = w;
-
-                       this._onChangeCallback();
-
-                       return this;
-               }
-
-               clone() {
-                       return new this.constructor(this._x, this._y, this._z, this._w);
-               }
-
-               copy(quaternion) {
-                       this._x = quaternion.x;
-                       this._y = quaternion.y;
-                       this._z = quaternion.z;
-                       this._w = quaternion.w;
-
-                       this._onChangeCallback();
-
-                       return this;
-               }
-
-               setFromEuler(euler, update) {
-                       if (!(euler && euler.isEuler)) {
-                               throw new Error('THREE.Quaternion: .setFromEuler() now expects an Euler rotation rather than a Vector3 and order.');
-                       }
-
-                       const x = euler._x,
-                                               y = euler._y,
-                                               z = euler._z,
-                                               order = euler._order; // http://www.mathworks.com/matlabcentral/fileexchange/
-                       //      20696-function-to-convert-between-dcm-euler-angles-quaternions-and-euler-vectors/
-                       //      content/SpinCalc.m
-
-                       const cos = Math.cos;
-                       const sin = Math.sin;
-                       const c1 = cos(x / 2);
-                       const c2 = cos(y / 2);
-                       const c3 = cos(z / 2);
-                       const s1 = sin(x / 2);
-                       const s2 = sin(y / 2);
-                       const s3 = sin(z / 2);
-
-                       switch (order) {
-                               case 'XYZ':
-                                       this._x = s1 * c2 * c3 + c1 * s2 * s3;
-                                       this._y = c1 * s2 * c3 - s1 * c2 * s3;
-                                       this._z = c1 * c2 * s3 + s1 * s2 * c3;
-                                       this._w = c1 * c2 * c3 - s1 * s2 * s3;
-                                       break;
-
-                               case 'YXZ':
-                                       this._x = s1 * c2 * c3 + c1 * s2 * s3;
-                                       this._y = c1 * s2 * c3 - s1 * c2 * s3;
-                                       this._z = c1 * c2 * s3 - s1 * s2 * c3;
-                                       this._w = c1 * c2 * c3 + s1 * s2 * s3;
-                                       break;
-
-                               case 'ZXY':
-                                       this._x = s1 * c2 * c3 - c1 * s2 * s3;
-                                       this._y = c1 * s2 * c3 + s1 * c2 * s3;
-                                       this._z = c1 * c2 * s3 + s1 * s2 * c3;
-                                       this._w = c1 * c2 * c3 - s1 * s2 * s3;
-                                       break;
-
-                               case 'ZYX':
-                                       this._x = s1 * c2 * c3 - c1 * s2 * s3;
-                                       this._y = c1 * s2 * c3 + s1 * c2 * s3;
-                                       this._z = c1 * c2 * s3 - s1 * s2 * c3;
-                                       this._w = c1 * c2 * c3 + s1 * s2 * s3;
-                                       break;
-
-                               case 'YZX':
-                                       this._x = s1 * c2 * c3 + c1 * s2 * s3;
-                                       this._y = c1 * s2 * c3 + s1 * c2 * s3;
-                                       this._z = c1 * c2 * s3 - s1 * s2 * c3;
-                                       this._w = c1 * c2 * c3 - s1 * s2 * s3;
-                                       break;
-
-                               case 'XZY':
-                                       this._x = s1 * c2 * c3 - c1 * s2 * s3;
-                                       this._y = c1 * s2 * c3 - s1 * c2 * s3;
-                                       this._z = c1 * c2 * s3 + s1 * s2 * c3;
-                                       this._w = c1 * c2 * c3 + s1 * s2 * s3;
-                                       break;
-
-                               default:
-                                       console.warn('THREE.Quaternion: .setFromEuler() encountered an unknown order: ' + order);
-                       }
-
-                       if (update !== false) this._onChangeCallback();
-                       return this;
-               }
-
-               setFromAxisAngle(axis, angle) {
-                       // http://www.euclideanspace.com/maths/geometry/rotations/conversions/angleToQuaternion/index.htm
-                       // assumes axis is normalized
-                       const halfAngle = angle / 2,
-                                               s = Math.sin(halfAngle);
-                       this._x = axis.x * s;
-                       this._y = axis.y * s;
-                       this._z = axis.z * s;
-                       this._w = Math.cos(halfAngle);
-
-                       this._onChangeCallback();
-
-                       return this;
-               }
-
-               setFromRotationMatrix(m) {
-                       // http://www.euclideanspace.com/maths/geometry/rotations/conversions/matrixToQuaternion/index.htm
-                       // assumes the upper 3x3 of m is a pure rotation matrix (i.e, unscaled)
-                       const te = m.elements,
-                                               m11 = te[0],
-                                               m12 = te[4],
-                                               m13 = te[8],
-                                               m21 = te[1],
-                                               m22 = te[5],
-                                               m23 = te[9],
-                                               m31 = te[2],
-                                               m32 = te[6],
-                                               m33 = te[10],
-                                               trace = m11 + m22 + m33;
-
-                       if (trace > 0) {
-                               const s = 0.5 / Math.sqrt(trace + 1.0);
-                               this._w = 0.25 / s;
-                               this._x = (m32 - m23) * s;
-                               this._y = (m13 - m31) * s;
-                               this._z = (m21 - m12) * s;
-                       } else if (m11 > m22 && m11 > m33) {
-                               const s = 2.0 * Math.sqrt(1.0 + m11 - m22 - m33);
-                               this._w = (m32 - m23) / s;
-                               this._x = 0.25 * s;
-                               this._y = (m12 + m21) / s;
-                               this._z = (m13 + m31) / s;
-                       } else if (m22 > m33) {
-                               const s = 2.0 * Math.sqrt(1.0 + m22 - m11 - m33);
-                               this._w = (m13 - m31) / s;
-                               this._x = (m12 + m21) / s;
-                               this._y = 0.25 * s;
-                               this._z = (m23 + m32) / s;
-                       } else {
-                               const s = 2.0 * Math.sqrt(1.0 + m33 - m11 - m22);
-                               this._w = (m21 - m12) / s;
-                               this._x = (m13 + m31) / s;
-                               this._y = (m23 + m32) / s;
-                               this._z = 0.25 * s;
-                       }
-
-                       this._onChangeCallback();
-
-                       return this;
-               }
-
-               setFromUnitVectors(vFrom, vTo) {
-                       // assumes direction vectors vFrom and vTo are normalized
-                       let r = vFrom.dot(vTo) + 1;
-
-                       if (r < Number.EPSILON) {
-                               // vFrom and vTo point in opposite directions
-                               r = 0;
-
-                               if (Math.abs(vFrom.x) > Math.abs(vFrom.z)) {
-                                       this._x = -vFrom.y;
-                                       this._y = vFrom.x;
-                                       this._z = 0;
-                                       this._w = r;
-                               } else {
-                                       this._x = 0;
-                                       this._y = -vFrom.z;
-                                       this._z = vFrom.y;
-                                       this._w = r;
-                               }
-                       } else {
-                               // crossVectors( vFrom, vTo ); // inlined to avoid cyclic dependency on Vector3
-                               this._x = vFrom.y * vTo.z - vFrom.z * vTo.y;
-                               this._y = vFrom.z * vTo.x - vFrom.x * vTo.z;
-                               this._z = vFrom.x * vTo.y - vFrom.y * vTo.x;
-                               this._w = r;
-                       }
-
-                       return this.normalize();
-               }
-
-               angleTo(q) {
-                       return 2 * Math.acos(Math.abs(clamp(this.dot(q), -1, 1)));
-               }
-
-               rotateTowards(q, step) {
-                       const angle = this.angleTo(q);
-                       if (angle === 0) return this;
-                       const t = Math.min(1, step / angle);
-                       this.slerp(q, t);
-                       return this;
-               }
-
-               identity() {
-                       return this.set(0, 0, 0, 1);
-               }
-
-               invert() {
-                       // quaternion is assumed to have unit length
-                       return this.conjugate();
-               }
-
-               conjugate() {
-                       this._x *= -1;
-                       this._y *= -1;
-                       this._z *= -1;
-
-                       this._onChangeCallback();
-
-                       return this;
-               }
-
-               dot(v) {
-                       return this._x * v._x + this._y * v._y + this._z * v._z + this._w * v._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 l = this.length();
-
-                       if (l === 0) {
-                               this._x = 0;
-                               this._y = 0;
-                               this._z = 0;
-                               this._w = 1;
-                       } else {
-                               l = 1 / l;
-                               this._x = this._x * l;
-                               this._y = this._y * l;
-                               this._z = this._z * l;
-                               this._w = this._w * l;
-                       }
-
-                       this._onChangeCallback();
-
-                       return this;
-               }
-
-               multiply(q, p) {
-                       if (p !== undefined) {
-                               console.warn('THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead.');
-                               return this.multiplyQuaternions(q, p);
-                       }
-
-                       return this.multiplyQuaternions(this, q);
-               }
-
-               premultiply(q) {
-                       return this.multiplyQuaternions(q, this);
-               }
-
-               multiplyQuaternions(a, b) {
-                       // from http://www.euclideanspace.com/maths/algebra/realNormedAlgebra/quaternions/code/index.htm
-                       const qax = a._x,
-                                               qay = a._y,
-                                               qaz = a._z,
-                                               qaw = a._w;
-                       const qbx = b._x,
-                                               qby = b._y,
-                                               qbz = b._z,
-                                               qbw = b._w;
-                       this._x = qax * qbw + qaw * qbx + qay * qbz - qaz * qby;
-                       this._y = qay * qbw + qaw * qby + qaz * qbx - qax * qbz;
-                       this._z = qaz * qbw + qaw * qbz + qax * qby - qay * qbx;
-                       this._w = qaw * qbw - qax * qbx - qay * qby - qaz * qbz;
-
-                       this._onChangeCallback();
-
-                       return this;
-               }
-
-               slerp(qb, t) {
-                       if (t === 0) return this;
-                       if (t === 1) return this.copy(qb);
-                       const x = this._x,
-                                               y = this._y,
-                                               z = this._z,
-                                               w = this._w; // http://www.euclideanspace.com/maths/algebra/realNormedAlgebra/quaternions/slerp/
-
-                       let cosHalfTheta = w * qb._w + x * qb._x + y * qb._y + z * qb._z;
-
-                       if (cosHalfTheta < 0) {
-                               this._w = -qb._w;
-                               this._x = -qb._x;
-                               this._y = -qb._y;
-                               this._z = -qb._z;
-                               cosHalfTheta = -cosHalfTheta;
-                       } else {
-                               this.copy(qb);
-                       }
-
-                       if (cosHalfTheta >= 1.0) {
-                               this._w = w;
-                               this._x = x;
-                               this._y = y;
-                               this._z = z;
-                               return this;
-                       }
-
-                       const sqrSinHalfTheta = 1.0 - cosHalfTheta * cosHalfTheta;
-
-                       if (sqrSinHalfTheta <= Number.EPSILON) {
-                               const s = 1 - t;
-                               this._w = s * w + t * this._w;
-                               this._x = s * x + t * this._x;
-                               this._y = s * y + t * this._y;
-                               this._z = s * z + t * this._z;
-                               this.normalize();
-
-                               this._onChangeCallback();
-
-                               return this;
-                       }
-
-                       const sinHalfTheta = Math.sqrt(sqrSinHalfTheta);
-                       const halfTheta = Math.atan2(sinHalfTheta, cosHalfTheta);
-                       const ratioA = Math.sin((1 - t) * halfTheta) / sinHalfTheta,
-                                               ratioB = Math.sin(t * halfTheta) / sinHalfTheta;
-                       this._w = w * ratioA + this._w * ratioB;
-                       this._x = x * ratioA + this._x * ratioB;
-                       this._y = y * ratioA + this._y * ratioB;
-                       this._z = z * ratioA + this._z * ratioB;
-
-                       this._onChangeCallback();
-
-                       return this;
-               }
-
-               slerpQuaternions(qa, qb, t) {
-                       this.copy(qa).slerp(qb, t);
-               }
-
-               equals(quaternion) {
-                       return quaternion._x === this._x && quaternion._y === this._y && quaternion._z === this._z && quaternion._w === this._w;
-               }
-
-               fromArray(array, offset = 0) {
-                       this._x = array[offset];
-                       this._y = array[offset + 1];
-                       this._z = array[offset + 2];
-                       this._w = array[offset + 3];
-
-                       this._onChangeCallback();
-
-                       return this;
-               }
-
-               toArray(array = [], offset = 0) {
-                       array[offset] = this._x;
-                       array[offset + 1] = this._y;
-                       array[offset + 2] = this._z;
-                       array[offset + 3] = this._w;
-                       return array;
-               }
-
-               fromBufferAttribute(attribute, index) {
-                       this._x = attribute.getX(index);
-                       this._y = attribute.getY(index);
-                       this._z = attribute.getZ(index);
-                       this._w = attribute.getW(index);
-                       return this;
-               }
-
-               _onChange(callback) {
-                       this._onChangeCallback = callback;
-                       return this;
-               }
-
-               _onChangeCallback() {}
-
-       }
-
-       Quaternion.prototype.isQuaternion = true;
-
-       class Vector3 {
-               constructor(x = 0, y = 0, z = 0) {
-                       this.x = x;
-                       this.y = y;
-                       this.z = z;
-               }
-
-               set(x, y, z) {
-                       if (z === undefined) z = this.z; // sprite.scale.set(x,y)
-
-                       this.x = x;
-                       this.y = y;
-                       this.z = z;
-                       return this;
-               }
-
-               setScalar(scalar) {
-                       this.x = scalar;
-                       this.y = scalar;
-                       this.z = scalar;
-                       return this;
-               }
-
-               setX(x) {
-                       this.x = x;
-                       return this;
-               }
-
-               setY(y) {
-                       this.y = y;
-                       return this;
-               }
-
-               setZ(z) {
-                       this.z = z;
-                       return this;
-               }
-
-               setComponent(index, value) {
-                       switch (index) {
-                               case 0:
-                                       this.x = value;
-                                       break;
-
-                               case 1:
-                                       this.y = value;
-                                       break;
-
-                               case 2:
-                                       this.z = value;
-                                       break;
-
-                               default:
-                                       throw new Error('index is out of range: ' + index);
-                       }
-
-                       return this;
-               }
-
-               getComponent(index) {
-                       switch (index) {
-                               case 0:
-                                       return this.x;
-
-                               case 1:
-                                       return this.y;
-
-                               case 2:
-                                       return this.z;
-
-                               default:
-                                       throw new Error('index is out of range: ' + index);
-                       }
-               }
-
-               clone() {
-                       return new this.constructor(this.x, this.y, this.z);
-               }
-
-               copy(v) {
-                       this.x = v.x;
-                       this.y = v.y;
-                       this.z = v.z;
-                       return this;
-               }
-
-               add(v, w) {
-                       if (w !== undefined) {
-                               console.warn('THREE.Vector3: .add() now only accepts one argument. Use .addVectors( a, b ) instead.');
-                               return this.addVectors(v, w);
-                       }
-
-                       this.x += v.x;
-                       this.y += v.y;
-                       this.z += v.z;
-                       return this;
-               }
-
-               addScalar(s) {
-                       this.x += s;
-                       this.y += s;
-                       this.z += s;
-                       return this;
-               }
-
-               addVectors(a, b) {
-                       this.x = a.x + b.x;
-                       this.y = a.y + b.y;
-                       this.z = a.z + b.z;
-                       return this;
-               }
-
-               addScaledVector(v, s) {
-                       this.x += v.x * s;
-                       this.y += v.y * s;
-                       this.z += v.z * s;
-                       return this;
-               }
-
-               sub(v, w) {
-                       if (w !== undefined) {
-                               console.warn('THREE.Vector3: .sub() now only accepts one argument. Use .subVectors( a, b ) instead.');
-                               return this.subVectors(v, w);
-                       }
-
-                       this.x -= v.x;
-                       this.y -= v.y;
-                       this.z -= v.z;
-                       return this;
-               }
-
-               subScalar(s) {
-                       this.x -= s;
-                       this.y -= s;
-                       this.z -= s;
-                       return this;
-               }
-
-               subVectors(a, b) {
-                       this.x = a.x - b.x;
-                       this.y = a.y - b.y;
-                       this.z = a.z - b.z;
-                       return this;
-               }
-
-               multiply(v, w) {
-                       if (w !== undefined) {
-                               console.warn('THREE.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead.');
-                               return this.multiplyVectors(v, w);
-                       }
-
-                       this.x *= v.x;
-                       this.y *= v.y;
-                       this.z *= v.z;
-                       return this;
-               }
-
-               multiplyScalar(scalar) {
-                       this.x *= scalar;
-                       this.y *= scalar;
-                       this.z *= scalar;
-                       return this;
-               }
-
-               multiplyVectors(a, b) {
-                       this.x = a.x * b.x;
-                       this.y = a.y * b.y;
-                       this.z = a.z * b.z;
-                       return this;
-               }
-
-               applyEuler(euler) {
-                       if (!(euler && euler.isEuler)) {
-                               console.error('THREE.Vector3: .applyEuler() now expects an Euler rotation rather than a Vector3 and order.');
-                       }
-
-                       return this.applyQuaternion(_quaternion$4.setFromEuler(euler));
-               }
-
-               applyAxisAngle(axis, angle) {
-                       return this.applyQuaternion(_quaternion$4.setFromAxisAngle(axis, angle));
-               }
-
-               applyMatrix3(m) {
-                       const x = this.x,
-                                               y = this.y,
-                                               z = this.z;
-                       const e = m.elements;
-                       this.x = e[0] * x + e[3] * y + e[6] * z;
-                       this.y = e[1] * x + e[4] * y + e[7] * z;
-                       this.z = e[2] * x + e[5] * y + e[8] * z;
-                       return this;
-               }
-
-               applyNormalMatrix(m) {
-                       return this.applyMatrix3(m).normalize();
-               }
-
-               applyMatrix4(m) {
-                       const x = this.x,
-                                               y = this.y,
-                                               z = this.z;
-                       const e = m.elements;
-                       const w = 1 / (e[3] * x + e[7] * y + e[11] * z + e[15]);
-                       this.x = (e[0] * x + e[4] * y + e[8] * z + e[12]) * w;
-                       this.y = (e[1] * x + e[5] * y + e[9] * z + e[13]) * w;
-                       this.z = (e[2] * x + e[6] * y + e[10] * z + e[14]) * w;
-                       return this;
-               }
-
-               applyQuaternion(q) {
-                       const x = this.x,
-                                               y = this.y,
-                                               z = this.z;
-                       const qx = q.x,
-                                               qy = q.y,
-                                               qz = q.z,
-                                               qw = q.w; // calculate quat * vector
-
-                       const ix = qw * x + qy * z - qz * y;
-                       const iy = qw * y + qz * x - qx * z;
-                       const iz = qw * z + qx * y - qy * x;
-                       const iw = -qx * x - qy * y - qz * z; // calculate result * inverse quat
-
-                       this.x = ix * qw + iw * -qx + iy * -qz - iz * -qy;
-                       this.y = iy * qw + iw * -qy + iz * -qx - ix * -qz;
-                       this.z = iz * qw + iw * -qz + ix * -qy - iy * -qx;
-                       return this;
-               }
-
-               project(camera) {
-                       return this.applyMatrix4(camera.matrixWorldInverse).applyMatrix4(camera.projectionMatrix);
-               }
-
-               unproject(camera) {
-                       return this.applyMatrix4(camera.projectionMatrixInverse).applyMatrix4(camera.matrixWorld);
-               }
-
-               transformDirection(m) {
-                       // input: THREE.Matrix4 affine matrix
-                       // vector interpreted as a direction
-                       const x = this.x,
-                                               y = this.y,
-                                               z = this.z;
-                       const e = m.elements;
-                       this.x = e[0] * x + e[4] * y + e[8] * z;
-                       this.y = e[1] * x + e[5] * y + e[9] * z;
-                       this.z = e[2] * x + e[6] * y + e[10] * z;
-                       return this.normalize();
-               }
-
-               divide(v) {
-                       this.x /= v.x;
-                       this.y /= v.y;
-                       this.z /= v.z;
-                       return this;
-               }
-
-               divideScalar(scalar) {
-                       return this.multiplyScalar(1 / scalar);
-               }
-
-               min(v) {
-                       this.x = Math.min(this.x, v.x);
-                       this.y = Math.min(this.y, v.y);
-                       this.z = Math.min(this.z, v.z);
-                       return this;
-               }
-
-               max(v) {
-                       this.x = Math.max(this.x, v.x);
-                       this.y = Math.max(this.y, v.y);
-                       this.z = Math.max(this.z, v.z);
-                       return this;
-               }
-
-               clamp(min, max) {
-                       // assumes min < max, componentwise
-                       this.x = Math.max(min.x, Math.min(max.x, this.x));
-                       this.y = Math.max(min.y, Math.min(max.y, this.y));
-                       this.z = Math.max(min.z, Math.min(max.z, this.z));
-                       return this;
-               }
-
-               clampScalar(minVal, maxVal) {
-                       this.x = Math.max(minVal, Math.min(maxVal, this.x));
-                       this.y = Math.max(minVal, Math.min(maxVal, this.y));
-                       this.z = Math.max(minVal, Math.min(maxVal, this.z));
-                       return this;
-               }
-
-               clampLength(min, max) {
-                       const length = this.length();
-                       return this.divideScalar(length || 1).multiplyScalar(Math.max(min, Math.min(max, length)));
-               }
-
-               floor() {
-                       this.x = Math.floor(this.x);
-                       this.y = Math.floor(this.y);
-                       this.z = Math.floor(this.z);
-                       return this;
-               }
-
-               ceil() {
-                       this.x = Math.ceil(this.x);
-                       this.y = Math.ceil(this.y);
-                       this.z = Math.ceil(this.z);
-                       return this;
-               }
-
-               round() {
-                       this.x = Math.round(this.x);
-                       this.y = Math.round(this.y);
-                       this.z = Math.round(this.z);
-                       return this;
-               }
-
-               roundToZero() {
-                       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);
-                       return this;
-               }
-
-               negate() {
-                       this.x = -this.x;
-                       this.y = -this.y;
-                       this.z = -this.z;
-                       return this;
-               }
-
-               dot(v) {
-                       return this.x * v.x + this.y * v.y + this.z * v.z;
-               } // TODO lengthSquared?
-
-
-               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(length) {
-                       return this.normalize().multiplyScalar(length);
-               }
-
-               lerp(v, alpha) {
-                       this.x += (v.x - this.x) * alpha;
-                       this.y += (v.y - this.y) * alpha;
-                       this.z += (v.z - this.z) * alpha;
-                       return this;
-               }
-
-               lerpVectors(v1, v2, alpha) {
-                       this.x = v1.x + (v2.x - v1.x) * alpha;
-                       this.y = v1.y + (v2.y - v1.y) * alpha;
-                       this.z = v1.z + (v2.z - v1.z) * alpha;
-                       return this;
-               }
-
-               cross(v, w) {
-                       if (w !== undefined) {
-                               console.warn('THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead.');
-                               return this.crossVectors(v, w);
-                       }
-
-                       return this.crossVectors(this, v);
-               }
-
-               crossVectors(a, b) {
-                       const ax = a.x,
-                                               ay = a.y,
-                                               az = a.z;
-                       const bx = b.x,
-                                               by = b.y,
-                                               bz = b.z;
-                       this.x = ay * bz - az * by;
-                       this.y = az * bx - ax * bz;
-                       this.z = ax * by - ay * bx;
-                       return this;
-               }
-
-               projectOnVector(v) {
-                       const denominator = v.lengthSq();
-                       if (denominator === 0) return this.set(0, 0, 0);
-                       const scalar = v.dot(this) / denominator;
-                       return this.copy(v).multiplyScalar(scalar);
-               }
-
-               projectOnPlane(planeNormal) {
-                       _vector$c.copy(this).projectOnVector(planeNormal);
-
-                       return this.sub(_vector$c);
-               }
-
-               reflect(normal) {
-                       // reflect incident vector off plane orthogonal to normal
-                       // normal is assumed to have unit length
-                       return this.sub(_vector$c.copy(normal).multiplyScalar(2 * this.dot(normal)));
-               }
-
-               angleTo(v) {
-                       const denominator = Math.sqrt(this.lengthSq() * v.lengthSq());
-                       if (denominator === 0) return Math.PI / 2;
-                       const theta = this.dot(v) / denominator; // clamp, to handle numerical problems
-
-                       return Math.acos(clamp(theta, -1, 1));
-               }
-
-               distanceTo(v) {
-                       return Math.sqrt(this.distanceToSquared(v));
-               }
-
-               distanceToSquared(v) {
-                       const dx = this.x - v.x,
-                                               dy = this.y - v.y,
-                                               dz = this.z - v.z;
-                       return dx * dx + dy * dy + dz * dz;
-               }
-
-               manhattanDistanceTo(v) {
-                       return Math.abs(this.x - v.x) + Math.abs(this.y - v.y) + Math.abs(this.z - v.z);
-               }
-
-               setFromSpherical(s) {
-                       return this.setFromSphericalCoords(s.radius, s.phi, s.theta);
-               }
-
-               setFromSphericalCoords(radius, phi, theta) {
-                       const sinPhiRadius = Math.sin(phi) * radius;
-                       this.x = sinPhiRadius * Math.sin(theta);
-                       this.y = Math.cos(phi) * radius;
-                       this.z = sinPhiRadius * Math.cos(theta);
-                       return this;
-               }
-
-               setFromCylindrical(c) {
-                       return this.setFromCylindricalCoords(c.radius, c.theta, c.y);
-               }
-
-               setFromCylindricalCoords(radius, theta, y) {
-                       this.x = radius * Math.sin(theta);
-                       this.y = y;
-                       this.z = radius * Math.cos(theta);
-                       return this;
-               }
-
-               setFromMatrixPosition(m) {
-                       const e = m.elements;
-                       this.x = e[12];
-                       this.y = e[13];
-                       this.z = e[14];
-                       return this;
-               }
-
-               setFromMatrixScale(m) {
-                       const sx = this.setFromMatrixColumn(m, 0).length();
-                       const sy = this.setFromMatrixColumn(m, 1).length();
-                       const sz = this.setFromMatrixColumn(m, 2).length();
-                       this.x = sx;
-                       this.y = sy;
-                       this.z = sz;
-                       return this;
-               }
-
-               setFromMatrixColumn(m, index) {
-                       return this.fromArray(m.elements, index * 4);
-               }
-
-               setFromMatrix3Column(m, index) {
-                       return this.fromArray(m.elements, index * 3);
-               }
-
-               equals(v) {
-                       return v.x === this.x && v.y === this.y && v.z === this.z;
-               }
-
-               fromArray(array, offset = 0) {
-                       this.x = array[offset];
-                       this.y = array[offset + 1];
-                       this.z = array[offset + 2];
-                       return this;
-               }
-
-               toArray(array = [], offset = 0) {
-                       array[offset] = this.x;
-                       array[offset + 1] = this.y;
-                       array[offset + 2] = this.z;
-                       return array;
-               }
-
-               fromBufferAttribute(attribute, index, offset) {
-                       if (offset !== undefined) {
-                               console.warn('THREE.Vector3: offset has been removed from .fromBufferAttribute().');
-                       }
-
-                       this.x = attribute.getX(index);
-                       this.y = attribute.getY(index);
-                       this.z = attribute.getZ(index);
-                       return this;
-               }
-
-               random() {
-                       this.x = Math.random();
-                       this.y = Math.random();
-                       this.z = Math.random();
-                       return this;
-               }
-
-       }
-
-       Vector3.prototype.isVector3 = true;
-
-       const _vector$c = /*@__PURE__*/new Vector3();
-
-       const _quaternion$4 = /*@__PURE__*/new Quaternion();
-
-       class Box3 {
-               constructor(min = new Vector3(+Infinity, +Infinity, +Infinity), max = new Vector3(-Infinity, -Infinity, -Infinity)) {
-                       this.min = min;
-                       this.max = max;
-               }
-
-               set(min, max) {
-                       this.min.copy(min);
-                       this.max.copy(max);
-                       return this;
-               }
-
-               setFromArray(array) {
-                       let minX = +Infinity;
-                       let minY = +Infinity;
-                       let minZ = +Infinity;
-                       let maxX = -Infinity;
-                       let maxY = -Infinity;
-                       let maxZ = -Infinity;
-
-                       for (let i = 0, l = array.length; i < l; i += 3) {
-                               const x = array[i];
-                               const y = array[i + 1];
-                               const z = array[i + 2];
-                               if (x < minX) minX = x;
-                               if (y < minY) minY = y;
-                               if (z < minZ) minZ = z;
-                               if (x > maxX) maxX = x;
-                               if (y > maxY) maxY = y;
-                               if (z > maxZ) maxZ = z;
-                       }
-
-                       this.min.set(minX, minY, minZ);
-                       this.max.set(maxX, maxY, maxZ);
-                       return this;
-               }
-
-               setFromBufferAttribute(attribute) {
-                       let minX = +Infinity;
-                       let minY = +Infinity;
-                       let minZ = +Infinity;
-                       let maxX = -Infinity;
-                       let maxY = -Infinity;
-                       let maxZ = -Infinity;
-
-                       for (let i = 0, l = attribute.count; i < l; i++) {
-                               const x = attribute.getX(i);
-                               const y = attribute.getY(i);
-                               const z = attribute.getZ(i);
-                               if (x < minX) minX = x;
-                               if (y < minY) minY = y;
-                               if (z < minZ) minZ = z;
-                               if (x > maxX) maxX = x;
-                               if (y > maxY) maxY = y;
-                               if (z > maxZ) maxZ = z;
-                       }
-
-                       this.min.set(minX, minY, minZ);
-                       this.max.set(maxX, maxY, maxZ);
-                       return this;
-               }
-
-               setFromPoints(points) {
-                       this.makeEmpty();
-
-                       for (let i = 0, il = points.length; i < il; i++) {
-                               this.expandByPoint(points[i]);
-                       }
-
-                       return this;
-               }
-
-               setFromCenterAndSize(center, size) {
-                       const halfSize = _vector$b.copy(size).multiplyScalar(0.5);
-
-                       this.min.copy(center).sub(halfSize);
-                       this.max.copy(center).add(halfSize);
-                       return this;
-               }
-
-               setFromObject(object) {
-                       this.makeEmpty();
-                       return this.expandByObject(object);
-               }
-
-               clone() {
-                       return new this.constructor().copy(this);
-               }
-
-               copy(box) {
-                       this.min.copy(box.min);
-                       this.max.copy(box.max);
-                       return this;
-               }
-
-               makeEmpty() {
-                       this.min.x = this.min.y = this.min.z = +Infinity;
-                       this.max.x = this.max.y = this.max.z = -Infinity;
-                       return this;
-               }
-
-               isEmpty() {
-                       // this is a more robust check for empty than ( volume <= 0 ) because volume can get positive with two negative axes
-                       return this.max.x < this.min.x || this.max.y < this.min.y || this.max.z < this.min.z;
-               }
-
-               getCenter(target) {
-                       return this.isEmpty() ? target.set(0, 0, 0) : target.addVectors(this.min, this.max).multiplyScalar(0.5);
-               }
-
-               getSize(target) {
-                       return this.isEmpty() ? target.set(0, 0, 0) : target.subVectors(this.max, this.min);
-               }
-
-               expandByPoint(point) {
-                       this.min.min(point);
-                       this.max.max(point);
-                       return this;
-               }
-
-               expandByVector(vector) {
-                       this.min.sub(vector);
-                       this.max.add(vector);
-                       return this;
-               }
-
-               expandByScalar(scalar) {
-                       this.min.addScalar(-scalar);
-                       this.max.addScalar(scalar);
-                       return this;
-               }
-
-               expandByObject(object) {
-                       // Computes the world-axis-aligned bounding box of an object (including its children),
-                       // accounting for both the object's, and children's, world transforms
-                       object.updateWorldMatrix(false, false);
-                       const geometry = object.geometry;
-
-                       if (geometry !== undefined) {
-                               if (geometry.boundingBox === null) {
-                                       geometry.computeBoundingBox();
-                               }
-
-                               _box$3.copy(geometry.boundingBox);
-
-                               _box$3.applyMatrix4(object.matrixWorld);
-
-                               this.union(_box$3);
-                       }
-
-                       const children = object.children;
-
-                       for (let i = 0, l = children.length; i < l; i++) {
-                               this.expandByObject(children[i]);
-                       }
-
-                       return this;
-               }
-
-               containsPoint(point) {
-                       return point.x < this.min.x || point.x > this.max.x || point.y < this.min.y || point.y > this.max.y || point.z < this.min.z || point.z > this.max.z ? false : true;
-               }
-
-               containsBox(box) {
-                       return this.min.x <= box.min.x && box.max.x <= this.max.x && this.min.y <= box.min.y && box.max.y <= this.max.y && this.min.z <= box.min.z && box.max.z <= this.max.z;
-               }
-
-               getParameter(point, target) {
-                       // This can potentially have a divide by zero if the box
-                       // has a size dimension of 0.
-                       return target.set((point.x - this.min.x) / (this.max.x - this.min.x), (point.y - this.min.y) / (this.max.y - this.min.y), (point.z - this.min.z) / (this.max.z - this.min.z));
-               }
-
-               intersectsBox(box) {
-                       // using 6 splitting planes to rule out intersections.
-                       return box.max.x < this.min.x || box.min.x > this.max.x || box.max.y < this.min.y || box.min.y > this.max.y || box.max.z < this.min.z || box.min.z > this.max.z ? false : true;
-               }
-
-               intersectsSphere(sphere) {
-                       // Find the point on the AABB closest to the sphere center.
-                       this.clampPoint(sphere.center, _vector$b); // If that point is inside the sphere, the AABB and sphere intersect.
-
-                       return _vector$b.distanceToSquared(sphere.center) <= sphere.radius * sphere.radius;
-               }
-
-               intersectsPlane(plane) {
-                       // We compute the minimum and maximum dot product values. If those values
-                       // are on the same side (back or front) of the plane, then there is no intersection.
-                       let min, max;
-
-                       if (plane.normal.x > 0) {
-                               min = plane.normal.x * this.min.x;
-                               max = plane.normal.x * this.max.x;
-                       } else {
-                               min = plane.normal.x * this.max.x;
-                               max = plane.normal.x * this.min.x;
-                       }
-
-                       if (plane.normal.y > 0) {
-                               min += plane.normal.y * this.min.y;
-                               max += plane.normal.y * this.max.y;
-                       } else {
-                               min += plane.normal.y * this.max.y;
-                               max += plane.normal.y * this.min.y;
-                       }
-
-                       if (plane.normal.z > 0) {
-                               min += plane.normal.z * this.min.z;
-                               max += plane.normal.z * this.max.z;
-                       } else {
-                               min += plane.normal.z * this.max.z;
-                               max += plane.normal.z * this.min.z;
-                       }
-
-                       return min <= -plane.constant && max >= -plane.constant;
-               }
-
-               intersectsTriangle(triangle) {
-                       if (this.isEmpty()) {
-                               return false;
-                       } // compute box center and extents
-
-
-                       this.getCenter(_center);
-
-                       _extents.subVectors(this.max, _center); // translate triangle to aabb origin
-
-
-                       _v0$2.subVectors(triangle.a, _center);
-
-                       _v1$7.subVectors(triangle.b, _center);
-
-                       _v2$3.subVectors(triangle.c, _center); // compute edge vectors for triangle
-
-
-                       _f0.subVectors(_v1$7, _v0$2);
-
-                       _f1.subVectors(_v2$3, _v1$7);
-
-                       _f2.subVectors(_v0$2, _v2$3); // test against axes that are given by cross product combinations of the edges of the triangle and the edges of the aabb
-                       // make an axis testing of each of the 3 sides of the aabb against each of the 3 sides of the triangle = 9 axis of separation
-                       // axis_ij = u_i x f_j (u0, u1, u2 = face normals of aabb = x,y,z axes vectors since aabb is axis aligned)
-
-
-                       let axes = [0, -_f0.z, _f0.y, 0, -_f1.z, _f1.y, 0, -_f2.z, _f2.y, _f0.z, 0, -_f0.x, _f1.z, 0, -_f1.x, _f2.z, 0, -_f2.x, -_f0.y, _f0.x, 0, -_f1.y, _f1.x, 0, -_f2.y, _f2.x, 0];
-
-                       if (!satForAxes(axes, _v0$2, _v1$7, _v2$3, _extents)) {
-                               return false;
-                       } // test 3 face normals from the aabb
-
-
-                       axes = [1, 0, 0, 0, 1, 0, 0, 0, 1];
-
-                       if (!satForAxes(axes, _v0$2, _v1$7, _v2$3, _extents)) {
-                               return false;
-                       } // finally testing the face normal of the triangle
-                       // use already existing triangle edge vectors here
-
-
-                       _triangleNormal.crossVectors(_f0, _f1);
-
-                       axes = [_triangleNormal.x, _triangleNormal.y, _triangleNormal.z];
-                       return satForAxes(axes, _v0$2, _v1$7, _v2$3, _extents);
-               }
-
-               clampPoint(point, target) {
-                       return target.copy(point).clamp(this.min, this.max);
-               }
-
-               distanceToPoint(point) {
-                       const clampedPoint = _vector$b.copy(point).clamp(this.min, this.max);
-
-                       return clampedPoint.sub(point).length();
-               }
-
-               getBoundingSphere(target) {
-                       this.getCenter(target.center);
-                       target.radius = this.getSize(_vector$b).length() * 0.5;
-                       return target;
-               }
-
-               intersect(box) {
-                       this.min.max(box.min);
-                       this.max.min(box.max); // ensure that if there is no overlap, the result is fully empty, not slightly empty with non-inf/+inf values that will cause subsequence intersects to erroneously return valid values.
-
-                       if (this.isEmpty()) this.makeEmpty();
-                       return this;
-               }
-
-               union(box) {
-                       this.min.min(box.min);
-                       this.max.max(box.max);
-                       return this;
-               }
-
-               applyMatrix4(matrix) {
-                       // transform of empty box is an empty box.
-                       if (this.isEmpty()) return this; // NOTE: I am using a binary pattern to specify all 2^3 combinations below
-
-                       _points[0].set(this.min.x, this.min.y, this.min.z).applyMatrix4(matrix); // 000
-
-
-                       _points[1].set(this.min.x, this.min.y, this.max.z).applyMatrix4(matrix); // 001
-
-
-                       _points[2].set(this.min.x, this.max.y, this.min.z).applyMatrix4(matrix); // 010
-
-
-                       _points[3].set(this.min.x, this.max.y, this.max.z).applyMatrix4(matrix); // 011
-
-
-                       _points[4].set(this.max.x, this.min.y, this.min.z).applyMatrix4(matrix); // 100
-
-
-                       _points[5].set(this.max.x, this.min.y, this.max.z).applyMatrix4(matrix); // 101
-
-
-                       _points[6].set(this.max.x, this.max.y, this.min.z).applyMatrix4(matrix); // 110
-
-
-                       _points[7].set(this.max.x, this.max.y, this.max.z).applyMatrix4(matrix); // 111
-
-
-                       this.setFromPoints(_points);
-                       return this;
-               }
-
-               translate(offset) {
-                       this.min.add(offset);
-                       this.max.add(offset);
-                       return this;
-               }
-
-               equals(box) {
-                       return box.min.equals(this.min) && box.max.equals(this.max);
-               }
-
-       }
-
-       Box3.prototype.isBox3 = true;
-       const _points = [/*@__PURE__*/new Vector3(), /*@__PURE__*/new Vector3(), /*@__PURE__*/new Vector3(), /*@__PURE__*/new Vector3(), /*@__PURE__*/new Vector3(), /*@__PURE__*/new Vector3(), /*@__PURE__*/new Vector3(), /*@__PURE__*/new Vector3()];
-
-       const _vector$b = /*@__PURE__*/new Vector3();
-
-       const _box$3 = /*@__PURE__*/new Box3(); // triangle centered vertices
-
-
-       const _v0$2 = /*@__PURE__*/new Vector3();
-
-       const _v1$7 = /*@__PURE__*/new Vector3();
-
-       const _v2$3 = /*@__PURE__*/new Vector3(); // triangle edge vectors
-
-
-       const _f0 = /*@__PURE__*/new Vector3();
-
-       const _f1 = /*@__PURE__*/new Vector3();
-
-       const _f2 = /*@__PURE__*/new Vector3();
-
-       const _center = /*@__PURE__*/new Vector3();
-
-       const _extents = /*@__PURE__*/new Vector3();
-
-       const _triangleNormal = /*@__PURE__*/new Vector3();
-
-       const _testAxis = /*@__PURE__*/new Vector3();
-
-       function satForAxes(axes, v0, v1, v2, extents) {
-               for (let i = 0, j = axes.length - 3; i <= j; i += 3) {
-                       _testAxis.fromArray(axes, i); // project the aabb onto the seperating axis
-
-
-                       const r = extents.x * Math.abs(_testAxis.x) + extents.y * Math.abs(_testAxis.y) + extents.z * Math.abs(_testAxis.z); // project all 3 vertices of the triangle onto the seperating axis
-
-                       const p0 = v0.dot(_testAxis);
-                       const p1 = v1.dot(_testAxis);
-                       const p2 = v2.dot(_testAxis); // actual test, basically see if either of the most extreme of the triangle points intersects r
-
-                       if (Math.max(-Math.max(p0, p1, p2), Math.min(p0, p1, p2)) > r) {
-                               // points of the projected triangle are outside the projected half-length of the aabb
-                               // the axis is seperating and we can exit
-                               return false;
-                       }
-               }
-
-               return true;
-       }
-
-       const _box$2 = /*@__PURE__*/new Box3();
-
-       const _v1$6 = /*@__PURE__*/new Vector3();
-
-       const _toFarthestPoint = /*@__PURE__*/new Vector3();
-
-       const _toPoint = /*@__PURE__*/new Vector3();
-
-       class Sphere {
-               constructor(center = new Vector3(), radius = -1) {
-                       this.center = center;
-                       this.radius = radius;
-               }
-
-               set(center, radius) {
-                       this.center.copy(center);
-                       this.radius = radius;
-                       return this;
-               }
-
-               setFromPoints(points, optionalCenter) {
-                       const center = this.center;
-
-                       if (optionalCenter !== undefined) {
-                               center.copy(optionalCenter);
-                       } else {
-                               _box$2.setFromPoints(points).getCenter(center);
-                       }
-
-                       let maxRadiusSq = 0;
-
-                       for (let i = 0, il = points.length; i < il; i++) {
-                               maxRadiusSq = Math.max(maxRadiusSq, center.distanceToSquared(points[i]));
-                       }
-
-                       this.radius = Math.sqrt(maxRadiusSq);
-                       return this;
-               }
-
-               copy(sphere) {
-                       this.center.copy(sphere.center);
-                       this.radius = sphere.radius;
-                       return this;
-               }
-
-               isEmpty() {
-                       return this.radius < 0;
-               }
-
-               makeEmpty() {
-                       this.center.set(0, 0, 0);
-                       this.radius = -1;
-                       return this;
-               }
-
-               containsPoint(point) {
-                       return point.distanceToSquared(this.center) <= this.radius * this.radius;
-               }
-
-               distanceToPoint(point) {
-                       return point.distanceTo(this.center) - this.radius;
-               }
-
-               intersectsSphere(sphere) {
-                       const radiusSum = this.radius + sphere.radius;
-                       return sphere.center.distanceToSquared(this.center) <= radiusSum * radiusSum;
-               }
-
-               intersectsBox(box) {
-                       return box.intersectsSphere(this);
-               }
-
-               intersectsPlane(plane) {
-                       return Math.abs(plane.distanceToPoint(this.center)) <= this.radius;
-               }
-
-               clampPoint(point, target) {
-                       const deltaLengthSq = this.center.distanceToSquared(point);
-                       target.copy(point);
-
-                       if (deltaLengthSq > this.radius * this.radius) {
-                               target.sub(this.center).normalize();
-                               target.multiplyScalar(this.radius).add(this.center);
-                       }
-
-                       return target;
-               }
-
-               getBoundingBox(target) {
-                       if (this.isEmpty()) {
-                               // Empty sphere produces empty bounding box
-                               target.makeEmpty();
-                               return target;
-                       }
-
-                       target.set(this.center, this.center);
-                       target.expandByScalar(this.radius);
-                       return target;
-               }
-
-               applyMatrix4(matrix) {
-                       this.center.applyMatrix4(matrix);
-                       this.radius = this.radius * matrix.getMaxScaleOnAxis();
-                       return this;
-               }
-
-               translate(offset) {
-                       this.center.add(offset);
-                       return this;
-               }
-
-               expandByPoint(point) {
-                       // from https://github.com/juj/MathGeoLib/blob/2940b99b99cfe575dd45103ef20f4019dee15b54/src/Geometry/Sphere.cpp#L649-L671
-                       _toPoint.subVectors(point, this.center);
-
-                       const lengthSq = _toPoint.lengthSq();
-
-                       if (lengthSq > this.radius * this.radius) {
-                               const length = Math.sqrt(lengthSq);
-                               const missingRadiusHalf = (length - this.radius) * 0.5; // Nudge this sphere towards the target point. Add half the missing distance to radius,
-                               // and the other half to position. This gives a tighter enclosure, instead of if
-                               // the whole missing distance were just added to radius.
-
-                               this.center.add(_toPoint.multiplyScalar(missingRadiusHalf / length));
-                               this.radius += missingRadiusHalf;
-                       }
-
-                       return this;
-               }
-
-               union(sphere) {
-                       // from https://github.com/juj/MathGeoLib/blob/2940b99b99cfe575dd45103ef20f4019dee15b54/src/Geometry/Sphere.cpp#L759-L769
-                       // To enclose another sphere into this sphere, we only need to enclose two points:
-                       // 1) Enclose the farthest point on the other sphere into this sphere.
-                       // 2) Enclose the opposite point of the farthest point into this sphere.
-                       _toFarthestPoint.subVectors(sphere.center, this.center).normalize().multiplyScalar(sphere.radius);
-
-                       this.expandByPoint(_v1$6.copy(sphere.center).add(_toFarthestPoint));
-                       this.expandByPoint(_v1$6.copy(sphere.center).sub(_toFarthestPoint));
-                       return this;
-               }
-
-               equals(sphere) {
-                       return sphere.center.equals(this.center) && sphere.radius === this.radius;
-               }
-
-               clone() {
-                       return new this.constructor().copy(this);
-               }
-
-       }
-
-       const _vector$a = /*@__PURE__*/new Vector3();
-
-       const _segCenter = /*@__PURE__*/new Vector3();
-
-       const _segDir = /*@__PURE__*/new Vector3();
-
-       const _diff = /*@__PURE__*/new Vector3();
-
-       const _edge1 = /*@__PURE__*/new Vector3();
-
-       const _edge2 = /*@__PURE__*/new Vector3();
-
-       const _normal$1 = /*@__PURE__*/new Vector3();
-
-       class Ray {
-               constructor(origin = new Vector3(), direction = new Vector3(0, 0, -1)) {
-                       this.origin = origin;
-                       this.direction = direction;
-               }
-
-               set(origin, direction) {
-                       this.origin.copy(origin);
-                       this.direction.copy(direction);
-                       return this;
-               }
-
-               copy(ray) {
-                       this.origin.copy(ray.origin);
-                       this.direction.copy(ray.direction);
-                       return this;
-               }
-
-               at(t, target) {
-                       return target.copy(this.direction).multiplyScalar(t).add(this.origin);
-               }
-
-               lookAt(v) {
-                       this.direction.copy(v).sub(this.origin).normalize();
-                       return this;
-               }
-
-               recast(t) {
-                       this.origin.copy(this.at(t, _vector$a));
-                       return this;
-               }
-
-               closestPointToPoint(point, target) {
-                       target.subVectors(point, this.origin);
-                       const directionDistance = target.dot(this.direction);
-
-                       if (directionDistance < 0) {
-                               return target.copy(this.origin);
-                       }
-
-                       return target.copy(this.direction).multiplyScalar(directionDistance).add(this.origin);
-               }
-
-               distanceToPoint(point) {
-                       return Math.sqrt(this.distanceSqToPoint(point));
-               }
-
-               distanceSqToPoint(point) {
-                       const directionDistance = _vector$a.subVectors(point, this.origin).dot(this.direction); // point behind the ray
-
-
-                       if (directionDistance < 0) {
-                               return this.origin.distanceToSquared(point);
-                       }
-
-                       _vector$a.copy(this.direction).multiplyScalar(directionDistance).add(this.origin);
-
-                       return _vector$a.distanceToSquared(point);
-               }
-
-               distanceSqToSegment(v0, v1, optionalPointOnRay, optionalPointOnSegment) {
-                       // from http://www.geometrictools.com/GTEngine/Include/Mathematics/GteDistRaySegment.h
-                       // It returns the min distance between the ray and the segment
-                       // defined by v0 and v1
-                       // It can also set two optional targets :
-                       // - The closest point on the ray
-                       // - The closest point on the segment
-                       _segCenter.copy(v0).add(v1).multiplyScalar(0.5);
-
-                       _segDir.copy(v1).sub(v0).normalize();
-
-                       _diff.copy(this.origin).sub(_segCenter);
-
-                       const segExtent = v0.distanceTo(v1) * 0.5;
-                       const a01 = -this.direction.dot(_segDir);
-
-                       const b0 = _diff.dot(this.direction);
-
-                       const b1 = -_diff.dot(_segDir);
-
-                       const c = _diff.lengthSq();
-
-                       const det = Math.abs(1 - a01 * a01);
-                       let s0, s1, sqrDist, extDet;
-
-                       if (det > 0) {
-                               // The ray and segment are not parallel.
-                               s0 = a01 * b1 - b0;
-                               s1 = a01 * b0 - b1;
-                               extDet = segExtent * det;
-
-                               if (s0 >= 0) {
-                                       if (s1 >= -extDet) {
-                                               if (s1 <= extDet) {
-                                                       // region 0
-                                                       // Minimum at interior points of ray and segment.
-                                                       const invDet = 1 / det;
-                                                       s0 *= invDet;
-                                                       s1 *= invDet;
-                                                       sqrDist = s0 * (s0 + a01 * s1 + 2 * b0) + s1 * (a01 * s0 + s1 + 2 * b1) + c;
-                                               } else {
-                                                       // region 1
-                                                       s1 = segExtent;
-                                                       s0 = Math.max(0, -(a01 * s1 + b0));
-                                                       sqrDist = -s0 * s0 + s1 * (s1 + 2 * b1) + c;
-                                               }
-                                       } else {
-                                               // region 5
-                                               s1 = -segExtent;
-                                               s0 = Math.max(0, -(a01 * s1 + b0));
-                                               sqrDist = -s0 * s0 + s1 * (s1 + 2 * b1) + c;
-                                       }
-                               } else {
-                                       if (s1 <= -extDet) {
-                                               // region 4
-                                               s0 = Math.max(0, -(-a01 * segExtent + b0));
-                                               s1 = s0 > 0 ? -segExtent : Math.min(Math.max(-segExtent, -b1), segExtent);
-                                               sqrDist = -s0 * s0 + s1 * (s1 + 2 * b1) + c;
-                                       } else if (s1 <= extDet) {
-                                               // region 3
-                                               s0 = 0;
-                                               s1 = Math.min(Math.max(-segExtent, -b1), segExtent);
-                                               sqrDist = s1 * (s1 + 2 * b1) + c;
-                                       } else {
-                                               // region 2
-                                               s0 = Math.max(0, -(a01 * segExtent + b0));
-                                               s1 = s0 > 0 ? segExtent : Math.min(Math.max(-segExtent, -b1), segExtent);
-                                               sqrDist = -s0 * s0 + s1 * (s1 + 2 * b1) + c;
-                                       }
-                               }
-                       } else {
-                               // Ray and segment are parallel.
-                               s1 = a01 > 0 ? -segExtent : segExtent;
-                               s0 = Math.max(0, -(a01 * s1 + b0));
-                               sqrDist = -s0 * s0 + s1 * (s1 + 2 * b1) + c;
-                       }
-
-                       if (optionalPointOnRay) {
-                               optionalPointOnRay.copy(this.direction).multiplyScalar(s0).add(this.origin);
-                       }
-
-                       if (optionalPointOnSegment) {
-                               optionalPointOnSegment.copy(_segDir).multiplyScalar(s1).add(_segCenter);
-                       }
-
-                       return sqrDist;
-               }
-
-               intersectSphere(sphere, target) {
-                       _vector$a.subVectors(sphere.center, this.origin);
-
-                       const tca = _vector$a.dot(this.direction);
-
-                       const d2 = _vector$a.dot(_vector$a) - tca * tca;
-                       const radius2 = sphere.radius * sphere.radius;
-                       if (d2 > radius2) return null;
-                       const thc = Math.sqrt(radius2 - d2); // t0 = first intersect point - entrance on front of sphere
-
-                       const t0 = tca - thc; // t1 = second intersect point - exit point on back of sphere
-
-                       const t1 = tca + thc; // test to see if both t0 and t1 are behind the ray - if so, return null
-
-                       if (t0 < 0 && t1 < 0) return null; // test to see if t0 is behind the ray:
-                       // if it is, the ray is inside the sphere, so return the second exit point scaled by t1,
-                       // in order to always return an intersect point that is in front of the ray.
-
-                       if (t0 < 0) return this.at(t1, target); // else t0 is in front of the ray, so return the first collision point scaled by t0
-
-                       return this.at(t0, target);
-               }
-
-               intersectsSphere(sphere) {
-                       return this.distanceSqToPoint(sphere.center) <= sphere.radius * sphere.radius;
-               }
-
-               distanceToPlane(plane) {
-                       const denominator = plane.normal.dot(this.direction);
-
-                       if (denominator === 0) {
-                               // line is coplanar, return origin
-                               if (plane.distanceToPoint(this.origin) === 0) {
-                                       return 0;
-                               } // Null is preferable to undefined since undefined means.... it is undefined
-
-
-                               return null;
-                       }
-
-                       const t = -(this.origin.dot(plane.normal) + plane.constant) / denominator; // Return if the ray never intersects the plane
-
-                       return t >= 0 ? t : null;
-               }
-
-               intersectPlane(plane, target) {
-                       const t = this.distanceToPlane(plane);
-
-                       if (t === null) {
-                               return null;
-                       }
-
-                       return this.at(t, target);
-               }
-
-               intersectsPlane(plane) {
-                       // check if the ray lies on the plane first
-                       const distToPoint = plane.distanceToPoint(this.origin);
-
-                       if (distToPoint === 0) {
-                               return true;
-                       }
-
-                       const denominator = plane.normal.dot(this.direction);
-
-                       if (denominator * distToPoint < 0) {
-                               return true;
-                       } // ray origin is behind the plane (and is pointing behind it)
-
-
-                       return false;
-               }
-
-               intersectBox(box, target) {
-                       let tmin, tmax, tymin, tymax, tzmin, tzmax;
-                       const invdirx = 1 / this.direction.x,
-                                               invdiry = 1 / this.direction.y,
-                                               invdirz = 1 / this.direction.z;
-                       const origin = this.origin;
-
-                       if (invdirx >= 0) {
-                               tmin = (box.min.x - origin.x) * invdirx;
-                               tmax = (box.max.x - origin.x) * invdirx;
-                       } else {
-                               tmin = (box.max.x - origin.x) * invdirx;
-                               tmax = (box.min.x - origin.x) * invdirx;
-                       }
-
-                       if (invdiry >= 0) {
-                               tymin = (box.min.y - origin.y) * invdiry;
-                               tymax = (box.max.y - origin.y) * invdiry;
-                       } else {
-                               tymin = (box.max.y - origin.y) * invdiry;
-                               tymax = (box.min.y - origin.y) * invdiry;
-                       }
-
-                       if (tmin > tymax || tymin > tmax) return null; // These lines also handle the case where tmin or tmax is NaN
-                       // (result of 0 * Infinity). x !== x returns true if x is NaN
-
-                       if (tymin > tmin || tmin !== tmin) tmin = tymin;
-                       if (tymax < tmax || tmax !== tmax) tmax = tymax;
-
-                       if (invdirz >= 0) {
-                               tzmin = (box.min.z - origin.z) * invdirz;
-                               tzmax = (box.max.z - origin.z) * invdirz;
-                       } else {
-                               tzmin = (box.max.z - origin.z) * invdirz;
-                               tzmax = (box.min.z - origin.z) * invdirz;
-                       }
-
-                       if (tmin > tzmax || tzmin > tmax) return null;
-                       if (tzmin > tmin || tmin !== tmin) tmin = tzmin;
-                       if (tzmax < tmax || tmax !== tmax) tmax = tzmax; //return point closest to the ray (positive side)
-
-                       if (tmax < 0) return null;
-                       return this.at(tmin >= 0 ? tmin : tmax, target);
-               }
-
-               intersectsBox(box) {
-                       return this.intersectBox(box, _vector$a) !== null;
-               }
-
-               intersectTriangle(a, b, c, backfaceCulling, target) {
-                       // Compute the offset origin, edges, and normal.
-                       // from http://www.geometrictools.com/GTEngine/Include/Mathematics/GteIntrRay3Triangle3.h
-                       _edge1.subVectors(b, a);
-
-                       _edge2.subVectors(c, a);
-
-                       _normal$1.crossVectors(_edge1, _edge2); // Solve Q + t*D = b1*E1 + b2*E2 (Q = kDiff, D = ray direction,
-                       // E1 = kEdge1, E2 = kEdge2, N = Cross(E1,E2)) by
-                       //       |Dot(D,N)|*b1 = sign(Dot(D,N))*Dot(D,Cross(Q,E2))
-                       //       |Dot(D,N)|*b2 = sign(Dot(D,N))*Dot(D,Cross(E1,Q))
-                       //       |Dot(D,N)|*t = -sign(Dot(D,N))*Dot(Q,N)
-
-
-                       let DdN = this.direction.dot(_normal$1);
-                       let sign;
-
-                       if (DdN > 0) {
-                               if (backfaceCulling) return null;
-                               sign = 1;
-                       } else if (DdN < 0) {
-                               sign = -1;
-                               DdN = -DdN;
-                       } else {
-                               return null;
-                       }
-
-                       _diff.subVectors(this.origin, a);
-
-                       const DdQxE2 = sign * this.direction.dot(_edge2.crossVectors(_diff, _edge2)); // b1 < 0, no intersection
-
-                       if (DdQxE2 < 0) {
-                               return null;
-                       }
-
-                       const DdE1xQ = sign * this.direction.dot(_edge1.cross(_diff)); // b2 < 0, no intersection
-
-                       if (DdE1xQ < 0) {
-                               return null;
-                       } // b1+b2 > 1, no intersection
-
-
-                       if (DdQxE2 + DdE1xQ > DdN) {
-                               return null;
-                       } // Line intersects triangle, check if ray does.
-
-
-                       const QdN = -sign * _diff.dot(_normal$1); // t < 0, no intersection
-
-
-                       if (QdN < 0) {
-                               return null;
-                       } // Ray intersects triangle.
-
-
-                       return this.at(QdN / DdN, target);
-               }
-
-               applyMatrix4(matrix4) {
-                       this.origin.applyMatrix4(matrix4);
-                       this.direction.transformDirection(matrix4);
-                       return this;
-               }
-
-               equals(ray) {
-                       return ray.origin.equals(this.origin) && ray.direction.equals(this.direction);
-               }
-
-               clone() {
-                       return new this.constructor().copy(this);
-               }
-
-       }
-
-       class Matrix4 {
-               constructor() {
-                       this.elements = [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1];
-
-                       if (arguments.length > 0) {
-                               console.error('THREE.Matrix4: the constructor no longer reads arguments. use .set() instead.');
-                       }
-               }
-
-               set(n11, n12, n13, n14, n21, n22, n23, n24, n31, n32, n33, n34, n41, n42, n43, n44) {
-                       const te = this.elements;
-                       te[0] = n11;
-                       te[4] = n12;
-                       te[8] = n13;
-                       te[12] = n14;
-                       te[1] = n21;
-                       te[5] = n22;
-                       te[9] = n23;
-                       te[13] = n24;
-                       te[2] = n31;
-                       te[6] = n32;
-                       te[10] = n33;
-                       te[14] = n34;
-                       te[3] = n41;
-                       te[7] = n42;
-                       te[11] = n43;
-                       te[15] = n44;
-                       return this;
-               }
-
-               identity() {
-                       this.set(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);
-                       return this;
-               }
-
-               clone() {
-                       return new Matrix4().fromArray(this.elements);
-               }
-
-               copy(m) {
-                       const te = this.elements;
-                       const me = m.elements;
-                       te[0] = me[0];
-                       te[1] = me[1];
-                       te[2] = me[2];
-                       te[3] = me[3];
-                       te[4] = me[4];
-                       te[5] = me[5];
-                       te[6] = me[6];
-                       te[7] = me[7];
-                       te[8] = me[8];
-                       te[9] = me[9];
-                       te[10] = me[10];
-                       te[11] = me[11];
-                       te[12] = me[12];
-                       te[13] = me[13];
-                       te[14] = me[14];
-                       te[15] = me[15];
-                       return this;
-               }
-
-               copyPosition(m) {
-                       const te = this.elements,
-                                               me = m.elements;
-                       te[12] = me[12];
-                       te[13] = me[13];
-                       te[14] = me[14];
-                       return this;
-               }
-
-               setFromMatrix3(m) {
-                       const me = m.elements;
-                       this.set(me[0], me[3], me[6], 0, me[1], me[4], me[7], 0, me[2], me[5], me[8], 0, 0, 0, 0, 1);
-                       return this;
-               }
-
-               extractBasis(xAxis, yAxis, zAxis) {
-                       xAxis.setFromMatrixColumn(this, 0);
-                       yAxis.setFromMatrixColumn(this, 1);
-                       zAxis.setFromMatrixColumn(this, 2);
-                       return this;
-               }
-
-               makeBasis(xAxis, yAxis, zAxis) {
-                       this.set(xAxis.x, yAxis.x, zAxis.x, 0, xAxis.y, yAxis.y, zAxis.y, 0, xAxis.z, yAxis.z, zAxis.z, 0, 0, 0, 0, 1);
-                       return this;
-               }
-
-               extractRotation(m) {
-                       // this method does not support reflection matrices
-                       const te = this.elements;
-                       const me = m.elements;
-
-                       const scaleX = 1 / _v1$5.setFromMatrixColumn(m, 0).length();
-
-                       const scaleY = 1 / _v1$5.setFromMatrixColumn(m, 1).length();
-
-                       const scaleZ = 1 / _v1$5.setFromMatrixColumn(m, 2).length();
-
-                       te[0] = me[0] * scaleX;
-                       te[1] = me[1] * scaleX;
-                       te[2] = me[2] * scaleX;
-                       te[3] = 0;
-                       te[4] = me[4] * scaleY;
-                       te[5] = me[5] * scaleY;
-                       te[6] = me[6] * scaleY;
-                       te[7] = 0;
-                       te[8] = me[8] * scaleZ;
-                       te[9] = me[9] * scaleZ;
-                       te[10] = me[10] * scaleZ;
-                       te[11] = 0;
-                       te[12] = 0;
-                       te[13] = 0;
-                       te[14] = 0;
-                       te[15] = 1;
-                       return this;
-               }
-
-               makeRotationFromEuler(euler) {
-                       if (!(euler && euler.isEuler)) {
-                               console.error('THREE.Matrix4: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.');
-                       }
-
-                       const te = this.elements;
-                       const x = euler.x,
-                                               y = euler.y,
-                                               z = euler.z;
-                       const a = Math.cos(x),
-                                               b = Math.sin(x);
-                       const c = Math.cos(y),
-                                               d = Math.sin(y);
-                       const e = Math.cos(z),
-                                               f = Math.sin(z);
-
-                       if (euler.order === 'XYZ') {
-                               const ae = a * e,
-                                                       af = a * f,
-                                                       be = b * e,
-                                                       bf = b * f;
-                               te[0] = c * e;
-                               te[4] = -c * f;
-                               te[8] = d;
-                               te[1] = af + be * d;
-                               te[5] = ae - bf * d;
-                               te[9] = -b * c;
-                               te[2] = bf - ae * d;
-                               te[6] = be + af * d;
-                               te[10] = a * c;
-                       } else if (euler.order === 'YXZ') {
-                               const ce = c * e,
-                                                       cf = c * f,
-                                                       de = d * e,
-                                                       df = d * f;
-                               te[0] = ce + df * b;
-                               te[4] = de * b - cf;
-                               te[8] = a * d;
-                               te[1] = a * f;
-                               te[5] = a * e;
-                               te[9] = -b;
-                               te[2] = cf * b - de;
-                               te[6] = df + ce * b;
-                               te[10] = a * c;
-                       } else if (euler.order === 'ZXY') {
-                               const ce = c * e,
-                                                       cf = c * f,
-                                                       de = d * e,
-                                                       df = d * f;
-                               te[0] = ce - df * b;
-                               te[4] = -a * f;
-                               te[8] = de + cf * b;
-                               te[1] = cf + de * b;
-                               te[5] = a * e;
-                               te[9] = df - ce * b;
-                               te[2] = -a * d;
-                               te[6] = b;
-                               te[10] = a * c;
-                       } else if (euler.order === 'ZYX') {
-                               const ae = a * e,
-                                                       af = a * f,
-                                                       be = b * e,
-                                                       bf = b * f;
-                               te[0] = c * e;
-                               te[4] = be * d - af;
-                               te[8] = ae * d + bf;
-                               te[1] = c * f;
-                               te[5] = bf * d + ae;
-                               te[9] = af * d - be;
-                               te[2] = -d;
-                               te[6] = b * c;
-                               te[10] = a * c;
-                       } else if (euler.order === 'YZX') {
-                               const ac = a * c,
-                                                       ad = a * d,
-                                                       bc = b * c,
-                                                       bd = b * d;
-                               te[0] = c * e;
-                               te[4] = bd - ac * f;
-                               te[8] = bc * f + ad;
-                               te[1] = f;
-                               te[5] = a * e;
-                               te[9] = -b * e;
-                               te[2] = -d * e;
-                               te[6] = ad * f + bc;
-                               te[10] = ac - bd * f;
-                       } else if (euler.order === 'XZY') {
-                               const ac = a * c,
-                                                       ad = a * d,
-                                                       bc = b * c,
-                                                       bd = b * d;
-                               te[0] = c * e;
-                               te[4] = -f;
-                               te[8] = d * e;
-                               te[1] = ac * f + bd;
-                               te[5] = a * e;
-                               te[9] = ad * f - bc;
-                               te[2] = bc * f - ad;
-                               te[6] = b * e;
-                               te[10] = bd * f + ac;
-                       } // bottom row
-
-
-                       te[3] = 0;
-                       te[7] = 0;
-                       te[11] = 0; // last column
-
-                       te[12] = 0;
-                       te[13] = 0;
-                       te[14] = 0;
-                       te[15] = 1;
-                       return this;
-               }
-
-               makeRotationFromQuaternion(q) {
-                       return this.compose(_zero, q, _one);
-               }
-
-               lookAt(eye, target, up) {
-                       const te = this.elements;
-
-                       _z.subVectors(eye, target);
-
-                       if (_z.lengthSq() === 0) {
-                               // eye and target are in the same position
-                               _z.z = 1;
-                       }
-
-                       _z.normalize();
-
-                       _x.crossVectors(up, _z);
-
-                       if (_x.lengthSq() === 0) {
-                               // up and z are parallel
-                               if (Math.abs(up.z) === 1) {
-                                       _z.x += 0.0001;
-                               } else {
-                                       _z.z += 0.0001;
-                               }
-
-                               _z.normalize();
-
-                               _x.crossVectors(up, _z);
-                       }
-
-                       _x.normalize();
-
-                       _y.crossVectors(_z, _x);
-
-                       te[0] = _x.x;
-                       te[4] = _y.x;
-                       te[8] = _z.x;
-                       te[1] = _x.y;
-                       te[5] = _y.y;
-                       te[9] = _z.y;
-                       te[2] = _x.z;
-                       te[6] = _y.z;
-                       te[10] = _z.z;
-                       return this;
-               }
-
-               multiply(m, n) {
-                       if (n !== undefined) {
-                               console.warn('THREE.Matrix4: .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead.');
-                               return this.multiplyMatrices(m, n);
-                       }
-
-                       return this.multiplyMatrices(this, m);
-               }
-
-               premultiply(m) {
-                       return this.multiplyMatrices(m, this);
-               }
-
-               multiplyMatrices(a, b) {
-                       const ae = a.elements;
-                       const be = b.elements;
-                       const te = this.elements;
-                       const a11 = ae[0],
-                                               a12 = ae[4],
-                                               a13 = ae[8],
-                                               a14 = ae[12];
-                       const a21 = ae[1],
-                                               a22 = ae[5],
-                                               a23 = ae[9],
-                                               a24 = ae[13];
-                       const a31 = ae[2],
-                                               a32 = ae[6],
-                                               a33 = ae[10],
-                                               a34 = ae[14];
-                       const a41 = ae[3],
-                                               a42 = ae[7],
-                                               a43 = ae[11],
-                                               a44 = ae[15];
-                       const b11 = be[0],
-                                               b12 = be[4],
-                                               b13 = be[8],
-                                               b14 = be[12];
-                       const b21 = be[1],
-                                               b22 = be[5],
-                                               b23 = be[9],
-                                               b24 = be[13];
-                       const b31 = be[2],
-                                               b32 = be[6],
-                                               b33 = be[10],
-                                               b34 = be[14];
-                       const b41 = be[3],
-                                               b42 = be[7],
-                                               b43 = be[11],
-                                               b44 = be[15];
-                       te[0] = a11 * b11 + a12 * b21 + a13 * b31 + a14 * b41;
-                       te[4] = a11 * b12 + a12 * b22 + a13 * b32 + a14 * b42;
-                       te[8] = a11 * b13 + a12 * b23 + a13 * b33 + a14 * b43;
-                       te[12] = a11 * b14 + a12 * b24 + a13 * b34 + a14 * b44;
-                       te[1] = a21 * b11 + a22 * b21 + a23 * b31 + a24 * b41;
-                       te[5] = a21 * b12 + a22 * b22 + a23 * b32 + a24 * b42;
-                       te[9] = a21 * b13 + a22 * b23 + a23 * b33 + a24 * b43;
-                       te[13] = a21 * b14 + a22 * b24 + a23 * b34 + a24 * b44;
-                       te[2] = a31 * b11 + a32 * b21 + a33 * b31 + a34 * b41;
-                       te[6] = a31 * b12 + a32 * b22 + a33 * b32 + a34 * b42;
-                       te[10] = a31 * b13 + a32 * b23 + a33 * b33 + a34 * b43;
-                       te[14] = a31 * b14 + a32 * b24 + a33 * b34 + a34 * b44;
-                       te[3] = a41 * b11 + a42 * b21 + a43 * b31 + a44 * b41;
-                       te[7] = a41 * b12 + a42 * b22 + a43 * b32 + a44 * b42;
-                       te[11] = a41 * b13 + a42 * b23 + a43 * b33 + a44 * b43;
-                       te[15] = a41 * b14 + a42 * b24 + a43 * b34 + a44 * b44;
-                       return this;
-               }
-
-               multiplyScalar(s) {
-                       const te = this.elements;
-                       te[0] *= s;
-                       te[4] *= s;
-                       te[8] *= s;
-                       te[12] *= s;
-                       te[1] *= s;
-                       te[5] *= s;
-                       te[9] *= s;
-                       te[13] *= s;
-                       te[2] *= s;
-                       te[6] *= s;
-                       te[10] *= s;
-                       te[14] *= s;
-                       te[3] *= s;
-                       te[7] *= s;
-                       te[11] *= s;
-                       te[15] *= s;
-                       return this;
-               }
-
-               determinant() {
-                       const te = this.elements;
-                       const n11 = te[0],
-                                               n12 = te[4],
-                                               n13 = te[8],
-                                               n14 = te[12];
-                       const n21 = te[1],
-                                               n22 = te[5],
-                                               n23 = te[9],
-                                               n24 = te[13];
-                       const n31 = te[2],
-                                               n32 = te[6],
-                                               n33 = te[10],
-                                               n34 = te[14];
-                       const n41 = te[3],
-                                               n42 = te[7],
-                                               n43 = te[11],
-                                               n44 = te[15]; //TODO: make this more efficient
-                       //( based on http://www.euclideanspace.com/maths/algebra/matrix/functions/inverse/fourD/index.htm )
-
-                       return n41 * (+n14 * n23 * n32 - n13 * n24 * n32 - n14 * n22 * n33 + n12 * n24 * n33 + n13 * n22 * n34 - n12 * n23 * n34) + n42 * (+n11 * n23 * n34 - n11 * n24 * n33 + n14 * n21 * n33 - n13 * n21 * n34 + n13 * n24 * n31 - n14 * n23 * n31) + n43 * (+n11 * n24 * n32 - n11 * n22 * n34 - n14 * n21 * n32 + n12 * n21 * n34 + n14 * n22 * n31 - n12 * n24 * n31) + n44 * (-n13 * n22 * n31 - n11 * n23 * n32 + n11 * n22 * n33 + n13 * n21 * n32 - n12 * n21 * n33 + n12 * n23 * n31);
-               }
-
-               transpose() {
-                       const te = this.elements;
-                       let tmp;
-                       tmp = te[1];
-                       te[1] = te[4];
-                       te[4] = tmp;
-                       tmp = te[2];
-                       te[2] = te[8];
-                       te[8] = tmp;
-                       tmp = te[6];
-                       te[6] = te[9];
-                       te[9] = tmp;
-                       tmp = te[3];
-                       te[3] = te[12];
-                       te[12] = tmp;
-                       tmp = te[7];
-                       te[7] = te[13];
-                       te[13] = tmp;
-                       tmp = te[11];
-                       te[11] = te[14];
-                       te[14] = tmp;
-                       return this;
-               }
-
-               setPosition(x, y, z) {
-                       const te = this.elements;
-
-                       if (x.isVector3) {
-                               te[12] = x.x;
-                               te[13] = x.y;
-                               te[14] = x.z;
-                       } else {
-                               te[12] = x;
-                               te[13] = y;
-                               te[14] = z;
-                       }
-
-                       return this;
-               }
-
-               invert() {
-                       // based on http://www.euclideanspace.com/maths/algebra/matrix/functions/inverse/fourD/index.htm
-                       const te = this.elements,
-                                               n11 = te[0],
-                                               n21 = te[1],
-                                               n31 = te[2],
-                                               n41 = te[3],
-                                               n12 = te[4],
-                                               n22 = te[5],
-                                               n32 = te[6],
-                                               n42 = te[7],
-                                               n13 = te[8],
-                                               n23 = te[9],
-                                               n33 = te[10],
-                                               n43 = te[11],
-                                               n14 = te[12],
-                                               n24 = te[13],
-                                               n34 = te[14],
-                                               n44 = te[15],
-                                               t11 = n23 * n34 * n42 - n24 * n33 * n42 + n24 * n32 * n43 - n22 * n34 * n43 - n23 * n32 * n44 + n22 * n33 * n44,
-                                               t12 = n14 * n33 * n42 - n13 * n34 * n42 - n14 * n32 * n43 + n12 * n34 * n43 + n13 * n32 * n44 - n12 * n33 * n44,
-                                               t13 = n13 * n24 * n42 - n14 * n23 * n42 + n14 * n22 * n43 - n12 * n24 * n43 - n13 * n22 * n44 + n12 * n23 * n44,
-                                               t14 = n14 * n23 * n32 - n13 * n24 * n32 - n14 * n22 * n33 + n12 * n24 * n33 + n13 * n22 * n34 - n12 * n23 * n34;
-                       const det = n11 * t11 + n21 * t12 + n31 * t13 + n41 * t14;
-                       if (det === 0) return this.set(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
-                       const detInv = 1 / det;
-                       te[0] = t11 * detInv;
-                       te[1] = (n24 * n33 * n41 - n23 * n34 * n41 - n24 * n31 * n43 + n21 * n34 * n43 + n23 * n31 * n44 - n21 * n33 * n44) * detInv;
-                       te[2] = (n22 * n34 * n41 - n24 * n32 * n41 + n24 * n31 * n42 - n21 * n34 * n42 - n22 * n31 * n44 + n21 * n32 * n44) * detInv;
-                       te[3] = (n23 * n32 * n41 - n22 * n33 * n41 - n23 * n31 * n42 + n21 * n33 * n42 + n22 * n31 * n43 - n21 * n32 * n43) * detInv;
-                       te[4] = t12 * detInv;
-                       te[5] = (n13 * n34 * n41 - n14 * n33 * n41 + n14 * n31 * n43 - n11 * n34 * n43 - n13 * n31 * n44 + n11 * n33 * n44) * detInv;
-                       te[6] = (n14 * n32 * n41 - n12 * n34 * n41 - n14 * n31 * n42 + n11 * n34 * n42 + n12 * n31 * n44 - n11 * n32 * n44) * detInv;
-                       te[7] = (n12 * n33 * n41 - n13 * n32 * n41 + n13 * n31 * n42 - n11 * n33 * n42 - n12 * n31 * n43 + n11 * n32 * n43) * detInv;
-                       te[8] = t13 * detInv;
-                       te[9] = (n14 * n23 * n41 - n13 * n24 * n41 - n14 * n21 * n43 + n11 * n24 * n43 + n13 * n21 * n44 - n11 * n23 * n44) * detInv;
-                       te[10] = (n12 * n24 * n41 - n14 * n22 * n41 + n14 * n21 * n42 - n11 * n24 * n42 - n12 * n21 * n44 + n11 * n22 * n44) * detInv;
-                       te[11] = (n13 * n22 * n41 - n12 * n23 * n41 - n13 * n21 * n42 + n11 * n23 * n42 + n12 * n21 * n43 - n11 * n22 * n43) * detInv;
-                       te[12] = t14 * detInv;
-                       te[13] = (n13 * n24 * n31 - n14 * n23 * n31 + n14 * n21 * n33 - n11 * n24 * n33 - n13 * n21 * n34 + n11 * n23 * n34) * detInv;
-                       te[14] = (n14 * n22 * n31 - n12 * n24 * n31 - n14 * n21 * n32 + n11 * n24 * n32 + n12 * n21 * n34 - n11 * n22 * n34) * detInv;
-                       te[15] = (n12 * n23 * n31 - n13 * n22 * n31 + n13 * n21 * n32 - n11 * n23 * n32 - n12 * n21 * n33 + n11 * n22 * n33) * detInv;
-                       return this;
-               }
-
-               scale(v) {
-                       const te = this.elements;
-                       const x = v.x,
-                                               y = v.y,
-                                               z = v.z;
-                       te[0] *= x;
-                       te[4] *= y;
-                       te[8] *= z;
-                       te[1] *= x;
-                       te[5] *= y;
-                       te[9] *= z;
-                       te[2] *= x;
-                       te[6] *= y;
-                       te[10] *= z;
-                       te[3] *= x;
-                       te[7] *= y;
-                       te[11] *= z;
-                       return this;
-               }
-
-               getMaxScaleOnAxis() {
-                       const te = this.elements;
-                       const scaleXSq = te[0] * te[0] + te[1] * te[1] + te[2] * te[2];
-                       const scaleYSq = te[4] * te[4] + te[5] * te[5] + te[6] * te[6];
-                       const scaleZSq = te[8] * te[8] + te[9] * te[9] + te[10] * te[10];
-                       return Math.sqrt(Math.max(scaleXSq, scaleYSq, scaleZSq));
-               }
-
-               makeTranslation(x, y, z) {
-                       this.set(1, 0, 0, x, 0, 1, 0, y, 0, 0, 1, z, 0, 0, 0, 1);
-                       return this;
-               }
-
-               makeRotationX(theta) {
-                       const c = Math.cos(theta),
-                                               s = Math.sin(theta);
-                       this.set(1, 0, 0, 0, 0, c, -s, 0, 0, s, c, 0, 0, 0, 0, 1);
-                       return this;
-               }
-
-               makeRotationY(theta) {
-                       const c = Math.cos(theta),
-                                               s = Math.sin(theta);
-                       this.set(c, 0, s, 0, 0, 1, 0, 0, -s, 0, c, 0, 0, 0, 0, 1);
-                       return this;
-               }
-
-               makeRotationZ(theta) {
-                       const c = Math.cos(theta),
-                                               s = Math.sin(theta);
-                       this.set(c, -s, 0, 0, s, c, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);
-                       return this;
-               }
-
-               makeRotationAxis(axis, angle) {
-                       // Based on http://www.gamedev.net/reference/articles/article1199.asp
-                       const c = Math.cos(angle);
-                       const s = Math.sin(angle);
-                       const t = 1 - c;
-                       const x = axis.x,
-                                               y = axis.y,
-                                               z = axis.z;
-                       const tx = t * x,
-                                               ty = t * y;
-                       this.set(tx * x + c, tx * y - s * z, tx * z + s * y, 0, tx * y + s * z, ty * y + c, ty * z - s * x, 0, tx * z - s * y, ty * z + s * x, t * z * z + c, 0, 0, 0, 0, 1);
-                       return this;
-               }
-
-               makeScale(x, y, z) {
-                       this.set(x, 0, 0, 0, 0, y, 0, 0, 0, 0, z, 0, 0, 0, 0, 1);
-                       return this;
-               }
-
-               makeShear(xy, xz, yx, yz, zx, zy) {
-                       this.set(1, yx, zx, 0, xy, 1, zy, 0, xz, yz, 1, 0, 0, 0, 0, 1);
-                       return this;
-               }
-
-               compose(position, quaternion, scale) {
-                       const te = this.elements;
-                       const x = quaternion._x,
-                                               y = quaternion._y,
-                                               z = quaternion._z,
-                                               w = quaternion._w;
-                       const x2 = x + x,
-                                               y2 = y + y,
-                                               z2 = z + z;
-                       const xx = x * x2,
-                                               xy = x * y2,
-                                               xz = x * z2;
-                       const yy = y * y2,
-                                               yz = y * z2,
-                                               zz = z * z2;
-                       const wx = w * x2,
-                                               wy = w * y2,
-                                               wz = w * z2;
-                       const sx = scale.x,
-                                               sy = scale.y,
-                                               sz = scale.z;
-                       te[0] = (1 - (yy + zz)) * sx;
-                       te[1] = (xy + wz) * sx;
-                       te[2] = (xz - wy) * sx;
-                       te[3] = 0;
-                       te[4] = (xy - wz) * sy;
-                       te[5] = (1 - (xx + zz)) * sy;
-                       te[6] = (yz + wx) * sy;
-                       te[7] = 0;
-                       te[8] = (xz + wy) * sz;
-                       te[9] = (yz - wx) * sz;
-                       te[10] = (1 - (xx + yy)) * sz;
-                       te[11] = 0;
-                       te[12] = position.x;
-                       te[13] = position.y;
-                       te[14] = position.z;
-                       te[15] = 1;
-                       return this;
-               }
-
-               decompose(position, quaternion, scale) {
-                       const te = this.elements;
-
-                       let sx = _v1$5.set(te[0], te[1], te[2]).length();
-
-                       const sy = _v1$5.set(te[4], te[5], te[6]).length();
-
-                       const sz = _v1$5.set(te[8], te[9], te[10]).length(); // if determine is negative, we need to invert one scale
-
-
-                       const det = this.determinant();
-                       if (det < 0) sx = -sx;
-                       position.x = te[12];
-                       position.y = te[13];
-                       position.z = te[14]; // scale the rotation part
-
-                       _m1$2.copy(this);
-
-                       const invSX = 1 / sx;
-                       const invSY = 1 / sy;
-                       const invSZ = 1 / sz;
-                       _m1$2.elements[0] *= invSX;
-                       _m1$2.elements[1] *= invSX;
-                       _m1$2.elements[2] *= invSX;
-                       _m1$2.elements[4] *= invSY;
-                       _m1$2.elements[5] *= invSY;
-                       _m1$2.elements[6] *= invSY;
-                       _m1$2.elements[8] *= invSZ;
-                       _m1$2.elements[9] *= invSZ;
-                       _m1$2.elements[10] *= invSZ;
-                       quaternion.setFromRotationMatrix(_m1$2);
-                       scale.x = sx;
-                       scale.y = sy;
-                       scale.z = sz;
-                       return this;
-               }
-
-               makePerspective(left, right, top, bottom, near, far) {
-                       if (far === undefined) {
-                               console.warn('THREE.Matrix4: .makePerspective() has been redefined and has a new signature. Please check the docs.');
-                       }
-
-                       const te = this.elements;
-                       const x = 2 * near / (right - left);
-                       const y = 2 * near / (top - bottom);
-                       const a = (right + left) / (right - left);
-                       const b = (top + bottom) / (top - bottom);
-                       const c = -(far + near) / (far - near);
-                       const d = -2 * far * near / (far - near);
-                       te[0] = x;
-                       te[4] = 0;
-                       te[8] = a;
-                       te[12] = 0;
-                       te[1] = 0;
-                       te[5] = y;
-                       te[9] = b;
-                       te[13] = 0;
-                       te[2] = 0;
-                       te[6] = 0;
-                       te[10] = c;
-                       te[14] = d;
-                       te[3] = 0;
-                       te[7] = 0;
-                       te[11] = -1;
-                       te[15] = 0;
-                       return this;
-               }
-
-               makeOrthographic(left, right, top, bottom, near, far) {
-                       const te = this.elements;
-                       const w = 1.0 / (right - left);
-                       const h = 1.0 / (top - bottom);
-                       const p = 1.0 / (far - near);
-                       const x = (right + left) * w;
-                       const y = (top + bottom) * h;
-                       const z = (far + near) * p;
-                       te[0] = 2 * w;
-                       te[4] = 0;
-                       te[8] = 0;
-                       te[12] = -x;
-                       te[1] = 0;
-                       te[5] = 2 * h;
-                       te[9] = 0;
-                       te[13] = -y;
-                       te[2] = 0;
-                       te[6] = 0;
-                       te[10] = -2 * p;
-                       te[14] = -z;
-                       te[3] = 0;
-                       te[7] = 0;
-                       te[11] = 0;
-                       te[15] = 1;
-                       return this;
-               }
-
-               equals(matrix) {
-                       const te = this.elements;
-                       const me = matrix.elements;
-
-                       for (let i = 0; i < 16; i++) {
-                               if (te[i] !== me[i]) return false;
-                       }
-
-                       return true;
-               }
-
-               fromArray(array, offset = 0) {
-                       for (let i = 0; i < 16; i++) {
-                               this.elements[i] = array[i + offset];
-                       }
-
-                       return this;
-               }
-
-               toArray(array = [], offset = 0) {
-                       const te = this.elements;
-                       array[offset] = te[0];
-                       array[offset + 1] = te[1];
-                       array[offset + 2] = te[2];
-                       array[offset + 3] = te[3];
-                       array[offset + 4] = te[4];
-                       array[offset + 5] = te[5];
-                       array[offset + 6] = te[6];
-                       array[offset + 7] = te[7];
-                       array[offset + 8] = te[8];
-                       array[offset + 9] = te[9];
-                       array[offset + 10] = te[10];
-                       array[offset + 11] = te[11];
-                       array[offset + 12] = te[12];
-                       array[offset + 13] = te[13];
-                       array[offset + 14] = te[14];
-                       array[offset + 15] = te[15];
-                       return array;
-               }
-
-       }
-
-       Matrix4.prototype.isMatrix4 = true;
-
-       const _v1$5 = /*@__PURE__*/new Vector3();
-
-       const _m1$2 = /*@__PURE__*/new Matrix4();
-
-       const _zero = /*@__PURE__*/new Vector3(0, 0, 0);
-
-       const _one = /*@__PURE__*/new Vector3(1, 1, 1);
-
-       const _x = /*@__PURE__*/new Vector3();
-
-       const _y = /*@__PURE__*/new Vector3();
-
-       const _z = /*@__PURE__*/new Vector3();
-
-       const _matrix$1 = /*@__PURE__*/new Matrix4();
-
-       const _quaternion$3 = /*@__PURE__*/new Quaternion();
-
-       class Euler {
-               constructor(x = 0, y = 0, z = 0, order = Euler.DefaultOrder) {
-                       this._x = x;
-                       this._y = y;
-                       this._z = z;
-                       this._order = order;
-               }
-
-               get x() {
-                       return this._x;
-               }
-
-               set x(value) {
-                       this._x = value;
-
-                       this._onChangeCallback();
-               }
-
-               get y() {
-                       return this._y;
-               }
-
-               set y(value) {
-                       this._y = value;
-
-                       this._onChangeCallback();
-               }
-
-               get z() {
-                       return this._z;
-               }
-
-               set z(value) {
-                       this._z = value;
-
-                       this._onChangeCallback();
-               }
-
-               get order() {
-                       return this._order;
-               }
-
-               set order(value) {
-                       this._order = value;
-
-                       this._onChangeCallback();
-               }
-
-               set(x, y, z, order = this._order) {
-                       this._x = x;
-                       this._y = y;
-                       this._z = z;
-                       this._order = order;
-
-                       this._onChangeCallback();
-
-                       return this;
-               }
-
-               clone() {
-                       return new this.constructor(this._x, this._y, this._z, this._order);
-               }
-
-               copy(euler) {
-                       this._x = euler._x;
-                       this._y = euler._y;
-                       this._z = euler._z;
-                       this._order = euler._order;
-
-                       this._onChangeCallback();
-
-                       return this;
-               }
-
-               setFromRotationMatrix(m, order = this._order, update = true) {
-                       // assumes the upper 3x3 of m is a pure rotation matrix (i.e, unscaled)
-                       const te = m.elements;
-                       const m11 = te[0],
-                                               m12 = te[4],
-                                               m13 = te[8];
-                       const m21 = te[1],
-                                               m22 = te[5],
-                                               m23 = te[9];
-                       const m31 = te[2],
-                                               m32 = te[6],
-                                               m33 = te[10];
-
-                       switch (order) {
-                               case 'XYZ':
-                                       this._y = Math.asin(clamp(m13, -1, 1));
-
-                                       if (Math.abs(m13) < 0.9999999) {
-                                               this._x = Math.atan2(-m23, m33);
-                                               this._z = Math.atan2(-m12, m11);
-                                       } else {
-                                               this._x = Math.atan2(m32, m22);
-                                               this._z = 0;
-                                       }
-
-                                       break;
-
-                               case 'YXZ':
-                                       this._x = Math.asin(-clamp(m23, -1, 1));
-
-                                       if (Math.abs(m23) < 0.9999999) {
-                                               this._y = Math.atan2(m13, m33);
-                                               this._z = Math.atan2(m21, m22);
-                                       } else {
-                                               this._y = Math.atan2(-m31, m11);
-                                               this._z = 0;
-                                       }
-
-                                       break;
-
-                               case 'ZXY':
-                                       this._x = Math.asin(clamp(m32, -1, 1));
-
-                                       if (Math.abs(m32) < 0.9999999) {
-                                               this._y = Math.atan2(-m31, m33);
-                                               this._z = Math.atan2(-m12, m22);
-                                       } else {
-                                               this._y = 0;
-                                               this._z = Math.atan2(m21, m11);
-                                       }
-
-                                       break;
-
-                               case 'ZYX':
-                                       this._y = Math.asin(-clamp(m31, -1, 1));
-
-                                       if (Math.abs(m31) < 0.9999999) {
-                                               this._x = Math.atan2(m32, m33);
-                                               this._z = Math.atan2(m21, m11);
-                                       } else {
-                                               this._x = 0;
-                                               this._z = Math.atan2(-m12, m22);
-                                       }
-
-                                       break;
-
-                               case 'YZX':
-                                       this._z = Math.asin(clamp(m21, -1, 1));
-
-                                       if (Math.abs(m21) < 0.9999999) {
-                                               this._x = Math.atan2(-m23, m22);
-                                               this._y = Math.atan2(-m31, m11);
-                                       } else {
-                                               this._x = 0;
-                                               this._y = Math.atan2(m13, m33);
-                                       }
-
-                                       break;
-
-                               case 'XZY':
-                                       this._z = Math.asin(-clamp(m12, -1, 1));
-
-                                       if (Math.abs(m12) < 0.9999999) {
-                                               this._x = Math.atan2(m32, m22);
-                                               this._y = Math.atan2(m13, m11);
-                                       } else {
-                                               this._x = Math.atan2(-m23, m33);
-                                               this._y = 0;
-                                       }
-
-                                       break;
-
-                               default:
-                                       console.warn('THREE.Euler: .setFromRotationMatrix() encountered an unknown order: ' + order);
-                       }
-
-                       this._order = order;
-                       if (update === true) this._onChangeCallback();
-                       return this;
-               }
-
-               setFromQuaternion(q, order, update) {
-                       _matrix$1.makeRotationFromQuaternion(q);
-
-                       return this.setFromRotationMatrix(_matrix$1, order, update);
-               }
-
-               setFromVector3(v, order = this._order) {
-                       return this.set(v.x, v.y, v.z, order);
-               }
-
-               reorder(newOrder) {
-                       // WARNING: this discards revolution information -bhouston
-                       _quaternion$3.setFromEuler(this);
-
-                       return this.setFromQuaternion(_quaternion$3, newOrder);
-               }
-
-               equals(euler) {
-                       return euler._x === this._x && euler._y === this._y && euler._z === this._z && euler._order === this._order;
-               }
-
-               fromArray(array) {
-                       this._x = array[0];
-                       this._y = array[1];
-                       this._z = array[2];
-                       if (array[3] !== undefined) this._order = array[3];
-
-                       this._onChangeCallback();
-
-                       return this;
-               }
-
-               toArray(array = [], offset = 0) {
-                       array[offset] = this._x;
-                       array[offset + 1] = this._y;
-                       array[offset + 2] = this._z;
-                       array[offset + 3] = this._order;
-                       return array;
-               }
-
-               toVector3(optionalResult) {
-                       if (optionalResult) {
-                               return optionalResult.set(this._x, this._y, this._z);
-                       } else {
-                               return new Vector3(this._x, this._y, this._z);
-                       }
-               }
-
-               _onChange(callback) {
-                       this._onChangeCallback = callback;
-                       return this;
-               }
-
-               _onChangeCallback() {}
-
-       }
-
-       Euler.prototype.isEuler = true;
-       Euler.DefaultOrder = 'XYZ';
-       Euler.RotationOrders = ['XYZ', 'YZX', 'ZXY', 'XZY', 'YXZ', 'ZYX'];
-
-       class Layers {
-               constructor() {
-                       this.mask = 1 | 0;
-               }
-
-               set(channel) {
-                       this.mask = 1 << channel | 0;
-               }
-
-               enable(channel) {
-                       this.mask |= 1 << channel | 0;
-               }
-
-               enableAll() {
-                       this.mask = 0xffffffff | 0;
-               }
-
-               toggle(channel) {
-                       this.mask ^= 1 << channel | 0;
-               }
-
-               disable(channel) {
-                       this.mask &= ~(1 << channel | 0);
-               }
-
-               disableAll() {
-                       this.mask = 0;
-               }
-
-               test(layers) {
-                       return (this.mask & layers.mask) !== 0;
-               }
-
-       }
-
-       let _object3DId = 0;
-
-       const _v1$4 = /*@__PURE__*/new Vector3();
-
-       const _q1 = /*@__PURE__*/new Quaternion();
-
-       const _m1$1 = /*@__PURE__*/new Matrix4();
-
-       const _target = /*@__PURE__*/new Vector3();
-
-       const _position$3 = /*@__PURE__*/new Vector3();
-
-       const _scale$2 = /*@__PURE__*/new Vector3();
-
-       const _quaternion$2 = /*@__PURE__*/new Quaternion();
-
-       const _xAxis = /*@__PURE__*/new Vector3(1, 0, 0);
-
-       const _yAxis = /*@__PURE__*/new Vector3(0, 1, 0);
-
-       const _zAxis = /*@__PURE__*/new Vector3(0, 0, 1);
-
-       const _addedEvent = {
-               type: 'added'
-       };
-       const _removedEvent = {
-               type: 'removed'
-       };
-
-       class Object3D extends EventDispatcher {
-               constructor() {
-                       super();
-                       Object.defineProperty(this, 'id', {
-                               value: _object3DId++
-                       });
-                       this.uuid = generateUUID();
-                       this.name = '';
-                       this.type = 'Object3D';
-                       this.parent = null;
-                       this.children = [];
-                       this.up = Object3D.DefaultUp.clone();
-                       const position = new Vector3();
-                       const rotation = new Euler();
-                       const quaternion = new Quaternion();
-                       const scale = new Vector3(1, 1, 1);
-
-                       function onRotationChange() {
-                               quaternion.setFromEuler(rotation, false);
-                       }
-
-                       function onQuaternionChange() {
-                               rotation.setFromQuaternion(quaternion, undefined, false);
-                       }
-
-                       rotation._onChange(onRotationChange);
-
-                       quaternion._onChange(onQuaternionChange);
-
-                       Object.defineProperties(this, {
-                               position: {
-                                       configurable: true,
-                                       enumerable: true,
-                                       value: position
-                               },
-                               rotation: {
-                                       configurable: true,
-                                       enumerable: true,
-                                       value: rotation
-                               },
-                               quaternion: {
-                                       configurable: true,
-                                       enumerable: true,
-                                       value: quaternion
-                               },
-                               scale: {
-                                       configurable: true,
-                                       enumerable: true,
-                                       value: scale
-                               },
-                               modelViewMatrix: {
-                                       value: new Matrix4()
-                               },
-                               normalMatrix: {
-                                       value: new Matrix3()
-                               }
-                       });
-                       this.matrix = new Matrix4();
-                       this.matrixWorld = new Matrix4();
-                       this.matrixAutoUpdate = Object3D.DefaultMatrixAutoUpdate;
-                       this.matrixWorldNeedsUpdate = false;
-                       this.layers = new Layers();
-                       this.visible = true;
-                       this.castShadow = false;
-                       this.receiveShadow = false;
-                       this.frustumCulled = true;
-                       this.renderOrder = 0;
-                       this.animations = [];
-                       this.userData = {};
-               }
-
-               onBeforeRender() {}
-
-               onAfterRender() {}
-
-               applyMatrix4(matrix) {
-                       if (this.matrixAutoUpdate) this.updateMatrix();
-                       this.matrix.premultiply(matrix);
-                       this.matrix.decompose(this.position, this.quaternion, this.scale);
-               }
-
-               applyQuaternion(q) {
-                       this.quaternion.premultiply(q);
-                       return this;
-               }
-
-               setRotationFromAxisAngle(axis, angle) {
-                       // assumes axis is normalized
-                       this.quaternion.setFromAxisAngle(axis, angle);
-               }
-
-               setRotationFromEuler(euler) {
-                       this.quaternion.setFromEuler(euler, true);
-               }
-
-               setRotationFromMatrix(m) {
-                       // assumes the upper 3x3 of m is a pure rotation matrix (i.e, unscaled)
-                       this.quaternion.setFromRotationMatrix(m);
-               }
-
-               setRotationFromQuaternion(q) {
-                       // assumes q is normalized
-                       this.quaternion.copy(q);
-               }
-
-               rotateOnAxis(axis, angle) {
-                       // rotate object on axis in object space
-                       // axis is assumed to be normalized
-                       _q1.setFromAxisAngle(axis, angle);
-
-                       this.quaternion.multiply(_q1);
-                       return this;
-               }
-
-               rotateOnWorldAxis(axis, angle) {
-                       // rotate object on axis in world space
-                       // axis is assumed to be normalized
-                       // method assumes no rotated parent
-                       _q1.setFromAxisAngle(axis, angle);
-
-                       this.quaternion.premultiply(_q1);
-                       return this;
-               }
-
-               rotateX(angle) {
-                       return this.rotateOnAxis(_xAxis, angle);
-               }
-
-               rotateY(angle) {
-                       return this.rotateOnAxis(_yAxis, angle);
-               }
-
-               rotateZ(angle) {
-                       return this.rotateOnAxis(_zAxis, angle);
-               }
-
-               translateOnAxis(axis, distance) {
-                       // translate object by distance along axis in object space
-                       // axis is assumed to be normalized
-                       _v1$4.copy(axis).applyQuaternion(this.quaternion);
-
-                       this.position.add(_v1$4.multiplyScalar(distance));
-                       return this;
-               }
-
-               translateX(distance) {
-                       return this.translateOnAxis(_xAxis, distance);
-               }
-
-               translateY(distance) {
-                       return this.translateOnAxis(_yAxis, distance);
-               }
-
-               translateZ(distance) {
-                       return this.translateOnAxis(_zAxis, distance);
-               }
-
-               localToWorld(vector) {
-                       return vector.applyMatrix4(this.matrixWorld);
-               }
-
-               worldToLocal(vector) {
-                       return vector.applyMatrix4(_m1$1.copy(this.matrixWorld).invert());
-               }
-
-               lookAt(x, y, z) {
-                       // This method does not support objects having non-uniformly-scaled parent(s)
-                       if (x.isVector3) {
-                               _target.copy(x);
-                       } else {
-                               _target.set(x, y, z);
-                       }
-
-                       const parent = this.parent;
-                       this.updateWorldMatrix(true, false);
-
-                       _position$3.setFromMatrixPosition(this.matrixWorld);
-
-                       if (this.isCamera || this.isLight) {
-                               _m1$1.lookAt(_position$3, _target, this.up);
-                       } else {
-                               _m1$1.lookAt(_target, _position$3, this.up);
-                       }
-
-                       this.quaternion.setFromRotationMatrix(_m1$1);
-
-                       if (parent) {
-                               _m1$1.extractRotation(parent.matrixWorld);
-
-                               _q1.setFromRotationMatrix(_m1$1);
-
-                               this.quaternion.premultiply(_q1.invert());
-                       }
-               }
-
-               add(object) {
-                       if (arguments.length > 1) {
-                               for (let i = 0; i < arguments.length; i++) {
-                                       this.add(arguments[i]);
-                               }
-
-                               return this;
-                       }
-
-                       if (object === this) {
-                               console.error('THREE.Object3D.add: object can\'t be added as a child of itself.', object);
-                               return this;
-                       }
-
-                       if (object && object.isObject3D) {
-                               if (object.parent !== null) {
-                                       object.parent.remove(object);
-                               }
-
-                               object.parent = this;
-                               this.children.push(object);
-                               object.dispatchEvent(_addedEvent);
-                       } else {
-                               console.error('THREE.Object3D.add: object not an instance of THREE.Object3D.', object);
-                       }
-
-                       return this;
-               }
-
-               remove(object) {
-                       if (arguments.length > 1) {
-                               for (let i = 0; i < arguments.length; i++) {
-                                       this.remove(arguments[i]);
-                               }
-
-                               return this;
-                       }
-
-                       const index = this.children.indexOf(object);
-
-                       if (index !== -1) {
-                               object.parent = null;
-                               this.children.splice(index, 1);
-                               object.dispatchEvent(_removedEvent);
-                       }
-
-                       return this;
-               }
-
-               removeFromParent() {
-                       const parent = this.parent;
-
-                       if (parent !== null) {
-                               parent.remove(this);
-                       }
-
-                       return this;
-               }
-
-               clear() {
-                       for (let i = 0; i < this.children.length; i++) {
-                               const object = this.children[i];
-                               object.parent = null;
-                               object.dispatchEvent(_removedEvent);
-                       }
-
-                       this.children.length = 0;
-                       return this;
-               }
-
-               attach(object) {
-                       // adds object as a child of this, while maintaining the object's world transform
-                       this.updateWorldMatrix(true, false);
-
-                       _m1$1.copy(this.matrixWorld).invert();
-
-                       if (object.parent !== null) {
-                               object.parent.updateWorldMatrix(true, false);
-
-                               _m1$1.multiply(object.parent.matrixWorld);
-                       }
-
-                       object.applyMatrix4(_m1$1);
-                       this.add(object);
-                       object.updateWorldMatrix(false, true);
-                       return this;
-               }
-
-               getObjectById(id) {
-                       return this.getObjectByProperty('id', id);
-               }
-
-               getObjectByName(name) {
-                       return this.getObjectByProperty('name', name);
-               }
-
-               getObjectByProperty(name, value) {
-                       if (this[name] === value) return this;
-
-                       for (let i = 0, l = this.children.length; i < l; i++) {
-                               const child = this.children[i];
-                               const object = child.getObjectByProperty(name, value);
-
-                               if (object !== undefined) {
-                                       return object;
-                               }
-                       }
-
-                       return undefined;
-               }
-
-               getWorldPosition(target) {
-                       this.updateWorldMatrix(true, false);
-                       return target.setFromMatrixPosition(this.matrixWorld);
-               }
-
-               getWorldQuaternion(target) {
-                       this.updateWorldMatrix(true, false);
-                       this.matrixWorld.decompose(_position$3, target, _scale$2);
-                       return target;
-               }
-
-               getWorldScale(target) {
-                       this.updateWorldMatrix(true, false);
-                       this.matrixWorld.decompose(_position$3, _quaternion$2, target);
-                       return target;
-               }
-
-               getWorldDirection(target) {
-                       this.updateWorldMatrix(true, false);
-                       const e = this.matrixWorld.elements;
-                       return target.set(e[8], e[9], e[10]).normalize();
-               }
-
-               raycast() {}
-
-               traverse(callback) {
-                       callback(this);
-                       const children = this.children;
-
-                       for (let i = 0, l = children.length; i < l; i++) {
-                               children[i].traverse(callback);
-                       }
-               }
-
-               traverseVisible(callback) {
-                       if (this.visible === false) return;
-                       callback(this);
-                       const children = this.children;
-
-                       for (let i = 0, l = children.length; i < l; i++) {
-                               children[i].traverseVisible(callback);
-                       }
-               }
-
-               traverseAncestors(callback) {
-                       const parent = this.parent;
-
-                       if (parent !== null) {
-                               callback(parent);
-                               parent.traverseAncestors(callback);
-                       }
-               }
-
-               updateMatrix() {
-                       this.matrix.compose(this.position, this.quaternion, this.scale);
-                       this.matrixWorldNeedsUpdate = true;
-               }
-
-               updateMatrixWorld(force) {
-                       if (this.matrixAutoUpdate) this.updateMatrix();
-
-                       if (this.matrixWorldNeedsUpdate || force) {
-                               if (this.parent === null) {
-                                       this.matrixWorld.copy(this.matrix);
-                               } else {
-                                       this.matrixWorld.multiplyMatrices(this.parent.matrixWorld, this.matrix);
-                               }
-
-                               this.matrixWorldNeedsUpdate = false;
-                               force = true;
-                       } // update children
-
-
-                       const children = this.children;
-
-                       for (let i = 0, l = children.length; i < l; i++) {
-                               children[i].updateMatrixWorld(force);
-                       }
-               }
-
-               updateWorldMatrix(updateParents, updateChildren) {
-                       const parent = this.parent;
-
-                       if (updateParents === true && parent !== null) {
-                               parent.updateWorldMatrix(true, false);
-                       }
-
-                       if (this.matrixAutoUpdate) this.updateMatrix();
-
-                       if (this.parent === null) {
-                               this.matrixWorld.copy(this.matrix);
-                       } else {
-                               this.matrixWorld.multiplyMatrices(this.parent.matrixWorld, this.matrix);
-                       } // update children
-
-
-                       if (updateChildren === true) {
-                               const children = this.children;
-
-                               for (let i = 0, l = children.length; i < l; i++) {
-                                       children[i].updateWorldMatrix(false, true);
-                               }
-                       }
-               }
-
-               toJSON(meta) {
-                       // meta is a string when called from JSON.stringify
-                       const isRootObject = meta === undefined || typeof meta === 'string';
-                       const output = {}; // meta is a hash used to collect geometries, materials.
-                       // not providing it implies that this is the root object
-                       // being serialized.
-
-                       if (isRootObject) {
-                               // initialize meta obj
-                               meta = {
-                                       geometries: {},
-                                       materials: {},
-                                       textures: {},
-                                       images: {},
-                                       shapes: {},
-                                       skeletons: {},
-                                       animations: {}
-                               };
-                               output.metadata = {
-                                       version: 4.5,
-                                       type: 'Object',
-                                       generator: 'Object3D.toJSON'
-                               };
-                       } // standard Object3D serialization
-
-
-                       const object = {};
-                       object.uuid = this.uuid;
-                       object.type = this.type;
-                       if (this.name !== '') object.name = this.name;
-                       if (this.castShadow === true) object.castShadow = true;
-                       if (this.receiveShadow === true) object.receiveShadow = true;
-                       if (this.visible === false) object.visible = false;
-                       if (this.frustumCulled === false) object.frustumCulled = false;
-                       if (this.renderOrder !== 0) object.renderOrder = this.renderOrder;
-                       if (JSON.stringify(this.userData) !== '{}') object.userData = this.userData;
-                       object.layers = this.layers.mask;
-                       object.matrix = this.matrix.toArray();
-                       if (this.matrixAutoUpdate === false) object.matrixAutoUpdate = false; // object specific properties
-
-                       if (this.isInstancedMesh) {
-                               object.type = 'InstancedMesh';
-                               object.count = this.count;
-                               object.instanceMatrix = this.instanceMatrix.toJSON();
-                               if (this.instanceColor !== null) object.instanceColor = this.instanceColor.toJSON();
-                       } //
-
-
-                       function serialize(library, element) {
-                               if (library[element.uuid] === undefined) {
-                                       library[element.uuid] = element.toJSON(meta);
-                               }
-
-                               return element.uuid;
-                       }
-
-                       if (this.isScene) {
-                               if (this.background) {
-                                       if (this.background.isColor) {
-                                               object.background = this.background.toJSON();
-                                       } else if (this.background.isTexture) {
-                                               object.background = this.background.toJSON(meta).uuid;
-                                       }
-                               }
-
-                               if (this.environment && this.environment.isTexture) {
-                                       object.environment = this.environment.toJSON(meta).uuid;
-                               }
-                       } else if (this.isMesh || this.isLine || this.isPoints) {
-                               object.geometry = serialize(meta.geometries, this.geometry);
-                               const parameters = this.geometry.parameters;
-
-                               if (parameters !== undefined && parameters.shapes !== undefined) {
-                                       const shapes = parameters.shapes;
-
-                                       if (Array.isArray(shapes)) {
-                                               for (let i = 0, l = shapes.length; i < l; i++) {
-                                                       const shape = shapes[i];
-                                                       serialize(meta.shapes, shape);
-                                               }
-                                       } else {
-                                               serialize(meta.shapes, shapes);
-                                       }
-                               }
-                       }
-
-                       if (this.isSkinnedMesh) {
-                               object.bindMode = this.bindMode;
-                               object.bindMatrix = this.bindMatrix.toArray();
-
-                               if (this.skeleton !== undefined) {
-                                       serialize(meta.skeletons, this.skeleton);
-                                       object.skeleton = this.skeleton.uuid;
-                               }
-                       }
-
-                       if (this.material !== undefined) {
-                               if (Array.isArray(this.material)) {
-                                       const uuids = [];
-
-                                       for (let i = 0, l = this.material.length; i < l; i++) {
-                                               uuids.push(serialize(meta.materials, this.material[i]));
-                                       }
-
-                                       object.material = uuids;
-                               } else {
-                                       object.material = serialize(meta.materials, this.material);
-                               }
-                       } //
-
-
-                       if (this.children.length > 0) {
-                               object.children = [];
-
-                               for (let i = 0; i < this.children.length; i++) {
-                                       object.children.push(this.children[i].toJSON(meta).object);
-                               }
-                       } //
-
-
-                       if (this.animations.length > 0) {
-                               object.animations = [];
-
-                               for (let i = 0; i < this.animations.length; i++) {
-                                       const animation = this.animations[i];
-                                       object.animations.push(serialize(meta.animations, animation));
-                               }
-                       }
-
-                       if (isRootObject) {
-                               const geometries = extractFromCache(meta.geometries);
-                               const materials = extractFromCache(meta.materials);
-                               const textures = extractFromCache(meta.textures);
-                               const images = extractFromCache(meta.images);
-                               const shapes = extractFromCache(meta.shapes);
-                               const skeletons = extractFromCache(meta.skeletons);
-                               const animations = extractFromCache(meta.animations);
-                               if (geometries.length > 0) output.geometries = geometries;
-                               if (materials.length > 0) output.materials = materials;
-                               if (textures.length > 0) output.textures = textures;
-                               if (images.length > 0) output.images = images;
-                               if (shapes.length > 0) output.shapes = shapes;
-                               if (skeletons.length > 0) output.skeletons = skeletons;
-                               if (animations.length > 0) output.animations = animations;
-                       }
-
-                       output.object = object;
-                       return output; // extract data from the cache hash
-                       // remove metadata on each item
-                       // and return as array
-
-                       function extractFromCache(cache) {
-                               const values = [];
-
-                               for (const key in cache) {
-                                       const data = cache[key];
-                                       delete data.metadata;
-                                       values.push(data);
-                               }
-
-                               return values;
-                       }
-               }
-
-               clone(recursive) {
-                       return new this.constructor().copy(this, recursive);
-               }
-
-               copy(source, recursive = true) {
-                       this.name = source.name;
-                       this.up.copy(source.up);
-                       this.position.copy(source.position);
-                       this.rotation.order = source.rotation.order;
-                       this.quaternion.copy(source.quaternion);
-                       this.scale.copy(source.scale);
-                       this.matrix.copy(source.matrix);
-                       this.matrixWorld.copy(source.matrixWorld);
-                       this.matrixAutoUpdate = source.matrixAutoUpdate;
-                       this.matrixWorldNeedsUpdate = source.matrixWorldNeedsUpdate;
-                       this.layers.mask = source.layers.mask;
-                       this.visible = source.visible;
-                       this.castShadow = source.castShadow;
-                       this.receiveShadow = source.receiveShadow;
-                       this.frustumCulled = source.frustumCulled;
-                       this.renderOrder = source.renderOrder;
-                       this.userData = JSON.parse(JSON.stringify(source.userData));
-
-                       if (recursive === true) {
-                               for (let i = 0; i < source.children.length; i++) {
-                                       const child = source.children[i];
-                                       this.add(child.clone());
-                               }
-                       }
-
-                       return this;
-               }
-
-       }
-
-       Object3D.DefaultUp = new Vector3(0, 1, 0);
-       Object3D.DefaultMatrixAutoUpdate = true;
-       Object3D.prototype.isObject3D = true;
-
-       const _v0$1 = /*@__PURE__*/new Vector3();
-
-       const _v1$3 = /*@__PURE__*/new Vector3();
-
-       const _v2$2 = /*@__PURE__*/new Vector3();
-
-       const _v3$1 = /*@__PURE__*/new Vector3();
-
-       const _vab = /*@__PURE__*/new Vector3();
-
-       const _vac = /*@__PURE__*/new Vector3();
-
-       const _vbc = /*@__PURE__*/new Vector3();
-
-       const _vap = /*@__PURE__*/new Vector3();
-
-       const _vbp = /*@__PURE__*/new Vector3();
-
-       const _vcp = /*@__PURE__*/new Vector3();
-
-       class Triangle {
-               constructor(a = new Vector3(), b = new Vector3(), c = new Vector3()) {
-                       this.a = a;
-                       this.b = b;
-                       this.c = c;
-               }
-
-               static getNormal(a, b, c, target) {
-                       target.subVectors(c, b);
-
-                       _v0$1.subVectors(a, b);
-
-                       target.cross(_v0$1);
-                       const targetLengthSq = target.lengthSq();
-
-                       if (targetLengthSq > 0) {
-                               return target.multiplyScalar(1 / Math.sqrt(targetLengthSq));
-                       }
-
-                       return target.set(0, 0, 0);
-               } // static/instance method to calculate barycentric coordinates
-               // based on: http://www.blackpawn.com/texts/pointinpoly/default.html
-
-
-               static getBarycoord(point, a, b, c, target) {
-                       _v0$1.subVectors(c, a);
-
-                       _v1$3.subVectors(b, a);
-
-                       _v2$2.subVectors(point, a);
-
-                       const dot00 = _v0$1.dot(_v0$1);
-
-                       const dot01 = _v0$1.dot(_v1$3);
-
-                       const dot02 = _v0$1.dot(_v2$2);
-
-                       const dot11 = _v1$3.dot(_v1$3);
-
-                       const dot12 = _v1$3.dot(_v2$2);
-
-                       const denom = dot00 * dot11 - dot01 * dot01; // collinear or singular triangle
-
-                       if (denom === 0) {
-                               // arbitrary location outside of triangle?
-                               // not sure if this is the best idea, maybe should be returning undefined
-                               return target.set(-2, -1, -1);
-                       }
-
-                       const invDenom = 1 / denom;
-                       const u = (dot11 * dot02 - dot01 * dot12) * invDenom;
-                       const v = (dot00 * dot12 - dot01 * dot02) * invDenom; // barycentric coordinates must always sum to 1
-
-                       return target.set(1 - u - v, v, u);
-               }
-
-               static containsPoint(point, a, b, c) {
-                       this.getBarycoord(point, a, b, c, _v3$1);
-                       return _v3$1.x >= 0 && _v3$1.y >= 0 && _v3$1.x + _v3$1.y <= 1;
-               }
-
-               static getUV(point, p1, p2, p3, uv1, uv2, uv3, target) {
-                       this.getBarycoord(point, p1, p2, p3, _v3$1);
-                       target.set(0, 0);
-                       target.addScaledVector(uv1, _v3$1.x);
-                       target.addScaledVector(uv2, _v3$1.y);
-                       target.addScaledVector(uv3, _v3$1.z);
-                       return target;
-               }
-
-               static isFrontFacing(a, b, c, direction) {
-                       _v0$1.subVectors(c, b);
-
-                       _v1$3.subVectors(a, b); // strictly front facing
-
-
-                       return _v0$1.cross(_v1$3).dot(direction) < 0 ? true : false;
-               }
-
-               set(a, b, c) {
-                       this.a.copy(a);
-                       this.b.copy(b);
-                       this.c.copy(c);
-                       return this;
-               }
-
-               setFromPointsAndIndices(points, i0, i1, i2) {
-                       this.a.copy(points[i0]);
-                       this.b.copy(points[i1]);
-                       this.c.copy(points[i2]);
-                       return this;
-               }
-
-               clone() {
-                       return new this.constructor().copy(this);
-               }
-
-               copy(triangle) {
-                       this.a.copy(triangle.a);
-                       this.b.copy(triangle.b);
-                       this.c.copy(triangle.c);
-                       return this;
-               }
-
-               getArea() {
-                       _v0$1.subVectors(this.c, this.b);
-
-                       _v1$3.subVectors(this.a, this.b);
-
-                       return _v0$1.cross(_v1$3).length() * 0.5;
-               }
-
-               getMidpoint(target) {
-                       return target.addVectors(this.a, this.b).add(this.c).multiplyScalar(1 / 3);
-               }
-
-               getNormal(target) {
-                       return Triangle.getNormal(this.a, this.b, this.c, target);
-               }
-
-               getPlane(target) {
-                       return target.setFromCoplanarPoints(this.a, this.b, this.c);
-               }
-
-               getBarycoord(point, target) {
-                       return Triangle.getBarycoord(point, this.a, this.b, this.c, target);
-               }
-
-               getUV(point, uv1, uv2, uv3, target) {
-                       return Triangle.getUV(point, this.a, this.b, this.c, uv1, uv2, uv3, target);
-               }
-
-               containsPoint(point) {
-                       return Triangle.containsPoint(point, this.a, this.b, this.c);
-               }
-
-               isFrontFacing(direction) {
-                       return Triangle.isFrontFacing(this.a, this.b, this.c, direction);
-               }
-
-               intersectsBox(box) {
-                       return box.intersectsTriangle(this);
-               }
-
-               closestPointToPoint(p, target) {
-                       const a = this.a,
-                                               b = this.b,
-                                               c = this.c;
-                       let v, w; // algorithm thanks to Real-Time Collision Detection by Christer Ericson,
-                       // published by Morgan Kaufmann Publishers, (c) 2005 Elsevier Inc.,
-                       // under the accompanying license; see chapter 5.1.5 for detailed explanation.
-                       // basically, we're distinguishing which of the voronoi regions of the triangle
-                       // the point lies in with the minimum amount of redundant computation.
-
-                       _vab.subVectors(b, a);
-
-                       _vac.subVectors(c, a);
-
-                       _vap.subVectors(p, a);
-
-                       const d1 = _vab.dot(_vap);
-
-                       const d2 = _vac.dot(_vap);
-
-                       if (d1 <= 0 && d2 <= 0) {
-                               // vertex region of A; barycentric coords (1, 0, 0)
-                               return target.copy(a);
-                       }
-
-                       _vbp.subVectors(p, b);
-
-                       const d3 = _vab.dot(_vbp);
-
-                       const d4 = _vac.dot(_vbp);
-
-                       if (d3 >= 0 && d4 <= d3) {
-                               // vertex region of B; barycentric coords (0, 1, 0)
-                               return target.copy(b);
-                       }
-
-                       const vc = d1 * d4 - d3 * d2;
-
-                       if (vc <= 0 && d1 >= 0 && d3 <= 0) {
-                               v = d1 / (d1 - d3); // edge region of AB; barycentric coords (1-v, v, 0)
-
-                               return target.copy(a).addScaledVector(_vab, v);
-                       }
-
-                       _vcp.subVectors(p, c);
-
-                       const d5 = _vab.dot(_vcp);
-
-                       const d6 = _vac.dot(_vcp);
-
-                       if (d6 >= 0 && d5 <= d6) {
-                               // vertex region of C; barycentric coords (0, 0, 1)
-                               return target.copy(c);
-                       }
-
-                       const vb = d5 * d2 - d1 * d6;
-
-                       if (vb <= 0 && d2 >= 0 && d6 <= 0) {
-                               w = d2 / (d2 - d6); // edge region of AC; barycentric coords (1-w, 0, w)
-
-                               return target.copy(a).addScaledVector(_vac, w);
-                       }
-
-                       const va = d3 * d6 - d5 * d4;
-
-                       if (va <= 0 && d4 - d3 >= 0 && d5 - d6 >= 0) {
-                               _vbc.subVectors(c, b);
-
-                               w = (d4 - d3) / (d4 - d3 + (d5 - d6)); // edge region of BC; barycentric coords (0, 1-w, w)
-
-                               return target.copy(b).addScaledVector(_vbc, w); // edge region of BC
-                       } // face region
-
-
-                       const denom = 1 / (va + vb + vc); // u = va * denom
-
-                       v = vb * denom;
-                       w = vc * denom;
-                       return target.copy(a).addScaledVector(_vab, v).addScaledVector(_vac, w);
-               }
-
-               equals(triangle) {
-                       return triangle.a.equals(this.a) && triangle.b.equals(this.b) && triangle.c.equals(this.c);
-               }
-
-       }
-
-       let materialId = 0;
-
-       class Material extends EventDispatcher {
-               constructor() {
-                       super();
-                       Object.defineProperty(this, 'id', {
-                               value: materialId++
-                       });
-                       this.uuid = generateUUID();
-                       this.name = '';
-                       this.type = 'Material';
-                       this.fog = true;
-                       this.blending = NormalBlending;
-                       this.side = FrontSide;
-                       this.vertexColors = false;
-                       this.opacity = 1;
-                       this.format = RGBAFormat;
-                       this.transparent = false;
-                       this.blendSrc = SrcAlphaFactor;
-                       this.blendDst = OneMinusSrcAlphaFactor;
-                       this.blendEquation = AddEquation;
-                       this.blendSrcAlpha = null;
-                       this.blendDstAlpha = null;
-                       this.blendEquationAlpha = null;
-                       this.depthFunc = LessEqualDepth;
-                       this.depthTest = true;
-                       this.depthWrite = true;
-                       this.stencilWriteMask = 0xff;
-                       this.stencilFunc = AlwaysStencilFunc;
-                       this.stencilRef = 0;
-                       this.stencilFuncMask = 0xff;
-                       this.stencilFail = KeepStencilOp;
-                       this.stencilZFail = KeepStencilOp;
-                       this.stencilZPass = KeepStencilOp;
-                       this.stencilWrite = false;
-                       this.clippingPlanes = null;
-                       this.clipIntersection = false;
-                       this.clipShadows = false;
-                       this.shadowSide = null;
-                       this.colorWrite = true;
-                       this.precision = null; // override the renderer's default precision for this material
-
-                       this.polygonOffset = false;
-                       this.polygonOffsetFactor = 0;
-                       this.polygonOffsetUnits = 0;
-                       this.dithering = false;
-                       this.alphaToCoverage = false;
-                       this.premultipliedAlpha = false;
-                       this.visible = true;
-                       this.toneMapped = true;
-                       this.userData = {};
-                       this.version = 0;
-                       this._alphaTest = 0;
-               }
-
-               get alphaTest() {
-                       return this._alphaTest;
-               }
-
-               set alphaTest(value) {
-                       if (this._alphaTest > 0 !== value > 0) {
-                               this.version++;
-                       }
-
-                       this._alphaTest = value;
-               }
-
-               onBuild() {}
-
-               onBeforeCompile() {}
-
-               customProgramCacheKey() {
-                       return this.onBeforeCompile.toString();
-               }
-
-               setValues(values) {
-                       if (values === undefined) return;
-
-                       for (const key in values) {
-                               const newValue = values[key];
-
-                               if (newValue === undefined) {
-                                       console.warn('THREE.Material: \'' + key + '\' parameter is undefined.');
-                                       continue;
-                               } // for backward compatability if shading is set in the constructor
-
-
-                               if (key === 'shading') {
-                                       console.warn('THREE.' + this.type + ': .shading has been removed. Use the boolean .flatShading instead.');
-                                       this.flatShading = newValue === FlatShading ? true : false;
-                                       continue;
-                               }
-
-                               const currentValue = this[key];
-
-                               if (currentValue === undefined) {
-                                       console.warn('THREE.' + this.type + ': \'' + key + '\' is not a property of this material.');
-                                       continue;
-                               }
-
-                               if (currentValue && currentValue.isColor) {
-                                       currentValue.set(newValue);
-                               } else if (currentValue && currentValue.isVector3 && newValue && newValue.isVector3) {
-                                       currentValue.copy(newValue);
-                               } else {
-                                       this[key] = newValue;
-                               }
-                       }
-               }
-
-               toJSON(meta) {
-                       const isRoot = meta === undefined || typeof meta === 'string';
-
-                       if (isRoot) {
-                               meta = {
-                                       textures: {},
-                                       images: {}
-                               };
-                       }
-
-                       const data = {
-                               metadata: {
-                                       version: 4.5,
-                                       type: 'Material',
-                                       generator: 'Material.toJSON'
-                               }
-                       }; // standard Material serialization
-
-                       data.uuid = this.uuid;
-                       data.type = this.type;
-                       if (this.name !== '') data.name = this.name;
-                       if (this.color && this.color.isColor) data.color = this.color.getHex();
-                       if (this.roughness !== undefined) data.roughness = this.roughness;
-                       if (this.metalness !== undefined) data.metalness = this.metalness;
-                       if (this.sheenTint && this.sheenTint.isColor) data.sheenTint = this.sheenTint.getHex();
-                       if (this.emissive && this.emissive.isColor) data.emissive = this.emissive.getHex();
-                       if (this.emissiveIntensity && this.emissiveIntensity !== 1) data.emissiveIntensity = this.emissiveIntensity;
-                       if (this.specular && this.specular.isColor) data.specular = this.specular.getHex();
-                       if (this.specularIntensity !== undefined) data.specularIntensity = this.specularIntensity;
-                       if (this.specularTint && this.specularTint.isColor) data.specularTint = this.specularTint.getHex();
-                       if (this.shininess !== undefined) data.shininess = this.shininess;
-                       if (this.clearcoat !== undefined) data.clearcoat = this.clearcoat;
-                       if (this.clearcoatRoughness !== undefined) data.clearcoatRoughness = this.clearcoatRoughness;
-
-                       if (this.clearcoatMap && this.clearcoatMap.isTexture) {
-                               data.clearcoatMap = this.clearcoatMap.toJSON(meta).uuid;
-                       }
-
-                       if (this.clearcoatRoughnessMap && this.clearcoatRoughnessMap.isTexture) {
-                               data.clearcoatRoughnessMap = this.clearcoatRoughnessMap.toJSON(meta).uuid;
-                       }
-
-                       if (this.clearcoatNormalMap && this.clearcoatNormalMap.isTexture) {
-                               data.clearcoatNormalMap = this.clearcoatNormalMap.toJSON(meta).uuid;
-                               data.clearcoatNormalScale = this.clearcoatNormalScale.toArray();
-                       }
-
-                       if (this.map && this.map.isTexture) data.map = this.map.toJSON(meta).uuid;
-                       if (this.matcap && this.matcap.isTexture) data.matcap = this.matcap.toJSON(meta).uuid;
-                       if (this.alphaMap && this.alphaMap.isTexture) data.alphaMap = this.alphaMap.toJSON(meta).uuid;
-
-                       if (this.lightMap && this.lightMap.isTexture) {
-                               data.lightMap = this.lightMap.toJSON(meta).uuid;
-                               data.lightMapIntensity = this.lightMapIntensity;
-                       }
-
-                       if (this.aoMap && this.aoMap.isTexture) {
-                               data.aoMap = this.aoMap.toJSON(meta).uuid;
-                               data.aoMapIntensity = this.aoMapIntensity;
-                       }
-
-                       if (this.bumpMap && this.bumpMap.isTexture) {
-                               data.bumpMap = this.bumpMap.toJSON(meta).uuid;
-                               data.bumpScale = this.bumpScale;
-                       }
-
-                       if (this.normalMap && this.normalMap.isTexture) {
-                               data.normalMap = this.normalMap.toJSON(meta).uuid;
-                               data.normalMapType = this.normalMapType;
-                               data.normalScale = this.normalScale.toArray();
-                       }
-
-                       if (this.displacementMap && this.displacementMap.isTexture) {
-                               data.displacementMap = this.displacementMap.toJSON(meta).uuid;
-                               data.displacementScale = this.displacementScale;
-                               data.displacementBias = this.displacementBias;
-                       }
-
-                       if (this.roughnessMap && this.roughnessMap.isTexture) data.roughnessMap = this.roughnessMap.toJSON(meta).uuid;
-                       if (this.metalnessMap && this.metalnessMap.isTexture) data.metalnessMap = this.metalnessMap.toJSON(meta).uuid;
-                       if (this.emissiveMap && this.emissiveMap.isTexture) data.emissiveMap = this.emissiveMap.toJSON(meta).uuid;
-                       if (this.specularMap && this.specularMap.isTexture) data.specularMap = this.specularMap.toJSON(meta).uuid;
-                       if (this.specularIntensityMap && this.specularIntensityMap.isTexture) data.specularIntensityMap = this.specularIntensityMap.toJSON(meta).uuid;
-                       if (this.specularTintMap && this.specularTintMap.isTexture) data.specularTintMap = this.specularTintMap.toJSON(meta).uuid;
-
-                       if (this.envMap && this.envMap.isTexture) {
-                               data.envMap = this.envMap.toJSON(meta).uuid;
-                               if (this.combine !== undefined) data.combine = this.combine;
-                       }
-
-                       if (this.envMapIntensity !== undefined) data.envMapIntensity = this.envMapIntensity;
-                       if (this.reflectivity !== undefined) data.reflectivity = this.reflectivity;
-                       if (this.refractionRatio !== undefined) data.refractionRatio = this.refractionRatio;
-
-                       if (this.gradientMap && this.gradientMap.isTexture) {
-                               data.gradientMap = this.gradientMap.toJSON(meta).uuid;
-                       }
-
-                       if (this.transmission !== undefined) data.transmission = this.transmission;
-                       if (this.transmissionMap && this.transmissionMap.isTexture) data.transmissionMap = this.transmissionMap.toJSON(meta).uuid;
-                       if (this.thickness !== undefined) data.thickness = this.thickness;
-                       if (this.thicknessMap && this.thicknessMap.isTexture) data.thicknessMap = this.thicknessMap.toJSON(meta).uuid;
-                       if (this.attenuationDistance !== undefined) data.attenuationDistance = this.attenuationDistance;
-                       if (this.attenuationTint !== undefined) data.attenuationTint = this.attenuationTint.getHex();
-                       if (this.size !== undefined) data.size = this.size;
-                       if (this.shadowSide !== null) data.shadowSide = this.shadowSide;
-                       if (this.sizeAttenuation !== undefined) data.sizeAttenuation = this.sizeAttenuation;
-                       if (this.blending !== NormalBlending) data.blending = this.blending;
-                       if (this.side !== FrontSide) data.side = this.side;
-                       if (this.vertexColors) data.vertexColors = true;
-                       if (this.opacity < 1) data.opacity = this.opacity;
-                       if (this.format !== RGBAFormat) data.format = this.format;
-                       if (this.transparent === true) data.transparent = this.transparent;
-                       data.depthFunc = this.depthFunc;
-                       data.depthTest = this.depthTest;
-                       data.depthWrite = this.depthWrite;
-                       data.colorWrite = this.colorWrite;
-                       data.stencilWrite = this.stencilWrite;
-                       data.stencilWriteMask = this.stencilWriteMask;
-                       data.stencilFunc = this.stencilFunc;
-                       data.stencilRef = this.stencilRef;
-                       data.stencilFuncMask = this.stencilFuncMask;
-                       data.stencilFail = this.stencilFail;
-                       data.stencilZFail = this.stencilZFail;
-                       data.stencilZPass = this.stencilZPass; // rotation (SpriteMaterial)
-
-                       if (this.rotation && this.rotation !== 0) data.rotation = this.rotation;
-                       if (this.polygonOffset === true) data.polygonOffset = true;
-                       if (this.polygonOffsetFactor !== 0) data.polygonOffsetFactor = this.polygonOffsetFactor;
-                       if (this.polygonOffsetUnits !== 0) data.polygonOffsetUnits = this.polygonOffsetUnits;
-                       if (this.linewidth && this.linewidth !== 1) data.linewidth = this.linewidth;
-                       if (this.dashSize !== undefined) data.dashSize = this.dashSize;
-                       if (this.gapSize !== undefined) data.gapSize = this.gapSize;
-                       if (this.scale !== undefined) data.scale = this.scale;
-                       if (this.dithering === true) data.dithering = true;
-                       if (this.alphaTest > 0) data.alphaTest = this.alphaTest;
-                       if (this.alphaToCoverage === true) data.alphaToCoverage = this.alphaToCoverage;
-                       if (this.premultipliedAlpha === true) data.premultipliedAlpha = this.premultipliedAlpha;
-                       if (this.wireframe === true) data.wireframe = this.wireframe;
-                       if (this.wireframeLinewidth > 1) data.wireframeLinewidth = this.wireframeLinewidth;
-                       if (this.wireframeLinecap !== 'round') data.wireframeLinecap = this.wireframeLinecap;
-                       if (this.wireframeLinejoin !== 'round') data.wireframeLinejoin = this.wireframeLinejoin;
-                       if (this.flatShading === true) data.flatShading = this.flatShading;
-                       if (this.visible === false) data.visible = false;
-                       if (this.toneMapped === false) data.toneMapped = false;
-                       if (JSON.stringify(this.userData) !== '{}') data.userData = this.userData; // TODO: Copied from Object3D.toJSON
-
-                       function extractFromCache(cache) {
-                               const values = [];
-
-                               for (const key in cache) {
-                                       const data = cache[key];
-                                       delete data.metadata;
-                                       values.push(data);
-                               }
-
-                               return values;
-                       }
-
-                       if (isRoot) {
-                               const textures = extractFromCache(meta.textures);
-                               const images = extractFromCache(meta.images);
-                               if (textures.length > 0) data.textures = textures;
-                               if (images.length > 0) data.images = images;
-                       }
-
-                       return data;
-               }
-
-               clone() {
-                       return new this.constructor().copy(this);
-               }
-
-               copy(source) {
-                       this.name = source.name;
-                       this.fog = source.fog;
-                       this.blending = source.blending;
-                       this.side = source.side;
-                       this.vertexColors = source.vertexColors;
-                       this.opacity = source.opacity;
-                       this.format = source.format;
-                       this.transparent = source.transparent;
-                       this.blendSrc = source.blendSrc;
-                       this.blendDst = source.blendDst;
-                       this.blendEquation = source.blendEquation;
-                       this.blendSrcAlpha = source.blendSrcAlpha;
-                       this.blendDstAlpha = source.blendDstAlpha;
-                       this.blendEquationAlpha = source.blendEquationAlpha;
-                       this.depthFunc = source.depthFunc;
-                       this.depthTest = source.depthTest;
-                       this.depthWrite = source.depthWrite;
-                       this.stencilWriteMask = source.stencilWriteMask;
-                       this.stencilFunc = source.stencilFunc;
-                       this.stencilRef = source.stencilRef;
-                       this.stencilFuncMask = source.stencilFuncMask;
-                       this.stencilFail = source.stencilFail;
-                       this.stencilZFail = source.stencilZFail;
-                       this.stencilZPass = source.stencilZPass;
-                       this.stencilWrite = source.stencilWrite;
-                       const srcPlanes = source.clippingPlanes;
-                       let dstPlanes = null;
-
-                       if (srcPlanes !== null) {
-                               const n = srcPlanes.length;
-                               dstPlanes = new Array(n);
-
-                               for (let i = 0; i !== n; ++i) {
-                                       dstPlanes[i] = srcPlanes[i].clone();
-                               }
-                       }
-
-                       this.clippingPlanes = dstPlanes;
-                       this.clipIntersection = source.clipIntersection;
-                       this.clipShadows = source.clipShadows;
-                       this.shadowSide = source.shadowSide;
-                       this.colorWrite = source.colorWrite;
-                       this.precision = source.precision;
-                       this.polygonOffset = source.polygonOffset;
-                       this.polygonOffsetFactor = source.polygonOffsetFactor;
-                       this.polygonOffsetUnits = source.polygonOffsetUnits;
-                       this.dithering = source.dithering;
-                       this.alphaTest = source.alphaTest;
-                       this.alphaToCoverage = source.alphaToCoverage;
-                       this.premultipliedAlpha = source.premultipliedAlpha;
-                       this.visible = source.visible;
-                       this.toneMapped = source.toneMapped;
-                       this.userData = JSON.parse(JSON.stringify(source.userData));
-                       return this;
-               }
-
-               dispose() {
-                       this.dispatchEvent({
-                               type: 'dispose'
-                       });
-               }
-
-               set needsUpdate(value) {
-                       if (value === true) this.version++;
-               }
-
-       }
-
-       Material.prototype.isMaterial = true;
-
-       const _colorKeywords = {
-               'aliceblue': 0xF0F8FF,
-               'antiquewhite': 0xFAEBD7,
-               'aqua': 0x00FFFF,
-               'aquamarine': 0x7FFFD4,
-               'azure': 0xF0FFFF,
-               'beige': 0xF5F5DC,
-               'bisque': 0xFFE4C4,
-               'black': 0x000000,
-               'blanchedalmond': 0xFFEBCD,
-               'blue': 0x0000FF,
-               'blueviolet': 0x8A2BE2,
-               'brown': 0xA52A2A,
-               'burlywood': 0xDEB887,
-               'cadetblue': 0x5F9EA0,
-               'chartreuse': 0x7FFF00,
-               'chocolate': 0xD2691E,
-               'coral': 0xFF7F50,
-               'cornflowerblue': 0x6495ED,
-               'cornsilk': 0xFFF8DC,
-               'crimson': 0xDC143C,
-               'cyan': 0x00FFFF,
-               'darkblue': 0x00008B,
-               'darkcyan': 0x008B8B,
-               'darkgoldenrod': 0xB8860B,
-               'darkgray': 0xA9A9A9,
-               'darkgreen': 0x006400,
-               'darkgrey': 0xA9A9A9,
-               'darkkhaki': 0xBDB76B,
-               'darkmagenta': 0x8B008B,
-               'darkolivegreen': 0x556B2F,
-               'darkorange': 0xFF8C00,
-               'darkorchid': 0x9932CC,
-               'darkred': 0x8B0000,
-               'darksalmon': 0xE9967A,
-               'darkseagreen': 0x8FBC8F,
-               'darkslateblue': 0x483D8B,
-               'darkslategray': 0x2F4F4F,
-               'darkslategrey': 0x2F4F4F,
-               'darkturquoise': 0x00CED1,
-               'darkviolet': 0x9400D3,
-               'deeppink': 0xFF1493,
-               'deepskyblue': 0x00BFFF,
-               'dimgray': 0x696969,
-               'dimgrey': 0x696969,
-               'dodgerblue': 0x1E90FF,
-               'firebrick': 0xB22222,
-               'floralwhite': 0xFFFAF0,
-               'forestgreen': 0x228B22,
-               'fuchsia': 0xFF00FF,
-               'gainsboro': 0xDCDCDC,
-               'ghostwhite': 0xF8F8FF,
-               'gold': 0xFFD700,
-               'goldenrod': 0xDAA520,
-               'gray': 0x808080,
-               'green': 0x008000,
-               'greenyellow': 0xADFF2F,
-               'grey': 0x808080,
-               'honeydew': 0xF0FFF0,
-               'hotpink': 0xFF69B4,
-               'indianred': 0xCD5C5C,
-               'indigo': 0x4B0082,
-               'ivory': 0xFFFFF0,
-               'khaki': 0xF0E68C,
-               'lavender': 0xE6E6FA,
-               'lavenderblush': 0xFFF0F5,
-               'lawngreen': 0x7CFC00,
-               'lemonchiffon': 0xFFFACD,
-               'lightblue': 0xADD8E6,
-               'lightcoral': 0xF08080,
-               'lightcyan': 0xE0FFFF,
-               'lightgoldenrodyellow': 0xFAFAD2,
-               'lightgray': 0xD3D3D3,
-               'lightgreen': 0x90EE90,
-               'lightgrey': 0xD3D3D3,
-               'lightpink': 0xFFB6C1,
-               'lightsalmon': 0xFFA07A,
-               'lightseagreen': 0x20B2AA,
-               'lightskyblue': 0x87CEFA,
-               'lightslategray': 0x778899,
-               'lightslategrey': 0x778899,
-               'lightsteelblue': 0xB0C4DE,
-               'lightyellow': 0xFFFFE0,
-               'lime': 0x00FF00,
-               'limegreen': 0x32CD32,
-               'linen': 0xFAF0E6,
-               'magenta': 0xFF00FF,
-               'maroon': 0x800000,
-               'mediumaquamarine': 0x66CDAA,
-               'mediumblue': 0x0000CD,
-               'mediumorchid': 0xBA55D3,
-               'mediumpurple': 0x9370DB,
-               'mediumseagreen': 0x3CB371,
-               'mediumslateblue': 0x7B68EE,
-               'mediumspringgreen': 0x00FA9A,
-               'mediumturquoise': 0x48D1CC,
-               'mediumvioletred': 0xC71585,
-               'midnightblue': 0x191970,
-               'mintcream': 0xF5FFFA,
-               'mistyrose': 0xFFE4E1,
-               'moccasin': 0xFFE4B5,
-               'navajowhite': 0xFFDEAD,
-               'navy': 0x000080,
-               'oldlace': 0xFDF5E6,
-               'olive': 0x808000,
-               'olivedrab': 0x6B8E23,
-               'orange': 0xFFA500,
-               'orangered': 0xFF4500,
-               'orchid': 0xDA70D6,
-               'palegoldenrod': 0xEEE8AA,
-               'palegreen': 0x98FB98,
-               'paleturquoise': 0xAFEEEE,
-               'palevioletred': 0xDB7093,
-               'papayawhip': 0xFFEFD5,
-               'peachpuff': 0xFFDAB9,
-               'peru': 0xCD853F,
-               'pink': 0xFFC0CB,
-               'plum': 0xDDA0DD,
-               'powderblue': 0xB0E0E6,
-               'purple': 0x800080,
-               'rebeccapurple': 0x663399,
-               'red': 0xFF0000,
-               'rosybrown': 0xBC8F8F,
-               'royalblue': 0x4169E1,
-               'saddlebrown': 0x8B4513,
-               'salmon': 0xFA8072,
-               'sandybrown': 0xF4A460,
-               'seagreen': 0x2E8B57,
-               'seashell': 0xFFF5EE,
-               'sienna': 0xA0522D,
-               'silver': 0xC0C0C0,
-               'skyblue': 0x87CEEB,
-               'slateblue': 0x6A5ACD,
-               'slategray': 0x708090,
-               'slategrey': 0x708090,
-               'snow': 0xFFFAFA,
-               'springgreen': 0x00FF7F,
-               'steelblue': 0x4682B4,
-               'tan': 0xD2B48C,
-               'teal': 0x008080,
-               'thistle': 0xD8BFD8,
-               'tomato': 0xFF6347,
-               'turquoise': 0x40E0D0,
-               'violet': 0xEE82EE,
-               'wheat': 0xF5DEB3,
-               'white': 0xFFFFFF,
-               'whitesmoke': 0xF5F5F5,
-               'yellow': 0xFFFF00,
-               'yellowgreen': 0x9ACD32
-       };
-       const _hslA = {
-               h: 0,
-               s: 0,
-               l: 0
-       };
-       const _hslB = {
-               h: 0,
-               s: 0,
-               l: 0
-       };
-
-       function hue2rgb(p, q, t) {
-               if (t < 0) t += 1;
-               if (t > 1) t -= 1;
-               if (t < 1 / 6) return p + (q - p) * 6 * t;
-               if (t < 1 / 2) return q;
-               if (t < 2 / 3) return p + (q - p) * 6 * (2 / 3 - t);
-               return p;
-       }
-
-       function SRGBToLinear(c) {
-               return c < 0.04045 ? c * 0.0773993808 : Math.pow(c * 0.9478672986 + 0.0521327014, 2.4);
-       }
-
-       function LinearToSRGB(c) {
-               return c < 0.0031308 ? c * 12.92 : 1.055 * Math.pow(c, 0.41666) - 0.055;
-       }
-
-       class Color {
-               constructor(r, g, b) {
-                       if (g === undefined && b === undefined) {
-                               // r is THREE.Color, hex or string
-                               return this.set(r);
-                       }
-
-                       return this.setRGB(r, g, b);
-               }
-
-               set(value) {
-                       if (value && value.isColor) {
-                               this.copy(value);
-                       } else if (typeof value === 'number') {
-                               this.setHex(value);
-                       } else if (typeof value === 'string') {
-                               this.setStyle(value);
-                       }
-
-                       return this;
-               }
-
-               setScalar(scalar) {
-                       this.r = scalar;
-                       this.g = scalar;
-                       this.b = scalar;
-                       return this;
-               }
-
-               setHex(hex) {
-                       hex = Math.floor(hex);
-                       this.r = (hex >> 16 & 255) / 255;
-                       this.g = (hex >> 8 & 255) / 255;
-                       this.b = (hex & 255) / 255;
-                       return this;
-               }
-
-               setRGB(r, g, b) {
-                       this.r = r;
-                       this.g = g;
-                       this.b = b;
-                       return this;
-               }
-
-               setHSL(h, s, l) {
-                       // h,s,l ranges are in 0.0 - 1.0
-                       h = euclideanModulo(h, 1);
-                       s = clamp(s, 0, 1);
-                       l = clamp(l, 0, 1);
-
-                       if (s === 0) {
-                               this.r = this.g = this.b = l;
-                       } else {
-                               const p = l <= 0.5 ? l * (1 + s) : l + s - l * s;
-                               const q = 2 * l - p;
-                               this.r = hue2rgb(q, p, h + 1 / 3);
-                               this.g = hue2rgb(q, p, h);
-                               this.b = hue2rgb(q, p, h - 1 / 3);
-                       }
-
-                       return this;
-               }
-
-               setStyle(style) {
-                       function handleAlpha(string) {
-                               if (string === undefined) return;
-
-                               if (parseFloat(string) < 1) {
-                                       console.warn('THREE.Color: Alpha component of ' + style + ' will be ignored.');
-                               }
-                       }
-
-                       let m;
-
-                       if (m = /^((?:rgb|hsl)a?)\(([^\)]*)\)/.exec(style)) {
-                               // rgb / hsl
-                               let color;
-                               const name = m[1];
-                               const components = m[2];
-
-                               switch (name) {
-                                       case 'rgb':
-                                       case 'rgba':
-                                               if (color = /^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(components)) {
-                                                       // rgb(255,0,0) rgba(255,0,0,0.5)
-                                                       this.r = Math.min(255, parseInt(color[1], 10)) / 255;
-                                                       this.g = Math.min(255, parseInt(color[2], 10)) / 255;
-                                                       this.b = Math.min(255, parseInt(color[3], 10)) / 255;
-                                                       handleAlpha(color[4]);
-                                                       return this;
-                                               }
-
-                                               if (color = /^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(components)) {
-                                                       // rgb(100%,0%,0%) rgba(100%,0%,0%,0.5)
-                                                       this.r = Math.min(100, parseInt(color[1], 10)) / 100;
-                                                       this.g = Math.min(100, parseInt(color[2], 10)) / 100;
-                                                       this.b = Math.min(100, parseInt(color[3], 10)) / 100;
-                                                       handleAlpha(color[4]);
-                                                       return this;
-                                               }
-
-                                               break;
-
-                                       case 'hsl':
-                                       case 'hsla':
-                                               if (color = /^\s*(\d*\.?\d+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(components)) {
-                                                       // hsl(120,50%,50%) hsla(120,50%,50%,0.5)
-                                                       const h = parseFloat(color[1]) / 360;
-                                                       const s = parseInt(color[2], 10) / 100;
-                                                       const l = parseInt(color[3], 10) / 100;
-                                                       handleAlpha(color[4]);
-                                                       return this.setHSL(h, s, l);
-                                               }
-
-                                               break;
-                               }
-                       } else if (m = /^\#([A-Fa-f\d]+)$/.exec(style)) {
-                               // hex color
-                               const hex = m[1];
-                               const size = hex.length;
-
-                               if (size === 3) {
-                                       // #ff0
-                                       this.r = parseInt(hex.charAt(0) + hex.charAt(0), 16) / 255;
-                                       this.g = parseInt(hex.charAt(1) + hex.charAt(1), 16) / 255;
-                                       this.b = parseInt(hex.charAt(2) + hex.charAt(2), 16) / 255;
-                                       return this;
-                               } else if (size === 6) {
-                                       // #ff0000
-                                       this.r = parseInt(hex.charAt(0) + hex.charAt(1), 16) / 255;
-                                       this.g = parseInt(hex.charAt(2) + hex.charAt(3), 16) / 255;
-                                       this.b = parseInt(hex.charAt(4) + hex.charAt(5), 16) / 255;
-                                       return this;
-                               }
-                       }
-
-                       if (style && style.length > 0) {
-                               return this.setColorName(style);
-                       }
-
-                       return this;
-               }
-
-               setColorName(style) {
-                       // color keywords
-                       const hex = _colorKeywords[style.toLowerCase()];
-
-                       if (hex !== undefined) {
-                               // red
-                               this.setHex(hex);
-                       } else {
-                               // unknown color
-                               console.warn('THREE.Color: Unknown color ' + style);
-                       }
-
-                       return this;
-               }
-
-               clone() {
-                       return new this.constructor(this.r, this.g, this.b);
-               }
-
-               copy(color) {
-                       this.r = color.r;
-                       this.g = color.g;
-                       this.b = color.b;
-                       return this;
-               }
-
-               copyGammaToLinear(color, gammaFactor = 2.0) {
-                       this.r = Math.pow(color.r, gammaFactor);
-                       this.g = Math.pow(color.g, gammaFactor);
-                       this.b = Math.pow(color.b, gammaFactor);
-                       return this;
-               }
-
-               copyLinearToGamma(color, gammaFactor = 2.0) {
-                       const safeInverse = gammaFactor > 0 ? 1.0 / gammaFactor : 1.0;
-                       this.r = Math.pow(color.r, safeInverse);
-                       this.g = Math.pow(color.g, safeInverse);
-                       this.b = Math.pow(color.b, safeInverse);
-                       return this;
-               }
-
-               convertGammaToLinear(gammaFactor) {
-                       this.copyGammaToLinear(this, gammaFactor);
-                       return this;
-               }
-
-               convertLinearToGamma(gammaFactor) {
-                       this.copyLinearToGamma(this, gammaFactor);
-                       return this;
-               }
-
-               copySRGBToLinear(color) {
-                       this.r = SRGBToLinear(color.r);
-                       this.g = SRGBToLinear(color.g);
-                       this.b = SRGBToLinear(color.b);
-                       return this;
-               }
-
-               copyLinearToSRGB(color) {
-                       this.r = LinearToSRGB(color.r);
-                       this.g = LinearToSRGB(color.g);
-                       this.b = LinearToSRGB(color.b);
-                       return this;
-               }
-
-               convertSRGBToLinear() {
-                       this.copySRGBToLinear(this);
-                       return this;
-               }
-
-               convertLinearToSRGB() {
-                       this.copyLinearToSRGB(this);
-                       return this;
-               }
-
-               getHex() {
-                       return this.r * 255 << 16 ^ this.g * 255 << 8 ^ this.b * 255 << 0;
-               }
-
-               getHexString() {
-                       return ('000000' + this.getHex().toString(16)).slice(-6);
-               }
-
-               getHSL(target) {
-                       // h,s,l ranges are in 0.0 - 1.0
-                       const r = this.r,
-                                               g = this.g,
-                                               b = this.b;
-                       const max = Math.max(r, g, b);
-                       const min = Math.min(r, g, b);
-                       let hue, saturation;
-                       const lightness = (min + max) / 2.0;
-
-                       if (min === max) {
-                               hue = 0;
-                               saturation = 0;
-                       } else {
-                               const delta = max - min;
-                               saturation = lightness <= 0.5 ? delta / (max + min) : delta / (2 - max - min);
-
-                               switch (max) {
-                                       case r:
-                                               hue = (g - b) / delta + (g < b ? 6 : 0);
-                                               break;
-
-                                       case g:
-                                               hue = (b - r) / delta + 2;
-                                               break;
-
-                                       case b:
-                                               hue = (r - g) / delta + 4;
-                                               break;
-                               }
-
-                               hue /= 6;
-                       }
-
-                       target.h = hue;
-                       target.s = saturation;
-                       target.l = lightness;
-                       return target;
-               }
-
-               getStyle() {
-                       return 'rgb(' + (this.r * 255 | 0) + ',' + (this.g * 255 | 0) + ',' + (this.b * 255 | 0) + ')';
-               }
-
-               offsetHSL(h, s, l) {
-                       this.getHSL(_hslA);
-                       _hslA.h += h;
-                       _hslA.s += s;
-                       _hslA.l += l;
-                       this.setHSL(_hslA.h, _hslA.s, _hslA.l);
-                       return this;
-               }
-
-               add(color) {
-                       this.r += color.r;
-                       this.g += color.g;
-                       this.b += color.b;
-                       return this;
-               }
-
-               addColors(color1, color2) {
-                       this.r = color1.r + color2.r;
-                       this.g = color1.g + color2.g;
-                       this.b = color1.b + color2.b;
-                       return this;
-               }
-
-               addScalar(s) {
-                       this.r += s;
-                       this.g += s;
-                       this.b += s;
-                       return this;
-               }
-
-               sub(color) {
-                       this.r = Math.max(0, this.r - color.r);
-                       this.g = Math.max(0, this.g - color.g);
-                       this.b = Math.max(0, this.b - color.b);
-                       return this;
-               }
-
-               multiply(color) {
-                       this.r *= color.r;
-                       this.g *= color.g;
-                       this.b *= color.b;
-                       return this;
-               }
-
-               multiplyScalar(s) {
-                       this.r *= s;
-                       this.g *= s;
-                       this.b *= s;
-                       return this;
-               }
-
-               lerp(color, alpha) {
-                       this.r += (color.r - this.r) * alpha;
-                       this.g += (color.g - this.g) * alpha;
-                       this.b += (color.b - this.b) * alpha;
-                       return this;
-               }
-
-               lerpColors(color1, color2, alpha) {
-                       this.r = color1.r + (color2.r - color1.r) * alpha;
-                       this.g = color1.g + (color2.g - color1.g) * alpha;
-                       this.b = color1.b + (color2.b - color1.b) * alpha;
-                       return this;
-               }
-
-               lerpHSL(color, alpha) {
-                       this.getHSL(_hslA);
-                       color.getHSL(_hslB);
-                       const h = lerp(_hslA.h, _hslB.h, alpha);
-                       const s = lerp(_hslA.s, _hslB.s, alpha);
-                       const l = lerp(_hslA.l, _hslB.l, alpha);
-                       this.setHSL(h, s, l);
-                       return this;
-               }
-
-               equals(c) {
-                       return c.r === this.r && c.g === this.g && c.b === this.b;
-               }
-
-               fromArray(array, offset = 0) {
-                       this.r = array[offset];
-                       this.g = array[offset + 1];
-                       this.b = array[offset + 2];
-                       return this;
-               }
-
-               toArray(array = [], offset = 0) {
-                       array[offset] = this.r;
-                       array[offset + 1] = this.g;
-                       array[offset + 2] = this.b;
-                       return array;
-               }
-
-               fromBufferAttribute(attribute, index) {
-                       this.r = attribute.getX(index);
-                       this.g = attribute.getY(index);
-                       this.b = attribute.getZ(index);
-
-                       if (attribute.normalized === true) {
-                               // assuming Uint8Array
-                               this.r /= 255;
-                               this.g /= 255;
-                               this.b /= 255;
-                       }
-
-                       return this;
-               }
-
-               toJSON() {
-                       return this.getHex();
-               }
-
-       }
-
-       Color.NAMES = _colorKeywords;
-       Color.prototype.isColor = true;
-       Color.prototype.r = 1;
-       Color.prototype.g = 1;
-       Color.prototype.b = 1;
-
-       /**
-        * parameters = {
-        *      color: <hex>,
-        *      opacity: <float>,
-        *      map: new THREE.Texture( <Image> ),
-        *
-        *      lightMap: new THREE.Texture( <Image> ),
-        *      lightMapIntensity: <float>
-        *
-        *      aoMap: new THREE.Texture( <Image> ),
-        *      aoMapIntensity: <float>
-        *
-        *      specularMap: new THREE.Texture( <Image> ),
-        *
-        *      alphaMap: new THREE.Texture( <Image> ),
-        *
-        *      envMap: new THREE.CubeTexture( [posx, negx, posy, negy, posz, negz] ),
-        *      combine: THREE.Multiply,
-        *      reflectivity: <float>,
-        *      refractionRatio: <float>,
-        *
-        *      depthTest: <bool>,
-        *      depthWrite: <bool>,
-        *
-        *      wireframe: <boolean>,
-        *      wireframeLinewidth: <float>,
-        * }
-        */
-
-       class MeshBasicMaterial extends Material {
-               constructor(parameters) {
-                       super();
-                       this.type = 'MeshBasicMaterial';
-                       this.color = new Color(0xffffff); // emissive
-
-                       this.map = null;
-                       this.lightMap = null;
-                       this.lightMapIntensity = 1.0;
-                       this.aoMap = null;
-                       this.aoMapIntensity = 1.0;
-                       this.specularMap = null;
-                       this.alphaMap = null;
-                       this.envMap = null;
-                       this.combine = MultiplyOperation;
-                       this.reflectivity = 1;
-                       this.refractionRatio = 0.98;
-                       this.wireframe = false;
-                       this.wireframeLinewidth = 1;
-                       this.wireframeLinecap = 'round';
-                       this.wireframeLinejoin = 'round';
-                       this.setValues(parameters);
-               }
-
-               copy(source) {
-                       super.copy(source);
-                       this.color.copy(source.color);
-                       this.map = source.map;
-                       this.lightMap = source.lightMap;
-                       this.lightMapIntensity = source.lightMapIntensity;
-                       this.aoMap = source.aoMap;
-                       this.aoMapIntensity = source.aoMapIntensity;
-                       this.specularMap = source.specularMap;
-                       this.alphaMap = source.alphaMap;
-                       this.envMap = source.envMap;
-                       this.combine = source.combine;
-                       this.reflectivity = source.reflectivity;
-                       this.refractionRatio = source.refractionRatio;
-                       this.wireframe = source.wireframe;
-                       this.wireframeLinewidth = source.wireframeLinewidth;
-                       this.wireframeLinecap = source.wireframeLinecap;
-                       this.wireframeLinejoin = source.wireframeLinejoin;
-                       return this;
-               }
-
-       }
-
-       MeshBasicMaterial.prototype.isMeshBasicMaterial = true;
-
-       const _vector$9 = /*@__PURE__*/new Vector3();
-
-       const _vector2$1 = /*@__PURE__*/new Vector2();
-
-       class BufferAttribute {
-               constructor(array, itemSize, normalized) {
-                       if (Array.isArray(array)) {
-                               throw new TypeError('THREE.BufferAttribute: array should be a Typed Array.');
-                       }
-
-                       this.name = '';
-                       this.array = array;
-                       this.itemSize = itemSize;
-                       this.count = array !== undefined ? array.length / itemSize : 0;
-                       this.normalized = normalized === true;
-                       this.usage = StaticDrawUsage;
-                       this.updateRange = {
-                               offset: 0,
-                               count: -1
-                       };
-                       this.version = 0;
-               }
-
-               onUploadCallback() {}
-
-               set needsUpdate(value) {
-                       if (value === true) this.version++;
-               }
-
-               setUsage(value) {
-                       this.usage = value;
-                       return this;
-               }
-
-               copy(source) {
-                       this.name = source.name;
-                       this.array = new source.array.constructor(source.array);
-                       this.itemSize = source.itemSize;
-                       this.count = source.count;
-                       this.normalized = source.normalized;
-                       this.usage = source.usage;
-                       return this;
-               }
-
-               copyAt(index1, attribute, index2) {
-                       index1 *= this.itemSize;
-                       index2 *= attribute.itemSize;
-
-                       for (let i = 0, l = this.itemSize; i < l; i++) {
-                               this.array[index1 + i] = attribute.array[index2 + i];
-                       }
-
-                       return this;
-               }
-
-               copyArray(array) {
-                       this.array.set(array);
-                       return this;
-               }
-
-               copyColorsArray(colors) {
-                       const array = this.array;
-                       let offset = 0;
-
-                       for (let i = 0, l = colors.length; i < l; i++) {
-                               let color = colors[i];
-
-                               if (color === undefined) {
-                                       console.warn('THREE.BufferAttribute.copyColorsArray(): color is undefined', i);
-                                       color = new Color();
-                               }
-
-                               array[offset++] = color.r;
-                               array[offset++] = color.g;
-                               array[offset++] = color.b;
-                       }
-
-                       return this;
-               }
-
-               copyVector2sArray(vectors) {
-                       const array = this.array;
-                       let offset = 0;
-
-                       for (let i = 0, l = vectors.length; i < l; i++) {
-                               let vector = vectors[i];
-
-                               if (vector === undefined) {
-                                       console.warn('THREE.BufferAttribute.copyVector2sArray(): vector is undefined', i);
-                                       vector = new Vector2();
-                               }
-
-                               array[offset++] = vector.x;
-                               array[offset++] = vector.y;
-                       }
-
-                       return this;
-               }
-
-               copyVector3sArray(vectors) {
-                       const array = this.array;
-                       let offset = 0;
-
-                       for (let i = 0, l = vectors.length; i < l; i++) {
-                               let vector = vectors[i];
-
-                               if (vector === undefined) {
-                                       console.warn('THREE.BufferAttribute.copyVector3sArray(): vector is undefined', i);
-                                       vector = new Vector3();
-                               }
-
-                               array[offset++] = vector.x;
-                               array[offset++] = vector.y;
-                               array[offset++] = vector.z;
-                       }
-
-                       return this;
-               }
-
-               copyVector4sArray(vectors) {
-                       const array = this.array;
-                       let offset = 0;
-
-                       for (let i = 0, l = vectors.length; i < l; i++) {
-                               let vector = vectors[i];
-
-                               if (vector === undefined) {
-                                       console.warn('THREE.BufferAttribute.copyVector4sArray(): vector is undefined', i);
-                                       vector = new Vector4();
-                               }
-
-                               array[offset++] = vector.x;
-                               array[offset++] = vector.y;
-                               array[offset++] = vector.z;
-                               array[offset++] = vector.w;
-                       }
-
-                       return this;
-               }
-
-               applyMatrix3(m) {
-                       if (this.itemSize === 2) {
-                               for (let i = 0, l = this.count; i < l; i++) {
-                                       _vector2$1.fromBufferAttribute(this, i);
-
-                                       _vector2$1.applyMatrix3(m);
-
-                                       this.setXY(i, _vector2$1.x, _vector2$1.y);
-                               }
-                       } else if (this.itemSize === 3) {
-                               for (let i = 0, l = this.count; i < l; i++) {
-                                       _vector$9.fromBufferAttribute(this, i);
-
-                                       _vector$9.applyMatrix3(m);
-
-                                       this.setXYZ(i, _vector$9.x, _vector$9.y, _vector$9.z);
-                               }
-                       }
-
-                       return this;
-               }
-
-               applyMatrix4(m) {
-                       for (let i = 0, l = this.count; i < l; i++) {
-                               _vector$9.x = this.getX(i);
-                               _vector$9.y = this.getY(i);
-                               _vector$9.z = this.getZ(i);
-
-                               _vector$9.applyMatrix4(m);
-
-                               this.setXYZ(i, _vector$9.x, _vector$9.y, _vector$9.z);
-                       }
-
-                       return this;
-               }
-
-               applyNormalMatrix(m) {
-                       for (let i = 0, l = this.count; i < l; i++) {
-                               _vector$9.x = this.getX(i);
-                               _vector$9.y = this.getY(i);
-                               _vector$9.z = this.getZ(i);
-
-                               _vector$9.applyNormalMatrix(m);
-
-                               this.setXYZ(i, _vector$9.x, _vector$9.y, _vector$9.z);
-                       }
-
-                       return this;
-               }
-
-               transformDirection(m) {
-                       for (let i = 0, l = this.count; i < l; i++) {
-                               _vector$9.x = this.getX(i);
-                               _vector$9.y = this.getY(i);
-                               _vector$9.z = this.getZ(i);
-
-                               _vector$9.transformDirection(m);
-
-                               this.setXYZ(i, _vector$9.x, _vector$9.y, _vector$9.z);
-                       }
-
-                       return this;
-               }
-
-               set(value, offset = 0) {
-                       this.array.set(value, offset);
-                       return this;
-               }
-
-               getX(index) {
-                       return this.array[index * this.itemSize];
-               }
-
-               setX(index, x) {
-                       this.array[index * this.itemSize] = x;
-                       return this;
-               }
-
-               getY(index) {
-                       return this.array[index * this.itemSize + 1];
-               }
-
-               setY(index, y) {
-                       this.array[index * this.itemSize + 1] = y;
-                       return this;
-               }
-
-               getZ(index) {
-                       return this.array[index * this.itemSize + 2];
-               }
-
-               setZ(index, z) {
-                       this.array[index * this.itemSize + 2] = z;
-                       return this;
-               }
-
-               getW(index) {
-                       return this.array[index * this.itemSize + 3];
-               }
-
-               setW(index, w) {
-                       this.array[index * this.itemSize + 3] = w;
-                       return this;
-               }
-
-               setXY(index, x, y) {
-                       index *= this.itemSize;
-                       this.array[index + 0] = x;
-                       this.array[index + 1] = y;
-                       return this;
-               }
-
-               setXYZ(index, x, y, z) {
-                       index *= this.itemSize;
-                       this.array[index + 0] = x;
-                       this.array[index + 1] = y;
-                       this.array[index + 2] = z;
-                       return this;
-               }
-
-               setXYZW(index, x, y, z, w) {
-                       index *= this.itemSize;
-                       this.array[index + 0] = x;
-                       this.array[index + 1] = y;
-                       this.array[index + 2] = z;
-                       this.array[index + 3] = w;
-                       return this;
-               }
-
-               onUpload(callback) {
-                       this.onUploadCallback = callback;
-                       return this;
-               }
-
-               clone() {
-                       return new this.constructor(this.array, this.itemSize).copy(this);
-               }
-
-               toJSON() {
-                       const data = {
-                               itemSize: this.itemSize,
-                               type: this.array.constructor.name,
-                               array: Array.prototype.slice.call(this.array),
-                               normalized: this.normalized
-                       };
-                       if (this.name !== '') data.name = this.name;
-                       if (this.usage !== StaticDrawUsage) data.usage = this.usage;
-                       if (this.updateRange.offset !== 0 || this.updateRange.count !== -1) data.updateRange = this.updateRange;
-                       return data;
-               }
-
-       }
-
-       BufferAttribute.prototype.isBufferAttribute = true; //
-
-       class Int8BufferAttribute extends BufferAttribute {
-               constructor(array, itemSize, normalized) {
-                       super(new Int8Array(array), itemSize, normalized);
-               }
-
-       }
-
-       class Uint8BufferAttribute extends BufferAttribute {
-               constructor(array, itemSize, normalized) {
-                       super(new Uint8Array(array), itemSize, normalized);
-               }
-
-       }
-
-       class Uint8ClampedBufferAttribute extends BufferAttribute {
-               constructor(array, itemSize, normalized) {
-                       super(new Uint8ClampedArray(array), itemSize, normalized);
-               }
-
-       }
-
-       class Int16BufferAttribute extends BufferAttribute {
-               constructor(array, itemSize, normalized) {
-                       super(new Int16Array(array), itemSize, normalized);
-               }
-
-       }
-
-       class Uint16BufferAttribute extends BufferAttribute {
-               constructor(array, itemSize, normalized) {
-                       super(new Uint16Array(array), itemSize, normalized);
-               }
-
-       }
-
-       class Int32BufferAttribute extends BufferAttribute {
-               constructor(array, itemSize, normalized) {
-                       super(new Int32Array(array), itemSize, normalized);
-               }
-
-       }
-
-       class Uint32BufferAttribute extends BufferAttribute {
-               constructor(array, itemSize, normalized) {
-                       super(new Uint32Array(array), itemSize, normalized);
-               }
-
-       }
-
-       class Float16BufferAttribute extends BufferAttribute {
-               constructor(array, itemSize, normalized) {
-                       super(new Uint16Array(array), itemSize, normalized);
-               }
-
-       }
-
-       Float16BufferAttribute.prototype.isFloat16BufferAttribute = true;
-
-       class Float32BufferAttribute extends BufferAttribute {
-               constructor(array, itemSize, normalized) {
-                       super(new Float32Array(array), itemSize, normalized);
-               }
-
-       }
-
-       class Float64BufferAttribute extends BufferAttribute {
-               constructor(array, itemSize, normalized) {
-                       super(new Float64Array(array), itemSize, normalized);
-               }
-
-       } //
-
-       function arrayMax(array) {
-               if (array.length === 0) return -Infinity;
-               let max = array[0];
-
-               for (let i = 1, l = array.length; i < l; ++i) {
-                       if (array[i] > max) max = array[i];
-               }
-
-               return max;
-       }
-
-       const TYPED_ARRAYS = {
-               Int8Array: Int8Array,
-               Uint8Array: Uint8Array,
-               Uint8ClampedArray: Uint8ClampedArray,
-               Int16Array: Int16Array,
-               Uint16Array: Uint16Array,
-               Int32Array: Int32Array,
-               Uint32Array: Uint32Array,
-               Float32Array: Float32Array,
-               Float64Array: Float64Array
-       };
-
-       function getTypedArray(type, buffer) {
-               return new TYPED_ARRAYS[type](buffer);
-       }
-
-       let _id = 0;
-
-       const _m1 = /*@__PURE__*/new Matrix4();
-
-       const _obj = /*@__PURE__*/new Object3D();
-
-       const _offset = /*@__PURE__*/new Vector3();
-
-       const _box$1 = /*@__PURE__*/new Box3();
-
-       const _boxMorphTargets = /*@__PURE__*/new Box3();
-
-       const _vector$8 = /*@__PURE__*/new Vector3();
-
-       class BufferGeometry extends EventDispatcher {
-               constructor() {
-                       super();
-                       Object.defineProperty(this, 'id', {
-                               value: _id++
-                       });
-                       this.uuid = generateUUID();
-                       this.name = '';
-                       this.type = 'BufferGeometry';
-                       this.index = null;
-                       this.attributes = {};
-                       this.morphAttributes = {};
-                       this.morphTargetsRelative = false;
-                       this.groups = [];
-                       this.boundingBox = null;
-                       this.boundingSphere = null;
-                       this.drawRange = {
-                               start: 0,
-                               count: Infinity
-                       };
-                       this.userData = {};
-               }
-
-               getIndex() {
-                       return this.index;
-               }
-
-               setIndex(index) {
-                       if (Array.isArray(index)) {
-                               this.index = new (arrayMax(index) > 65535 ? Uint32BufferAttribute : Uint16BufferAttribute)(index, 1);
-                       } else {
-                               this.index = index;
-                       }
-
-                       return this;
-               }
-
-               getAttribute(name) {
-                       return this.attributes[name];
-               }
-
-               setAttribute(name, attribute) {
-                       this.attributes[name] = attribute;
-                       return this;
-               }
-
-               deleteAttribute(name) {
-                       delete this.attributes[name];
-                       return this;
-               }
-
-               hasAttribute(name) {
-                       return this.attributes[name] !== undefined;
-               }
-
-               addGroup(start, count, materialIndex = 0) {
-                       this.groups.push({
-                               start: start,
-                               count: count,
-                               materialIndex: materialIndex
-                       });
-               }
-
-               clearGroups() {
-                       this.groups = [];
-               }
-
-               setDrawRange(start, count) {
-                       this.drawRange.start = start;
-                       this.drawRange.count = count;
-               }
-
-               applyMatrix4(matrix) {
-                       const position = this.attributes.position;
-
-                       if (position !== undefined) {
-                               position.applyMatrix4(matrix);
-                               position.needsUpdate = true;
-                       }
-
-                       const normal = this.attributes.normal;
-
-                       if (normal !== undefined) {
-                               const normalMatrix = new Matrix3().getNormalMatrix(matrix);
-                               normal.applyNormalMatrix(normalMatrix);
-                               normal.needsUpdate = true;
-                       }
-
-                       const tangent = this.attributes.tangent;
-
-                       if (tangent !== undefined) {
-                               tangent.transformDirection(matrix);
-                               tangent.needsUpdate = true;
-                       }
-
-                       if (this.boundingBox !== null) {
-                               this.computeBoundingBox();
-                       }
-
-                       if (this.boundingSphere !== null) {
-                               this.computeBoundingSphere();
-                       }
-
-                       return this;
-               }
-
-               applyQuaternion(q) {
-                       _m1.makeRotationFromQuaternion(q);
-
-                       this.applyMatrix4(_m1);
-                       return this;
-               }
-
-               rotateX(angle) {
-                       // rotate geometry around world x-axis
-                       _m1.makeRotationX(angle);
-
-                       this.applyMatrix4(_m1);
-                       return this;
-               }
-
-               rotateY(angle) {
-                       // rotate geometry around world y-axis
-                       _m1.makeRotationY(angle);
-
-                       this.applyMatrix4(_m1);
-                       return this;
-               }
-
-               rotateZ(angle) {
-                       // rotate geometry around world z-axis
-                       _m1.makeRotationZ(angle);
-
-                       this.applyMatrix4(_m1);
-                       return this;
-               }
-
-               translate(x, y, z) {
-                       // translate geometry
-                       _m1.makeTranslation(x, y, z);
-
-                       this.applyMatrix4(_m1);
-                       return this;
-               }
-
-               scale(x, y, z) {
-                       // scale geometry
-                       _m1.makeScale(x, y, z);
-
-                       this.applyMatrix4(_m1);
-                       return this;
-               }
-
-               lookAt(vector) {
-                       _obj.lookAt(vector);
-
-                       _obj.updateMatrix();
-
-                       this.applyMatrix4(_obj.matrix);
-                       return this;
-               }
-
-               center() {
-                       this.computeBoundingBox();
-                       this.boundingBox.getCenter(_offset).negate();
-                       this.translate(_offset.x, _offset.y, _offset.z);
-                       return this;
-               }
-
-               setFromPoints(points) {
-                       const position = [];
-
-                       for (let i = 0, l = points.length; i < l; i++) {
-                               const point = points[i];
-                               position.push(point.x, point.y, point.z || 0);
-                       }
-
-                       this.setAttribute('position', new Float32BufferAttribute(position, 3));
-                       return this;
-               }
-
-               computeBoundingBox() {
-                       if (this.boundingBox === null) {
-                               this.boundingBox = new Box3();
-                       }
-
-                       const position = this.attributes.position;
-                       const morphAttributesPosition = this.morphAttributes.position;
-
-                       if (position && position.isGLBufferAttribute) {
-                               console.error('THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box. Alternatively set "mesh.frustumCulled" to "false".', this);
-                               this.boundingBox.set(new Vector3(-Infinity, -Infinity, -Infinity), new Vector3(+Infinity, +Infinity, +Infinity));
-                               return;
-                       }
-
-                       if (position !== undefined) {
-                               this.boundingBox.setFromBufferAttribute(position); // process morph attributes if present
-
-                               if (morphAttributesPosition) {
-                                       for (let i = 0, il = morphAttributesPosition.length; i < il; i++) {
-                                               const morphAttribute = morphAttributesPosition[i];
-
-                                               _box$1.setFromBufferAttribute(morphAttribute);
-
-                                               if (this.morphTargetsRelative) {
-                                                       _vector$8.addVectors(this.boundingBox.min, _box$1.min);
-
-                                                       this.boundingBox.expandByPoint(_vector$8);
-
-                                                       _vector$8.addVectors(this.boundingBox.max, _box$1.max);
-
-                                                       this.boundingBox.expandByPoint(_vector$8);
-                                               } else {
-                                                       this.boundingBox.expandByPoint(_box$1.min);
-                                                       this.boundingBox.expandByPoint(_box$1.max);
-                                               }
-                                       }
-                               }
-                       } else {
-                               this.boundingBox.makeEmpty();
-                       }
-
-                       if (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() {
-                       if (this.boundingSphere === null) {
-                               this.boundingSphere = new Sphere();
-                       }
-
-                       const position = this.attributes.position;
-                       const morphAttributesPosition = this.morphAttributes.position;
-
-                       if (position && position.isGLBufferAttribute) {
-                               console.error('THREE.BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere. Alternatively set "mesh.frustumCulled" to "false".', this);
-                               this.boundingSphere.set(new Vector3(), Infinity);
-                               return;
-                       }
-
-                       if (position) {
-                               // first, find the center of the bounding sphere
-                               const center = this.boundingSphere.center;
-
-                               _box$1.setFromBufferAttribute(position); // process morph attributes if present
-
-
-                               if (morphAttributesPosition) {
-                                       for (let i = 0, il = morphAttributesPosition.length; i < il; i++) {
-                                               const morphAttribute = morphAttributesPosition[i];
-
-                                               _boxMorphTargets.setFromBufferAttribute(morphAttribute);
-
-                                               if (this.morphTargetsRelative) {
-                                                       _vector$8.addVectors(_box$1.min, _boxMorphTargets.min);
-
-                                                       _box$1.expandByPoint(_vector$8);
-
-                                                       _vector$8.addVectors(_box$1.max, _boxMorphTargets.max);
-
-                                                       _box$1.expandByPoint(_vector$8);
-                                               } else {
-                                                       _box$1.expandByPoint(_boxMorphTargets.min);
-
-                                                       _box$1.expandByPoint(_boxMorphTargets.max);
-                                               }
-                                       }
-                               }
-
-                               _box$1.getCenter(center); // second, try to find a boundingSphere with a radius smaller than the
-                               // boundingSphere of the boundingBox: sqrt(3) smaller in the best case
-
-
-                               let maxRadiusSq = 0;
-
-                               for (let i = 0, il = position.count; i < il; i++) {
-                                       _vector$8.fromBufferAttribute(position, i);
-
-                                       maxRadiusSq = Math.max(maxRadiusSq, center.distanceToSquared(_vector$8));
-                               } // process morph attributes if present
-
-
-                               if (morphAttributesPosition) {
-                                       for (let i = 0, il = morphAttributesPosition.length; i < il; i++) {
-                                               const morphAttribute = morphAttributesPosition[i];
-                                               const morphTargetsRelative = this.morphTargetsRelative;
-
-                                               for (let j = 0, jl = morphAttribute.count; j < jl; j++) {
-                                                       _vector$8.fromBufferAttribute(morphAttribute, j);
-
-                                                       if (morphTargetsRelative) {
-                                                               _offset.fromBufferAttribute(position, j);
-
-                                                               _vector$8.add(_offset);
-                                                       }
-
-                                                       maxRadiusSq = Math.max(maxRadiusSq, center.distanceToSquared(_vector$8));
-                                               }
-                                       }
-                               }
-
-                               this.boundingSphere.radius = Math.sqrt(maxRadiusSq);
-
-                               if (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 index = this.index;
-                       const attributes = this.attributes; // based on http://www.terathon.com/code/tangent.html
-                       // (per vertex tangents)
-
-                       if (index === null || attributes.position === undefined || attributes.normal === undefined || attributes.uv === undefined) {
-                               console.error('THREE.BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)');
-                               return;
-                       }
-
-                       const indices = index.array;
-                       const positions = attributes.position.array;
-                       const normals = attributes.normal.array;
-                       const uvs = attributes.uv.array;
-                       const nVertices = positions.length / 3;
-
-                       if (attributes.tangent === undefined) {
-                               this.setAttribute('tangent', new BufferAttribute(new Float32Array(4 * nVertices), 4));
-                       }
-
-                       const tangents = attributes.tangent.array;
-                       const tan1 = [],
-                                               tan2 = [];
-
-                       for (let i = 0; i < nVertices; i++) {
-                               tan1[i] = new Vector3();
-                               tan2[i] = new Vector3();
-                       }
-
-                       const vA = new Vector3(),
-                                               vB = new Vector3(),
-                                               vC = new Vector3(),
-                                               uvA = new Vector2(),
-                                               uvB = new Vector2(),
-                                               uvC = new Vector2(),
-                                               sdir = new Vector3(),
-                                               tdir = new Vector3();
-
-                       function handleTriangle(a, b, c) {
-                               vA.fromArray(positions, a * 3);
-                               vB.fromArray(positions, b * 3);
-                               vC.fromArray(positions, c * 3);
-                               uvA.fromArray(uvs, a * 2);
-                               uvB.fromArray(uvs, b * 2);
-                               uvC.fromArray(uvs, c * 2);
-                               vB.sub(vA);
-                               vC.sub(vA);
-                               uvB.sub(uvA);
-                               uvC.sub(uvA);
-                               const r = 1.0 / (uvB.x * uvC.y - uvC.x * uvB.y); // silently ignore degenerate uv triangles having coincident or colinear vertices
-
-                               if (!isFinite(r)) return;
-                               sdir.copy(vB).multiplyScalar(uvC.y).addScaledVector(vC, -uvB.y).multiplyScalar(r);
-                               tdir.copy(vC).multiplyScalar(uvB.x).addScaledVector(vB, -uvC.x).multiplyScalar(r);
-                               tan1[a].add(sdir);
-                               tan1[b].add(sdir);
-                               tan1[c].add(sdir);
-                               tan2[a].add(tdir);
-                               tan2[b].add(tdir);
-                               tan2[c].add(tdir);
-                       }
-
-                       let groups = this.groups;
-
-                       if (groups.length === 0) {
-                               groups = [{
-                                       start: 0,
-                                       count: indices.length
-                               }];
-                       }
-
-                       for (let i = 0, il = groups.length; i < il; ++i) {
-                               const group = groups[i];
-                               const start = group.start;
-                               const count = group.count;
-
-                               for (let j = start, jl = start + count; j < jl; j += 3) {
-                                       handleTriangle(indices[j + 0], indices[j + 1], indices[j + 2]);
-                               }
-                       }
-
-                       const tmp = new Vector3(),
-                                               tmp2 = new Vector3();
-                       const n = new Vector3(),
-                                               n2 = new Vector3();
-
-                       function handleVertex(v) {
-                               n.fromArray(normals, v * 3);
-                               n2.copy(n);
-                               const t = tan1[v]; // Gram-Schmidt orthogonalize
-
-                               tmp.copy(t);
-                               tmp.sub(n.multiplyScalar(n.dot(t))).normalize(); // Calculate handedness
-
-                               tmp2.crossVectors(n2, t);
-                               const test = tmp2.dot(tan2[v]);
-                               const w = test < 0.0 ? -1.0 : 1.0;
-                               tangents[v * 4] = tmp.x;
-                               tangents[v * 4 + 1] = tmp.y;
-                               tangents[v * 4 + 2] = tmp.z;
-                               tangents[v * 4 + 3] = w;
-                       }
-
-                       for (let i = 0, il = groups.length; i < il; ++i) {
-                               const group = groups[i];
-                               const start = group.start;
-                               const count = group.count;
-
-                               for (let j = start, jl = start + count; j < jl; j += 3) {
-                                       handleVertex(indices[j + 0]);
-                                       handleVertex(indices[j + 1]);
-                                       handleVertex(indices[j + 2]);
-                               }
-                       }
-               }
-
-               computeVertexNormals() {
-                       const index = this.index;
-                       const positionAttribute = this.getAttribute('position');
-
-                       if (positionAttribute !== undefined) {
-                               let normalAttribute = this.getAttribute('normal');
-
-                               if (normalAttribute === undefined) {
-                                       normalAttribute = new BufferAttribute(new Float32Array(positionAttribute.count * 3), 3);
-                                       this.setAttribute('normal', normalAttribute);
-                               } else {
-                                       // reset existing normals to zero
-                                       for (let i = 0, il = normalAttribute.count; i < il; i++) {
-                                               normalAttribute.setXYZ(i, 0, 0, 0);
-                                       }
-                               }
-
-                               const pA = new Vector3(),
-                                                       pB = new Vector3(),
-                                                       pC = new Vector3();
-                               const nA = new Vector3(),
-                                                       nB = new Vector3(),
-                                                       nC = new Vector3();
-                               const cb = new Vector3(),
-                                                       ab = new Vector3(); // indexed elements
-
-                               if (index) {
-                                       for (let i = 0, il = index.count; i < il; i += 3) {
-                                               const vA = index.getX(i + 0);
-                                               const vB = index.getX(i + 1);
-                                               const vC = index.getX(i + 2);
-                                               pA.fromBufferAttribute(positionAttribute, vA);
-                                               pB.fromBufferAttribute(positionAttribute, vB);
-                                               pC.fromBufferAttribute(positionAttribute, vC);
-                                               cb.subVectors(pC, pB);
-                                               ab.subVectors(pA, pB);
-                                               cb.cross(ab);
-                                               nA.fromBufferAttribute(normalAttribute, vA);
-                                               nB.fromBufferAttribute(normalAttribute, vB);
-                                               nC.fromBufferAttribute(normalAttribute, vC);
-                                               nA.add(cb);
-                                               nB.add(cb);
-                                               nC.add(cb);
-                                               normalAttribute.setXYZ(vA, nA.x, nA.y, nA.z);
-                                               normalAttribute.setXYZ(vB, nB.x, nB.y, nB.z);
-                                               normalAttribute.setXYZ(vC, nC.x, nC.y, nC.z);
-                                       }
-                               } else {
-                                       // non-indexed elements (unconnected triangle soup)
-                                       for (let i = 0, il = positionAttribute.count; i < il; i += 3) {
-                                               pA.fromBufferAttribute(positionAttribute, i + 0);
-                                               pB.fromBufferAttribute(positionAttribute, i + 1);
-                                               pC.fromBufferAttribute(positionAttribute, i + 2);
-                                               cb.subVectors(pC, pB);
-                                               ab.subVectors(pA, pB);
-                                               cb.cross(ab);
-                                               normalAttribute.setXYZ(i + 0, cb.x, cb.y, cb.z);
-                                               normalAttribute.setXYZ(i + 1, cb.x, cb.y, cb.z);
-                                               normalAttribute.setXYZ(i + 2, cb.x, cb.y, cb.z);
-                                       }
-                               }
-
-                               this.normalizeNormals();
-                               normalAttribute.needsUpdate = true;
-                       }
-               }
-
-               merge(geometry, offset) {
-                       if (!(geometry && geometry.isBufferGeometry)) {
-                               console.error('THREE.BufferGeometry.merge(): geometry not an instance of THREE.BufferGeometry.', geometry);
-                               return;
-                       }
-
-                       if (offset === undefined) {
-                               offset = 0;
-                               console.warn('THREE.BufferGeometry.merge(): Overwriting original geometry, starting at offset=0. ' + 'Use BufferGeometryUtils.mergeBufferGeometries() for lossless merge.');
-                       }
-
-                       const attributes = this.attributes;
-
-                       for (const key in attributes) {
-                               if (geometry.attributes[key] === undefined) continue;
-                               const attribute1 = attributes[key];
-                               const attributeArray1 = attribute1.array;
-                               const attribute2 = geometry.attributes[key];
-                               const attributeArray2 = attribute2.array;
-                               const attributeOffset = attribute2.itemSize * offset;
-                               const length = Math.min(attributeArray2.length, attributeArray1.length - attributeOffset);
-
-                               for (let i = 0, j = attributeOffset; i < length; i++, j++) {
-                                       attributeArray1[j] = attributeArray2[i];
-                               }
-                       }
-
-                       return this;
-               }
-
-               normalizeNormals() {
-                       const normals = this.attributes.normal;
-
-                       for (let i = 0, il = normals.count; i < il; i++) {
-                               _vector$8.fromBufferAttribute(normals, i);
-
-                               _vector$8.normalize();
-
-                               normals.setXYZ(i, _vector$8.x, _vector$8.y, _vector$8.z);
-                       }
-               }
-
-               toNonIndexed() {
-                       function convertBufferAttribute(attribute, indices) {
-                               const array = attribute.array;
-                               const itemSize = attribute.itemSize;
-                               const normalized = attribute.normalized;
-                               const array2 = new array.constructor(indices.length * itemSize);
-                               let index = 0,
-                                               index2 = 0;
-
-                               for (let i = 0, l = indices.length; i < l; i++) {
-                                       if (attribute.isInterleavedBufferAttribute) {
-                                               index = indices[i] * attribute.data.stride + attribute.offset;
-                                       } else {
-                                               index = indices[i] * itemSize;
-                                       }
-
-                                       for (let j = 0; j < itemSize; j++) {
-                                               array2[index2++] = array[index++];
-                                       }
-                               }
-
-                               return new BufferAttribute(array2, itemSize, normalized);
-                       } //
-
-
-                       if (this.index === null) {
-                               console.warn('THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed.');
-                               return this;
-                       }
-
-                       const geometry2 = new BufferGeometry();
-                       const indices = this.index.array;
-                       const attributes = this.attributes; // attributes
-
-                       for (const name in attributes) {
-                               const attribute = attributes[name];
-                               const newAttribute = convertBufferAttribute(attribute, indices);
-                               geometry2.setAttribute(name, newAttribute);
-                       } // morph attributes
-
-
-                       const morphAttributes = this.morphAttributes;
-
-                       for (const name in morphAttributes) {
-                               const morphArray = [];
-                               const morphAttribute = morphAttributes[name]; // morphAttribute: array of Float32BufferAttributes
-
-                               for (let i = 0, il = morphAttribute.length; i < il; i++) {
-                                       const attribute = morphAttribute[i];
-                                       const newAttribute = convertBufferAttribute(attribute, indices);
-                                       morphArray.push(newAttribute);
-                               }
-
-                               geometry2.morphAttributes[name] = morphArray;
-                       }
-
-                       geometry2.morphTargetsRelative = this.morphTargetsRelative; // groups
-
-                       const groups = this.groups;
-
-                       for (let i = 0, l = groups.length; i < l; i++) {
-                               const group = groups[i];
-                               geometry2.addGroup(group.start, group.count, group.materialIndex);
-                       }
-
-                       return geometry2;
-               }
-
-               toJSON() {
-                       const data = {
-                               metadata: {
-                                       version: 4.5,
-                                       type: 'BufferGeometry',
-                                       generator: 'BufferGeometry.toJSON'
-                               }
-                       }; // standard BufferGeometry serialization
-
-                       data.uuid = this.uuid;
-                       data.type = this.type;
-                       if (this.name !== '') data.name = this.name;
-                       if (Object.keys(this.userData).length > 0) data.userData = this.userData;
-
-                       if (this.parameters !== undefined) {
-                               const parameters = this.parameters;
-
-                               for (const key in parameters) {
-                                       if (parameters[key] !== undefined) data[key] = parameters[key];
-                               }
-
-                               return data;
-                       } // for simplicity the code assumes attributes are not shared across geometries, see #15811
-
-
-                       data.data = {
-                               attributes: {}
-                       };
-                       const index = this.index;
-
-                       if (index !== null) {
-                               data.data.index = {
-                                       type: index.array.constructor.name,
-                                       array: Array.prototype.slice.call(index.array)
-                               };
-                       }
-
-                       const attributes = this.attributes;
-
-                       for (const key in attributes) {
-                               const attribute = attributes[key];
-                               data.data.attributes[key] = attribute.toJSON(data.data);
-                       }
-
-                       const morphAttributes = {};
-                       let hasMorphAttributes = false;
-
-                       for (const key in this.morphAttributes) {
-                               const attributeArray = this.morphAttributes[key];
-                               const array = [];
-
-                               for (let i = 0, il = attributeArray.length; i < il; i++) {
-                                       const attribute = attributeArray[i];
-                                       array.push(attribute.toJSON(data.data));
-                               }
-
-                               if (array.length > 0) {
-                                       morphAttributes[key] = array;
-                                       hasMorphAttributes = true;
-                               }
-                       }
-
-                       if (hasMorphAttributes) {
-                               data.data.morphAttributes = morphAttributes;
-                               data.data.morphTargetsRelative = this.morphTargetsRelative;
-                       }
-
-                       const groups = this.groups;
-
-                       if (groups.length > 0) {
-                               data.data.groups = JSON.parse(JSON.stringify(groups));
-                       }
-
-                       const boundingSphere = this.boundingSphere;
-
-                       if (boundingSphere !== null) {
-                               data.data.boundingSphere = {
-                                       center: boundingSphere.center.toArray(),
-                                       radius: boundingSphere.radius
-                               };
-                       }
-
-                       return data;
-               }
-
-               clone() {
-                       /*
-                        // Handle primitives
-                                const parameters = this.parameters;
-                                if ( parameters !== undefined ) {
-                                const values = [];
-                                for ( const key in parameters ) {
-                                values.push( parameters[ key ] );
-                                }
-                                const geometry = Object.create( this.constructor.prototype );
-                        this.constructor.apply( geometry, values );
-                        return geometry;
-                                }
-                                return new this.constructor().copy( this );
-                        */
-                       return new BufferGeometry().copy(this);
-               }
-
-               copy(source) {
-                       // reset
-                       this.index = null;
-                       this.attributes = {};
-                       this.morphAttributes = {};
-                       this.groups = [];
-                       this.boundingBox = null;
-                       this.boundingSphere = null; // used for storing cloned, shared data
-
-                       const data = {}; // name
-
-                       this.name = source.name; // index
-
-                       const index = source.index;
-
-                       if (index !== null) {
-                               this.setIndex(index.clone(data));
-                       } // attributes
-
-
-                       const attributes = source.attributes;
-
-                       for (const name in attributes) {
-                               const attribute = attributes[name];
-                               this.setAttribute(name, attribute.clone(data));
-                       } // morph attributes
-
-
-                       const morphAttributes = source.morphAttributes;
-
-                       for (const name in morphAttributes) {
-                               const array = [];
-                               const morphAttribute = morphAttributes[name]; // morphAttribute: array of Float32BufferAttributes
-
-                               for (let i = 0, l = morphAttribute.length; i < l; i++) {
-                                       array.push(morphAttribute[i].clone(data));
-                               }
-
-                               this.morphAttributes[name] = array;
-                       }
-
-                       this.morphTargetsRelative = source.morphTargetsRelative; // groups
-
-                       const groups = source.groups;
-
-                       for (let i = 0, l = groups.length; i < l; i++) {
-                               const group = groups[i];
-                               this.addGroup(group.start, group.count, group.materialIndex);
-                       } // bounding box
-
-
-                       const boundingBox = source.boundingBox;
-
-                       if (boundingBox !== null) {
-                               this.boundingBox = boundingBox.clone();
-                       } // bounding sphere
-
-
-                       const boundingSphere = source.boundingSphere;
-
-                       if (boundingSphere !== null) {
-                               this.boundingSphere = boundingSphere.clone();
-                       } // draw range
-
-
-                       this.drawRange.start = source.drawRange.start;
-                       this.drawRange.count = source.drawRange.count; // user data
-
-                       this.userData = source.userData;
-                       return this;
-               }
-
-               dispose() {
-                       this.dispatchEvent({
-                               type: 'dispose'
-                       });
-               }
-
-       }
-
-       BufferGeometry.prototype.isBufferGeometry = true;
-
-       const _inverseMatrix$2 = /*@__PURE__*/new Matrix4();
-
-       const _ray$2 = /*@__PURE__*/new Ray();
-
-       const _sphere$3 = /*@__PURE__*/new Sphere();
-
-       const _vA$1 = /*@__PURE__*/new Vector3();
-
-       const _vB$1 = /*@__PURE__*/new Vector3();
-
-       const _vC$1 = /*@__PURE__*/new Vector3();
-
-       const _tempA = /*@__PURE__*/new Vector3();
-
-       const _tempB = /*@__PURE__*/new Vector3();
-
-       const _tempC = /*@__PURE__*/new Vector3();
-
-       const _morphA = /*@__PURE__*/new Vector3();
-
-       const _morphB = /*@__PURE__*/new Vector3();
-
-       const _morphC = /*@__PURE__*/new Vector3();
-
-       const _uvA$1 = /*@__PURE__*/new Vector2();
-
-       const _uvB$1 = /*@__PURE__*/new Vector2();
-
-       const _uvC$1 = /*@__PURE__*/new Vector2();
-
-       const _intersectionPoint = /*@__PURE__*/new Vector3();
-
-       const _intersectionPointWorld = /*@__PURE__*/new Vector3();
-
-       class Mesh extends Object3D {
-               constructor(geometry = new BufferGeometry(), material = new MeshBasicMaterial()) {
-                       super();
-                       this.type = 'Mesh';
-                       this.geometry = geometry;
-                       this.material = material;
-                       this.updateMorphTargets();
-               }
-
-               copy(source) {
-                       super.copy(source);
-
-                       if (source.morphTargetInfluences !== undefined) {
-                               this.morphTargetInfluences = source.morphTargetInfluences.slice();
-                       }
-
-                       if (source.morphTargetDictionary !== undefined) {
-                               this.morphTargetDictionary = Object.assign({}, source.morphTargetDictionary);
-                       }
-
-                       this.material = source.material;
-                       this.geometry = source.geometry;
-                       return this;
-               }
-
-               updateMorphTargets() {
-                       const geometry = this.geometry;
-
-                       if (geometry.isBufferGeometry) {
-                               const morphAttributes = geometry.morphAttributes;
-                               const keys = Object.keys(morphAttributes);
-
-                               if (keys.length > 0) {
-                                       const morphAttribute = morphAttributes[keys[0]];
-
-                                       if (morphAttribute !== undefined) {
-                                               this.morphTargetInfluences = [];
-                                               this.morphTargetDictionary = {};
-
-                                               for (let m = 0, ml = morphAttribute.length; m < ml; m++) {
-                                                       const name = morphAttribute[m].name || String(m);
-                                                       this.morphTargetInfluences.push(0);
-                                                       this.morphTargetDictionary[name] = m;
-                                               }
-                                       }
-                               }
-                       } else {
-                               const morphTargets = geometry.morphTargets;
-
-                               if (morphTargets !== undefined && morphTargets.length > 0) {
-                                       console.error('THREE.Mesh.updateMorphTargets() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.');
-                               }
-                       }
-               }
-
-               raycast(raycaster, intersects) {
-                       const geometry = this.geometry;
-                       const material = this.material;
-                       const matrixWorld = this.matrixWorld;
-                       if (material === undefined) return; // Checking boundingSphere distance to ray
-
-                       if (geometry.boundingSphere === null) geometry.computeBoundingSphere();
-
-                       _sphere$3.copy(geometry.boundingSphere);
-
-                       _sphere$3.applyMatrix4(matrixWorld);
-
-                       if (raycaster.ray.intersectsSphere(_sphere$3) === false) return; //
-
-                       _inverseMatrix$2.copy(matrixWorld).invert();
-
-                       _ray$2.copy(raycaster.ray).applyMatrix4(_inverseMatrix$2); // Check boundingBox before continuing
-
-
-                       if (geometry.boundingBox !== null) {
-                               if (_ray$2.intersectsBox(geometry.boundingBox) === false) return;
-                       }
-
-                       let intersection;
-
-                       if (geometry.isBufferGeometry) {
-                               const index = geometry.index;
-                               const position = geometry.attributes.position;
-                               const morphPosition = geometry.morphAttributes.position;
-                               const morphTargetsRelative = geometry.morphTargetsRelative;
-                               const uv = geometry.attributes.uv;
-                               const uv2 = geometry.attributes.uv2;
-                               const groups = geometry.groups;
-                               const drawRange = geometry.drawRange;
-
-                               if (index !== null) {
-                                       // indexed buffer geometry
-                                       if (Array.isArray(material)) {
-                                               for (let i = 0, il = groups.length; i < il; i++) {
-                                                       const group = groups[i];
-                                                       const groupMaterial = material[group.materialIndex];
-                                                       const start = Math.max(group.start, drawRange.start);
-                                                       const end = Math.min(group.start + group.count, drawRange.start + drawRange.count);
-
-                                                       for (let j = start, jl = end; j < jl; j += 3) {
-                                                               const a = index.getX(j);
-                                                               const b = index.getX(j + 1);
-                                                               const c = index.getX(j + 2);
-                                                               intersection = checkBufferGeometryIntersection(this, groupMaterial, raycaster, _ray$2, position, morphPosition, morphTargetsRelative, uv, uv2, a, b, c);
-
-                                                               if (intersection) {
-                                                                       intersection.faceIndex = Math.floor(j / 3); // triangle number in indexed buffer semantics
-
-                                                                       intersection.face.materialIndex = group.materialIndex;
-                                                                       intersects.push(intersection);
-                                                               }
-                                                       }
-                                               }
-                                       } else {
-                                               const start = Math.max(0, drawRange.start);
-                                               const end = Math.min(index.count, drawRange.start + drawRange.count);
-
-                                               for (let i = start, il = end; i < il; i += 3) {
-                                                       const a = index.getX(i);
-                                                       const b = index.getX(i + 1);
-                                                       const c = index.getX(i + 2);
-                                                       intersection = checkBufferGeometryIntersection(this, material, raycaster, _ray$2, position, morphPosition, morphTargetsRelative, uv, uv2, a, b, c);
-
-                                                       if (intersection) {
-                                                               intersection.faceIndex = Math.floor(i / 3); // triangle number in indexed buffer semantics
-
-                                                               intersects.push(intersection);
-                                                       }
-                                               }
-                                       }
-                               } else if (position !== undefined) {
-                                       // non-indexed buffer geometry
-                                       if (Array.isArray(material)) {
-                                               for (let i = 0, il = groups.length; i < il; i++) {
-                                                       const group = groups[i];
-                                                       const groupMaterial = material[group.materialIndex];
-                                                       const start = Math.max(group.start, drawRange.start);
-                                                       const end = Math.min(group.start + group.count, drawRange.start + drawRange.count);
-
-                                                       for (let j = start, jl = end; j < jl; j += 3) {
-                                                               const a = j;
-                                                               const b = j + 1;
-                                                               const c = j + 2;
-                                                               intersection = checkBufferGeometryIntersection(this, groupMaterial, raycaster, _ray$2, position, morphPosition, morphTargetsRelative, uv, uv2, a, b, c);
-
-                                                               if (intersection) {
-                                                                       intersection.faceIndex = Math.floor(j / 3); // triangle number in non-indexed buffer semantics
-
-                                                                       intersection.face.materialIndex = group.materialIndex;
-                                                                       intersects.push(intersection);
-                                                               }
-                                                       }
-                                               }
-                                       } else {
-                                               const start = Math.max(0, drawRange.start);
-                                               const end = Math.min(position.count, drawRange.start + drawRange.count);
-
-                                               for (let i = start, il = end; i < il; i += 3) {
-                                                       const a = i;
-                                                       const b = i + 1;
-                                                       const c = i + 2;
-                                                       intersection = checkBufferGeometryIntersection(this, material, raycaster, _ray$2, position, morphPosition, morphTargetsRelative, uv, uv2, a, b, c);
-
-                                                       if (intersection) {
-                                                               intersection.faceIndex = Math.floor(i / 3); // triangle number in non-indexed buffer semantics
-
-                                                               intersects.push(intersection);
-                                                       }
-                                               }
-                                       }
-                               }
-                       } else if (geometry.isGeometry) {
-                               console.error('THREE.Mesh.raycast() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.');
-                       }
-               }
-
-       }
-
-       Mesh.prototype.isMesh = true;
-
-       function checkIntersection(object, material, raycaster, ray, pA, pB, pC, point) {
-               let intersect;
-
-               if (material.side === BackSide) {
-                       intersect = ray.intersectTriangle(pC, pB, pA, true, point);
-               } else {
-                       intersect = ray.intersectTriangle(pA, pB, pC, material.side !== DoubleSide, point);
-               }
-
-               if (intersect === null) return null;
-
-               _intersectionPointWorld.copy(point);
-
-               _intersectionPointWorld.applyMatrix4(object.matrixWorld);
-
-               const distance = raycaster.ray.origin.distanceTo(_intersectionPointWorld);
-               if (distance < raycaster.near || distance > raycaster.far) return null;
-               return {
-                       distance: distance,
-                       point: _intersectionPointWorld.clone(),
-                       object: object
-               };
-       }
-
-       function checkBufferGeometryIntersection(object, material, raycaster, ray, position, morphPosition, morphTargetsRelative, uv, uv2, a, b, c) {
-               _vA$1.fromBufferAttribute(position, a);
-
-               _vB$1.fromBufferAttribute(position, b);
-
-               _vC$1.fromBufferAttribute(position, c);
-
-               const morphInfluences = object.morphTargetInfluences;
-
-               if (morphPosition && morphInfluences) {
-                       _morphA.set(0, 0, 0);
-
-                       _morphB.set(0, 0, 0);
-
-                       _morphC.set(0, 0, 0);
-
-                       for (let i = 0, il = morphPosition.length; i < il; i++) {
-                               const influence = morphInfluences[i];
-                               const morphAttribute = morphPosition[i];
-                               if (influence === 0) continue;
-
-                               _tempA.fromBufferAttribute(morphAttribute, a);
-
-                               _tempB.fromBufferAttribute(morphAttribute, b);
-
-                               _tempC.fromBufferAttribute(morphAttribute, c);
-
-                               if (morphTargetsRelative) {
-                                       _morphA.addScaledVector(_tempA, influence);
-
-                                       _morphB.addScaledVector(_tempB, influence);
-
-                                       _morphC.addScaledVector(_tempC, influence);
-                               } else {
-                                       _morphA.addScaledVector(_tempA.sub(_vA$1), influence);
-
-                                       _morphB.addScaledVector(_tempB.sub(_vB$1), influence);
-
-                                       _morphC.addScaledVector(_tempC.sub(_vC$1), influence);
-                               }
-                       }
-
-                       _vA$1.add(_morphA);
-
-                       _vB$1.add(_morphB);
-
-                       _vC$1.add(_morphC);
-               }
-
-               if (object.isSkinnedMesh) {
-                       object.boneTransform(a, _vA$1);
-                       object.boneTransform(b, _vB$1);
-                       object.boneTransform(c, _vC$1);
-               }
-
-               const intersection = checkIntersection(object, material, raycaster, ray, _vA$1, _vB$1, _vC$1, _intersectionPoint);
-
-               if (intersection) {
-                       if (uv) {
-                               _uvA$1.fromBufferAttribute(uv, a);
-
-                               _uvB$1.fromBufferAttribute(uv, b);
-
-                               _uvC$1.fromBufferAttribute(uv, c);
-
-                               intersection.uv = Triangle.getUV(_intersectionPoint, _vA$1, _vB$1, _vC$1, _uvA$1, _uvB$1, _uvC$1, new Vector2());
-                       }
-
-                       if (uv2) {
-                               _uvA$1.fromBufferAttribute(uv2, a);
-
-                               _uvB$1.fromBufferAttribute(uv2, b);
-
-                               _uvC$1.fromBufferAttribute(uv2, c);
-
-                               intersection.uv2 = Triangle.getUV(_intersectionPoint, _vA$1, _vB$1, _vC$1, _uvA$1, _uvB$1, _uvC$1, new Vector2());
-                       }
-
-                       const face = {
-                               a: a,
-                               b: b,
-                               c: c,
-                               normal: new Vector3(),
-                               materialIndex: 0
-                       };
-                       Triangle.getNormal(_vA$1, _vB$1, _vC$1, face.normal);
-                       intersection.face = face;
-               }
-
-               return intersection;
-       }
-
-       class BoxGeometry extends BufferGeometry {
-               constructor(width = 1, height = 1, depth = 1, widthSegments = 1, heightSegments = 1, depthSegments = 1) {
-                       super();
-                       this.type = 'BoxGeometry';
-                       this.parameters = {
-                               width: width,
-                               height: height,
-                               depth: depth,
-                               widthSegments: widthSegments,
-                               heightSegments: heightSegments,
-                               depthSegments: depthSegments
-                       };
-                       const scope = this; // segments
-
-                       widthSegments = Math.floor(widthSegments);
-                       heightSegments = Math.floor(heightSegments);
-                       depthSegments = Math.floor(depthSegments); // buffers
-
-                       const indices = [];
-                       const vertices = [];
-                       const normals = [];
-                       const uvs = []; // helper variables
-
-                       let numberOfVertices = 0;
-                       let groupStart = 0; // build each side of the box geometry
-
-                       buildPlane('z', 'y', 'x', -1, -1, depth, height, width, depthSegments, heightSegments, 0); // px
-
-                       buildPlane('z', 'y', 'x', 1, -1, depth, height, -width, depthSegments, heightSegments, 1); // nx
-
-                       buildPlane('x', 'z', 'y', 1, 1, width, depth, height, widthSegments, depthSegments, 2); // py
-
-                       buildPlane('x', 'z', 'y', 1, -1, width, depth, -height, widthSegments, depthSegments, 3); // ny
-
-                       buildPlane('x', 'y', 'z', 1, -1, width, height, depth, widthSegments, heightSegments, 4); // pz
-
-                       buildPlane('x', 'y', 'z', -1, -1, width, height, -depth, widthSegments, heightSegments, 5); // nz
-                       // build geometry
-
-                       this.setIndex(indices);
-                       this.setAttribute('position', new Float32BufferAttribute(vertices, 3));
-                       this.setAttribute('normal', new Float32BufferAttribute(normals, 3));
-                       this.setAttribute('uv', new Float32BufferAttribute(uvs, 2));
-
-                       function buildPlane(u, v, w, udir, vdir, width, height, depth, gridX, gridY, materialIndex) {
-                               const segmentWidth = width / gridX;
-                               const segmentHeight = height / gridY;
-                               const widthHalf = width / 2;
-                               const heightHalf = height / 2;
-                               const depthHalf = depth / 2;
-                               const gridX1 = gridX + 1;
-                               const gridY1 = gridY + 1;
-                               let vertexCounter = 0;
-                               let groupCount = 0;
-                               const vector = new Vector3(); // generate vertices, normals and uvs
-
-                               for (let iy = 0; iy < gridY1; iy++) {
-                                       const y = iy * segmentHeight - heightHalf;
-
-                                       for (let ix = 0; ix < gridX1; ix++) {
-                                               const x = ix * segmentWidth - widthHalf; // set values to correct vector component
-
-                                               vector[u] = x * udir;
-                                               vector[v] = y * vdir;
-                                               vector[w] = depthHalf; // now apply vector to vertex buffer
-
-                                               vertices.push(vector.x, vector.y, vector.z); // set values to correct vector component
-
-                                               vector[u] = 0;
-                                               vector[v] = 0;
-                                               vector[w] = depth > 0 ? 1 : -1; // now apply vector to normal buffer
-
-                                               normals.push(vector.x, vector.y, vector.z); // uvs
-
-                                               uvs.push(ix / gridX);
-                                               uvs.push(1 - iy / gridY); // counters
-
-                                               vertexCounter += 1;
-                                       }
-                               } // indices
-                               // 1. you need three indices to draw a single face
-                               // 2. a single segment consists of two faces
-                               // 3. so we need to generate six (2*3) indices per segment
-
-
-                               for (let iy = 0; iy < gridY; iy++) {
-                                       for (let ix = 0; ix < gridX; ix++) {
-                                               const a = numberOfVertices + ix + gridX1 * iy;
-                                               const b = numberOfVertices + ix + gridX1 * (iy + 1);
-                                               const c = numberOfVertices + (ix + 1) + gridX1 * (iy + 1);
-                                               const d = numberOfVertices + (ix + 1) + gridX1 * iy; // faces
-
-                                               indices.push(a, b, d);
-                                               indices.push(b, c, d); // increase counter
-
-                                               groupCount += 6;
-                                       }
-                               } // add a group to the geometry. this will ensure multi material support
-
-
-                               scope.addGroup(groupStart, groupCount, materialIndex); // calculate new start value for groups
-
-                               groupStart += groupCount; // update total number of vertices
-
-                               numberOfVertices += vertexCounter;
-                       }
-               }
-
-               static fromJSON(data) {
-                       return new BoxGeometry(data.width, data.height, data.depth, data.widthSegments, data.heightSegments, data.depthSegments);
-               }
-
-       }
-
-       /**
-        * Uniform Utilities
-        */
-       function cloneUniforms(src) {
-               const dst = {};
-
-               for (const u in src) {
-                       dst[u] = {};
-
-                       for (const p in src[u]) {
-                               const property = src[u][p];
-
-                               if (property && (property.isColor || property.isMatrix3 || property.isMatrix4 || property.isVector2 || property.isVector3 || property.isVector4 || property.isTexture || property.isQuaternion)) {
-                                       dst[u][p] = property.clone();
-                               } else if (Array.isArray(property)) {
-                                       dst[u][p] = property.slice();
-                               } else {
-                                       dst[u][p] = property;
-                               }
-                       }
-               }
-
-               return dst;
-       }
-       function mergeUniforms(uniforms) {
-               const merged = {};
-
-               for (let u = 0; u < uniforms.length; u++) {
-                       const tmp = cloneUniforms(uniforms[u]);
-
-                       for (const p in tmp) {
-                               merged[p] = tmp[p];
-                       }
-               }
-
-               return merged;
-       } // Legacy
-
-       const UniformsUtils = {
-               clone: cloneUniforms,
-               merge: mergeUniforms
-       };
-
-       var default_vertex = "void main() {\n\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}";
-
-       var default_fragment = "void main() {\n\tgl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );\n}";
-
-       /**
-        * parameters = {
-        *      defines: { "label" : "value" },
-        *      uniforms: { "parameter1": { value: 1.0 }, "parameter2": { value2: 2 } },
-        *
-        *      fragmentShader: <string>,
-        *      vertexShader: <string>,
-        *
-        *      wireframe: <boolean>,
-        *      wireframeLinewidth: <float>,
-        *
-        *      lights: <bool>
-        * }
-        */
-
-       class ShaderMaterial extends Material {
-               constructor(parameters) {
-                       super();
-                       this.type = 'ShaderMaterial';
-                       this.defines = {};
-                       this.uniforms = {};
-                       this.vertexShader = default_vertex;
-                       this.fragmentShader = default_fragment;
-                       this.linewidth = 1;
-                       this.wireframe = false;
-                       this.wireframeLinewidth = 1;
-                       this.fog = false; // set to use scene fog
-
-                       this.lights = false; // set to use scene lights
-
-                       this.clipping = false; // set to use user-defined clipping planes
-
-                       this.extensions = {
-                               derivatives: false,
-                               // set to use derivatives
-                               fragDepth: false,
-                               // set to use fragment depth values
-                               drawBuffers: false,
-                               // set to use draw buffers
-                               shaderTextureLOD: false // set to use shader texture LOD
-
-                       }; // When rendered geometry doesn't include these attributes but the material does,
-                       // use these default values in WebGL. This avoids errors when buffer data is missing.
-
-                       this.defaultAttributeValues = {
-                               'color': [1, 1, 1],
-                               'uv': [0, 0],
-                               'uv2': [0, 0]
-                       };
-                       this.index0AttributeName = undefined;
-                       this.uniformsNeedUpdate = false;
-                       this.glslVersion = null;
-
-                       if (parameters !== undefined) {
-                               if (parameters.attributes !== undefined) {
-                                       console.error('THREE.ShaderMaterial: attributes should now be defined in THREE.BufferGeometry instead.');
-                               }
-
-                               this.setValues(parameters);
-                       }
-               }
-
-               copy(source) {
-                       super.copy(source);
-                       this.fragmentShader = source.fragmentShader;
-                       this.vertexShader = source.vertexShader;
-                       this.uniforms = cloneUniforms(source.uniforms);
-                       this.defines = Object.assign({}, source.defines);
-                       this.wireframe = source.wireframe;
-                       this.wireframeLinewidth = source.wireframeLinewidth;
-                       this.lights = source.lights;
-                       this.clipping = source.clipping;
-                       this.extensions = Object.assign({}, source.extensions);
-                       this.glslVersion = source.glslVersion;
-                       return this;
-               }
-
-               toJSON(meta) {
-                       const data = super.toJSON(meta);
-                       data.glslVersion = this.glslVersion;
-                       data.uniforms = {};
-
-                       for (const name in this.uniforms) {
-                               const uniform = this.uniforms[name];
-                               const value = uniform.value;
-
-                               if (value && value.isTexture) {
-                                       data.uniforms[name] = {
-                                               type: 't',
-                                               value: value.toJSON(meta).uuid
-                                       };
-                               } else if (value && value.isColor) {
-                                       data.uniforms[name] = {
-                                               type: 'c',
-                                               value: value.getHex()
-                                       };
-                               } else if (value && value.isVector2) {
-                                       data.uniforms[name] = {
-                                               type: 'v2',
-                                               value: value.toArray()
-                                       };
-                               } else if (value && value.isVector3) {
-                                       data.uniforms[name] = {
-                                               type: 'v3',
-                                               value: value.toArray()
-                                       };
-                               } else if (value && value.isVector4) {
-                                       data.uniforms[name] = {
-                                               type: 'v4',
-                                               value: value.toArray()
-                                       };
-                               } else if (value && value.isMatrix3) {
-                                       data.uniforms[name] = {
-                                               type: 'm3',
-                                               value: value.toArray()
-                                       };
-                               } else if (value && value.isMatrix4) {
-                                       data.uniforms[name] = {
-                                               type: 'm4',
-                                               value: value.toArray()
-                                       };
-                               } else {
-                                       data.uniforms[name] = {
-                                               value: value
-                                       }; // note: the array variants v2v, v3v, v4v, m4v and tv are not supported so far
-                               }
-                       }
-
-                       if (Object.keys(this.defines).length > 0) data.defines = this.defines;
-                       data.vertexShader = this.vertexShader;
-                       data.fragmentShader = this.fragmentShader;
-                       const extensions = {};
-
-                       for (const key in this.extensions) {
-                               if (this.extensions[key] === true) extensions[key] = true;
-                       }
-
-                       if (Object.keys(extensions).length > 0) data.extensions = extensions;
-                       return data;
-               }
-
-       }
-
-       ShaderMaterial.prototype.isShaderMaterial = true;
-
-       class Camera extends Object3D {
-               constructor() {
-                       super();
-                       this.type = 'Camera';
-                       this.matrixWorldInverse = new Matrix4();
-                       this.projectionMatrix = new Matrix4();
-                       this.projectionMatrixInverse = new Matrix4();
-               }
-
-               copy(source, recursive) {
-                       super.copy(source, recursive);
-                       this.matrixWorldInverse.copy(source.matrixWorldInverse);
-                       this.projectionMatrix.copy(source.projectionMatrix);
-                       this.projectionMatrixInverse.copy(source.projectionMatrixInverse);
-                       return this;
-               }
-
-               getWorldDirection(target) {
-                       this.updateWorldMatrix(true, false);
-                       const e = this.matrixWorld.elements;
-                       return target.set(-e[8], -e[9], -e[10]).normalize();
-               }
-
-               updateMatrixWorld(force) {
-                       super.updateMatrixWorld(force);
-                       this.matrixWorldInverse.copy(this.matrixWorld).invert();
-               }
-
-               updateWorldMatrix(updateParents, updateChildren) {
-                       super.updateWorldMatrix(updateParents, updateChildren);
-                       this.matrixWorldInverse.copy(this.matrixWorld).invert();
-               }
-
-               clone() {
-                       return new this.constructor().copy(this);
-               }
-
-       }
-
-       Camera.prototype.isCamera = true;
-
-       class PerspectiveCamera extends Camera {
-               constructor(fov = 50, aspect = 1, near = 0.1, far = 2000) {
-                       super();
-                       this.type = 'PerspectiveCamera';
-                       this.fov = fov;
-                       this.zoom = 1;
-                       this.near = near;
-                       this.far = far;
-                       this.focus = 10;
-                       this.aspect = aspect;
-                       this.view = null;
-                       this.filmGauge = 35; // width of the film (default in millimeters)
-
-                       this.filmOffset = 0; // horizontal film offset (same unit as gauge)
-
-                       this.updateProjectionMatrix();
-               }
-
-               copy(source, recursive) {
-                       super.copy(source, recursive);
-                       this.fov = source.fov;
-                       this.zoom = source.zoom;
-                       this.near = source.near;
-                       this.far = source.far;
-                       this.focus = source.focus;
-                       this.aspect = source.aspect;
-                       this.view = source.view === null ? null : Object.assign({}, source.view);
-                       this.filmGauge = source.filmGauge;
-                       this.filmOffset = source.filmOffset;
-                       return this;
-               }
-               /**
-                * Sets the FOV by focal length in respect to the current .filmGauge.
-                *
-                * The default film gauge is 35, so that the focal length can be specified for
-                * a 35mm (full frame) camera.
-                *
-                * Values for focal length and film gauge must have the same unit.
-                */
-
-
-               setFocalLength(focalLength) {
-                       /** see {@link http://www.bobatkins.com/photography/technical/field_of_view.html} */
-                       const vExtentSlope = 0.5 * this.getFilmHeight() / focalLength;
-                       this.fov = RAD2DEG * 2 * Math.atan(vExtentSlope);
-                       this.updateProjectionMatrix();
-               }
-               /**
-                * Calculates the focal length from the current .fov and .filmGauge.
-                */
-
-
-               getFocalLength() {
-                       const vExtentSlope = Math.tan(DEG2RAD * 0.5 * this.fov);
-                       return 0.5 * this.getFilmHeight() / vExtentSlope;
-               }
-
-               getEffectiveFOV() {
-                       return RAD2DEG * 2 * Math.atan(Math.tan(DEG2RAD * 0.5 * this.fov) / this.zoom);
-               }
-
-               getFilmWidth() {
-                       // film not completely covered in portrait format (aspect < 1)
-                       return this.filmGauge * Math.min(this.aspect, 1);
-               }
-
-               getFilmHeight() {
-                       // film not completely covered in landscape format (aspect > 1)
-                       return this.filmGauge / Math.max(this.aspect, 1);
-               }
-               /**
-                * Sets an offset in a larger frustum. This is useful for multi-window or
-                * multi-monitor/multi-machine setups.
-                *
-                * For example, if you have 3x2 monitors and each monitor is 1920x1080 and
-                * the monitors are in grid like this
-                *
-                *       +---+---+---+
-                *       | A | B | C |
-                *       +---+---+---+
-                *       | D | E | F |
-                *       +---+---+---+
-                *
-                * then for each monitor you would call it like this
-                *
-                *       const w = 1920;
-                *       const h = 1080;
-                *       const fullWidth = w * 3;
-                *       const fullHeight = h * 2;
-                *
-                *       --A--
-                *       camera.setViewOffset( fullWidth, fullHeight, w * 0, h * 0, w, h );
-                *       --B--
-                *       camera.setViewOffset( fullWidth, fullHeight, w * 1, h * 0, w, h );
-                *       --C--
-                *       camera.setViewOffset( fullWidth, fullHeight, w * 2, h * 0, w, h );
-                *       --D--
-                *       camera.setViewOffset( fullWidth, fullHeight, w * 0, h * 1, w, h );
-                *       --E--
-                *       camera.setViewOffset( fullWidth, fullHeight, w * 1, h * 1, w, h );
-                *       --F--
-                *       camera.setViewOffset( fullWidth, fullHeight, w * 2, h * 1, w, h );
-                *
-                *       Note there is no reason monitors have to be the same size or in a grid.
-                */
-
-
-               setViewOffset(fullWidth, fullHeight, x, y, width, height) {
-                       this.aspect = fullWidth / fullHeight;
-
-                       if (this.view === null) {
-                               this.view = {
-                                       enabled: true,
-                                       fullWidth: 1,
-                                       fullHeight: 1,
-                                       offsetX: 0,
-                                       offsetY: 0,
-                                       width: 1,
-                                       height: 1
-                               };
-                       }
-
-                       this.view.enabled = true;
-                       this.view.fullWidth = fullWidth;
-                       this.view.fullHeight = fullHeight;
-                       this.view.offsetX = x;
-                       this.view.offsetY = y;
-                       this.view.width = width;
-                       this.view.height = height;
-                       this.updateProjectionMatrix();
-               }
-
-               clearViewOffset() {
-                       if (this.view !== null) {
-                               this.view.enabled = false;
-                       }
-
-                       this.updateProjectionMatrix();
-               }
-
-               updateProjectionMatrix() {
-                       const near = this.near;
-                       let top = near * Math.tan(DEG2RAD * 0.5 * this.fov) / this.zoom;
-                       let height = 2 * top;
-                       let width = this.aspect * height;
-                       let left = -0.5 * width;
-                       const view = this.view;
-
-                       if (this.view !== null && this.view.enabled) {
-                               const fullWidth = view.fullWidth,
-                                                       fullHeight = view.fullHeight;
-                               left += view.offsetX * width / fullWidth;
-                               top -= view.offsetY * height / fullHeight;
-                               width *= view.width / fullWidth;
-                               height *= view.height / fullHeight;
-                       }
-
-                       const skew = this.filmOffset;
-                       if (skew !== 0) left += near * skew / this.getFilmWidth();
-                       this.projectionMatrix.makePerspective(left, left + width, top, top - height, near, this.far);
-                       this.projectionMatrixInverse.copy(this.projectionMatrix).invert();
-               }
-
-               toJSON(meta) {
-                       const data = super.toJSON(meta);
-                       data.object.fov = this.fov;
-                       data.object.zoom = this.zoom;
-                       data.object.near = this.near;
-                       data.object.far = this.far;
-                       data.object.focus = this.focus;
-                       data.object.aspect = this.aspect;
-                       if (this.view !== null) data.object.view = Object.assign({}, this.view);
-                       data.object.filmGauge = this.filmGauge;
-                       data.object.filmOffset = this.filmOffset;
-                       return data;
-               }
-
-       }
-
-       PerspectiveCamera.prototype.isPerspectiveCamera = true;
-
-       const fov = 90,
-                               aspect = 1;
-
-       class CubeCamera extends Object3D {
-               constructor(near, far, renderTarget) {
-                       super();
-                       this.type = 'CubeCamera';
-
-                       if (renderTarget.isWebGLCubeRenderTarget !== true) {
-                               console.error('THREE.CubeCamera: The constructor now expects an instance of WebGLCubeRenderTarget as third parameter.');
-                               return;
-                       }
-
-                       this.renderTarget = renderTarget;
-                       const cameraPX = new PerspectiveCamera(fov, aspect, near, far);
-                       cameraPX.layers = this.layers;
-                       cameraPX.up.set(0, -1, 0);
-                       cameraPX.lookAt(new Vector3(1, 0, 0));
-                       this.add(cameraPX);
-                       const cameraNX = new PerspectiveCamera(fov, aspect, near, far);
-                       cameraNX.layers = this.layers;
-                       cameraNX.up.set(0, -1, 0);
-                       cameraNX.lookAt(new Vector3(-1, 0, 0));
-                       this.add(cameraNX);
-                       const cameraPY = new PerspectiveCamera(fov, aspect, near, far);
-                       cameraPY.layers = this.layers;
-                       cameraPY.up.set(0, 0, 1);
-                       cameraPY.lookAt(new Vector3(0, 1, 0));
-                       this.add(cameraPY);
-                       const cameraNY = new PerspectiveCamera(fov, aspect, near, far);
-                       cameraNY.layers = this.layers;
-                       cameraNY.up.set(0, 0, -1);
-                       cameraNY.lookAt(new Vector3(0, -1, 0));
-                       this.add(cameraNY);
-                       const cameraPZ = new PerspectiveCamera(fov, aspect, near, far);
-                       cameraPZ.layers = this.layers;
-                       cameraPZ.up.set(0, -1, 0);
-                       cameraPZ.lookAt(new Vector3(0, 0, 1));
-                       this.add(cameraPZ);
-                       const cameraNZ = new PerspectiveCamera(fov, aspect, near, far);
-                       cameraNZ.layers = this.layers;
-                       cameraNZ.up.set(0, -1, 0);
-                       cameraNZ.lookAt(new Vector3(0, 0, -1));
-                       this.add(cameraNZ);
-               }
-
-               update(renderer, scene) {
-                       if (this.parent === null) this.updateMatrixWorld();
-                       const renderTarget = this.renderTarget;
-                       const [cameraPX, cameraNX, cameraPY, cameraNY, cameraPZ, cameraNZ] = this.children;
-                       const currentXrEnabled = renderer.xr.enabled;
-                       const currentRenderTarget = renderer.getRenderTarget();
-                       renderer.xr.enabled = false;
-                       const generateMipmaps = renderTarget.texture.generateMipmaps;
-                       renderTarget.texture.generateMipmaps = false;
-                       renderer.setRenderTarget(renderTarget, 0);
-                       renderer.render(scene, cameraPX);
-                       renderer.setRenderTarget(renderTarget, 1);
-                       renderer.render(scene, cameraNX);
-                       renderer.setRenderTarget(renderTarget, 2);
-                       renderer.render(scene, cameraPY);
-                       renderer.setRenderTarget(renderTarget, 3);
-                       renderer.render(scene, cameraNY);
-                       renderer.setRenderTarget(renderTarget, 4);
-                       renderer.render(scene, cameraPZ);
-                       renderTarget.texture.generateMipmaps = generateMipmaps;
-                       renderer.setRenderTarget(renderTarget, 5);
-                       renderer.render(scene, cameraNZ);
-                       renderer.setRenderTarget(currentRenderTarget);
-                       renderer.xr.enabled = currentXrEnabled;
-               }
-
-       }
-
-       class CubeTexture extends Texture {
-               constructor(images, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy, encoding) {
-                       images = images !== undefined ? images : [];
-                       mapping = mapping !== undefined ? mapping : CubeReflectionMapping;
-                       format = format !== undefined ? format : RGBFormat;
-                       super(images, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy, encoding);
-                       this.flipY = false;
-               }
-
-               get images() {
-                       return this.image;
-               }
-
-               set images(value) {
-                       this.image = value;
-               }
-
-       }
-
-       CubeTexture.prototype.isCubeTexture = true;
-
-       class WebGLCubeRenderTarget extends WebGLRenderTarget {
-               constructor(size, options, dummy) {
-                       if (Number.isInteger(options)) {
-                               console.warn('THREE.WebGLCubeRenderTarget: constructor signature is now WebGLCubeRenderTarget( size, options )');
-                               options = dummy;
-                       }
-
-                       super(size, size, options);
-                       options = options || {}; // By convention -- likely based on the RenderMan spec from the 1990's -- cube maps are specified by WebGL (and three.js)
-                       // in a coordinate system in which positive-x is to the right when looking up the positive-z axis -- in other words,
-                       // in a left-handed coordinate system. By continuing this convention, preexisting cube maps continued to render correctly.
-                       // three.js uses a right-handed coordinate system. So environment maps used in three.js appear to have px and nx swapped
-                       // and the flag isRenderTargetTexture controls this conversion. The flip is not required when using WebGLCubeRenderTarget.texture
-                       // as a cube texture (this is detected when isRenderTargetTexture is set to true for cube textures).
-
-                       this.texture = new CubeTexture(undefined, options.mapping, options.wrapS, options.wrapT, options.magFilter, options.minFilter, options.format, options.type, options.anisotropy, options.encoding);
-                       this.texture.isRenderTargetTexture = true;
-                       this.texture.generateMipmaps = options.generateMipmaps !== undefined ? options.generateMipmaps : false;
-                       this.texture.minFilter = options.minFilter !== undefined ? options.minFilter : LinearFilter;
-                       this.texture._needsFlipEnvMap = false;
-               }
-
-               fromEquirectangularTexture(renderer, texture) {
-                       this.texture.type = texture.type;
-                       this.texture.format = RGBAFormat; // see #18859
-
-                       this.texture.encoding = texture.encoding;
-                       this.texture.generateMipmaps = texture.generateMipmaps;
-                       this.texture.minFilter = texture.minFilter;
-                       this.texture.magFilter = texture.magFilter;
-                       const shader = {
-                               uniforms: {
-                                       tEquirect: {
-                                               value: null
-                                       }
-                               },
-                               vertexShader:
-                               /* glsl */
-                               `
-
-                               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:
-                               /* glsl */
-                               `
-
-                               uniform sampler2D tEquirect;
-
-                               varying vec3 vWorldDirection;
-
-                               #include <common>
-
-                               void main() {
-
-                                       vec3 direction = normalize( vWorldDirection );
-
-                                       vec2 sampleUV = equirectUv( direction );
-
-                                       gl_FragColor = texture2D( tEquirect, sampleUV );
-
-                               }
-                       `
-                       };
-                       const geometry = new BoxGeometry(5, 5, 5);
-                       const material = new ShaderMaterial({
-                               name: 'CubemapFromEquirect',
-                               uniforms: cloneUniforms(shader.uniforms),
-                               vertexShader: shader.vertexShader,
-                               fragmentShader: shader.fragmentShader,
-                               side: BackSide,
-                               blending: NoBlending
-                       });
-                       material.uniforms.tEquirect.value = texture;
-                       const mesh = new Mesh(geometry, material);
-                       const currentMinFilter = texture.minFilter; // Avoid blurred poles
-
-                       if (texture.minFilter === LinearMipmapLinearFilter) texture.minFilter = LinearFilter;
-                       const camera = new CubeCamera(1, 10, this);
-                       camera.update(renderer, mesh);
-                       texture.minFilter = currentMinFilter;
-                       mesh.geometry.dispose();
-                       mesh.material.dispose();
-                       return this;
-               }
-
-               clear(renderer, color, depth, stencil) {
-                       const currentRenderTarget = renderer.getRenderTarget();
-
-                       for (let i = 0; i < 6; i++) {
-                               renderer.setRenderTarget(this, i);
-                               renderer.clear(color, depth, stencil);
-                       }
-
-                       renderer.setRenderTarget(currentRenderTarget);
-               }
-
-       }
-
-       WebGLCubeRenderTarget.prototype.isWebGLCubeRenderTarget = true;
-
-       const _vector1 = /*@__PURE__*/new Vector3();
-
-       const _vector2 = /*@__PURE__*/new Vector3();
-
-       const _normalMatrix = /*@__PURE__*/new Matrix3();
-
-       class Plane {
-               constructor(normal = new Vector3(1, 0, 0), constant = 0) {
-                       // normal is assumed to be normalized
-                       this.normal = normal;
-                       this.constant = constant;
-               }
-
-               set(normal, constant) {
-                       this.normal.copy(normal);
-                       this.constant = constant;
-                       return this;
-               }
-
-               setComponents(x, y, z, w) {
-                       this.normal.set(x, y, z);
-                       this.constant = w;
-                       return this;
-               }
-
-               setFromNormalAndCoplanarPoint(normal, point) {
-                       this.normal.copy(normal);
-                       this.constant = -point.dot(this.normal);
-                       return this;
-               }
-
-               setFromCoplanarPoints(a, b, c) {
-                       const normal = _vector1.subVectors(c, b).cross(_vector2.subVectors(a, b)).normalize(); // Q: should an error be thrown if normal is zero (e.g. degenerate plane)?
-
-
-                       this.setFromNormalAndCoplanarPoint(normal, a);
-                       return this;
-               }
-
-               copy(plane) {
-                       this.normal.copy(plane.normal);
-                       this.constant = plane.constant;
-                       return this;
-               }
-
-               normalize() {
-                       // Note: will lead to a divide by zero if the plane is invalid.
-                       const inverseNormalLength = 1.0 / this.normal.length();
-                       this.normal.multiplyScalar(inverseNormalLength);
-                       this.constant *= inverseNormalLength;
-                       return this;
-               }
-
-               negate() {
-                       this.constant *= -1;
-                       this.normal.negate();
-                       return this;
-               }
-
-               distanceToPoint(point) {
-                       return this.normal.dot(point) + this.constant;
-               }
-
-               distanceToSphere(sphere) {
-                       return this.distanceToPoint(sphere.center) - sphere.radius;
-               }
-
-               projectPoint(point, target) {
-                       return target.copy(this.normal).multiplyScalar(-this.distanceToPoint(point)).add(point);
-               }
-
-               intersectLine(line, target) {
-                       const direction = line.delta(_vector1);
-                       const denominator = this.normal.dot(direction);
-
-                       if (denominator === 0) {
-                               // line is coplanar, return origin
-                               if (this.distanceToPoint(line.start) === 0) {
-                                       return target.copy(line.start);
-                               } // Unsure if this is the correct method to handle this case.
-
-
-                               return null;
-                       }
-
-                       const t = -(line.start.dot(this.normal) + this.constant) / denominator;
-
-                       if (t < 0 || t > 1) {
-                               return null;
-                       }
-
-                       return target.copy(direction).multiplyScalar(t).add(line.start);
-               }
-
-               intersectsLine(line) {
-                       // Note: this tests if a line intersects the plane, not whether it (or its end-points) are coplanar with it.
-                       const startSign = this.distanceToPoint(line.start);
-                       const endSign = this.distanceToPoint(line.end);
-                       return startSign < 0 && endSign > 0 || endSign < 0 && startSign > 0;
-               }
-
-               intersectsBox(box) {
-                       return box.intersectsPlane(this);
-               }
-
-               intersectsSphere(sphere) {
-                       return sphere.intersectsPlane(this);
-               }
-
-               coplanarPoint(target) {
-                       return target.copy(this.normal).multiplyScalar(-this.constant);
-               }
-
-               applyMatrix4(matrix, optionalNormalMatrix) {
-                       const normalMatrix = optionalNormalMatrix || _normalMatrix.getNormalMatrix(matrix);
-
-                       const referencePoint = this.coplanarPoint(_vector1).applyMatrix4(matrix);
-                       const normal = this.normal.applyMatrix3(normalMatrix).normalize();
-                       this.constant = -referencePoint.dot(normal);
-                       return this;
-               }
-
-               translate(offset) {
-                       this.constant -= offset.dot(this.normal);
-                       return this;
-               }
-
-               equals(plane) {
-                       return plane.normal.equals(this.normal) && plane.constant === this.constant;
-               }
-
-               clone() {
-                       return new this.constructor().copy(this);
-               }
-
-       }
-
-       Plane.prototype.isPlane = true;
-
-       const _sphere$2 = /*@__PURE__*/new Sphere();
-
-       const _vector$7 = /*@__PURE__*/new Vector3();
-
-       class Frustum {
-               constructor(p0 = new Plane(), p1 = new Plane(), p2 = new Plane(), p3 = new Plane(), p4 = new Plane(), p5 = new Plane()) {
-                       this.planes = [p0, p1, p2, p3, p4, p5];
-               }
-
-               set(p0, p1, p2, p3, p4, p5) {
-                       const planes = this.planes;
-                       planes[0].copy(p0);
-                       planes[1].copy(p1);
-                       planes[2].copy(p2);
-                       planes[3].copy(p3);
-                       planes[4].copy(p4);
-                       planes[5].copy(p5);
-                       return this;
-               }
-
-               copy(frustum) {
-                       const planes = this.planes;
-
-                       for (let i = 0; i < 6; i++) {
-                               planes[i].copy(frustum.planes[i]);
-                       }
-
-                       return this;
-               }
-
-               setFromProjectionMatrix(m) {
-                       const planes = this.planes;
-                       const me = m.elements;
-                       const me0 = me[0],
-                                               me1 = me[1],
-                                               me2 = me[2],
-                                               me3 = me[3];
-                       const me4 = me[4],
-                                               me5 = me[5],
-                                               me6 = me[6],
-                                               me7 = me[7];
-                       const me8 = me[8],
-                                               me9 = me[9],
-                                               me10 = me[10],
-                                               me11 = me[11];
-                       const me12 = me[12],
-                                               me13 = me[13],
-                                               me14 = me[14],
-                                               me15 = me[15];
-                       planes[0].setComponents(me3 - me0, me7 - me4, me11 - me8, me15 - me12).normalize();
-                       planes[1].setComponents(me3 + me0, me7 + me4, me11 + me8, me15 + me12).normalize();
-                       planes[2].setComponents(me3 + me1, me7 + me5, me11 + me9, me15 + me13).normalize();
-                       planes[3].setComponents(me3 - me1, me7 - me5, me11 - me9, me15 - me13).normalize();
-                       planes[4].setComponents(me3 - me2, me7 - me6, me11 - me10, me15 - me14).normalize();
-                       planes[5].setComponents(me3 + me2, me7 + me6, me11 + me10, me15 + me14).normalize();
-                       return this;
-               }
-
-               intersectsObject(object) {
-                       const geometry = object.geometry;
-                       if (geometry.boundingSphere === null) geometry.computeBoundingSphere();
-
-                       _sphere$2.copy(geometry.boundingSphere).applyMatrix4(object.matrixWorld);
-
-                       return this.intersectsSphere(_sphere$2);
-               }
-
-               intersectsSprite(sprite) {
-                       _sphere$2.center.set(0, 0, 0);
-
-                       _sphere$2.radius = 0.7071067811865476;
-
-                       _sphere$2.applyMatrix4(sprite.matrixWorld);
-
-                       return this.intersectsSphere(_sphere$2);
-               }
-
-               intersectsSphere(sphere) {
-                       const planes = this.planes;
-                       const center = sphere.center;
-                       const negRadius = -sphere.radius;
-
-                       for (let i = 0; i < 6; i++) {
-                               const distance = planes[i].distanceToPoint(center);
-
-                               if (distance < negRadius) {
-                                       return false;
-                               }
-                       }
-
-                       return true;
-               }
-
-               intersectsBox(box) {
-                       const planes = this.planes;
-
-                       for (let i = 0; i < 6; i++) {
-                               const plane = planes[i]; // corner at max distance
-
-                               _vector$7.x = plane.normal.x > 0 ? box.max.x : box.min.x;
-                               _vector$7.y = plane.normal.y > 0 ? box.max.y : box.min.y;
-                               _vector$7.z = plane.normal.z > 0 ? box.max.z : box.min.z;
-
-                               if (plane.distanceToPoint(_vector$7) < 0) {
-                                       return false;
-                               }
-                       }
-
-                       return true;
-               }
-
-               containsPoint(point) {
-                       const planes = this.planes;
-
-                       for (let i = 0; i < 6; i++) {
-                               if (planes[i].distanceToPoint(point) < 0) {
-                                       return false;
-                               }
-                       }
-
-                       return true;
-               }
-
-               clone() {
-                       return new this.constructor().copy(this);
-               }
-
-       }
-
-       function WebGLAnimation() {
-               let context = null;
-               let isAnimating = false;
-               let animationLoop = null;
-               let requestId = null;
-
-               function onAnimationFrame(time, frame) {
-                       animationLoop(time, frame);
-                       requestId = context.requestAnimationFrame(onAnimationFrame);
-               }
-
-               return {
-                       start: function () {
-                               if (isAnimating === true) return;
-                               if (animationLoop === null) return;
-                               requestId = context.requestAnimationFrame(onAnimationFrame);
-                               isAnimating = true;
-                       },
-                       stop: function () {
-                               context.cancelAnimationFrame(requestId);
-                               isAnimating = false;
-                       },
-                       setAnimationLoop: function (callback) {
-                               animationLoop = callback;
-                       },
-                       setContext: function (value) {
-                               context = value;
-                       }
-               };
-       }
-
-       function WebGLAttributes(gl, capabilities) {
-               const isWebGL2 = capabilities.isWebGL2;
-               const buffers = new WeakMap();
-
-               function createBuffer(attribute, bufferType) {
-                       const array = attribute.array;
-                       const usage = attribute.usage;
-                       const buffer = gl.createBuffer();
-                       gl.bindBuffer(bufferType, buffer);
-                       gl.bufferData(bufferType, array, usage);
-                       attribute.onUploadCallback();
-                       let type = gl.FLOAT;
-
-                       if (array instanceof Float32Array) {
-                               type = gl.FLOAT;
-                       } else if (array instanceof Float64Array) {
-                               console.warn('THREE.WebGLAttributes: Unsupported data buffer format: Float64Array.');
-                       } else if (array instanceof Uint16Array) {
-                               if (attribute.isFloat16BufferAttribute) {
-                                       if (isWebGL2) {
-                                               type = gl.HALF_FLOAT;
-                                       } else {
-                                               console.warn('THREE.WebGLAttributes: Usage of Float16BufferAttribute requires WebGL2.');
-                                       }
-                               } else {
-                                       type = gl.UNSIGNED_SHORT;
-                               }
-                       } else if (array instanceof Int16Array) {
-                               type = gl.SHORT;
-                       } else if (array instanceof Uint32Array) {
-                               type = gl.UNSIGNED_INT;
-                       } else if (array instanceof Int32Array) {
-                               type = gl.INT;
-                       } else if (array instanceof Int8Array) {
-                               type = gl.BYTE;
-                       } else if (array instanceof Uint8Array) {
-                               type = gl.UNSIGNED_BYTE;
-                       } else if (array instanceof Uint8ClampedArray) {
-                               type = gl.UNSIGNED_BYTE;
-                       }
-
-                       return {
-                               buffer: buffer,
-                               type: type,
-                               bytesPerElement: array.BYTES_PER_ELEMENT,
-                               version: attribute.version
-                       };
-               }
-
-               function updateBuffer(buffer, attribute, bufferType) {
-                       const array = attribute.array;
-                       const updateRange = attribute.updateRange;
-                       gl.bindBuffer(bufferType, buffer);
-
-                       if (updateRange.count === -1) {
-                               // Not using update ranges
-                               gl.bufferSubData(bufferType, 0, array);
-                       } else {
-                               if (isWebGL2) {
-                                       gl.bufferSubData(bufferType, updateRange.offset * array.BYTES_PER_ELEMENT, array, updateRange.offset, updateRange.count);
-                               } else {
-                                       gl.bufferSubData(bufferType, updateRange.offset * array.BYTES_PER_ELEMENT, array.subarray(updateRange.offset, updateRange.offset + updateRange.count));
-                               }
-
-                               updateRange.count = -1; // reset range
-                       }
-               } //
-
-
-               function get(attribute) {
-                       if (attribute.isInterleavedBufferAttribute) attribute = attribute.data;
-                       return buffers.get(attribute);
-               }
-
-               function remove(attribute) {
-                       if (attribute.isInterleavedBufferAttribute) attribute = attribute.data;
-                       const data = buffers.get(attribute);
-
-                       if (data) {
-                               gl.deleteBuffer(data.buffer);
-                               buffers.delete(attribute);
-                       }
-               }
-
-               function update(attribute, bufferType) {
-                       if (attribute.isGLBufferAttribute) {
-                               const cached = buffers.get(attribute);
-
-                               if (!cached || cached.version < attribute.version) {
-                                       buffers.set(attribute, {
-                                               buffer: attribute.buffer,
-                                               type: attribute.type,
-                                               bytesPerElement: attribute.elementSize,
-                                               version: attribute.version
-                                       });
-                               }
-
-                               return;
-                       }
-
-                       if (attribute.isInterleavedBufferAttribute) attribute = attribute.data;
-                       const data = buffers.get(attribute);
-
-                       if (data === undefined) {
-                               buffers.set(attribute, createBuffer(attribute, bufferType));
-                       } else if (data.version < attribute.version) {
-                               updateBuffer(data.buffer, attribute, bufferType);
-                               data.version = attribute.version;
-                       }
-               }
-
-               return {
-                       get: get,
-                       remove: remove,
-                       update: update
-               };
-       }
-
-       class PlaneGeometry extends BufferGeometry {
-               constructor(width = 1, height = 1, widthSegments = 1, heightSegments = 1) {
-                       super();
-                       this.type = 'PlaneGeometry';
-                       this.parameters = {
-                               width: width,
-                               height: height,
-                               widthSegments: widthSegments,
-                               heightSegments: heightSegments
-                       };
-                       const width_half = width / 2;
-                       const height_half = height / 2;
-                       const gridX = Math.floor(widthSegments);
-                       const gridY = Math.floor(heightSegments);
-                       const gridX1 = gridX + 1;
-                       const gridY1 = gridY + 1;
-                       const segment_width = width / gridX;
-                       const segment_height = height / gridY; //
-
-                       const indices = [];
-                       const vertices = [];
-                       const normals = [];
-                       const uvs = [];
-
-                       for (let iy = 0; iy < gridY1; iy++) {
-                               const y = iy * segment_height - height_half;
-
-                               for (let ix = 0; ix < gridX1; ix++) {
-                                       const x = ix * segment_width - width_half;
-                                       vertices.push(x, -y, 0);
-                                       normals.push(0, 0, 1);
-                                       uvs.push(ix / gridX);
-                                       uvs.push(1 - iy / gridY);
-                               }
-                       }
-
-                       for (let iy = 0; iy < gridY; iy++) {
-                               for (let ix = 0; ix < gridX; ix++) {
-                                       const a = ix + gridX1 * iy;
-                                       const b = ix + gridX1 * (iy + 1);
-                                       const c = ix + 1 + gridX1 * (iy + 1);
-                                       const d = ix + 1 + gridX1 * iy;
-                                       indices.push(a, b, d);
-                                       indices.push(b, c, d);
-                               }
-                       }
-
-                       this.setIndex(indices);
-                       this.setAttribute('position', new Float32BufferAttribute(vertices, 3));
-                       this.setAttribute('normal', new Float32BufferAttribute(normals, 3));
-                       this.setAttribute('uv', new Float32BufferAttribute(uvs, 2));
-               }
-
-               static fromJSON(data) {
-                       return new PlaneGeometry(data.width, data.height, data.widthSegments, data.heightSegments);
-               }
-
-       }
-
-       var alphamap_fragment = "#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, vUv ).g;\n#endif";
-
-       var alphamap_pars_fragment = "#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif";
-
-       var alphatest_fragment = "#ifdef USE_ALPHATEST\n\tif ( diffuseColor.a < alphaTest ) discard;\n#endif";
-
-       var alphatest_pars_fragment = "#ifdef USE_ALPHATEST\n\tuniform float alphaTest;\n#endif";
-
-       var aomap_fragment = "#ifdef USE_AOMAP\n\tfloat ambientOcclusion = ( texture2D( aoMap, vUv2 ).r - 1.0 ) * aoMapIntensity + 1.0;\n\treflectedLight.indirectDiffuse *= ambientOcclusion;\n\t#if defined( USE_ENVMAP ) && defined( STANDARD )\n\t\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\t\treflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness );\n\t#endif\n#endif";
-
-       var aomap_pars_fragment = "#ifdef USE_AOMAP\n\tuniform sampler2D aoMap;\n\tuniform float aoMapIntensity;\n#endif";
-
-       var begin_vertex = "vec3 transformed = vec3( position );";
-
-       var beginnormal_vertex = "vec3 objectNormal = vec3( normal );\n#ifdef USE_TANGENT\n\tvec3 objectTangent = vec3( tangent.xyz );\n#endif";
-
-       var bsdfs = "vec3 BRDF_Lambert( const in vec3 diffuseColor ) {\n\treturn RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {\n\tfloat fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\n\treturn f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\n}\nfloat V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\tfloat gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\treturn 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n\tfloat a2 = pow2( alpha );\n\tfloat denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n\treturn RECIPROCAL_PI * a2 / pow2( denom );\n}\nvec3 BRDF_GGX( const in IncidentLight incidentLight, const in vec3 viewDir, const in vec3 normal, const in vec3 f0, const in float f90, const in float roughness ) {\n\tfloat alpha = pow2( roughness );\n\tvec3 halfDir = normalize( incidentLight.direction + viewDir );\n\tfloat dotNL = saturate( dot( normal, incidentLight.direction ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\tvec3 F = F_Schlick( f0, f90, dotVH );\n\tfloat V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\tfloat D = D_GGX( alpha, dotNH );\n\treturn F * ( V * D );\n}\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\n\tconst float LUT_SIZE = 64.0;\n\tconst float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\n\tconst float LUT_BIAS = 0.5 / LUT_SIZE;\n\tfloat dotNV = saturate( dot( N, V ) );\n\tvec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );\n\tuv = uv * LUT_SCALE + LUT_BIAS;\n\treturn uv;\n}\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\n\tfloat l = length( f );\n\treturn max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\n}\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\n\tfloat x = dot( v1, v2 );\n\tfloat y = abs( x );\n\tfloat a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;\n\tfloat b = 3.4175940 + ( 4.1616724 + y ) * y;\n\tfloat v = a / b;\n\tfloat theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;\n\treturn cross( v1, v2 ) * theta_sintheta;\n}\nvec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {\n\tvec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\n\tvec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\n\tvec3 lightNormal = cross( v1, v2 );\n\tif( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\n\tvec3 T1, T2;\n\tT1 = normalize( V - N * dot( V, N ) );\n\tT2 = - cross( N, T1 );\n\tmat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );\n\tvec3 coords[ 4 ];\n\tcoords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\n\tcoords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\n\tcoords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\n\tcoords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\n\tcoords[ 0 ] = normalize( coords[ 0 ] );\n\tcoords[ 1 ] = normalize( coords[ 1 ] );\n\tcoords[ 2 ] = normalize( coords[ 2 ] );\n\tcoords[ 3 ] = normalize( coords[ 3 ] );\n\tvec3 vectorFormFactor = vec3( 0.0 );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\n\tfloat result = LTC_ClippedSphereFormFactor( vectorFormFactor );\n\treturn vec3( result );\n}\nfloat G_BlinnPhong_Implicit( ) {\n\treturn 0.25;\n}\nfloat D_BlinnPhong( const in float shininess, const in float dotNH ) {\n\treturn RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );\n}\nvec3 BRDF_BlinnPhong( const in IncidentLight incidentLight, const in GeometricContext geometry, const in vec3 specularColor, const in float shininess ) {\n\tvec3 halfDir = normalize( incidentLight.direction + geometry.viewDir );\n\tfloat dotNH = saturate( dot( geometry.normal, halfDir ) );\n\tfloat dotVH = saturate( dot( geometry.viewDir, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, 1.0, dotVH );\n\tfloat G = G_BlinnPhong_Implicit( );\n\tfloat D = D_BlinnPhong( shininess, dotNH );\n\treturn F * ( G * D );\n}\n#if defined( USE_SHEEN )\nfloat D_Charlie( float roughness, float NoH ) {\n\tfloat invAlpha = 1.0 / roughness;\n\tfloat cos2h = NoH * NoH;\n\tfloat sin2h = max( 1.0 - cos2h, 0.0078125 );\n\treturn ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );\n}\nfloat V_Neubelt( float NoV, float NoL ) {\n\treturn saturate( 1.0 / ( 4.0 * ( NoL + NoV - NoL * NoV ) ) );\n}\nvec3 BRDF_Sheen( const in float roughness, const in vec3 L, const in GeometricContext geometry, vec3 specularColor ) {\n\tvec3 N = geometry.normal;\n\tvec3 V = geometry.viewDir;\n\tvec3 H = normalize( V + L );\n\tfloat dotNH = saturate( dot( N, H ) );\n\treturn specularColor * D_Charlie( roughness, dotNH ) * V_Neubelt( dot(N, V), dot(N, L) );\n}\n#endif";
-
-       var bumpmap_pars_fragment = "#ifdef USE_BUMPMAP\n\tuniform sampler2D bumpMap;\n\tuniform float bumpScale;\n\tvec2 dHdxy_fwd() {\n\t\tvec2 dSTdx = dFdx( vUv );\n\t\tvec2 dSTdy = dFdy( vUv );\n\t\tfloat Hll = bumpScale * texture2D( bumpMap, vUv ).x;\n\t\tfloat dBx = bumpScale * texture2D( bumpMap, vUv + dSTdx ).x - Hll;\n\t\tfloat dBy = bumpScale * texture2D( bumpMap, vUv + dSTdy ).x - Hll;\n\t\treturn vec2( dBx, dBy );\n\t}\n\tvec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) {\n\t\tvec3 vSigmaX = vec3( dFdx( surf_pos.x ), dFdx( surf_pos.y ), dFdx( surf_pos.z ) );\n\t\tvec3 vSigmaY = vec3( dFdy( surf_pos.x ), dFdy( surf_pos.y ), dFdy( surf_pos.z ) );\n\t\tvec3 vN = surf_norm;\n\t\tvec3 R1 = cross( vSigmaY, vN );\n\t\tvec3 R2 = cross( vN, vSigmaX );\n\t\tfloat fDet = dot( vSigmaX, R1 ) * faceDirection;\n\t\tvec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n\t\treturn normalize( abs( fDet ) * surf_norm - vGrad );\n\t}\n#endif";
-
-       var clipping_planes_fragment = "#if NUM_CLIPPING_PLANES > 0\n\tvec4 plane;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n\t\tplane = clippingPlanes[ i ];\n\t\tif ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;\n\t}\n\t#pragma unroll_loop_end\n\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\t\tbool clipped = true;\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n\t\t\tplane = clippingPlanes[ i ];\n\t\t\tclipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t\tif ( clipped ) discard;\n\t#endif\n#endif";
-
-       var clipping_planes_pars_fragment = "#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n\tuniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif";
-
-       var clipping_planes_pars_vertex = "#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n#endif";
-
-       var clipping_planes_vertex = "#if NUM_CLIPPING_PLANES > 0\n\tvClipPosition = - mvPosition.xyz;\n#endif";
-
-       var color_fragment = "#if defined( USE_COLOR_ALPHA )\n\tdiffuseColor *= vColor;\n#elif defined( USE_COLOR )\n\tdiffuseColor.rgb *= vColor;\n#endif";
-
-       var color_pars_fragment = "#if defined( USE_COLOR_ALPHA )\n\tvarying vec4 vColor;\n#elif defined( USE_COLOR )\n\tvarying vec3 vColor;\n#endif";
-
-       var color_pars_vertex = "#if defined( USE_COLOR_ALPHA )\n\tvarying vec4 vColor;\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )\n\tvarying vec3 vColor;\n#endif";
-
-       var color_vertex = "#if defined( USE_COLOR_ALPHA )\n\tvColor = vec4( 1.0 );\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )\n\tvColor = vec3( 1.0 );\n#endif\n#ifdef USE_COLOR\n\tvColor *= color;\n#endif\n#ifdef USE_INSTANCING_COLOR\n\tvColor.xyz *= instanceColor.xyz;\n#endif";
-
-       var common = "#define PI 3.141592653589793\n#define PI2 6.283185307179586\n#define PI_HALF 1.5707963267948966\n#define RECIPROCAL_PI 0.3183098861837907\n#define RECIPROCAL_PI2 0.15915494309189535\n#define EPSILON 1e-6\n#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\n#define whiteComplement( a ) ( 1.0 - saturate( a ) )\nfloat pow2( const in float x ) { return x*x; }\nfloat pow3( const in float x ) { return x*x*x; }\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\nfloat max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); }\nfloat average( const in vec3 color ) { return dot( color, vec3( 0.3333 ) ); }\nhighp float rand( const in vec2 uv ) {\n\tconst highp float a = 12.9898, b = 78.233, c = 43758.5453;\n\thighp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n\treturn fract( sin( sn ) * c );\n}\n#ifdef HIGH_PRECISION\n\tfloat precisionSafeLength( vec3 v ) { return length( v ); }\n#else\n\tfloat precisionSafeLength( vec3 v ) {\n\t\tfloat maxComponent = max3( abs( v ) );\n\t\treturn length( v / maxComponent ) * maxComponent;\n\t}\n#endif\nstruct IncidentLight {\n\tvec3 color;\n\tvec3 direction;\n\tbool visible;\n};\nstruct ReflectedLight {\n\tvec3 directDiffuse;\n\tvec3 directSpecular;\n\tvec3 indirectDiffuse;\n\tvec3 indirectSpecular;\n};\nstruct GeometricContext {\n\tvec3 position;\n\tvec3 normal;\n\tvec3 viewDir;\n#ifdef USE_CLEARCOAT\n\tvec3 clearcoatNormal;\n#endif\n};\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n}\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\n}\nmat3 transposeMat3( const in mat3 m ) {\n\tmat3 tmp;\n\ttmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );\n\ttmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );\n\ttmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );\n\treturn tmp;\n}\nfloat linearToRelativeLuminance( const in vec3 color ) {\n\tvec3 weights = vec3( 0.2126, 0.7152, 0.0722 );\n\treturn dot( weights, color.rgb );\n}\nbool isPerspectiveMatrix( mat4 m ) {\n\treturn m[ 2 ][ 3 ] == - 1.0;\n}\nvec2 equirectUv( in vec3 dir ) {\n\tfloat u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;\n\tfloat v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\treturn vec2( u, v );\n}";
-
-       var cube_uv_reflection_fragment = "#ifdef ENVMAP_TYPE_CUBE_UV\n\t#define cubeUV_maxMipLevel 8.0\n\t#define cubeUV_minMipLevel 4.0\n\t#define cubeUV_maxTileSize 256.0\n\t#define cubeUV_minTileSize 16.0\n\tfloat getFace( vec3 direction ) {\n\t\tvec3 absDirection = abs( direction );\n\t\tfloat face = - 1.0;\n\t\tif ( absDirection.x > absDirection.z ) {\n\t\t\tif ( absDirection.x > absDirection.y )\n\t\t\t\tface = direction.x > 0.0 ? 0.0 : 3.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t} else {\n\t\t\tif ( absDirection.z > absDirection.y )\n\t\t\t\tface = direction.z > 0.0 ? 2.0 : 5.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t}\n\t\treturn face;\n\t}\n\tvec2 getUV( vec3 direction, float face ) {\n\t\tvec2 uv;\n\t\tif ( face == 0.0 ) {\n\t\t\tuv = vec2( direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 1.0 ) {\n\t\t\tuv = vec2( - direction.x, - direction.z ) / abs( direction.y );\n\t\t} else if ( face == 2.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.y ) / abs( direction.z );\n\t\t} else if ( face == 3.0 ) {\n\t\t\tuv = vec2( - direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 4.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.z ) / abs( direction.y );\n\t\t} else {\n\t\t\tuv = vec2( direction.x, direction.y ) / abs( direction.z );\n\t\t}\n\t\treturn 0.5 * ( uv + 1.0 );\n\t}\n\tvec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {\n\t\tfloat face = getFace( direction );\n\t\tfloat filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );\n\t\tmipInt = max( mipInt, cubeUV_minMipLevel );\n\t\tfloat faceSize = exp2( mipInt );\n\t\tfloat texelSize = 1.0 / ( 3.0 * cubeUV_maxTileSize );\n\t\tvec2 uv = getUV( direction, face ) * ( faceSize - 1.0 );\n\t\tvec2 f = fract( uv );\n\t\tuv += 0.5 - f;\n\t\tif ( face > 2.0 ) {\n\t\t\tuv.y += faceSize;\n\t\t\tface -= 3.0;\n\t\t}\n\t\tuv.x += face * faceSize;\n\t\tif ( mipInt < cubeUV_maxMipLevel ) {\n\t\t\tuv.y += 2.0 * cubeUV_maxTileSize;\n\t\t}\n\t\tuv.y += filterInt * 2.0 * cubeUV_minTileSize;\n\t\tuv.x += 3.0 * max( 0.0, cubeUV_maxTileSize - 2.0 * faceSize );\n\t\tuv *= texelSize;\n\t\tvec3 tl = envMapTexelToLinear( texture2D( envMap, uv ) ).rgb;\n\t\tuv.x += texelSize;\n\t\tvec3 tr = envMapTexelToLinear( texture2D( envMap, uv ) ).rgb;\n\t\tuv.y += texelSize;\n\t\tvec3 br = envMapTexelToLinear( texture2D( envMap, uv ) ).rgb;\n\t\tuv.x -= texelSize;\n\t\tvec3 bl = envMapTexelToLinear( texture2D( envMap, uv ) ).rgb;\n\t\tvec3 tm = mix( tl, tr, f.x );\n\t\tvec3 bm = mix( bl, br, f.x );\n\t\treturn mix( tm, bm, f.y );\n\t}\n\t#define r0 1.0\n\t#define v0 0.339\n\t#define m0 - 2.0\n\t#define r1 0.8\n\t#define v1 0.276\n\t#define m1 - 1.0\n\t#define r4 0.4\n\t#define v4 0.046\n\t#define m4 2.0\n\t#define r5 0.305\n\t#define v5 0.016\n\t#define m5 3.0\n\t#define r6 0.21\n\t#define v6 0.0038\n\t#define m6 4.0\n\tfloat roughnessToMip( float roughness ) {\n\t\tfloat mip = 0.0;\n\t\tif ( roughness >= r1 ) {\n\t\t\tmip = ( r0 - roughness ) * ( m1 - m0 ) / ( r0 - r1 ) + m0;\n\t\t} else if ( roughness >= r4 ) {\n\t\t\tmip = ( r1 - roughness ) * ( m4 - m1 ) / ( r1 - r4 ) + m1;\n\t\t} else if ( roughness >= r5 ) {\n\t\t\tmip = ( r4 - roughness ) * ( m5 - m4 ) / ( r4 - r5 ) + m4;\n\t\t} else if ( roughness >= r6 ) {\n\t\t\tmip = ( r5 - roughness ) * ( m6 - m5 ) / ( r5 - r6 ) + m5;\n\t\t} else {\n\t\t\tmip = - 2.0 * log2( 1.16 * roughness );\t\t}\n\t\treturn mip;\n\t}\n\tvec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {\n\t\tfloat mip = clamp( roughnessToMip( roughness ), m0, cubeUV_maxMipLevel );\n\t\tfloat mipF = fract( mip );\n\t\tfloat mipInt = floor( mip );\n\t\tvec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );\n\t\tif ( mipF == 0.0 ) {\n\t\t\treturn vec4( color0, 1.0 );\n\t\t} else {\n\t\t\tvec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );\n\t\t\treturn vec4( mix( color0, color1, mipF ), 1.0 );\n\t\t}\n\t}\n#endif";
-
-       var defaultnormal_vertex = "vec3 transformedNormal = objectNormal;\n#ifdef USE_INSTANCING\n\tmat3 m = mat3( instanceMatrix );\n\ttransformedNormal /= vec3( dot( m[ 0 ], m[ 0 ] ), dot( m[ 1 ], m[ 1 ] ), dot( m[ 2 ], m[ 2 ] ) );\n\ttransformedNormal = m * transformedNormal;\n#endif\ntransformedNormal = normalMatrix * transformedNormal;\n#ifdef FLIP_SIDED\n\ttransformedNormal = - transformedNormal;\n#endif\n#ifdef USE_TANGENT\n\tvec3 transformedTangent = ( modelViewMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n\t#ifdef FLIP_SIDED\n\t\ttransformedTangent = - transformedTangent;\n\t#endif\n#endif";
-
-       var displacementmap_pars_vertex = "#ifdef USE_DISPLACEMENTMAP\n\tuniform sampler2D displacementMap;\n\tuniform float displacementScale;\n\tuniform float displacementBias;\n#endif";
-
-       var displacementmap_vertex = "#ifdef USE_DISPLACEMENTMAP\n\ttransformed += normalize( objectNormal ) * ( texture2D( displacementMap, vUv ).x * displacementScale + displacementBias );\n#endif";
-
-       var emissivemap_fragment = "#ifdef USE_EMISSIVEMAP\n\tvec4 emissiveColor = texture2D( emissiveMap, vUv );\n\temissiveColor.rgb = emissiveMapTexelToLinear( emissiveColor ).rgb;\n\ttotalEmissiveRadiance *= emissiveColor.rgb;\n#endif";
-
-       var emissivemap_pars_fragment = "#ifdef USE_EMISSIVEMAP\n\tuniform sampler2D emissiveMap;\n#endif";
-
-       var encodings_fragment = "gl_FragColor = linearToOutputTexel( gl_FragColor );";
-
-       var encodings_pars_fragment = "\nvec4 LinearToLinear( in vec4 value ) {\n\treturn value;\n}\nvec4 GammaToLinear( in vec4 value, in float gammaFactor ) {\n\treturn vec4( pow( value.rgb, vec3( gammaFactor ) ), value.a );\n}\nvec4 LinearToGamma( in vec4 value, in float gammaFactor ) {\n\treturn vec4( pow( value.rgb, vec3( 1.0 / gammaFactor ) ), value.a );\n}\nvec4 sRGBToLinear( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.a );\n}\nvec4 LinearTosRGB( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a );\n}\nvec4 RGBEToLinear( in vec4 value ) {\n\treturn vec4( value.rgb * exp2( value.a * 255.0 - 128.0 ), 1.0 );\n}\nvec4 LinearToRGBE( in vec4 value ) {\n\tfloat maxComponent = max( max( value.r, value.g ), value.b );\n\tfloat fExp = clamp( ceil( log2( maxComponent ) ), -128.0, 127.0 );\n\treturn vec4( value.rgb / exp2( fExp ), ( fExp + 128.0 ) / 255.0 );\n}\nvec4 RGBMToLinear( in vec4 value, in float maxRange ) {\n\treturn vec4( value.rgb * value.a * maxRange, 1.0 );\n}\nvec4 LinearToRGBM( in vec4 value, in float maxRange ) {\n\tfloat maxRGB = max( value.r, max( value.g, value.b ) );\n\tfloat M = clamp( maxRGB / maxRange, 0.0, 1.0 );\n\tM = ceil( M * 255.0 ) / 255.0;\n\treturn vec4( value.rgb / ( M * maxRange ), M );\n}\nvec4 RGBDToLinear( in vec4 value, in float maxRange ) {\n\treturn vec4( value.rgb * ( ( maxRange / 255.0 ) / value.a ), 1.0 );\n}\nvec4 LinearToRGBD( in vec4 value, in float maxRange ) {\n\tfloat maxRGB = max( value.r, max( value.g, value.b ) );\n\tfloat D = max( maxRange / maxRGB, 1.0 );\n\tD = clamp( floor( D ) / 255.0, 0.0, 1.0 );\n\treturn vec4( value.rgb * ( D * ( 255.0 / maxRange ) ), D );\n}\nconst mat3 cLogLuvM = mat3( 0.2209, 0.3390, 0.4184, 0.1138, 0.6780, 0.7319, 0.0102, 0.1130, 0.2969 );\nvec4 LinearToLogLuv( in vec4 value ) {\n\tvec3 Xp_Y_XYZp = cLogLuvM * value.rgb;\n\tXp_Y_XYZp = max( Xp_Y_XYZp, vec3( 1e-6, 1e-6, 1e-6 ) );\n\tvec4 vResult;\n\tvResult.xy = Xp_Y_XYZp.xy / Xp_Y_XYZp.z;\n\tfloat Le = 2.0 * log2(Xp_Y_XYZp.y) + 127.0;\n\tvResult.w = fract( Le );\n\tvResult.z = ( Le - ( floor( vResult.w * 255.0 ) ) / 255.0 ) / 255.0;\n\treturn vResult;\n}\nconst mat3 cLogLuvInverseM = mat3( 6.0014, -2.7008, -1.7996, -1.3320, 3.1029, -5.7721, 0.3008, -1.0882, 5.6268 );\nvec4 LogLuvToLinear( in vec4 value ) {\n\tfloat Le = value.z * 255.0 + value.w;\n\tvec3 Xp_Y_XYZp;\n\tXp_Y_XYZp.y = exp2( ( Le - 127.0 ) / 2.0 );\n\tXp_Y_XYZp.z = Xp_Y_XYZp.y / value.y;\n\tXp_Y_XYZp.x = value.x * Xp_Y_XYZp.z;\n\tvec3 vRGB = cLogLuvInverseM * Xp_Y_XYZp.rgb;\n\treturn vec4( max( vRGB, 0.0 ), 1.0 );\n}";
-
-       var envmap_fragment = "#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvec3 cameraToFrag;\n\t\tif ( isOrthographic ) {\n\t\t\tcameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToFrag = normalize( vWorldPosition - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( cameraToFrag, worldNormal );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );\n\t\t#endif\n\t#else\n\t\tvec3 reflectVec = vReflect;\n\t#endif\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 envColor = textureCube( envMap, vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n\t\tenvColor = envMapTexelToLinear( envColor );\n\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\tvec4 envColor = textureCubeUV( envMap, reflectVec, 0.0 );\n\t#else\n\t\tvec4 envColor = vec4( 0.0 );\n\t#endif\n\t#ifdef ENVMAP_BLENDING_MULTIPLY\n\t\toutgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_MIX )\n\t\toutgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_ADD )\n\t\toutgoingLight += envColor.xyz * specularStrength * reflectivity;\n\t#endif\n#endif";
-
-       var envmap_common_pars_fragment = "#ifdef USE_ENVMAP\n\tuniform float envMapIntensity;\n\tuniform float flipEnvMap;\n\tuniform int maxMipLevel;\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tuniform samplerCube envMap;\n\t#else\n\t\tuniform sampler2D envMap;\n\t#endif\n\t\n#endif";
-
-       var envmap_pars_fragment = "#ifdef USE_ENVMAP\n\tuniform float reflectivity;\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\tvarying vec3 vWorldPosition;\n\t\tuniform float refractionRatio;\n\t#else\n\t\tvarying vec3 vReflect;\n\t#endif\n#endif";
-
-       var envmap_pars_vertex = "#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) ||defined( PHONG )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\t\n\t\tvarying vec3 vWorldPosition;\n\t#else\n\t\tvarying vec3 vReflect;\n\t\tuniform float refractionRatio;\n\t#endif\n#endif";
-
-       var envmap_vertex = "#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvWorldPosition = worldPosition.xyz;\n\t#else\n\t\tvec3 cameraToVertex;\n\t\tif ( isOrthographic ) {\n\t\t\tcameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvReflect = reflect( cameraToVertex, worldNormal );\n\t\t#else\n\t\t\tvReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n\t\t#endif\n\t#endif\n#endif";
-
-       var fog_vertex = "#ifdef USE_FOG\n\tvFogDepth = - mvPosition.z;\n#endif";
-
-       var fog_pars_vertex = "#ifdef USE_FOG\n\tvarying float vFogDepth;\n#endif";
-
-       var fog_fragment = "#ifdef USE_FOG\n\t#ifdef FOG_EXP2\n\t\tfloat fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );\n\t#else\n\t\tfloat fogFactor = smoothstep( fogNear, fogFar, vFogDepth );\n\t#endif\n\tgl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\n#endif";
-
-       var fog_pars_fragment = "#ifdef USE_FOG\n\tuniform vec3 fogColor;\n\tvarying float vFogDepth;\n\t#ifdef FOG_EXP2\n\t\tuniform float fogDensity;\n\t#else\n\t\tuniform float fogNear;\n\t\tuniform float fogFar;\n\t#endif\n#endif";
-
-       var gradientmap_pars_fragment = "#ifdef USE_GRADIENTMAP\n\tuniform sampler2D gradientMap;\n#endif\nvec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {\n\tfloat dotNL = dot( normal, lightDirection );\n\tvec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );\n\t#ifdef USE_GRADIENTMAP\n\t\treturn texture2D( gradientMap, coord ).rgb;\n\t#else\n\t\treturn ( coord.x < 0.7 ) ? vec3( 0.7 ) : vec3( 1.0 );\n\t#endif\n}";
-
-       var lightmap_fragment = "#ifdef USE_LIGHTMAP\n\tvec4 lightMapTexel = texture2D( lightMap, vUv2 );\n\tvec3 lightMapIrradiance = lightMapTexelToLinear( lightMapTexel ).rgb * lightMapIntensity;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tlightMapIrradiance *= PI;\n\t#endif\n\treflectedLight.indirectDiffuse += lightMapIrradiance;\n#endif";
-
-       var lightmap_pars_fragment = "#ifdef USE_LIGHTMAP\n\tuniform sampler2D lightMap;\n\tuniform float lightMapIntensity;\n#endif";
-
-       var lights_lambert_vertex = "vec3 diffuse = vec3( 1.0 );\nGeometricContext geometry;\ngeometry.position = mvPosition.xyz;\ngeometry.normal = normalize( transformedNormal );\ngeometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( -mvPosition.xyz );\nGeometricContext backGeometry;\nbackGeometry.position = geometry.position;\nbackGeometry.normal = -geometry.normal;\nbackGeometry.viewDir = geometry.viewDir;\nvLightFront = vec3( 0.0 );\nvIndirectFront = vec3( 0.0 );\n#ifdef DOUBLE_SIDED\n\tvLightBack = vec3( 0.0 );\n\tvIndirectBack = vec3( 0.0 );\n#endif\nIncidentLight directLight;\nfloat dotNL;\nvec3 directLightColor_Diffuse;\nvIndirectFront += getAmbientLightIrradiance( ambientLightColor );\nvIndirectFront += getLightProbeIrradiance( lightProbe, geometry );\n#ifdef DOUBLE_SIDED\n\tvIndirectBack += getAmbientLightIrradiance( ambientLightColor );\n\tvIndirectBack += getLightProbeIrradiance( lightProbe, backGeometry );\n#endif\n#if NUM_POINT_LIGHTS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tgetPointLightInfo( pointLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( - dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tgetSpotLightInfo( spotLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( - dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if NUM_DIR_LIGHTS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tgetDirectionalLightInfo( directionalLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( - dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\tvIndirectFront += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvIndirectBack += getHemisphereLightIrradiance( hemisphereLights[ i ], backGeometry );\n\t\t#endif\n\t}\n\t#pragma unroll_loop_end\n#endif";
-
-       var lights_pars_begin = "uniform bool receiveShadow;\nuniform vec3 ambientLightColor;\nuniform vec3 lightProbe[ 9 ];\nvec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {\n\tfloat x = normal.x, y = normal.y, z = normal.z;\n\tvec3 result = shCoefficients[ 0 ] * 0.886227;\n\tresult += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;\n\tresult += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;\n\tresult += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;\n\tresult += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;\n\tresult += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;\n\tresult += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );\n\tresult += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;\n\tresult += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );\n\treturn result;\n}\nvec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in GeometricContext geometry ) {\n\tvec3 worldNormal = inverseTransformDirection( geometry.normal, viewMatrix );\n\tvec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );\n\treturn irradiance;\n}\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n\tvec3 irradiance = ambientLightColor;\n\treturn irradiance;\n}\nfloat getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n\t#if defined ( PHYSICALLY_CORRECT_LIGHTS )\n\t\tfloat distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n\t\tif ( cutoffDistance > 0.0 ) {\n\t\t\tdistanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n\t\t}\n\t\treturn distanceFalloff;\n\t#else\n\t\tif ( cutoffDistance > 0.0 && decayExponent > 0.0 ) {\n\t\t\treturn pow( saturate( - lightDistance / cutoffDistance + 1.0 ), decayExponent );\n\t\t}\n\t\treturn 1.0;\n\t#endif\n}\nfloat getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) {\n\treturn smoothstep( coneCosine, penumbraCosine, angleCosine );\n}\n#if NUM_DIR_LIGHTS > 0\n\tstruct DirectionalLight {\n\t\tvec3 direction;\n\t\tvec3 color;\n\t};\n\tuniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n\tvoid getDirectionalLightInfo( const in DirectionalLight directionalLight, const in GeometricContext geometry, out IncidentLight light ) {\n\t\tlight.color = directionalLight.color;\n\t\tlight.direction = directionalLight.direction;\n\t\tlight.visible = true;\n\t}\n#endif\n#if NUM_POINT_LIGHTS > 0\n\tstruct PointLight {\n\t\tvec3 position;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t};\n\tuniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n\tvoid getPointLightInfo( const in PointLight pointLight, const in GeometricContext geometry, out IncidentLight light ) {\n\t\tvec3 lVector = pointLight.position - geometry.position;\n\t\tlight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tlight.color = pointLight.color;\n\t\tlight.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay );\n\t\tlight.visible = ( light.color != vec3( 0.0 ) );\n\t}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\tstruct SpotLight {\n\t\tvec3 position;\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tfloat coneCos;\n\t\tfloat penumbraCos;\n\t};\n\tuniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n\tvoid getSpotLightInfo( const in SpotLight spotLight, const in GeometricContext geometry, out IncidentLight light ) {\n\t\tvec3 lVector = spotLight.position - geometry.position;\n\t\tlight.direction = normalize( lVector );\n\t\tfloat angleCos = dot( light.direction, spotLight.direction );\n\t\tfloat spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n\t\tif ( spotAttenuation > 0.0 ) {\n\t\t\tfloat lightDistance = length( lVector );\n\t\t\tlight.color = spotLight.color * spotAttenuation;\n\t\t\tlight.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay );\n\t\t\tlight.visible = ( light.color != vec3( 0.0 ) );\n\t\t} else {\n\t\t\tlight.color = vec3( 0.0 );\n\t\t\tlight.visible = false;\n\t\t}\n\t}\n#endif\n#if NUM_RECT_AREA_LIGHTS > 0\n\tstruct RectAreaLight {\n\t\tvec3 color;\n\t\tvec3 position;\n\t\tvec3 halfWidth;\n\t\tvec3 halfHeight;\n\t};\n\tuniform sampler2D ltc_1;\tuniform sampler2D ltc_2;\n\tuniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\tstruct HemisphereLight {\n\t\tvec3 direction;\n\t\tvec3 skyColor;\n\t\tvec3 groundColor;\n\t};\n\tuniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n\tvec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in GeometricContext geometry ) {\n\t\tfloat dotNL = dot( geometry.normal, hemiLight.direction );\n\t\tfloat hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n\t\tvec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n\t\treturn irradiance;\n\t}\n#endif";
-
-       var envmap_physical_pars_fragment = "#if defined( USE_ENVMAP )\n\t#ifdef ENVMAP_MODE_REFRACTION\n\t\tuniform float refractionRatio;\n\t#endif\n\tvec3 getIBLIrradiance( const in GeometricContext geometry ) {\n\t\t#if defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec3 worldNormal = inverseTransformDirection( geometry.normal, viewMatrix );\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, worldNormal, 1.0 );\n\t\t\treturn PI * envMapColor.rgb * envMapIntensity;\n\t\t#else\n\t\t\treturn vec3( 0.0 );\n\t\t#endif\n\t}\n\tvec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {\n\t\t#if defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec3 reflectVec;\n\t\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\t\treflectVec = reflect( - viewDir, normal );\n\t\t\t\treflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );\n\t\t\t#else\n\t\t\t\treflectVec = refract( - viewDir, normal, refractionRatio );\n\t\t\t#endif\n\t\t\treflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, reflectVec, roughness );\n\t\t\treturn envMapColor.rgb * envMapIntensity;\n\t\t#else\n\t\t\treturn vec3( 0.0 );\n\t\t#endif\n\t}\n#endif";
-
-       var lights_toon_fragment = "ToonMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;";
-
-       var lights_toon_pars_fragment = "varying vec3 vViewPosition;\nstruct ToonMaterial {\n\tvec3 diffuseColor;\n};\nvoid RE_Direct_Toon( const in IncidentLight directLight, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\tvec3 irradiance = getGradientIrradiance( geometry.normal, directLight.direction ) * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_Toon\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Toon\n#define Material_LightProbeLOD( material )\t(0)";
-
-       var lights_phong_fragment = "BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;";
-
-       var lights_phong_pars_fragment = "varying vec3 vViewPosition;\nstruct BlinnPhongMaterial {\n\tvec3 diffuseColor;\n\tvec3 specularColor;\n\tfloat specularShininess;\n\tvec3 specularStrength;\n};\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n\treflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight, geometry, material.specularColor, material.specularShininess ) * material.specularStrength.rgb;\n}\nvoid RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_BlinnPhong\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_BlinnPhong\n#define Material_LightProbeLOD( material )\t(0)";
-
-       var lights_physical_fragment = "PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nvec3 dxy = max( abs( dFdx( geometryNormal ) ), abs( dFdy( geometryNormal ) ) );\nfloat geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );\nmaterial.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness;\nmaterial.roughness = min( material.roughness, 1.0 );\n#ifdef IOR\n\t#ifdef SPECULAR\n\t\tfloat specularIntensityFactor = specularIntensity;\n\t\tvec3 specularTintFactor = specularTint;\n\t\t#ifdef USE_SPECULARINTENSITYMAP\n\t\t\tspecularIntensityFactor *= texture2D( specularIntensityMap, vUv ).a;\n\t\t#endif\n\t\t#ifdef USE_SPECULARTINTMAP\n\t\t\tspecularTintFactor *= specularTintMapTexelToLinear( texture2D( specularTintMap, vUv ) ).rgb;\n\t\t#endif\n\t\tmaterial.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor );\n\t#else\n\t\tfloat specularIntensityFactor = 1.0;\n\t\tvec3 specularTintFactor = vec3( 1.0 );\n\t\tmaterial.specularF90 = 1.0;\n\t#endif\n\tmaterial.specularColor = mix( min( pow2( ( ior - 1.0 ) / ( ior + 1.0 ) ) * specularTintFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor );\n#else\n\tmaterial.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor );\n\tmaterial.specularF90 = 1.0;\n#endif\n#ifdef USE_CLEARCOAT\n\tmaterial.clearcoat = clearcoat;\n\tmaterial.clearcoatRoughness = clearcoatRoughness;\n\tmaterial.clearcoatF0 = vec3( 0.04 );\n\tmaterial.clearcoatF90 = 1.0;\n\t#ifdef USE_CLEARCOATMAP\n\t\tmaterial.clearcoat *= texture2D( clearcoatMap, vUv ).x;\n\t#endif\n\t#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\t\tmaterial.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vUv ).y;\n\t#endif\n\tmaterial.clearcoat = saturate( material.clearcoat );\tmaterial.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );\n\tmaterial.clearcoatRoughness += geometryRoughness;\n\tmaterial.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );\n#endif\n#ifdef USE_SHEEN\n\tmaterial.sheenTint = sheenTint;\n#endif";
-
-       var lights_physical_pars_fragment = "struct PhysicalMaterial {\n\tvec3 diffuseColor;\n\tfloat roughness;\n\tvec3 specularColor;\n\tfloat specularF90;\n\t#ifdef USE_CLEARCOAT\n\t\tfloat clearcoat;\n\t\tfloat clearcoatRoughness;\n\t\tvec3 clearcoatF0;\n\t\tfloat clearcoatF90;\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tvec3 sheenTint;\n\t#endif\n};\nvec3 clearcoatSpecular = vec3( 0.0 );\nvec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tconst vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\n\tconst vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\n\tvec4 r = roughness * c0 + c1;\n\tfloat a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\n\tvec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw;\n\treturn fab;\n}\nvec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {\n\tvec2 fab = DFGApprox( normal, viewDir, roughness );\n\treturn specularColor * fab.x + specularF90 * fab.y;\n}\nvoid 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 ) {\n\tvec2 fab = DFGApprox( normal, viewDir, roughness );\n\tvec3 FssEss = specularColor * fab.x + specularF90 * fab.y;\n\tfloat Ess = fab.x + fab.y;\n\tfloat Ems = 1.0 - Ess;\n\tvec3 Favg = specularColor + ( 1.0 - specularColor ) * 0.047619;\tvec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );\n\tsingleScatter += FssEss;\n\tmultiScatter += Fms * Ems;\n}\n#if NUM_RECT_AREA_LIGHTS > 0\n\tvoid RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t\tvec3 normal = geometry.normal;\n\t\tvec3 viewDir = geometry.viewDir;\n\t\tvec3 position = geometry.position;\n\t\tvec3 lightPos = rectAreaLight.position;\n\t\tvec3 halfWidth = rectAreaLight.halfWidth;\n\t\tvec3 halfHeight = rectAreaLight.halfHeight;\n\t\tvec3 lightColor = rectAreaLight.color;\n\t\tfloat roughness = material.roughness;\n\t\tvec3 rectCoords[ 4 ];\n\t\trectCoords[ 0 ] = lightPos + halfWidth - halfHeight;\t\trectCoords[ 1 ] = lightPos - halfWidth - halfHeight;\n\t\trectCoords[ 2 ] = lightPos - halfWidth + halfHeight;\n\t\trectCoords[ 3 ] = lightPos + halfWidth + halfHeight;\n\t\tvec2 uv = LTC_Uv( normal, viewDir, roughness );\n\t\tvec4 t1 = texture2D( ltc_1, uv );\n\t\tvec4 t2 = texture2D( ltc_2, uv );\n\t\tmat3 mInv = mat3(\n\t\t\tvec3( t1.x, 0, t1.y ),\n\t\t\tvec3(          0, 1,           0 ),\n\t\t\tvec3( t1.z, 0, t1.w )\n\t\t);\n\t\tvec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );\n\t\treflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n\t\treflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );\n\t}\n#endif\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifdef USE_CLEARCOAT\n\t\tfloat dotNLcc = saturate( dot( geometry.clearcoatNormal, directLight.direction ) );\n\t\tvec3 ccIrradiance = dotNLcc * directLight.color;\n\t\tclearcoatSpecular += ccIrradiance * BRDF_GGX( directLight, geometry.viewDir, geometry.clearcoatNormal, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );\n\t#endif\n\t#ifdef USE_SHEEN\n\t\treflectedLight.directSpecular += irradiance * BRDF_Sheen( material.roughness, directLight.direction, geometry, material.sheenTint );\n\t#else\n\t\treflectedLight.directSpecular += irradiance * BRDF_GGX( directLight, geometry.viewDir, geometry.normal, material.specularColor, material.specularF90, material.roughness );\n\t#endif\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\n\t#ifdef USE_CLEARCOAT\n\t\tclearcoatSpecular += clearcoatRadiance * EnvironmentBRDF( geometry.clearcoatNormal, geometry.viewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );\n\t#endif\n\tvec3 singleScattering = vec3( 0.0 );\n\tvec3 multiScattering = vec3( 0.0 );\n\tvec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n\tcomputeMultiscattering( geometry.normal, geometry.viewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering );\n\tvec3 diffuse = material.diffuseColor * ( 1.0 - ( singleScattering + multiScattering ) );\n\treflectedLight.indirectSpecular += radiance * singleScattering;\n\treflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;\n\treflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;\n}\n#define RE_Direct\t\t\t\tRE_Direct_Physical\n#define RE_Direct_RectArea\t\tRE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular\t\tRE_IndirectSpecular_Physical\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n\treturn saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n}";
-
-       var lights_fragment_begin = "\nGeometricContext geometry;\ngeometry.position = - vViewPosition;\ngeometry.normal = normal;\ngeometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );\n#ifdef USE_CLEARCOAT\n\tgeometry.clearcoatNormal = clearcoatNormal;\n#endif\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n\tPointLight pointLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tgetPointLightInfo( pointLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )\n\t\tpointLightShadow = pointLightShadows[ i ];\n\t\tdirectLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n\tSpotLight spotLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tgetSpotLightInfo( spotLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\tspotLightShadow = spotLightShadows[ i ];\n\t\tdirectLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n\tDirectionalLight directionalLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tgetDirectionalLightInfo( directionalLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\n\t\tdirectionalLightShadow = directionalLightShadows[ i ];\n\t\tdirectLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n\tRectAreaLight rectAreaLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n\t\trectAreaLight = rectAreaLights[ i ];\n\t\tRE_Direct_RectArea( rectAreaLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if defined( RE_IndirectDiffuse )\n\tvec3 iblIrradiance = vec3( 0.0 );\n\tvec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n\tirradiance += getLightProbeIrradiance( lightProbe, geometry );\n\t#if ( NUM_HEMI_LIGHTS > 0 )\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\t\tirradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#endif\n#endif\n#if defined( RE_IndirectSpecular )\n\tvec3 radiance = vec3( 0.0 );\n\tvec3 clearcoatRadiance = vec3( 0.0 );\n#endif";
-
-       var lights_fragment_maps = "#if defined( RE_IndirectDiffuse )\n\t#ifdef USE_LIGHTMAP\n\t\tvec4 lightMapTexel = texture2D( lightMap, vUv2 );\n\t\tvec3 lightMapIrradiance = lightMapTexelToLinear( lightMapTexel ).rgb * lightMapIntensity;\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tlightMapIrradiance *= PI;\n\t\t#endif\n\t\tirradiance += lightMapIrradiance;\n\t#endif\n\t#if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )\n\t\tiblIrradiance += getIBLIrradiance( geometry );\n\t#endif\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n\tradiance += getIBLRadiance( geometry.viewDir, geometry.normal, material.roughness );\n\t#ifdef USE_CLEARCOAT\n\t\tclearcoatRadiance += getIBLRadiance( geometry.viewDir, geometry.clearcoatNormal, material.clearcoatRoughness );\n\t#endif\n#endif";
-
-       var lights_fragment_end = "#if defined( RE_IndirectDiffuse )\n\tRE_IndirectDiffuse( irradiance, geometry, material, reflectedLight );\n#endif\n#if defined( RE_IndirectSpecular )\n\tRE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometry, material, reflectedLight );\n#endif";
-
-       var logdepthbuf_fragment = "#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n\tgl_FragDepthEXT = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\n#endif";
-
-       var logdepthbuf_pars_fragment = "#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n\tuniform float logDepthBufFC;\n\tvarying float vFragDepth;\n\tvarying float vIsPerspective;\n#endif";
-
-       var logdepthbuf_pars_vertex = "#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvarying float vFragDepth;\n\t\tvarying float vIsPerspective;\n\t#else\n\t\tuniform float logDepthBufFC;\n\t#endif\n#endif";
-
-       var logdepthbuf_vertex = "#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvFragDepth = 1.0 + gl_Position.w;\n\t\tvIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );\n\t#else\n\t\tif ( isPerspectiveMatrix( projectionMatrix ) ) {\n\t\t\tgl_Position.z = log2( max( EPSILON, gl_Position.w + 1.0 ) ) * logDepthBufFC - 1.0;\n\t\t\tgl_Position.z *= gl_Position.w;\n\t\t}\n\t#endif\n#endif";
-
-       var map_fragment = "#ifdef USE_MAP\n\tvec4 texelColor = texture2D( map, vUv );\n\ttexelColor = mapTexelToLinear( texelColor );\n\tdiffuseColor *= texelColor;\n#endif";
-
-       var map_pars_fragment = "#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif";
-
-       var map_particle_fragment = "#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\tvec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;\n#endif\n#ifdef USE_MAP\n\tvec4 mapTexel = texture2D( map, uv );\n\tdiffuseColor *= mapTexelToLinear( mapTexel );\n#endif\n#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, uv ).g;\n#endif";
-
-       var map_particle_pars_fragment = "#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\tuniform mat3 uvTransform;\n#endif\n#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif\n#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif";
-
-       var metalnessmap_fragment = "float metalnessFactor = metalness;\n#ifdef USE_METALNESSMAP\n\tvec4 texelMetalness = texture2D( metalnessMap, vUv );\n\tmetalnessFactor *= texelMetalness.b;\n#endif";
-
-       var metalnessmap_pars_fragment = "#ifdef USE_METALNESSMAP\n\tuniform sampler2D metalnessMap;\n#endif";
-
-       var morphnormal_vertex = "#ifdef USE_MORPHNORMALS\n\tobjectNormal *= morphTargetBaseInfluence;\n\tobjectNormal += morphNormal0 * morphTargetInfluences[ 0 ];\n\tobjectNormal += morphNormal1 * morphTargetInfluences[ 1 ];\n\tobjectNormal += morphNormal2 * morphTargetInfluences[ 2 ];\n\tobjectNormal += morphNormal3 * morphTargetInfluences[ 3 ];\n#endif";
-
-       var morphtarget_pars_vertex = "#ifdef USE_MORPHTARGETS\n\tuniform float morphTargetBaseInfluence;\n\t#ifndef USE_MORPHNORMALS\n\t\tuniform float morphTargetInfluences[ 8 ];\n\t#else\n\t\tuniform float morphTargetInfluences[ 4 ];\n\t#endif\n#endif";
-
-       var morphtarget_vertex = "#ifdef USE_MORPHTARGETS\n\ttransformed *= morphTargetBaseInfluence;\n\ttransformed += morphTarget0 * morphTargetInfluences[ 0 ];\n\ttransformed += morphTarget1 * morphTargetInfluences[ 1 ];\n\ttransformed += morphTarget2 * morphTargetInfluences[ 2 ];\n\ttransformed += morphTarget3 * morphTargetInfluences[ 3 ];\n\t#ifndef USE_MORPHNORMALS\n\t\ttransformed += morphTarget4 * morphTargetInfluences[ 4 ];\n\t\ttransformed += morphTarget5 * morphTargetInfluences[ 5 ];\n\t\ttransformed += morphTarget6 * morphTargetInfluences[ 6 ];\n\t\ttransformed += morphTarget7 * morphTargetInfluences[ 7 ];\n\t#endif\n#endif";
-
-       var normal_fragment_begin = "float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;\n#ifdef FLAT_SHADED\n\tvec3 fdx = vec3( dFdx( vViewPosition.x ), dFdx( vViewPosition.y ), dFdx( vViewPosition.z ) );\n\tvec3 fdy = vec3( dFdy( vViewPosition.x ), dFdy( vViewPosition.y ), dFdy( vViewPosition.z ) );\n\tvec3 normal = normalize( cross( fdx, fdy ) );\n#else\n\tvec3 normal = normalize( vNormal );\n\t#ifdef DOUBLE_SIDED\n\t\tnormal = normal * faceDirection;\n\t#endif\n\t#ifdef USE_TANGENT\n\t\tvec3 tangent = normalize( vTangent );\n\t\tvec3 bitangent = normalize( vBitangent );\n\t\t#ifdef DOUBLE_SIDED\n\t\t\ttangent = tangent * faceDirection;\n\t\t\tbitangent = bitangent * faceDirection;\n\t\t#endif\n\t\t#if defined( TANGENTSPACE_NORMALMAP ) || defined( USE_CLEARCOAT_NORMALMAP )\n\t\t\tmat3 vTBN = mat3( tangent, bitangent, normal );\n\t\t#endif\n\t#endif\n#endif\nvec3 geometryNormal = normal;";
-
-       var normal_fragment_maps = "#ifdef OBJECTSPACE_NORMALMAP\n\tnormal = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\t#ifdef FLIP_SIDED\n\t\tnormal = - normal;\n\t#endif\n\t#ifdef DOUBLE_SIDED\n\t\tnormal = normal * faceDirection;\n\t#endif\n\tnormal = normalize( normalMatrix * normal );\n#elif defined( TANGENTSPACE_NORMALMAP )\n\tvec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\tmapN.xy *= normalScale;\n\t#ifdef USE_TANGENT\n\t\tnormal = normalize( vTBN * mapN );\n\t#else\n\t\tnormal = perturbNormal2Arb( - vViewPosition, normal, mapN, faceDirection );\n\t#endif\n#elif defined( USE_BUMPMAP )\n\tnormal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );\n#endif";
-
-       var normal_pars_fragment = "#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif";
-
-       var normal_pars_vertex = "#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif";
-
-       var normal_vertex = "#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n\t#ifdef USE_TANGENT\n\t\tvTangent = normalize( transformedTangent );\n\t\tvBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );\n\t#endif\n#endif";
-
-       var normalmap_pars_fragment = "#ifdef USE_NORMALMAP\n\tuniform sampler2D normalMap;\n\tuniform vec2 normalScale;\n#endif\n#ifdef OBJECTSPACE_NORMALMAP\n\tuniform mat3 normalMatrix;\n#endif\n#if ! defined ( USE_TANGENT ) && ( defined ( TANGENTSPACE_NORMALMAP ) || defined ( USE_CLEARCOAT_NORMALMAP ) )\n\tvec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm, vec3 mapN, float faceDirection ) {\n\t\tvec3 q0 = vec3( dFdx( eye_pos.x ), dFdx( eye_pos.y ), dFdx( eye_pos.z ) );\n\t\tvec3 q1 = vec3( dFdy( eye_pos.x ), dFdy( eye_pos.y ), dFdy( eye_pos.z ) );\n\t\tvec2 st0 = dFdx( vUv.st );\n\t\tvec2 st1 = dFdy( vUv.st );\n\t\tvec3 N = surf_norm;\n\t\tvec3 q1perp = cross( q1, N );\n\t\tvec3 q0perp = cross( N, q0 );\n\t\tvec3 T = q1perp * st0.x + q0perp * st1.x;\n\t\tvec3 B = q1perp * st0.y + q0perp * st1.y;\n\t\tfloat det = max( dot( T, T ), dot( B, B ) );\n\t\tfloat scale = ( det == 0.0 ) ? 0.0 : faceDirection * inversesqrt( det );\n\t\treturn normalize( T * ( mapN.x * scale ) + B * ( mapN.y * scale ) + N * mapN.z );\n\t}\n#endif";
-
-       var clearcoat_normal_fragment_begin = "#ifdef USE_CLEARCOAT\n\tvec3 clearcoatNormal = geometryNormal;\n#endif";
-
-       var clearcoat_normal_fragment_maps = "#ifdef USE_CLEARCOAT_NORMALMAP\n\tvec3 clearcoatMapN = texture2D( clearcoatNormalMap, vUv ).xyz * 2.0 - 1.0;\n\tclearcoatMapN.xy *= clearcoatNormalScale;\n\t#ifdef USE_TANGENT\n\t\tclearcoatNormal = normalize( vTBN * clearcoatMapN );\n\t#else\n\t\tclearcoatNormal = perturbNormal2Arb( - vViewPosition, clearcoatNormal, clearcoatMapN, faceDirection );\n\t#endif\n#endif";
-
-       var clearcoat_pars_fragment = "#ifdef USE_CLEARCOATMAP\n\tuniform sampler2D clearcoatMap;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tuniform sampler2D clearcoatRoughnessMap;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tuniform sampler2D clearcoatNormalMap;\n\tuniform vec2 clearcoatNormalScale;\n#endif";
-
-       var output_fragment = "#ifdef OPAQUE\ndiffuseColor.a = 1.0;\n#endif\n#ifdef USE_TRANSMISSION\ndiffuseColor.a *= transmissionAlpha + 0.1;\n#endif\ngl_FragColor = vec4( outgoingLight, diffuseColor.a );";
-
-       var packing = "vec3 packNormalToRGB( const in vec3 normal ) {\n\treturn normalize( normal ) * 0.5 + 0.5;\n}\nvec3 unpackRGBToNormal( const in vec3 rgb ) {\n\treturn 2.0 * rgb.xyz - 1.0;\n}\nconst float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;\nconst vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );\nconst vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. );\nconst float ShiftRight8 = 1. / 256.;\nvec4 packDepthToRGBA( const in float v ) {\n\tvec4 r = vec4( fract( v * PackFactors ), v );\n\tr.yzw -= r.xyz * ShiftRight8;\treturn r * PackUpscale;\n}\nfloat unpackRGBAToDepth( const in vec4 v ) {\n\treturn dot( v, UnpackFactors );\n}\nvec4 pack2HalfToRGBA( vec2 v ) {\n\tvec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) );\n\treturn vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w );\n}\nvec2 unpackRGBATo2Half( vec4 v ) {\n\treturn vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );\n}\nfloat viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn ( viewZ + near ) / ( near - far );\n}\nfloat orthographicDepthToViewZ( const in float linearClipZ, const in float near, const in float far ) {\n\treturn linearClipZ * ( near - far ) - near;\n}\nfloat viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ );\n}\nfloat perspectiveDepthToViewZ( const in float invClipZ, const in float near, const in float far ) {\n\treturn ( near * far ) / ( ( far - near ) * invClipZ - far );\n}";
-
-       var premultiplied_alpha_fragment = "#ifdef PREMULTIPLIED_ALPHA\n\tgl_FragColor.rgb *= gl_FragColor.a;\n#endif";
-
-       var project_vertex = "vec4 mvPosition = vec4( transformed, 1.0 );\n#ifdef USE_INSTANCING\n\tmvPosition = instanceMatrix * mvPosition;\n#endif\nmvPosition = modelViewMatrix * mvPosition;\ngl_Position = projectionMatrix * mvPosition;";
-
-       var dithering_fragment = "#ifdef DITHERING\n\tgl_FragColor.rgb = dithering( gl_FragColor.rgb );\n#endif";
-
-       var dithering_pars_fragment = "#ifdef DITHERING\n\tvec3 dithering( vec3 color ) {\n\t\tfloat grid_position = rand( gl_FragCoord.xy );\n\t\tvec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );\n\t\tdither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );\n\t\treturn color + dither_shift_RGB;\n\t}\n#endif";
-
-       var roughnessmap_fragment = "float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\n\tvec4 texelRoughness = texture2D( roughnessMap, vUv );\n\troughnessFactor *= texelRoughness.g;\n#endif";
-
-       var roughnessmap_pars_fragment = "#ifdef USE_ROUGHNESSMAP\n\tuniform sampler2D roughnessMap;\n#endif";
-
-       var shadowmap_pars_fragment = "#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n\tfloat texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\n\t\treturn step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );\n\t}\n\tvec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {\n\t\treturn unpackRGBATo2Half( texture2D( shadow, uv ) );\n\t}\n\tfloat VSMShadow (sampler2D shadow, vec2 uv, float compare ){\n\t\tfloat occlusion = 1.0;\n\t\tvec2 distribution = texture2DDistribution( shadow, uv );\n\t\tfloat hard_shadow = step( compare , distribution.x );\n\t\tif (hard_shadow != 1.0 ) {\n\t\t\tfloat distance = compare - distribution.x ;\n\t\t\tfloat variance = max( 0.00000, distribution.y * distribution.y );\n\t\t\tfloat softness_probability = variance / (variance + distance * distance );\t\t\tsoftness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 );\t\t\tocclusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 );\n\t\t}\n\t\treturn occlusion;\n\t}\n\tfloat getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\t\tfloat shadow = 1.0;\n\t\tshadowCoord.xyz /= shadowCoord.w;\n\t\tshadowCoord.z += shadowBias;\n\t\tbvec4 inFrustumVec = bvec4 ( shadowCoord.x >= 0.0, shadowCoord.x <= 1.0, shadowCoord.y >= 0.0, shadowCoord.y <= 1.0 );\n\t\tbool inFrustum = all( inFrustumVec );\n\t\tbvec2 frustumTestVec = bvec2( inFrustum, shadowCoord.z <= 1.0 );\n\t\tbool frustumTest = all( frustumTestVec );\n\t\tif ( frustumTest ) {\n\t\t#if defined( SHADOWMAP_TYPE_PCF )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx0 = - texelSize.x * shadowRadius;\n\t\t\tfloat dy0 = - texelSize.y * shadowRadius;\n\t\t\tfloat dx1 = + texelSize.x * shadowRadius;\n\t\t\tfloat dy1 = + texelSize.y * shadowRadius;\n\t\t\tfloat dx2 = dx0 / 2.0;\n\t\t\tfloat dy2 = dy0 / 2.0;\n\t\t\tfloat dx3 = dx1 / 2.0;\n\t\t\tfloat dy3 = dy1 / 2.0;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n\t\t\t) * ( 1.0 / 17.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx = texelSize.x;\n\t\t\tfloat dy = texelSize.y;\n\t\t\tvec2 uv = shadowCoord.xy;\n\t\t\tvec2 f = fract( uv * shadowMapSize + 0.5 );\n\t\t\tuv -= f * texelSize;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, uv, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ), \n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ), \n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ), \n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ), \n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ), \n\t\t\t\t\t\t  texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t\t f.x ),\n\t\t\t\t\t mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ), \n\t\t\t\t\t\t        texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t\t    f.x ),\n\t\t\t\t\t f.y )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_VSM )\n\t\t\tshadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#else\n\t\t\tshadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#endif\n\t\t}\n\t\treturn shadow;\n\t}\n\tvec2 cubeToUV( vec3 v, float texelSizeY ) {\n\t\tvec3 absV = abs( v );\n\t\tfloat scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );\n\t\tabsV *= scaleToCube;\n\t\tv *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );\n\t\tvec2 planar = v.xy;\n\t\tfloat almostATexel = 1.5 * texelSizeY;\n\t\tfloat almostOne = 1.0 - almostATexel;\n\t\tif ( absV.z >= almostOne ) {\n\t\t\tif ( v.z > 0.0 )\n\t\t\t\tplanar.x = 4.0 - v.x;\n\t\t} else if ( absV.x >= almostOne ) {\n\t\t\tfloat signX = sign( v.x );\n\t\t\tplanar.x = v.z * signX + 2.0 * signX;\n\t\t} else if ( absV.y >= almostOne ) {\n\t\t\tfloat signY = sign( v.y );\n\t\t\tplanar.x = v.x + 2.0 * signY + 2.0;\n\t\t\tplanar.y = v.z * signY - 2.0;\n\t\t}\n\t\treturn vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );\n\t}\n\tfloat getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\n\t\tvec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );\n\t\tvec3 lightToPosition = shadowCoord.xyz;\n\t\tfloat dp = ( length( lightToPosition ) - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear );\t\tdp += shadowBias;\n\t\tvec3 bd3D = normalize( lightToPosition );\n\t\t#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )\n\t\t\tvec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;\n\t\t\treturn (\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#else\n\t\t\treturn texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );\n\t\t#endif\n\t}\n#endif";
-
-       var shadowmap_pars_vertex = "#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tuniform mat4 spotShadowMatrix[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n#endif";
-
-       var shadowmap_vertex = "#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0 || NUM_SPOT_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0\n\t\tvec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\t\tvec4 shadowWorldPosition;\n\t#endif\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );\n\t\tvDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias, 0 );\n\t\tvSpotShadowCoord[ i ] = spotShadowMatrix[ i ] * shadowWorldPosition;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );\n\t\tvPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n#endif";
-
-       var shadowmask_pars_fragment = "float getShadowMask() {\n\tfloat shadow = 1.0;\n\t#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\tdirectionalLight = directionalLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n\t\tspotLight = spotLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\tpointLight = pointLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#endif\n\treturn shadow;\n}";
-
-       var skinbase_vertex = "#ifdef USE_SKINNING\n\tmat4 boneMatX = getBoneMatrix( skinIndex.x );\n\tmat4 boneMatY = getBoneMatrix( skinIndex.y );\n\tmat4 boneMatZ = getBoneMatrix( skinIndex.z );\n\tmat4 boneMatW = getBoneMatrix( skinIndex.w );\n#endif";
-
-       var skinning_pars_vertex = "#ifdef USE_SKINNING\n\tuniform mat4 bindMatrix;\n\tuniform mat4 bindMatrixInverse;\n\t#ifdef BONE_TEXTURE\n\t\tuniform highp sampler2D boneTexture;\n\t\tuniform int boneTextureSize;\n\t\tmat4 getBoneMatrix( const in float i ) {\n\t\t\tfloat j = i * 4.0;\n\t\t\tfloat x = mod( j, float( boneTextureSize ) );\n\t\t\tfloat y = floor( j / float( boneTextureSize ) );\n\t\t\tfloat dx = 1.0 / float( boneTextureSize );\n\t\t\tfloat dy = 1.0 / float( boneTextureSize );\n\t\t\ty = dy * ( y + 0.5 );\n\t\t\tvec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) );\n\t\t\tvec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) );\n\t\t\tvec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) );\n\t\t\tvec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) );\n\t\t\tmat4 bone = mat4( v1, v2, v3, v4 );\n\t\t\treturn bone;\n\t\t}\n\t#else\n\t\tuniform mat4 boneMatrices[ MAX_BONES ];\n\t\tmat4 getBoneMatrix( const in float i ) {\n\t\t\tmat4 bone = boneMatrices[ int(i) ];\n\t\t\treturn bone;\n\t\t}\n\t#endif\n#endif";
-
-       var skinning_vertex = "#ifdef USE_SKINNING\n\tvec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );\n\tvec4 skinned = vec4( 0.0 );\n\tskinned += boneMatX * skinVertex * skinWeight.x;\n\tskinned += boneMatY * skinVertex * skinWeight.y;\n\tskinned += boneMatZ * skinVertex * skinWeight.z;\n\tskinned += boneMatW * skinVertex * skinWeight.w;\n\ttransformed = ( bindMatrixInverse * skinned ).xyz;\n#endif";
-
-       var skinnormal_vertex = "#ifdef USE_SKINNING\n\tmat4 skinMatrix = mat4( 0.0 );\n\tskinMatrix += skinWeight.x * boneMatX;\n\tskinMatrix += skinWeight.y * boneMatY;\n\tskinMatrix += skinWeight.z * boneMatZ;\n\tskinMatrix += skinWeight.w * boneMatW;\n\tskinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;\n\tobjectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;\n\t#ifdef USE_TANGENT\n\t\tobjectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n\t#endif\n#endif";
-
-       var specularmap_fragment = "vec3 specularStrength;\n#ifdef USE_SPECULARMAP\n\tvec4 texelSpecular = texture2D( specularMap, vUv );\n\tspecularStrength = texelSpecular.rgb;\n#else\n\tspecularStrength = vec3( 1.0, 1.0, 1.0 );\n#endif";
-
-       var specularmap_pars_fragment = "#ifdef USE_SPECULARMAP\n\tuniform sampler2D specularMap;\n#endif";
-
-       var tonemapping_fragment = "#if defined( TONE_MAPPING )\n\tgl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n#endif";
-
-       var tonemapping_pars_fragment = "#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\nuniform float toneMappingExposure;\nvec3 LinearToneMapping( vec3 color ) {\n\treturn toneMappingExposure * color;\n}\nvec3 ReinhardToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( color / ( vec3( 1.0 ) + color ) );\n}\nvec3 OptimizedCineonToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\tcolor = max( vec3( 0.0 ), color - 0.004 );\n\treturn pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n}\nvec3 RRTAndODTFit( vec3 v ) {\n\tvec3 a = v * ( v + 0.0245786 ) - 0.000090537;\n\tvec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;\n\treturn a / b;\n}\nvec3 ACESFilmicToneMapping( vec3 color ) {\n\tconst mat3 ACESInputMat = mat3(\n\t\tvec3( 0.59719, 0.07600, 0.02840 ),\t\tvec3( 0.35458, 0.90834, 0.13383 ),\n\t\tvec3( 0.04823, 0.01566, 0.83777 )\n\t);\n\tconst mat3 ACESOutputMat = mat3(\n\t\tvec3(   1.60475, -0.10208, -0.00327 ),\t\tvec3( -0.53108,       1.10813, -0.07276 ),\n\t\tvec3( -0.07367, -0.00605,     1.07602 )\n\t);\n\tcolor *= toneMappingExposure / 0.6;\n\tcolor = ACESInputMat * color;\n\tcolor = RRTAndODTFit( color );\n\tcolor = ACESOutputMat * color;\n\treturn saturate( color );\n}\nvec3 CustomToneMapping( vec3 color ) { return color; }";
-
-       var transmission_fragment = "#ifdef USE_TRANSMISSION\n\tfloat transmissionAlpha = 1.0;\n\tfloat transmissionFactor = transmission;\n\tfloat thicknessFactor = thickness;\n\t#ifdef USE_TRANSMISSIONMAP\n\t\ttransmissionFactor *= texture2D( transmissionMap, vUv ).r;\n\t#endif\n\t#ifdef USE_THICKNESSMAP\n\t\tthicknessFactor *= texture2D( thicknessMap, vUv ).g;\n\t#endif\n\tvec3 pos = vWorldPosition;\n\tvec3 v = normalize( cameraPosition - pos );\n\tvec3 n = inverseTransformDirection( normal, viewMatrix );\n\tvec4 transmission = getIBLVolumeRefraction(\n\t\tn, v, roughnessFactor, material.diffuseColor, material.specularColor, material.specularF90,\n\t\tpos, modelMatrix, viewMatrix, projectionMatrix, ior, thicknessFactor,\n\t\tattenuationTint, attenuationDistance );\n\ttotalDiffuse = mix( totalDiffuse, transmission.rgb, transmissionFactor );\n\ttransmissionAlpha = transmission.a;\n#endif";
-
-       var transmission_pars_fragment = "#ifdef USE_TRANSMISSION\n\tuniform float transmission;\n\tuniform float thickness;\n\tuniform float attenuationDistance;\n\tuniform vec3 attenuationTint;\n\t#ifdef USE_TRANSMISSIONMAP\n\t\tuniform sampler2D transmissionMap;\n\t#endif\n\t#ifdef USE_THICKNESSMAP\n\t\tuniform sampler2D thicknessMap;\n\t#endif\n\tuniform vec2 transmissionSamplerSize;\n\tuniform sampler2D transmissionSamplerMap;\n\tuniform mat4 modelMatrix;\n\tuniform mat4 projectionMatrix;\n\tvarying vec3 vWorldPosition;\n\tvec3 getVolumeTransmissionRay( vec3 n, vec3 v, float thickness, float ior, mat4 modelMatrix ) {\n\t\tvec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );\n\t\tvec3 modelScale;\n\t\tmodelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );\n\t\tmodelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );\n\t\tmodelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );\n\t\treturn normalize( refractionVector ) * thickness * modelScale;\n\t}\n\tfloat applyIorToRoughness( float roughness, float ior ) {\n\t\treturn roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );\n\t}\n\tvec4 getTransmissionSample( vec2 fragCoord, float roughness, float ior ) {\n\t\tfloat framebufferLod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );\n\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\treturn texture2DLodEXT( transmissionSamplerMap, fragCoord.xy, framebufferLod );\n\t\t#else\n\t\t\treturn texture2D( transmissionSamplerMap, fragCoord.xy, framebufferLod );\n\t\t#endif\n\t}\n\tvec3 applyVolumeAttenuation( vec3 radiance, float transmissionDistance, vec3 attenuationColor, float attenuationDistance ) {\n\t\tif ( attenuationDistance == 0.0 ) {\n\t\t\treturn radiance;\n\t\t} else {\n\t\t\tvec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;\n\t\t\tvec3 transmittance = exp( - attenuationCoefficient * transmissionDistance );\t\t\treturn transmittance * radiance;\n\t\t}\n\t}\n\tvec4 getIBLVolumeRefraction( vec3 n, vec3 v, float roughness, vec3 diffuseColor, vec3 specularColor, float specularF90,\n\t\tvec3 position, mat4 modelMatrix, mat4 viewMatrix, mat4 projMatrix, float ior, float thickness,\n\t\tvec3 attenuationColor, float attenuationDistance ) {\n\t\tvec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );\n\t\tvec3 refractedRayExit = position + transmissionRay;\n\t\tvec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );\n\t\tvec2 refractionCoords = ndcPos.xy / ndcPos.w;\n\t\trefractionCoords += 1.0;\n\t\trefractionCoords /= 2.0;\n\t\tvec4 transmittedLight = getTransmissionSample( refractionCoords, roughness, ior );\n\t\tvec3 attenuatedColor = applyVolumeAttenuation( transmittedLight.rgb, length( transmissionRay ), attenuationColor, attenuationDistance );\n\t\tvec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );\n\t\treturn vec4( ( 1.0 - F ) * attenuatedColor * diffuseColor, transmittedLight.a );\n\t}\n#endif";
-
-       var uv_pars_fragment = "#if ( defined( USE_UV ) && ! defined( UVS_VERTEX_ONLY ) )\n\tvarying vec2 vUv;\n#endif";
-
-       var uv_pars_vertex = "#ifdef USE_UV\n\t#ifdef UVS_VERTEX_ONLY\n\t\tvec2 vUv;\n\t#else\n\t\tvarying vec2 vUv;\n\t#endif\n\tuniform mat3 uvTransform;\n#endif";
-
-       var uv_vertex = "#ifdef USE_UV\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n#endif";
-
-       var uv2_pars_fragment = "#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvarying vec2 vUv2;\n#endif";
-
-       var uv2_pars_vertex = "#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tattribute vec2 uv2;\n\tvarying vec2 vUv2;\n\tuniform mat3 uv2Transform;\n#endif";
-
-       var uv2_vertex = "#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvUv2 = ( uv2Transform * vec3( uv2, 1 ) ).xy;\n#endif";
-
-       var worldpos_vertex = "#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION )\n\tvec4 worldPosition = vec4( transformed, 1.0 );\n\t#ifdef USE_INSTANCING\n\t\tworldPosition = instanceMatrix * worldPosition;\n\t#endif\n\tworldPosition = modelMatrix * worldPosition;\n#endif";
-
-       var background_frag = "uniform sampler2D t2D;\nvarying vec2 vUv;\nvoid main() {\n\tvec4 texColor = texture2D( t2D, vUv );\n\tgl_FragColor = mapTexelToLinear( texColor );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n}";
-
-       var background_vert = "varying vec2 vUv;\nuniform mat3 uvTransform;\nvoid main() {\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n\tgl_Position = vec4( position.xy, 1.0, 1.0 );\n}";
-
-       var cube_frag = "#include <envmap_common_pars_fragment>\nuniform float opacity;\nvarying vec3 vWorldDirection;\n#include <cube_uv_reflection_fragment>\nvoid main() {\n\tvec3 vReflect = vWorldDirection;\n\t#include <envmap_fragment>\n\tgl_FragColor = envColor;\n\tgl_FragColor.a *= opacity;\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n}";
-
-       var cube_vert = "varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n\tgl_Position.z = gl_Position.w;\n}";
-
-       var depth_frag = "#if DEPTH_PACKING == 3200\n\tuniform float opacity;\n#endif\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#if DEPTH_PACKING == 3200\n\t\tdiffuseColor.a = opacity;\n\t#endif\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <logdepthbuf_fragment>\n\tfloat fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;\n\t#if DEPTH_PACKING == 3200\n\t\tgl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );\n\t#elif DEPTH_PACKING == 3201\n\t\tgl_FragColor = packDepthToRGBA( fragCoordZ );\n\t#endif\n}";
-
-       var depth_vert = "#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\t#include <uv_vertex>\n\t#include <skinbase_vertex>\n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvHighPrecisionZW = gl_Position.zw;\n}";
-
-       var distanceRGBA_frag = "#define DISTANCE\nuniform vec3 referencePosition;\nuniform float nearDistance;\nuniform float farDistance;\nvarying vec3 vWorldPosition;\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main () {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\tfloat dist = length( vWorldPosition - referencePosition );\n\tdist = ( dist - nearDistance ) / ( farDistance - nearDistance );\n\tdist = saturate( dist );\n\tgl_FragColor = packDepthToRGBA( dist );\n}";
-
-       var distanceRGBA_vert = "#define DISTANCE\nvarying vec3 vWorldPosition;\n#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <skinbase_vertex>\n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <worldpos_vertex>\n\t#include <clipping_planes_vertex>\n\tvWorldPosition = worldPosition.xyz;\n}";
-
-       var equirect_frag = "uniform sampler2D tEquirect;\nvarying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvec3 direction = normalize( vWorldDirection );\n\tvec2 sampleUV = equirectUv( direction );\n\tvec4 texColor = texture2D( tEquirect, sampleUV );\n\tgl_FragColor = mapTexelToLinear( texColor );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n}";
-
-       var equirect_vert = "varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n}";
-
-       var linedashed_frag = "uniform vec3 diffuse;\nuniform float opacity;\nuniform float dashSize;\nuniform float totalSize;\nvarying float vLineDistance;\n#include <common>\n#include <color_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tif ( mod( vLineDistance, totalSize ) > dashSize ) {\n\t\tdiscard;\n\t}\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <color_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\t#include <output_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n}";
-
-       var linedashed_vert = "uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\n#include <common>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\tvLineDistance = scale * lineDistance;\n\t#include <color_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n}";
-
-       var meshbasic_frag = "uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <cube_uv_reflection_fragment>\n#include <fog_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\t#ifdef USE_LIGHTMAP\n\t\tvec4 lightMapTexel= texture2D( lightMap, vUv2 );\n\t\treflectedLight.indirectDiffuse += lightMapTexelToLinear( lightMapTexel ).rgb * lightMapIntensity;\n\t#else\n\t\treflectedLight.indirectDiffuse += vec3( 1.0 );\n\t#endif\n\t#include <aomap_fragment>\n\treflectedLight.indirectDiffuse *= diffuseColor.rgb;\n\tvec3 outgoingLight = reflectedLight.indirectDiffuse;\n\t#include <envmap_fragment>\n\t#include <output_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}";
-
-       var meshbasic_vert = "#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinbase_vertex>\n\t\t#include <skinnormal_vertex>\n\t\t#include <defaultnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <fog_vertex>\n}";
-
-       var meshlambert_frag = "uniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\nvarying vec3 vLightFront;\nvarying vec3 vIndirectFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n\tvarying vec3 vIndirectBack;\n#endif\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <cube_uv_reflection_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <fog_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <shadowmask_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\t#include <emissivemap_fragment>\n\t#ifdef DOUBLE_SIDED\n\t\treflectedLight.indirectDiffuse += ( gl_FrontFacing ) ? vIndirectFront : vIndirectBack;\n\t#else\n\t\treflectedLight.indirectDiffuse += vIndirectFront;\n\t#endif\n\t#include <lightmap_fragment>\n\treflectedLight.indirectDiffuse *= BRDF_Lambert( diffuseColor.rgb );\n\t#ifdef DOUBLE_SIDED\n\t\treflectedLight.directDiffuse = ( gl_FrontFacing ) ? vLightFront : vLightBack;\n\t#else\n\t\treflectedLight.directDiffuse = vLightFront;\n\t#endif\n\treflectedLight.directDiffuse *= BRDF_Lambert( diffuseColor.rgb ) * getShadowMask();\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include <envmap_fragment>\n\t#include <output_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}";
-
-       var meshlambert_vert = "#define LAMBERT\nvarying vec3 vLightFront;\nvarying vec3 vIndirectFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n\tvarying vec3 vIndirectBack;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <envmap_pars_vertex>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <lights_lambert_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}";
-
-       var meshmatcap_frag = "#define MATCAP\nuniform vec3 diffuse;\nuniform float opacity;\nuniform sampler2D matcap;\nvarying vec3 vViewPosition;\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <fog_pars_fragment>\n#include <normal_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\tvec3 viewDir = normalize( vViewPosition );\n\tvec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );\n\tvec3 y = cross( viewDir, x );\n\tvec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;\n\t#ifdef USE_MATCAP\n\t\tvec4 matcapColor = texture2D( matcap, uv );\n\t\tmatcapColor = matcapTexelToLinear( matcapColor );\n\t#else\n\t\tvec4 matcapColor = vec4( 1.0 );\n\t#endif\n\tvec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;\n\t#include <output_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}";
-
-       var meshmatcap_vert = "#define MATCAP\nvarying vec3 vViewPosition;\n#include <common>\n#include <uv_pars_vertex>\n#include <color_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n\tvViewPosition = - mvPosition.xyz;\n}";
-
-       var meshnormal_frag = "#define NORMAL\nuniform float opacity;\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\tvarying vec3 vViewPosition;\n#endif\n#include <packing>\n#include <uv_pars_fragment>\n#include <normal_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\t#include <logdepthbuf_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\tgl_FragColor = vec4( packNormalToRGB( normal ), opacity );\n}";
-
-       var meshnormal_vert = "#define NORMAL\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\tvarying vec3 vViewPosition;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\tvViewPosition = - mvPosition.xyz;\n#endif\n}";
-
-       var meshphong_frag = "#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <cube_uv_reflection_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_phong_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_phong_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\t#include <envmap_fragment>\n\t#include <output_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}";
-
-       var meshphong_vert = "#define PHONG\nvarying vec3 vViewPosition;\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}";
-
-       var meshphysical_frag = "#define STANDARD\n#ifdef PHYSICAL\n\t#define IOR\n\t#define SPECULAR\n#endif\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifdef IOR\n\tuniform float ior;\n#endif\n#ifdef SPECULAR\n\tuniform float specularIntensity;\n\tuniform vec3 specularTint;\n\t#ifdef USE_SPECULARINTENSITYMAP\n\t\tuniform sampler2D specularIntensityMap;\n\t#endif\n\t#ifdef USE_SPECULARTINTMAP\n\t\tuniform sampler2D specularTintMap;\n\t#endif\n#endif\n#ifdef USE_CLEARCOAT\n\tuniform float clearcoat;\n\tuniform float clearcoatRoughness;\n#endif\n#ifdef USE_SHEEN\n\tuniform vec3 sheenTint;\n#endif\nvarying vec3 vViewPosition;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <bsdfs>\n#include <cube_uv_reflection_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_physical_pars_fragment>\n#include <fog_pars_fragment>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_physical_pars_fragment>\n#include <transmission_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <clearcoat_pars_fragment>\n#include <roughnessmap_pars_fragment>\n#include <metalnessmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <roughnessmap_fragment>\n\t#include <metalnessmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <clearcoat_normal_fragment_begin>\n\t#include <clearcoat_normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_physical_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;\n\tvec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;\n\t#include <transmission_fragment>\n\tvec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;\n\t#ifdef USE_CLEARCOAT\n\t\tfloat dotNVcc = saturate( dot( geometry.clearcoatNormal, geometry.viewDir ) );\n\t\tvec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );\n\t\toutgoingLight = outgoingLight * ( 1.0 - clearcoat * Fcc ) + clearcoatSpecular * clearcoat;\n\t#endif\n\t#include <output_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}";
-
-       var meshphysical_vert = "#define STANDARD\nvarying vec3 vViewPosition;\n#ifdef USE_TRANSMISSION\n\tvarying vec3 vWorldPosition;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n#ifdef USE_TRANSMISSION\n\tvWorldPosition = worldPosition.xyz;\n#endif\n}";
-
-       var meshtoon_frag = "#define TOON\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <gradientmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_toon_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_toon_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include <output_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}";
-
-       var meshtoon_vert = "#define TOON\nvarying vec3 vViewPosition;\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}";
-
-       var points_frag = "uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <color_pars_fragment>\n#include <map_particle_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_particle_fragment>\n\t#include <color_fragment>\n\t#include <alphatest_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\t#include <output_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n}";
-
-       var points_vert = "uniform float size;\nuniform float scale;\n#include <common>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <color_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <project_vertex>\n\tgl_PointSize = size;\n\t#ifdef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );\n\t#endif\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <fog_vertex>\n}";
-
-       var shadow_frag = "uniform vec3 color;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <shadowmap_pars_fragment>\n#include <shadowmask_pars_fragment>\nvoid main() {\n\tgl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n}";
-
-       var shadow_vert = "#include <common>\n#include <fog_pars_vertex>\n#include <shadowmap_pars_vertex>\nvoid main() {\n\t#include <begin_vertex>\n\t#include <project_vertex>\n\t#include <worldpos_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}";
-
-       var sprite_frag = "uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\t#include <output_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n}";
-
-       var sprite_vert = "uniform float rotation;\nuniform vec2 center;\n#include <common>\n#include <uv_pars_vertex>\n#include <fog_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\tvec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );\n\tvec2 scale;\n\tscale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) );\n\tscale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) );\n\t#ifndef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) scale *= - mvPosition.z;\n\t#endif\n\tvec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;\n\tvec2 rotatedPosition;\n\trotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\n\trotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\n\tmvPosition.xy += rotatedPosition;\n\tgl_Position = projectionMatrix * mvPosition;\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n}";
-
-       const ShaderChunk = {
-               alphamap_fragment: alphamap_fragment,
-               alphamap_pars_fragment: alphamap_pars_fragment,
-               alphatest_fragment: alphatest_fragment,
-               alphatest_pars_fragment: alphatest_pars_fragment,
-               aomap_fragment: aomap_fragment,
-               aomap_pars_fragment: aomap_pars_fragment,
-               begin_vertex: begin_vertex,
-               beginnormal_vertex: beginnormal_vertex,
-               bsdfs: bsdfs,
-               bumpmap_pars_fragment: bumpmap_pars_fragment,
-               clipping_planes_fragment: clipping_planes_fragment,
-               clipping_planes_pars_fragment: clipping_planes_pars_fragment,
-               clipping_planes_pars_vertex: clipping_planes_pars_vertex,
-               clipping_planes_vertex: clipping_planes_vertex,
-               color_fragment: color_fragment,
-               color_pars_fragment: color_pars_fragment,
-               color_pars_vertex: color_pars_vertex,
-               color_vertex: color_vertex,
-               common: common,
-               cube_uv_reflection_fragment: cube_uv_reflection_fragment,
-               defaultnormal_vertex: defaultnormal_vertex,
-               displacementmap_pars_vertex: displacementmap_pars_vertex,
-               displacementmap_vertex: displacementmap_vertex,
-               emissivemap_fragment: emissivemap_fragment,
-               emissivemap_pars_fragment: emissivemap_pars_fragment,
-               encodings_fragment: encodings_fragment,
-               encodings_pars_fragment: encodings_pars_fragment,
-               envmap_fragment: envmap_fragment,
-               envmap_common_pars_fragment: envmap_common_pars_fragment,
-               envmap_pars_fragment: envmap_pars_fragment,
-               envmap_pars_vertex: envmap_pars_vertex,
-               envmap_physical_pars_fragment: envmap_physical_pars_fragment,
-               envmap_vertex: envmap_vertex,
-               fog_vertex: fog_vertex,
-               fog_pars_vertex: fog_pars_vertex,
-               fog_fragment: fog_fragment,
-               fog_pars_fragment: fog_pars_fragment,
-               gradientmap_pars_fragment: gradientmap_pars_fragment,
-               lightmap_fragment: lightmap_fragment,
-               lightmap_pars_fragment: lightmap_pars_fragment,
-               lights_lambert_vertex: lights_lambert_vertex,
-               lights_pars_begin: lights_pars_begin,
-               lights_toon_fragment: lights_toon_fragment,
-               lights_toon_pars_fragment: lights_toon_pars_fragment,
-               lights_phong_fragment: lights_phong_fragment,
-               lights_phong_pars_fragment: lights_phong_pars_fragment,
-               lights_physical_fragment: lights_physical_fragment,
-               lights_physical_pars_fragment: lights_physical_pars_fragment,
-               lights_fragment_begin: lights_fragment_begin,
-               lights_fragment_maps: lights_fragment_maps,
-               lights_fragment_end: lights_fragment_end,
-               logdepthbuf_fragment: logdepthbuf_fragment,
-               logdepthbuf_pars_fragment: logdepthbuf_pars_fragment,
-               logdepthbuf_pars_vertex: logdepthbuf_pars_vertex,
-               logdepthbuf_vertex: logdepthbuf_vertex,
-               map_fragment: map_fragment,
-               map_pars_fragment: map_pars_fragment,
-               map_particle_fragment: map_particle_fragment,
-               map_particle_pars_fragment: map_particle_pars_fragment,
-               metalnessmap_fragment: metalnessmap_fragment,
-               metalnessmap_pars_fragment: metalnessmap_pars_fragment,
-               morphnormal_vertex: morphnormal_vertex,
-               morphtarget_pars_vertex: morphtarget_pars_vertex,
-               morphtarget_vertex: morphtarget_vertex,
-               normal_fragment_begin: normal_fragment_begin,
-               normal_fragment_maps: normal_fragment_maps,
-               normal_pars_fragment: normal_pars_fragment,
-               normal_pars_vertex: normal_pars_vertex,
-               normal_vertex: normal_vertex,
-               normalmap_pars_fragment: normalmap_pars_fragment,
-               clearcoat_normal_fragment_begin: clearcoat_normal_fragment_begin,
-               clearcoat_normal_fragment_maps: clearcoat_normal_fragment_maps,
-               clearcoat_pars_fragment: clearcoat_pars_fragment,
-               output_fragment: output_fragment,
-               packing: packing,
-               premultiplied_alpha_fragment: premultiplied_alpha_fragment,
-               project_vertex: project_vertex,
-               dithering_fragment: dithering_fragment,
-               dithering_pars_fragment: dithering_pars_fragment,
-               roughnessmap_fragment: roughnessmap_fragment,
-               roughnessmap_pars_fragment: roughnessmap_pars_fragment,
-               shadowmap_pars_fragment: shadowmap_pars_fragment,
-               shadowmap_pars_vertex: shadowmap_pars_vertex,
-               shadowmap_vertex: shadowmap_vertex,
-               shadowmask_pars_fragment: shadowmask_pars_fragment,
-               skinbase_vertex: skinbase_vertex,
-               skinning_pars_vertex: skinning_pars_vertex,
-               skinning_vertex: skinning_vertex,
-               skinnormal_vertex: skinnormal_vertex,
-               specularmap_fragment: specularmap_fragment,
-               specularmap_pars_fragment: specularmap_pars_fragment,
-               tonemapping_fragment: tonemapping_fragment,
-               tonemapping_pars_fragment: tonemapping_pars_fragment,
-               transmission_fragment: transmission_fragment,
-               transmission_pars_fragment: transmission_pars_fragment,
-               uv_pars_fragment: uv_pars_fragment,
-               uv_pars_vertex: uv_pars_vertex,
-               uv_vertex: uv_vertex,
-               uv2_pars_fragment: uv2_pars_fragment,
-               uv2_pars_vertex: uv2_pars_vertex,
-               uv2_vertex: uv2_vertex,
-               worldpos_vertex: worldpos_vertex,
-               background_frag: background_frag,
-               background_vert: background_vert,
-               cube_frag: cube_frag,
-               cube_vert: cube_vert,
-               depth_frag: depth_frag,
-               depth_vert: depth_vert,
-               distanceRGBA_frag: distanceRGBA_frag,
-               distanceRGBA_vert: distanceRGBA_vert,
-               equirect_frag: equirect_frag,
-               equirect_vert: equirect_vert,
-               linedashed_frag: linedashed_frag,
-               linedashed_vert: linedashed_vert,
-               meshbasic_frag: meshbasic_frag,
-               meshbasic_vert: meshbasic_vert,
-               meshlambert_frag: meshlambert_frag,
-               meshlambert_vert: meshlambert_vert,
-               meshmatcap_frag: meshmatcap_frag,
-               meshmatcap_vert: meshmatcap_vert,
-               meshnormal_frag: meshnormal_frag,
-               meshnormal_vert: meshnormal_vert,
-               meshphong_frag: meshphong_frag,
-               meshphong_vert: meshphong_vert,
-               meshphysical_frag: meshphysical_frag,
-               meshphysical_vert: meshphysical_vert,
-               meshtoon_frag: meshtoon_frag,
-               meshtoon_vert: meshtoon_vert,
-               points_frag: points_frag,
-               points_vert: points_vert,
-               shadow_frag: shadow_frag,
-               shadow_vert: shadow_vert,
-               sprite_frag: sprite_frag,
-               sprite_vert: sprite_vert
-       };
-
-       /**
-        * Uniforms library for shared webgl shaders
-        */
-
-       const UniformsLib = {
-               common: {
-                       diffuse: {
-                               value: new Color(0xffffff)
-                       },
-                       opacity: {
-                               value: 1.0
-                       },
-                       map: {
-                               value: null
-                       },
-                       uvTransform: {
-                               value: new Matrix3()
-                       },
-                       uv2Transform: {
-                               value: new Matrix3()
-                       },
-                       alphaMap: {
-                               value: null
-                       },
-                       alphaTest: {
-                               value: 0
-                       }
-               },
-               specularmap: {
-                       specularMap: {
-                               value: null
-                       }
-               },
-               envmap: {
-                       envMap: {
-                               value: null
-                       },
-                       flipEnvMap: {
-                               value: -1
-                       },
-                       reflectivity: {
-                               value: 1.0
-                       },
-                       // basic, lambert, phong
-                       ior: {
-                               value: 1.5
-                       },
-                       // standard, physical
-                       refractionRatio: {
-                               value: 0.98
-                       },
-                       maxMipLevel: {
-                               value: 0
-                       }
-               },
-               aomap: {
-                       aoMap: {
-                               value: null
-                       },
-                       aoMapIntensity: {
-                               value: 1
-                       }
-               },
-               lightmap: {
-                       lightMap: {
-                               value: null
-                       },
-                       lightMapIntensity: {
-                               value: 1
-                       }
-               },
-               emissivemap: {
-                       emissiveMap: {
-                               value: null
-                       }
-               },
-               bumpmap: {
-                       bumpMap: {
-                               value: null
-                       },
-                       bumpScale: {
-                               value: 1
-                       }
-               },
-               normalmap: {
-                       normalMap: {
-                               value: null
-                       },
-                       normalScale: {
-                               value: new Vector2(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: 0.00025
-                       },
-                       fogNear: {
-                               value: 1
-                       },
-                       fogFar: {
-                               value: 2000
-                       },
-                       fogColor: {
-                               value: new Color(0xffffff)
-                       }
-               },
-               lights: {
-                       ambientLightColor: {
-                               value: []
-                       },
-                       lightProbe: {
-                               value: []
-                       },
-                       directionalLights: {
-                               value: [],
-                               properties: {
-                                       direction: {},
-                                       color: {}
-                               }
-                       },
-                       directionalLightShadows: {
-                               value: [],
-                               properties: {
-                                       shadowBias: {},
-                                       shadowNormalBias: {},
-                                       shadowRadius: {},
-                                       shadowMapSize: {}
-                               }
-                       },
-                       directionalShadowMap: {
-                               value: []
-                       },
-                       directionalShadowMatrix: {
-                               value: []
-                       },
-                       spotLights: {
-                               value: [],
-                               properties: {
-                                       color: {},
-                                       position: {},
-                                       direction: {},
-                                       distance: {},
-                                       coneCos: {},
-                                       penumbraCos: {},
-                                       decay: {}
-                               }
-                       },
-                       spotLightShadows: {
-                               value: [],
-                               properties: {
-                                       shadowBias: {},
-                                       shadowNormalBias: {},
-                                       shadowRadius: {},
-                                       shadowMapSize: {}
-                               }
-                       },
-                       spotShadowMap: {
-                               value: []
-                       },
-                       spotShadowMatrix: {
-                               value: []
-                       },
-                       pointLights: {
-                               value: [],
-                               properties: {
-                                       color: {},
-                                       position: {},
-                                       decay: {},
-                                       distance: {}
-                               }
-                       },
-                       pointLightShadows: {
-                               value: [],
-                               properties: {
-                                       shadowBias: {},
-                                       shadowNormalBias: {},
-                                       shadowRadius: {},
-                                       shadowMapSize: {},
-                                       shadowCameraNear: {},
-                                       shadowCameraFar: {}
-                               }
-                       },
-                       pointShadowMap: {
-                               value: []
-                       },
-                       pointShadowMatrix: {
-                               value: []
-                       },
-                       hemisphereLights: {
-                               value: [],
-                               properties: {
-                                       direction: {},
-                                       skyColor: {},
-                                       groundColor: {}
-                               }
-                       },
-                       // TODO (abelnation): RectAreaLight BRDF data needs to be moved from example to main src
-                       rectAreaLights: {
-                               value: [],
-                               properties: {
-                                       color: {},
-                                       position: {},
-                                       width: {},
-                                       height: {}
-                               }
-                       },
-                       ltc_1: {
-                               value: null
-                       },
-                       ltc_2: {
-                               value: null
-                       }
-               },
-               points: {
-                       diffuse: {
-                               value: new Color(0xffffff)
-                       },
-                       opacity: {
-                               value: 1.0
-                       },
-                       size: {
-                               value: 1.0
-                       },
-                       scale: {
-                               value: 1.0
-                       },
-                       map: {
-                               value: null
-                       },
-                       alphaMap: {
-                               value: null
-                       },
-                       alphaTest: {
-                               value: 0
-                       },
-                       uvTransform: {
-                               value: new Matrix3()
-                       }
-               },
-               sprite: {
-                       diffuse: {
-                               value: new Color(0xffffff)
-                       },
-                       opacity: {
-                               value: 1.0
-                       },
-                       center: {
-                               value: new Vector2(0.5, 0.5)
-                       },
-                       rotation: {
-                               value: 0.0
-                       },
-                       map: {
-                               value: null
-                       },
-                       alphaMap: {
-                               value: null
-                       },
-                       alphaTest: {
-                               value: 0
-                       },
-                       uvTransform: {
-                               value: new Matrix3()
-                       }
-               }
-       };
-
-       const ShaderLib = {
-               basic: {
-                       uniforms: mergeUniforms([UniformsLib.common, UniformsLib.specularmap, UniformsLib.envmap, UniformsLib.aomap, UniformsLib.lightmap, UniformsLib.fog]),
-                       vertexShader: ShaderChunk.meshbasic_vert,
-                       fragmentShader: ShaderChunk.meshbasic_frag
-               },
-               lambert: {
-                       uniforms: mergeUniforms([UniformsLib.common, UniformsLib.specularmap, UniformsLib.envmap, UniformsLib.aomap, UniformsLib.lightmap, UniformsLib.emissivemap, UniformsLib.fog, UniformsLib.lights, {
-                               emissive: {
-                                       value: new Color(0x000000)
-                               }
-                       }]),
-                       vertexShader: ShaderChunk.meshlambert_vert,
-                       fragmentShader: ShaderChunk.meshlambert_frag
-               },
-               phong: {
-                       uniforms: mergeUniforms([UniformsLib.common, UniformsLib.specularmap, UniformsLib.envmap, UniformsLib.aomap, UniformsLib.lightmap, UniformsLib.emissivemap, UniformsLib.bumpmap, UniformsLib.normalmap, UniformsLib.displacementmap, UniformsLib.fog, UniformsLib.lights, {
-                               emissive: {
-                                       value: new Color(0x000000)
-                               },
-                               specular: {
-                                       value: new Color(0x111111)
-                               },
-                               shininess: {
-                                       value: 30
-                               }
-                       }]),
-                       vertexShader: ShaderChunk.meshphong_vert,
-                       fragmentShader: ShaderChunk.meshphong_frag
-               },
-               standard: {
-                       uniforms: mergeUniforms([UniformsLib.common, UniformsLib.envmap, UniformsLib.aomap, UniformsLib.lightmap, UniformsLib.emissivemap, UniformsLib.bumpmap, UniformsLib.normalmap, UniformsLib.displacementmap, UniformsLib.roughnessmap, UniformsLib.metalnessmap, UniformsLib.fog, UniformsLib.lights, {
-                               emissive: {
-                                       value: new Color(0x000000)
-                               },
-                               roughness: {
-                                       value: 1.0
-                               },
-                               metalness: {
-                                       value: 0.0
-                               },
-                               envMapIntensity: {
-                                       value: 1
-                               } // temporary
-
-                       }]),
-                       vertexShader: ShaderChunk.meshphysical_vert,
-                       fragmentShader: ShaderChunk.meshphysical_frag
-               },
-               toon: {
-                       uniforms: mergeUniforms([UniformsLib.common, UniformsLib.aomap, UniformsLib.lightmap, UniformsLib.emissivemap, UniformsLib.bumpmap, UniformsLib.normalmap, UniformsLib.displacementmap, UniformsLib.gradientmap, UniformsLib.fog, UniformsLib.lights, {
-                               emissive: {
-                                       value: new Color(0x000000)
-                               }
-                       }]),
-                       vertexShader: ShaderChunk.meshtoon_vert,
-                       fragmentShader: ShaderChunk.meshtoon_frag
-               },
-               matcap: {
-                       uniforms: mergeUniforms([UniformsLib.common, UniformsLib.bumpmap, UniformsLib.normalmap, UniformsLib.displacementmap, UniformsLib.fog, {
-                               matcap: {
-                                       value: null
-                               }
-                       }]),
-                       vertexShader: ShaderChunk.meshmatcap_vert,
-                       fragmentShader: ShaderChunk.meshmatcap_frag
-               },
-               points: {
-                       uniforms: mergeUniforms([UniformsLib.points, UniformsLib.fog]),
-                       vertexShader: ShaderChunk.points_vert,
-                       fragmentShader: ShaderChunk.points_frag
-               },
-               dashed: {
-                       uniforms: mergeUniforms([UniformsLib.common, UniformsLib.fog, {
-                               scale: {
-                                       value: 1
-                               },
-                               dashSize: {
-                                       value: 1
-                               },
-                               totalSize: {
-                                       value: 2
-                               }
-                       }]),
-                       vertexShader: ShaderChunk.linedashed_vert,
-                       fragmentShader: ShaderChunk.linedashed_frag
-               },
-               depth: {
-                       uniforms: mergeUniforms([UniformsLib.common, UniformsLib.displacementmap]),
-                       vertexShader: ShaderChunk.depth_vert,
-                       fragmentShader: ShaderChunk.depth_frag
-               },
-               normal: {
-                       uniforms: mergeUniforms([UniformsLib.common, UniformsLib.bumpmap, UniformsLib.normalmap, UniformsLib.displacementmap, {
-                               opacity: {
-                                       value: 1.0
-                               }
-                       }]),
-                       vertexShader: ShaderChunk.meshnormal_vert,
-                       fragmentShader: ShaderChunk.meshnormal_frag
-               },
-               sprite: {
-                       uniforms: mergeUniforms([UniformsLib.sprite, UniformsLib.fog]),
-                       vertexShader: ShaderChunk.sprite_vert,
-                       fragmentShader: ShaderChunk.sprite_frag
-               },
-               background: {
-                       uniforms: {
-                               uvTransform: {
-                                       value: new Matrix3()
-                               },
-                               t2D: {
-                                       value: null
-                               }
-                       },
-                       vertexShader: ShaderChunk.background_vert,
-                       fragmentShader: ShaderChunk.background_frag
-               },
-
-               /* -------------------------------------------------------------------------
-               //      Cube map shader
-                ------------------------------------------------------------------------- */
-               cube: {
-                       uniforms: mergeUniforms([UniformsLib.envmap, {
-                               opacity: {
-                                       value: 1.0
-                               }
-                       }]),
-                       vertexShader: ShaderChunk.cube_vert,
-                       fragmentShader: ShaderChunk.cube_frag
-               },
-               equirect: {
-                       uniforms: {
-                               tEquirect: {
-                                       value: null
-                               }
-                       },
-                       vertexShader: ShaderChunk.equirect_vert,
-                       fragmentShader: ShaderChunk.equirect_frag
-               },
-               distanceRGBA: {
-                       uniforms: mergeUniforms([UniformsLib.common, UniformsLib.displacementmap, {
-                               referencePosition: {
-                                       value: new Vector3()
-                               },
-                               nearDistance: {
-                                       value: 1
-                               },
-                               farDistance: {
-                                       value: 1000
-                               }
-                       }]),
-                       vertexShader: ShaderChunk.distanceRGBA_vert,
-                       fragmentShader: ShaderChunk.distanceRGBA_frag
-               },
-               shadow: {
-                       uniforms: mergeUniforms([UniformsLib.lights, UniformsLib.fog, {
-                               color: {
-                                       value: new Color(0x00000)
-                               },
-                               opacity: {
-                                       value: 1.0
-                               }
-                       }]),
-                       vertexShader: ShaderChunk.shadow_vert,
-                       fragmentShader: ShaderChunk.shadow_frag
-               }
-       };
-       ShaderLib.physical = {
-               uniforms: mergeUniforms([ShaderLib.standard.uniforms, {
-                       clearcoat: {
-                               value: 0
-                       },
-                       clearcoatMap: {
-                               value: null
-                       },
-                       clearcoatRoughness: {
-                               value: 0
-                       },
-                       clearcoatRoughnessMap: {
-                               value: null
-                       },
-                       clearcoatNormalScale: {
-                               value: new Vector2(1, 1)
-                       },
-                       clearcoatNormalMap: {
-                               value: null
-                       },
-                       sheenTint: {
-                               value: new Color(0x000000)
-                       },
-                       transmission: {
-                               value: 0
-                       },
-                       transmissionMap: {
-                               value: null
-                       },
-                       transmissionSamplerSize: {
-                               value: new Vector2()
-                       },
-                       transmissionSamplerMap: {
-                               value: null
-                       },
-                       thickness: {
-                               value: 0
-                       },
-                       thicknessMap: {
-                               value: null
-                       },
-                       attenuationDistance: {
-                               value: 0
-                       },
-                       attenuationTint: {
-                               value: new Color(0x000000)
-                       },
-                       specularIntensity: {
-                               value: 0
-                       },
-                       specularIntensityMap: {
-                               value: null
-                       },
-                       specularTint: {
-                               value: new Color(1, 1, 1)
-                       },
-                       specularTintMap: {
-                               value: null
-                       }
-               }]),
-               vertexShader: ShaderChunk.meshphysical_vert,
-               fragmentShader: ShaderChunk.meshphysical_frag
-       };
-
-       function WebGLBackground(renderer, cubemaps, state, objects, premultipliedAlpha) {
-               const clearColor = new Color(0x000000);
-               let clearAlpha = 0;
-               let planeMesh;
-               let boxMesh;
-               let currentBackground = null;
-               let currentBackgroundVersion = 0;
-               let currentTonemapping = null;
-
-               function render(renderList, scene) {
-                       let forceClear = false;
-                       let background = scene.isScene === true ? scene.background : null;
-
-                       if (background && background.isTexture) {
-                               background = cubemaps.get(background);
-                       } // Ignore background in AR
-                       // TODO: Reconsider this.
-
-
-                       const xr = renderer.xr;
-                       const session = xr.getSession && xr.getSession();
-
-                       if (session && session.environmentBlendMode === 'additive') {
-                               background = null;
-                       }
-
-                       if (background === null) {
-                               setClear(clearColor, clearAlpha);
-                       } else if (background && background.isColor) {
-                               setClear(background, 1);
-                               forceClear = true;
-                       }
-
-                       if (renderer.autoClear || forceClear) {
-                               renderer.clear(renderer.autoClearColor, renderer.autoClearDepth, renderer.autoClearStencil);
-                       }
-
-                       if (background && (background.isCubeTexture || background.mapping === CubeUVReflectionMapping)) {
-                               if (boxMesh === undefined) {
-                                       boxMesh = new Mesh(new BoxGeometry(1, 1, 1), new ShaderMaterial({
-                                               name: 'BackgroundCubeMaterial',
-                                               uniforms: cloneUniforms(ShaderLib.cube.uniforms),
-                                               vertexShader: ShaderLib.cube.vertexShader,
-                                               fragmentShader: ShaderLib.cube.fragmentShader,
-                                               side: BackSide,
-                                               depthTest: false,
-                                               depthWrite: false,
-                                               fog: false
-                                       }));
-                                       boxMesh.geometry.deleteAttribute('normal');
-                                       boxMesh.geometry.deleteAttribute('uv');
-
-                                       boxMesh.onBeforeRender = function (renderer, scene, camera) {
-                                               this.matrixWorld.copyPosition(camera.matrixWorld);
-                                       }; // enable code injection for non-built-in material
-
-
-                                       Object.defineProperty(boxMesh.material, 'envMap', {
-                                               get: function () {
-                                                       return this.uniforms.envMap.value;
-                                               }
-                                       });
-                                       objects.update(boxMesh);
-                               }
-
-                               boxMesh.material.uniforms.envMap.value = background;
-                               boxMesh.material.uniforms.flipEnvMap.value = background.isCubeTexture && background.isRenderTargetTexture === false ? -1 : 1;
-
-                               if (currentBackground !== background || currentBackgroundVersion !== background.version || currentTonemapping !== renderer.toneMapping) {
-                                       boxMesh.material.needsUpdate = true;
-                                       currentBackground = background;
-                                       currentBackgroundVersion = background.version;
-                                       currentTonemapping = renderer.toneMapping;
-                               } // push to the pre-sorted opaque render list
-
-
-                               renderList.unshift(boxMesh, boxMesh.geometry, boxMesh.material, 0, 0, null);
-                       } else if (background && background.isTexture) {
-                               if (planeMesh === undefined) {
-                                       planeMesh = new Mesh(new PlaneGeometry(2, 2), new ShaderMaterial({
-                                               name: 'BackgroundMaterial',
-                                               uniforms: cloneUniforms(ShaderLib.background.uniforms),
-                                               vertexShader: ShaderLib.background.vertexShader,
-                                               fragmentShader: ShaderLib.background.fragmentShader,
-                                               side: FrontSide,
-                                               depthTest: false,
-                                               depthWrite: false,
-                                               fog: false
-                                       }));
-                                       planeMesh.geometry.deleteAttribute('normal'); // enable code injection for non-built-in material
-
-                                       Object.defineProperty(planeMesh.material, 'map', {
-                                               get: function () {
-                                                       return this.uniforms.t2D.value;
-                                               }
-                                       });
-                                       objects.update(planeMesh);
-                               }
-
-                               planeMesh.material.uniforms.t2D.value = background;
-
-                               if (background.matrixAutoUpdate === true) {
-                                       background.updateMatrix();
-                               }
-
-                               planeMesh.material.uniforms.uvTransform.value.copy(background.matrix);
-
-                               if (currentBackground !== background || currentBackgroundVersion !== background.version || currentTonemapping !== renderer.toneMapping) {
-                                       planeMesh.material.needsUpdate = true;
-                                       currentBackground = background;
-                                       currentBackgroundVersion = background.version;
-                                       currentTonemapping = renderer.toneMapping;
-                               } // push to the pre-sorted opaque render list
-
-
-                               renderList.unshift(planeMesh, planeMesh.geometry, planeMesh.material, 0, 0, null);
-                       }
-               }
-
-               function setClear(color, alpha) {
-                       state.buffers.color.setClear(color.r, color.g, color.b, alpha, premultipliedAlpha);
-               }
-
-               return {
-                       getClearColor: function () {
-                               return clearColor;
-                       },
-                       setClearColor: function (color, alpha = 1) {
-                               clearColor.set(color);
-                               clearAlpha = alpha;
-                               setClear(clearColor, clearAlpha);
-                       },
-                       getClearAlpha: function () {
-                               return clearAlpha;
-                       },
-                       setClearAlpha: function (alpha) {
-                               clearAlpha = alpha;
-                               setClear(clearColor, clearAlpha);
-                       },
-                       render: render
-               };
-       }
-
-       function WebGLBindingStates(gl, extensions, attributes, capabilities) {
-               const maxVertexAttributes = gl.getParameter(gl.MAX_VERTEX_ATTRIBS);
-               const extension = capabilities.isWebGL2 ? null : extensions.get('OES_vertex_array_object');
-               const vaoAvailable = capabilities.isWebGL2 || extension !== null;
-               const bindingStates = {};
-               const defaultState = createBindingState(null);
-               let currentState = defaultState;
-
-               function setup(object, material, program, geometry, index) {
-                       let updateBuffers = false;
-
-                       if (vaoAvailable) {
-                               const state = getBindingState(geometry, program, material);
-
-                               if (currentState !== state) {
-                                       currentState = state;
-                                       bindVertexArrayObject(currentState.object);
-                               }
-
-                               updateBuffers = needsUpdate(geometry, index);
-                               if (updateBuffers) saveCache(geometry, index);
-                       } else {
-                               const wireframe = material.wireframe === true;
-
-                               if (currentState.geometry !== geometry.id || currentState.program !== program.id || currentState.wireframe !== wireframe) {
-                                       currentState.geometry = geometry.id;
-                                       currentState.program = program.id;
-                                       currentState.wireframe = wireframe;
-                                       updateBuffers = true;
-                               }
-                       }
-
-                       if (object.isInstancedMesh === true) {
-                               updateBuffers = true;
-                       }
-
-                       if (index !== null) {
-                               attributes.update(index, gl.ELEMENT_ARRAY_BUFFER);
-                       }
-
-                       if (updateBuffers) {
-                               setupVertexAttributes(object, material, program, geometry);
-
-                               if (index !== null) {
-                                       gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, attributes.get(index).buffer);
-                               }
-                       }
-               }
-
-               function createVertexArrayObject() {
-                       if (capabilities.isWebGL2) return gl.createVertexArray();
-                       return extension.createVertexArrayOES();
-               }
-
-               function bindVertexArrayObject(vao) {
-                       if (capabilities.isWebGL2) return gl.bindVertexArray(vao);
-                       return extension.bindVertexArrayOES(vao);
-               }
-
-               function deleteVertexArrayObject(vao) {
-                       if (capabilities.isWebGL2) return gl.deleteVertexArray(vao);
-                       return extension.deleteVertexArrayOES(vao);
-               }
-
-               function getBindingState(geometry, program, material) {
-                       const wireframe = material.wireframe === true;
-                       let programMap = bindingStates[geometry.id];
-
-                       if (programMap === undefined) {
-                               programMap = {};
-                               bindingStates[geometry.id] = programMap;
-                       }
-
-                       let stateMap = programMap[program.id];
-
-                       if (stateMap === undefined) {
-                               stateMap = {};
-                               programMap[program.id] = stateMap;
-                       }
-
-                       let state = stateMap[wireframe];
-
-                       if (state === undefined) {
-                               state = createBindingState(createVertexArrayObject());
-                               stateMap[wireframe] = state;
-                       }
-
-                       return state;
-               }
-
-               function createBindingState(vao) {
-                       const newAttributes = [];
-                       const enabledAttributes = [];
-                       const attributeDivisors = [];
-
-                       for (let i = 0; i < maxVertexAttributes; i++) {
-                               newAttributes[i] = 0;
-                               enabledAttributes[i] = 0;
-                               attributeDivisors[i] = 0;
-                       }
-
-                       return {
-                               // for backward compatibility on non-VAO support browser
-                               geometry: null,
-                               program: null,
-                               wireframe: false,
-                               newAttributes: newAttributes,
-                               enabledAttributes: enabledAttributes,
-                               attributeDivisors: attributeDivisors,
-                               object: vao,
-                               attributes: {},
-                               index: null
-                       };
-               }
-
-               function needsUpdate(geometry, index) {
-                       const cachedAttributes = currentState.attributes;
-                       const geometryAttributes = geometry.attributes;
-                       let attributesNum = 0;
-
-                       for (const key in geometryAttributes) {
-                               const cachedAttribute = cachedAttributes[key];
-                               const geometryAttribute = geometryAttributes[key];
-                               if (cachedAttribute === undefined) return true;
-                               if (cachedAttribute.attribute !== geometryAttribute) return true;
-                               if (cachedAttribute.data !== geometryAttribute.data) return true;
-                               attributesNum++;
-                       }
-
-                       if (currentState.attributesNum !== attributesNum) return true;
-                       if (currentState.index !== index) return true;
-                       return false;
-               }
-
-               function saveCache(geometry, index) {
-                       const cache = {};
-                       const attributes = geometry.attributes;
-                       let attributesNum = 0;
-
-                       for (const key in attributes) {
-                               const attribute = attributes[key];
-                               const data = {};
-                               data.attribute = attribute;
-
-                               if (attribute.data) {
-                                       data.data = attribute.data;
-                               }
-
-                               cache[key] = data;
-                               attributesNum++;
-                       }
-
-                       currentState.attributes = cache;
-                       currentState.attributesNum = attributesNum;
-                       currentState.index = index;
-               }
-
-               function initAttributes() {
-                       const newAttributes = currentState.newAttributes;
-
-                       for (let i = 0, il = newAttributes.length; i < il; i++) {
-                               newAttributes[i] = 0;
-                       }
-               }
-
-               function enableAttribute(attribute) {
-                       enableAttributeAndDivisor(attribute, 0);
-               }
-
-               function enableAttributeAndDivisor(attribute, meshPerAttribute) {
-                       const newAttributes = currentState.newAttributes;
-                       const enabledAttributes = currentState.enabledAttributes;
-                       const attributeDivisors = currentState.attributeDivisors;
-                       newAttributes[attribute] = 1;
-
-                       if (enabledAttributes[attribute] === 0) {
-                               gl.enableVertexAttribArray(attribute);
-                               enabledAttributes[attribute] = 1;
-                       }
-
-                       if (attributeDivisors[attribute] !== meshPerAttribute) {
-                               const extension = capabilities.isWebGL2 ? gl : extensions.get('ANGLE_instanced_arrays');
-                               extension[capabilities.isWebGL2 ? 'vertexAttribDivisor' : 'vertexAttribDivisorANGLE'](attribute, meshPerAttribute);
-                               attributeDivisors[attribute] = meshPerAttribute;
-                       }
-               }
-
-               function disableUnusedAttributes() {
-                       const newAttributes = currentState.newAttributes;
-                       const enabledAttributes = currentState.enabledAttributes;
-
-                       for (let i = 0, il = enabledAttributes.length; i < il; i++) {
-                               if (enabledAttributes[i] !== newAttributes[i]) {
-                                       gl.disableVertexAttribArray(i);
-                                       enabledAttributes[i] = 0;
-                               }
-                       }
-               }
-
-               function vertexAttribPointer(index, size, type, normalized, stride, offset) {
-                       if (capabilities.isWebGL2 === true && (type === gl.INT || type === gl.UNSIGNED_INT)) {
-                               gl.vertexAttribIPointer(index, size, type, stride, offset);
-                       } else {
-                               gl.vertexAttribPointer(index, size, type, normalized, stride, offset);
-                       }
-               }
-
-               function setupVertexAttributes(object, material, program, geometry) {
-                       if (capabilities.isWebGL2 === false && (object.isInstancedMesh || geometry.isInstancedBufferGeometry)) {
-                               if (extensions.get('ANGLE_instanced_arrays') === null) return;
-                       }
-
-                       initAttributes();
-                       const geometryAttributes = geometry.attributes;
-                       const programAttributes = program.getAttributes();
-                       const materialDefaultAttributeValues = material.defaultAttributeValues;
-
-                       for (const name in programAttributes) {
-                               const programAttribute = programAttributes[name];
-
-                               if (programAttribute.location >= 0) {
-                                       let geometryAttribute = geometryAttributes[name];
-
-                                       if (geometryAttribute === undefined) {
-                                               if (name === 'instanceMatrix' && object.instanceMatrix) geometryAttribute = object.instanceMatrix;
-                                               if (name === 'instanceColor' && object.instanceColor) geometryAttribute = object.instanceColor;
-                                       }
-
-                                       if (geometryAttribute !== undefined) {
-                                               const normalized = geometryAttribute.normalized;
-                                               const size = geometryAttribute.itemSize;
-                                               const attribute = attributes.get(geometryAttribute); // TODO Attribute may not be available on context restore
-
-                                               if (attribute === undefined) continue;
-                                               const buffer = attribute.buffer;
-                                               const type = attribute.type;
-                                               const bytesPerElement = attribute.bytesPerElement;
-
-                                               if (geometryAttribute.isInterleavedBufferAttribute) {
-                                                       const data = geometryAttribute.data;
-                                                       const stride = data.stride;
-                                                       const offset = geometryAttribute.offset;
-
-                                                       if (data && data.isInstancedInterleavedBuffer) {
-                                                               for (let i = 0; i < programAttribute.locationSize; i++) {
-                                                                       enableAttributeAndDivisor(programAttribute.location + i, data.meshPerAttribute);
-                                                               }
-
-                                                               if (object.isInstancedMesh !== true && geometry._maxInstanceCount === undefined) {
-                                                                       geometry._maxInstanceCount = data.meshPerAttribute * data.count;
-                                                               }
-                                                       } else {
-                                                               for (let i = 0; i < programAttribute.locationSize; i++) {
-                                                                       enableAttribute(programAttribute.location + i);
-                                                               }
-                                                       }
-
-                                                       gl.bindBuffer(gl.ARRAY_BUFFER, buffer);
-
-                                                       for (let i = 0; i < programAttribute.locationSize; i++) {
-                                                               vertexAttribPointer(programAttribute.location + i, size / programAttribute.locationSize, type, normalized, stride * bytesPerElement, (offset + size / programAttribute.locationSize * i) * bytesPerElement);
-                                                       }
-                                               } else {
-                                                       if (geometryAttribute.isInstancedBufferAttribute) {
-                                                               for (let i = 0; i < programAttribute.locationSize; i++) {
-                                                                       enableAttributeAndDivisor(programAttribute.location + i, geometryAttribute.meshPerAttribute);
-                                                               }
-
-                                                               if (object.isInstancedMesh !== true && geometry._maxInstanceCount === undefined) {
-                                                                       geometry._maxInstanceCount = geometryAttribute.meshPerAttribute * geometryAttribute.count;
-                                                               }
-                                                       } else {
-                                                               for (let i = 0; i < programAttribute.locationSize; i++) {
-                                                                       enableAttribute(programAttribute.location + i);
-                                                               }
-                                                       }
-
-                                                       gl.bindBuffer(gl.ARRAY_BUFFER, buffer);
-
-                                                       for (let i = 0; i < programAttribute.locationSize; i++) {
-                                                               vertexAttribPointer(programAttribute.location + i, size / programAttribute.locationSize, type, normalized, size * bytesPerElement, size / programAttribute.locationSize * i * bytesPerElement);
-                                                       }
-                                               }
-                                       } else if (materialDefaultAttributeValues !== undefined) {
-                                               const value = materialDefaultAttributeValues[name];
-
-                                               if (value !== undefined) {
-                                                       switch (value.length) {
-                                                               case 2:
-                                                                       gl.vertexAttrib2fv(programAttribute.location, value);
-                                                                       break;
-
-                                                               case 3:
-                                                                       gl.vertexAttrib3fv(programAttribute.location, value);
-                                                                       break;
-
-                                                               case 4:
-                                                                       gl.vertexAttrib4fv(programAttribute.location, value);
-                                                                       break;
-
-                                                               default:
-                                                                       gl.vertexAttrib1fv(programAttribute.location, value);
-                                                       }
-                                               }
-                                       }
-                               }
-                       }
-
-                       disableUnusedAttributes();
-               }
-
-               function dispose() {
-                       reset();
-
-                       for (const geometryId in bindingStates) {
-                               const programMap = bindingStates[geometryId];
-
-                               for (const programId in programMap) {
-                                       const stateMap = programMap[programId];
-
-                                       for (const wireframe in stateMap) {
-                                               deleteVertexArrayObject(stateMap[wireframe].object);
-                                               delete stateMap[wireframe];
-                                       }
-
-                                       delete programMap[programId];
-                               }
-
-                               delete bindingStates[geometryId];
-                       }
-               }
-
-               function releaseStatesOfGeometry(geometry) {
-                       if (bindingStates[geometry.id] === undefined) return;
-                       const programMap = bindingStates[geometry.id];
-
-                       for (const programId in programMap) {
-                               const stateMap = programMap[programId];
-
-                               for (const wireframe in stateMap) {
-                                       deleteVertexArrayObject(stateMap[wireframe].object);
-                                       delete stateMap[wireframe];
-                               }
-
-                               delete programMap[programId];
-                       }
-
-                       delete bindingStates[geometry.id];
-               }
-
-               function releaseStatesOfProgram(program) {
-                       for (const geometryId in bindingStates) {
-                               const programMap = bindingStates[geometryId];
-                               if (programMap[program.id] === undefined) continue;
-                               const stateMap = programMap[program.id];
-
-                               for (const wireframe in stateMap) {
-                                       deleteVertexArrayObject(stateMap[wireframe].object);
-                                       delete stateMap[wireframe];
-                               }
-
-                               delete programMap[program.id];
-                       }
-               }
-
-               function reset() {
-                       resetDefaultState();
-                       if (currentState === defaultState) return;
-                       currentState = defaultState;
-                       bindVertexArrayObject(currentState.object);
-               } // for backward-compatilibity
-
-
-               function resetDefaultState() {
-                       defaultState.geometry = null;
-                       defaultState.program = null;
-                       defaultState.wireframe = false;
-               }
-
-               return {
-                       setup: setup,
-                       reset: reset,
-                       resetDefaultState: resetDefaultState,
-                       dispose: dispose,
-                       releaseStatesOfGeometry: releaseStatesOfGeometry,
-                       releaseStatesOfProgram: releaseStatesOfProgram,
-                       initAttributes: initAttributes,
-                       enableAttribute: enableAttribute,
-                       disableUnusedAttributes: disableUnusedAttributes
-               };
-       }
-
-       function WebGLBufferRenderer(gl, extensions, info, capabilities) {
-               const isWebGL2 = capabilities.isWebGL2;
-               let mode;
-
-               function setMode(value) {
-                       mode = value;
-               }
-
-               function render(start, count) {
-                       gl.drawArrays(mode, start, count);
-                       info.update(count, mode, 1);
-               }
-
-               function renderInstances(start, count, primcount) {
-                       if (primcount === 0) return;
-                       let extension, methodName;
-
-                       if (isWebGL2) {
-                               extension = gl;
-                               methodName = 'drawArraysInstanced';
-                       } else {
-                               extension = extensions.get('ANGLE_instanced_arrays');
-                               methodName = 'drawArraysInstancedANGLE';
-
-                               if (extension === null) {
-                                       console.error('THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.');
-                                       return;
-                               }
-                       }
-
-                       extension[methodName](mode, start, count, primcount);
-                       info.update(count, mode, primcount);
-               } //
-
-
-               this.setMode = setMode;
-               this.render = render;
-               this.renderInstances = renderInstances;
-       }
-
-       function WebGLCapabilities(gl, extensions, parameters) {
-               let maxAnisotropy;
-
-               function getMaxAnisotropy() {
-                       if (maxAnisotropy !== undefined) return maxAnisotropy;
-
-                       if (extensions.has('EXT_texture_filter_anisotropic') === true) {
-                               const extension = extensions.get('EXT_texture_filter_anisotropic');
-                               maxAnisotropy = gl.getParameter(extension.MAX_TEXTURE_MAX_ANISOTROPY_EXT);
-                       } else {
-                               maxAnisotropy = 0;
-                       }
-
-                       return maxAnisotropy;
-               }
-
-               function getMaxPrecision(precision) {
-                       if (precision === 'highp') {
-                               if (gl.getShaderPrecisionFormat(gl.VERTEX_SHADER, gl.HIGH_FLOAT).precision > 0 && gl.getShaderPrecisionFormat(gl.FRAGMENT_SHADER, gl.HIGH_FLOAT).precision > 0) {
-                                       return 'highp';
-                               }
-
-                               precision = 'mediump';
-                       }
-
-                       if (precision === 'mediump') {
-                               if (gl.getShaderPrecisionFormat(gl.VERTEX_SHADER, gl.MEDIUM_FLOAT).precision > 0 && gl.getShaderPrecisionFormat(gl.FRAGMENT_SHADER, gl.MEDIUM_FLOAT).precision > 0) {
-                                       return 'mediump';
-                               }
-                       }
-
-                       return 'lowp';
-               }
-               /* eslint-disable no-undef */
-
-
-               const isWebGL2 = typeof WebGL2RenderingContext !== 'undefined' && gl instanceof WebGL2RenderingContext || typeof WebGL2ComputeRenderingContext !== 'undefined' && gl instanceof WebGL2ComputeRenderingContext;
-               /* eslint-enable no-undef */
-
-               let precision = parameters.precision !== undefined ? parameters.precision : 'highp';
-               const maxPrecision = getMaxPrecision(precision);
-
-               if (maxPrecision !== precision) {
-                       console.warn('THREE.WebGLRenderer:', precision, 'not supported, using', maxPrecision, 'instead.');
-                       precision = maxPrecision;
-               }
-
-               const drawBuffers = isWebGL2 || extensions.has('WEBGL_draw_buffers');
-               const logarithmicDepthBuffer = parameters.logarithmicDepthBuffer === true;
-               const maxTextures = gl.getParameter(gl.MAX_TEXTURE_IMAGE_UNITS);
-               const maxVertexTextures = gl.getParameter(gl.MAX_VERTEX_TEXTURE_IMAGE_UNITS);
-               const maxTextureSize = gl.getParameter(gl.MAX_TEXTURE_SIZE);
-               const maxCubemapSize = gl.getParameter(gl.MAX_CUBE_MAP_TEXTURE_SIZE);
-               const maxAttributes = gl.getParameter(gl.MAX_VERTEX_ATTRIBS);
-               const maxVertexUniforms = gl.getParameter(gl.MAX_VERTEX_UNIFORM_VECTORS);
-               const maxVaryings = gl.getParameter(gl.MAX_VARYING_VECTORS);
-               const maxFragmentUniforms = gl.getParameter(gl.MAX_FRAGMENT_UNIFORM_VECTORS);
-               const vertexTextures = maxVertexTextures > 0;
-               const floatFragmentTextures = isWebGL2 || extensions.has('OES_texture_float');
-               const floatVertexTextures = vertexTextures && floatFragmentTextures;
-               const maxSamples = isWebGL2 ? gl.getParameter(gl.MAX_SAMPLES) : 0;
-               return {
-                       isWebGL2: isWebGL2,
-                       drawBuffers: drawBuffers,
-                       getMaxAnisotropy: getMaxAnisotropy,
-                       getMaxPrecision: getMaxPrecision,
-                       precision: precision,
-                       logarithmicDepthBuffer: logarithmicDepthBuffer,
-                       maxTextures: maxTextures,
-                       maxVertexTextures: maxVertexTextures,
-                       maxTextureSize: maxTextureSize,
-                       maxCubemapSize: maxCubemapSize,
-                       maxAttributes: maxAttributes,
-                       maxVertexUniforms: maxVertexUniforms,
-                       maxVaryings: maxVaryings,
-                       maxFragmentUniforms: maxFragmentUniforms,
-                       vertexTextures: vertexTextures,
-                       floatFragmentTextures: floatFragmentTextures,
-                       floatVertexTextures: floatVertexTextures,
-                       maxSamples: maxSamples
-               };
-       }
-
-       function WebGLClipping(properties) {
-               const scope = this;
-               let globalState = null,
-                               numGlobalPlanes = 0,
-                               localClippingEnabled = false,
-                               renderingShadows = false;
-               const plane = new Plane(),
-                                       viewNormalMatrix = new Matrix3(),
-                                       uniform = {
-                       value: null,
-                       needsUpdate: false
-               };
-               this.uniform = uniform;
-               this.numPlanes = 0;
-               this.numIntersection = 0;
-
-               this.init = function (planes, enableLocalClipping, camera) {
-                       const enabled = planes.length !== 0 || enableLocalClipping || // enable state of previous frame - the clipping code has to
-                       // run another frame in order to reset the state:
-                       numGlobalPlanes !== 0 || localClippingEnabled;
-                       localClippingEnabled = enableLocalClipping;
-                       globalState = projectPlanes(planes, camera, 0);
-                       numGlobalPlanes = planes.length;
-                       return enabled;
-               };
-
-               this.beginShadows = function () {
-                       renderingShadows = true;
-                       projectPlanes(null);
-               };
-
-               this.endShadows = function () {
-                       renderingShadows = false;
-                       resetGlobalState();
-               };
-
-               this.setState = function (material, camera, useCache) {
-                       const planes = material.clippingPlanes,
-                                               clipIntersection = material.clipIntersection,
-                                               clipShadows = material.clipShadows;
-                       const materialProperties = properties.get(material);
-
-                       if (!localClippingEnabled || planes === null || planes.length === 0 || renderingShadows && !clipShadows) {
-                               // there's no local clipping
-                               if (renderingShadows) {
-                                       // there's no global clipping
-                                       projectPlanes(null);
-                               } else {
-                                       resetGlobalState();
-                               }
-                       } else {
-                               const nGlobal = renderingShadows ? 0 : numGlobalPlanes,
-                                                       lGlobal = nGlobal * 4;
-                               let dstArray = materialProperties.clippingState || null;
-                               uniform.value = dstArray; // ensure unique state
-
-                               dstArray = projectPlanes(planes, camera, lGlobal, useCache);
-
-                               for (let i = 0; i !== lGlobal; ++i) {
-                                       dstArray[i] = globalState[i];
-                               }
-
-                               materialProperties.clippingState = dstArray;
-                               this.numIntersection = clipIntersection ? this.numPlanes : 0;
-                               this.numPlanes += nGlobal;
-                       }
-               };
-
-               function resetGlobalState() {
-                       if (uniform.value !== globalState) {
-                               uniform.value = globalState;
-                               uniform.needsUpdate = numGlobalPlanes > 0;
-                       }
-
-                       scope.numPlanes = numGlobalPlanes;
-                       scope.numIntersection = 0;
-               }
-
-               function projectPlanes(planes, camera, dstOffset, skipTransform) {
-                       const nPlanes = planes !== null ? planes.length : 0;
-                       let dstArray = null;
-
-                       if (nPlanes !== 0) {
-                               dstArray = uniform.value;
-
-                               if (skipTransform !== true || dstArray === null) {
-                                       const flatSize = dstOffset + nPlanes * 4,
-                                                               viewMatrix = camera.matrixWorldInverse;
-                                       viewNormalMatrix.getNormalMatrix(viewMatrix);
-
-                                       if (dstArray === null || dstArray.length < flatSize) {
-                                               dstArray = new Float32Array(flatSize);
-                                       }
-
-                                       for (let i = 0, i4 = dstOffset; i !== nPlanes; ++i, i4 += 4) {
-                                               plane.copy(planes[i]).applyMatrix4(viewMatrix, viewNormalMatrix);
-                                               plane.normal.toArray(dstArray, i4);
-                                               dstArray[i4 + 3] = plane.constant;
-                                       }
-                               }
-
-                               uniform.value = dstArray;
-                               uniform.needsUpdate = true;
-                       }
-
-                       scope.numPlanes = nPlanes;
-                       scope.numIntersection = 0;
-                       return dstArray;
-               }
-       }
-
-       function WebGLCubeMaps(renderer) {
-               let cubemaps = new WeakMap();
-
-               function mapTextureMapping(texture, mapping) {
-                       if (mapping === EquirectangularReflectionMapping) {
-                               texture.mapping = CubeReflectionMapping;
-                       } else if (mapping === EquirectangularRefractionMapping) {
-                               texture.mapping = CubeRefractionMapping;
-                       }
-
-                       return texture;
-               }
-
-               function get(texture) {
-                       if (texture && texture.isTexture && texture.isRenderTargetTexture === false) {
-                               const mapping = texture.mapping;
-
-                               if (mapping === EquirectangularReflectionMapping || mapping === EquirectangularRefractionMapping) {
-                                       if (cubemaps.has(texture)) {
-                                               const cubemap = cubemaps.get(texture).texture;
-                                               return mapTextureMapping(cubemap, texture.mapping);
-                                       } else {
-                                               const image = texture.image;
-
-                                               if (image && image.height > 0) {
-                                                       const currentRenderTarget = renderer.getRenderTarget();
-                                                       const renderTarget = new WebGLCubeRenderTarget(image.height / 2);
-                                                       renderTarget.fromEquirectangularTexture(renderer, texture);
-                                                       cubemaps.set(texture, renderTarget);
-                                                       renderer.setRenderTarget(currentRenderTarget);
-                                                       texture.addEventListener('dispose', onTextureDispose);
-                                                       return mapTextureMapping(renderTarget.texture, texture.mapping);
-                                               } else {
-                                                       // image not yet ready. try the conversion next frame
-                                                       return null;
-                                               }
-                                       }
-                               }
-                       }
-
-                       return texture;
-               }
-
-               function onTextureDispose(event) {
-                       const texture = event.target;
-                       texture.removeEventListener('dispose', onTextureDispose);
-                       const cubemap = cubemaps.get(texture);
-
-                       if (cubemap !== undefined) {
-                               cubemaps.delete(texture);
-                               cubemap.dispose();
-                       }
-               }
-
-               function dispose() {
-                       cubemaps = new WeakMap();
-               }
-
-               return {
-                       get: get,
-                       dispose: dispose
-               };
-       }
-
-       class OrthographicCamera extends Camera {
-               constructor(left = -1, right = 1, top = 1, bottom = -1, near = 0.1, far = 2000) {
-                       super();
-                       this.type = 'OrthographicCamera';
-                       this.zoom = 1;
-                       this.view = null;
-                       this.left = left;
-                       this.right = right;
-                       this.top = top;
-                       this.bottom = bottom;
-                       this.near = near;
-                       this.far = far;
-                       this.updateProjectionMatrix();
-               }
-
-               copy(source, recursive) {
-                       super.copy(source, recursive);
-                       this.left = source.left;
-                       this.right = source.right;
-                       this.top = source.top;
-                       this.bottom = source.bottom;
-                       this.near = source.near;
-                       this.far = source.far;
-                       this.zoom = source.zoom;
-                       this.view = source.view === null ? null : Object.assign({}, source.view);
-                       return this;
-               }
-
-               setViewOffset(fullWidth, fullHeight, x, y, width, height) {
-                       if (this.view === null) {
-                               this.view = {
-                                       enabled: true,
-                                       fullWidth: 1,
-                                       fullHeight: 1,
-                                       offsetX: 0,
-                                       offsetY: 0,
-                                       width: 1,
-                                       height: 1
-                               };
-                       }
-
-                       this.view.enabled = true;
-                       this.view.fullWidth = fullWidth;
-                       this.view.fullHeight = fullHeight;
-                       this.view.offsetX = x;
-                       this.view.offsetY = y;
-                       this.view.width = width;
-                       this.view.height = height;
-                       this.updateProjectionMatrix();
-               }
-
-               clearViewOffset() {
-                       if (this.view !== null) {
-                               this.view.enabled = false;
-                       }
-
-                       this.updateProjectionMatrix();
-               }
-
-               updateProjectionMatrix() {
-                       const dx = (this.right - this.left) / (2 * this.zoom);
-                       const dy = (this.top - this.bottom) / (2 * this.zoom);
-                       const cx = (this.right + this.left) / 2;
-                       const cy = (this.top + this.bottom) / 2;
-                       let left = cx - dx;
-                       let right = cx + dx;
-                       let top = cy + dy;
-                       let bottom = cy - dy;
-
-                       if (this.view !== null && this.view.enabled) {
-                               const scaleW = (this.right - this.left) / this.view.fullWidth / this.zoom;
-                               const scaleH = (this.top - this.bottom) / this.view.fullHeight / this.zoom;
-                               left += scaleW * this.view.offsetX;
-                               right = left + scaleW * this.view.width;
-                               top -= scaleH * this.view.offsetY;
-                               bottom = top - scaleH * this.view.height;
-                       }
-
-                       this.projectionMatrix.makeOrthographic(left, right, top, bottom, this.near, this.far);
-                       this.projectionMatrixInverse.copy(this.projectionMatrix).invert();
-               }
-
-               toJSON(meta) {
-                       const data = super.toJSON(meta);
-                       data.object.zoom = this.zoom;
-                       data.object.left = this.left;
-                       data.object.right = this.right;
-                       data.object.top = this.top;
-                       data.object.bottom = this.bottom;
-                       data.object.near = this.near;
-                       data.object.far = this.far;
-                       if (this.view !== null) data.object.view = Object.assign({}, this.view);
-                       return data;
-               }
-
-       }
-
-       OrthographicCamera.prototype.isOrthographicCamera = true;
-
-       class RawShaderMaterial extends ShaderMaterial {
-               constructor(parameters) {
-                       super(parameters);
-                       this.type = 'RawShaderMaterial';
-               }
-
-       }
-
-       RawShaderMaterial.prototype.isRawShaderMaterial = true;
-
-       const LOD_MIN = 4;
-       const LOD_MAX = 8;
-       const SIZE_MAX = Math.pow(2, LOD_MAX); // The standard deviations (radians) associated with the extra mips. These are
-       // chosen to approximate a Trowbridge-Reitz distribution function times the
-       // geometric shadowing function. These sigma values squared must match the
-       // variance #defines in cube_uv_reflection_fragment.glsl.js.
-
-       const EXTRA_LOD_SIGMA = [0.125, 0.215, 0.35, 0.446, 0.526, 0.582];
-       const TOTAL_LODS = LOD_MAX - LOD_MIN + 1 + EXTRA_LOD_SIGMA.length; // The maximum length of the blur for loop. Smaller sigmas will use fewer
-       // samples and exit early, but not recompile the shader.
-
-       const MAX_SAMPLES = 20;
-       const ENCODINGS = {
-               [LinearEncoding]: 0,
-               [sRGBEncoding]: 1,
-               [RGBEEncoding]: 2,
-               [RGBM7Encoding]: 3,
-               [RGBM16Encoding]: 4,
-               [RGBDEncoding]: 5,
-               [GammaEncoding]: 6
-       };
-
-       const _flatCamera = /*@__PURE__*/new OrthographicCamera();
-
-       const {
-               _lodPlanes,
-               _sizeLods,
-               _sigmas
-       } = /*@__PURE__*/_createPlanes();
-
-       const _clearColor = /*@__PURE__*/new Color();
-
-       let _oldTarget = null; // Golden Ratio
-
-       const PHI = (1 + Math.sqrt(5)) / 2;
-       const INV_PHI = 1 / PHI; // Vertices of a dodecahedron (except the opposites, which represent the
-       // same axis), used as axis directions evenly spread on a sphere.
-
-       const _axisDirections = [/*@__PURE__*/new Vector3(1, 1, 1), /*@__PURE__*/new Vector3(-1, 1, 1), /*@__PURE__*/new Vector3(1, 1, -1), /*@__PURE__*/new Vector3(-1, 1, -1), /*@__PURE__*/new Vector3(0, PHI, INV_PHI), /*@__PURE__*/new Vector3(0, PHI, -INV_PHI), /*@__PURE__*/new Vector3(INV_PHI, 0, PHI), /*@__PURE__*/new Vector3(-INV_PHI, 0, PHI), /*@__PURE__*/new Vector3(PHI, INV_PHI, 0), /*@__PURE__*/new Vector3(-PHI, INV_PHI, 0)];
-       /**
-        * This class generates a Prefiltered, Mipmapped Radiance Environment Map
-        * (PMREM) from a cubeMap environment texture. This allows different levels of
-        * blur to be quickly accessed based on material roughness. It is packed into a
-        * special CubeUV format that allows us to perform custom interpolation so that
-        * we can support nonlinear formats such as RGBE. Unlike a traditional mipmap
-        * chain, it only goes down to the LOD_MIN level (above), and then creates extra
-        * even more filtered 'mips' at the same LOD_MIN resolution, associated with
-        * higher roughness levels. In this way we maintain resolution to smoothly
-        * interpolate diffuse lighting while limiting sampling computation.
-        *
-        * Paper: Fast, Accurate Image-Based Lighting
-        * https://drive.google.com/file/d/15y8r_UpKlU9SvV4ILb0C3qCPecS8pvLz/view
-       */
-
-       class PMREMGenerator {
-               constructor(renderer) {
-                       this._renderer = renderer;
-                       this._pingPongRenderTarget = null;
-                       this._blurMaterial = _getBlurShader(MAX_SAMPLES);
-                       this._equirectShader = null;
-                       this._cubemapShader = null;
-
-                       this._compileMaterial(this._blurMaterial);
-               }
-               /**
-                * Generates a PMREM from a supplied Scene, which can be faster than using an
-                * image if networking bandwidth is low. Optional sigma specifies a blur radius
-                * in radians to be applied to the scene before PMREM generation. Optional near
-                * and far planes ensure the scene is rendered in its entirety (the cubeCamera
-                * is placed at the origin).
-                */
-
-
-               fromScene(scene, sigma = 0, near = 0.1, far = 100) {
-                       _oldTarget = this._renderer.getRenderTarget();
-
-                       const cubeUVRenderTarget = this._allocateTargets();
-
-                       this._sceneToCubeUV(scene, near, far, cubeUVRenderTarget);
-
-                       if (sigma > 0) {
-                               this._blur(cubeUVRenderTarget, 0, 0, sigma);
-                       }
-
-                       this._applyPMREM(cubeUVRenderTarget);
-
-                       this._cleanup(cubeUVRenderTarget);
-
-                       return cubeUVRenderTarget;
-               }
-               /**
-                * Generates a PMREM from an equirectangular texture, which can be either LDR
-                * (RGBFormat) or HDR (RGBEFormat). The ideal input image size is 1k (1024 x 512),
-                * as this matches best with the 256 x 256 cubemap output.
-                */
-
-
-               fromEquirectangular(equirectangular) {
-                       return this._fromTexture(equirectangular);
-               }
-               /**
-                * Generates a PMREM from an cubemap texture, which can be either LDR
-                * (RGBFormat) or HDR (RGBEFormat). The ideal input cube size is 256 x 256,
-                * as this matches best with the 256 x 256 cubemap output.
-                */
-
-
-               fromCubemap(cubemap) {
-                       return this._fromTexture(cubemap);
-               }
-               /**
-                * Pre-compiles the cubemap shader. You can get faster start-up by invoking this method during
-                * your texture's network fetch for increased concurrency.
-                */
-
-
-               compileCubemapShader() {
-                       if (this._cubemapShader === null) {
-                               this._cubemapShader = _getCubemapShader();
-
-                               this._compileMaterial(this._cubemapShader);
-                       }
-               }
-               /**
-                * Pre-compiles the equirectangular shader. You can get faster start-up by invoking this method during
-                * your texture's network fetch for increased concurrency.
-                */
-
-
-               compileEquirectangularShader() {
-                       if (this._equirectShader === null) {
-                               this._equirectShader = _getEquirectShader();
-
-                               this._compileMaterial(this._equirectShader);
-                       }
-               }
-               /**
-                * Disposes of the PMREMGenerator's internal memory. Note that PMREMGenerator is a static class,
-                * so you should not need more than one PMREMGenerator object. If you do, calling dispose() on
-                * one of them will cause any others to also become unusable.
-                */
-
-
-               dispose() {
-                       this._blurMaterial.dispose();
-
-                       if (this._cubemapShader !== null) this._cubemapShader.dispose();
-                       if (this._equirectShader !== null) this._equirectShader.dispose();
-
-                       for (let i = 0; i < _lodPlanes.length; i++) {
-                               _lodPlanes[i].dispose();
-                       }
-               } // private interface
-
-
-               _cleanup(outputTarget) {
-                       this._pingPongRenderTarget.dispose();
-
-                       this._renderer.setRenderTarget(_oldTarget);
-
-                       outputTarget.scissorTest = false;
-
-                       _setViewport(outputTarget, 0, 0, outputTarget.width, outputTarget.height);
-               }
-
-               _fromTexture(texture) {
-                       _oldTarget = this._renderer.getRenderTarget();
-
-                       const cubeUVRenderTarget = this._allocateTargets(texture);
-
-                       this._textureToCubeUV(texture, cubeUVRenderTarget);
-
-                       this._applyPMREM(cubeUVRenderTarget);
-
-                       this._cleanup(cubeUVRenderTarget);
-
-                       return cubeUVRenderTarget;
-               }
-
-               _allocateTargets(texture) {
-                       // warning: null texture is valid
-                       const params = {
-                               magFilter: NearestFilter,
-                               minFilter: NearestFilter,
-                               generateMipmaps: false,
-                               type: UnsignedByteType,
-                               format: RGBEFormat,
-                               encoding: _isLDR(texture) ? texture.encoding : RGBEEncoding,
-                               depthBuffer: false
-                       };
-
-                       const cubeUVRenderTarget = _createRenderTarget(params);
-
-                       cubeUVRenderTarget.depthBuffer = texture ? false : true;
-                       this._pingPongRenderTarget = _createRenderTarget(params);
-                       return cubeUVRenderTarget;
-               }
-
-               _compileMaterial(material) {
-                       const tmpMesh = new Mesh(_lodPlanes[0], material);
-
-                       this._renderer.compile(tmpMesh, _flatCamera);
-               }
-
-               _sceneToCubeUV(scene, near, far, cubeUVRenderTarget) {
-                       const fov = 90;
-                       const aspect = 1;
-                       const cubeCamera = new PerspectiveCamera(fov, aspect, near, far);
-                       const upSign = [1, -1, 1, 1, 1, 1];
-                       const forwardSign = [1, 1, 1, -1, -1, -1];
-                       const renderer = this._renderer;
-                       const originalAutoClear = renderer.autoClear;
-                       const outputEncoding = renderer.outputEncoding;
-                       const toneMapping = renderer.toneMapping;
-                       renderer.getClearColor(_clearColor);
-                       renderer.toneMapping = NoToneMapping;
-                       renderer.outputEncoding = LinearEncoding;
-                       renderer.autoClear = false;
-                       const backgroundMaterial = new MeshBasicMaterial({
-                               name: 'PMREM.Background',
-                               side: BackSide,
-                               depthWrite: false,
-                               depthTest: false
-                       });
-                       const backgroundBox = new Mesh(new BoxGeometry(), backgroundMaterial);
-                       let useSolidColor = false;
-                       const background = scene.background;
-
-                       if (background) {
-                               if (background.isColor) {
-                                       backgroundMaterial.color.copy(background);
-                                       scene.background = null;
-                                       useSolidColor = true;
-                               }
-                       } else {
-                               backgroundMaterial.color.copy(_clearColor);
-                               useSolidColor = true;
-                       }
-
-                       for (let i = 0; i < 6; i++) {
-                               const col = i % 3;
-
-                               if (col == 0) {
-                                       cubeCamera.up.set(0, upSign[i], 0);
-                                       cubeCamera.lookAt(forwardSign[i], 0, 0);
-                               } else if (col == 1) {
-                                       cubeCamera.up.set(0, 0, upSign[i]);
-                                       cubeCamera.lookAt(0, forwardSign[i], 0);
-                               } else {
-                                       cubeCamera.up.set(0, upSign[i], 0);
-                                       cubeCamera.lookAt(0, 0, forwardSign[i]);
-                               }
-
-                               _setViewport(cubeUVRenderTarget, col * SIZE_MAX, i > 2 ? SIZE_MAX : 0, SIZE_MAX, SIZE_MAX);
-
-                               renderer.setRenderTarget(cubeUVRenderTarget);
-
-                               if (useSolidColor) {
-                                       renderer.render(backgroundBox, cubeCamera);
-                               }
-
-                               renderer.render(scene, cubeCamera);
-                       }
-
-                       backgroundBox.geometry.dispose();
-                       backgroundBox.material.dispose();
-                       renderer.toneMapping = toneMapping;
-                       renderer.outputEncoding = outputEncoding;
-                       renderer.autoClear = originalAutoClear;
-                       scene.background = background;
-               }
-
-               _textureToCubeUV(texture, cubeUVRenderTarget) {
-                       const renderer = this._renderer;
-
-                       if (texture.isCubeTexture) {
-                               if (this._cubemapShader == null) {
-                                       this._cubemapShader = _getCubemapShader();
-                               }
-                       } else {
-                               if (this._equirectShader == null) {
-                                       this._equirectShader = _getEquirectShader();
-                               }
-                       }
-
-                       const material = texture.isCubeTexture ? this._cubemapShader : this._equirectShader;
-                       const mesh = new Mesh(_lodPlanes[0], material);
-                       const uniforms = material.uniforms;
-                       uniforms['envMap'].value = texture;
-
-                       if (!texture.isCubeTexture) {
-                               uniforms['texelSize'].value.set(1.0 / texture.image.width, 1.0 / texture.image.height);
-                       }
-
-                       uniforms['inputEncoding'].value = ENCODINGS[texture.encoding];
-                       uniforms['outputEncoding'].value = ENCODINGS[cubeUVRenderTarget.texture.encoding];
-
-                       _setViewport(cubeUVRenderTarget, 0, 0, 3 * SIZE_MAX, 2 * SIZE_MAX);
-
-                       renderer.setRenderTarget(cubeUVRenderTarget);
-                       renderer.render(mesh, _flatCamera);
-               }
-
-               _applyPMREM(cubeUVRenderTarget) {
-                       const renderer = this._renderer;
-                       const autoClear = renderer.autoClear;
-                       renderer.autoClear = false;
-
-                       for (let i = 1; i < TOTAL_LODS; i++) {
-                               const sigma = Math.sqrt(_sigmas[i] * _sigmas[i] - _sigmas[i - 1] * _sigmas[i - 1]);
-                               const poleAxis = _axisDirections[(i - 1) % _axisDirections.length];
-
-                               this._blur(cubeUVRenderTarget, i - 1, i, sigma, poleAxis);
-                       }
-
-                       renderer.autoClear = autoClear;
-               }
-               /**
-                * This is a two-pass Gaussian blur for a cubemap. Normally this is done
-                * vertically and horizontally, but this breaks down on a cube. Here we apply
-                * the blur latitudinally (around the poles), and then longitudinally (towards
-                * the poles) to approximate the orthogonally-separable blur. It is least
-                * accurate at the poles, but still does a decent job.
-                */
-
-
-               _blur(cubeUVRenderTarget, lodIn, lodOut, sigma, poleAxis) {
-                       const pingPongRenderTarget = this._pingPongRenderTarget;
-
-                       this._halfBlur(cubeUVRenderTarget, pingPongRenderTarget, lodIn, lodOut, sigma, 'latitudinal', poleAxis);
-
-                       this._halfBlur(pingPongRenderTarget, cubeUVRenderTarget, lodOut, lodOut, sigma, 'longitudinal', poleAxis);
-               }
-
-               _halfBlur(targetIn, targetOut, lodIn, lodOut, sigmaRadians, direction, poleAxis) {
-                       const renderer = this._renderer;
-                       const blurMaterial = this._blurMaterial;
-
-                       if (direction !== 'latitudinal' && direction !== 'longitudinal') {
-                               console.error('blur direction must be either latitudinal or longitudinal!');
-                       } // Number of standard deviations at which to cut off the discrete approximation.
-
-
-                       const STANDARD_DEVIATIONS = 3;
-                       const blurMesh = new Mesh(_lodPlanes[lodOut], blurMaterial);
-                       const blurUniforms = blurMaterial.uniforms;
-                       const pixels = _sizeLods[lodIn] - 1;
-                       const radiansPerPixel = isFinite(sigmaRadians) ? Math.PI / (2 * pixels) : 2 * Math.PI / (2 * MAX_SAMPLES - 1);
-                       const sigmaPixels = sigmaRadians / radiansPerPixel;
-                       const samples = isFinite(sigmaRadians) ? 1 + Math.floor(STANDARD_DEVIATIONS * sigmaPixels) : MAX_SAMPLES;
-
-                       if (samples > MAX_SAMPLES) {
-                               console.warn(`sigmaRadians, ${sigmaRadians}, is too large and will clip, as it requested ${samples} samples when the maximum is set to ${MAX_SAMPLES}`);
-                       }
-
-                       const weights = [];
-                       let sum = 0;
-
-                       for (let i = 0; i < MAX_SAMPLES; ++i) {
-                               const x = i / sigmaPixels;
-                               const weight = Math.exp(-x * x / 2);
-                               weights.push(weight);
-
-                               if (i == 0) {
-                                       sum += weight;
-                               } else if (i < samples) {
-                                       sum += 2 * weight;
-                               }
-                       }
-
-                       for (let i = 0; i < weights.length; i++) {
-                               weights[i] = weights[i] / sum;
-                       }
-
-                       blurUniforms['envMap'].value = targetIn.texture;
-                       blurUniforms['samples'].value = samples;
-                       blurUniforms['weights'].value = weights;
-                       blurUniforms['latitudinal'].value = direction === 'latitudinal';
-
-                       if (poleAxis) {
-                               blurUniforms['poleAxis'].value = poleAxis;
-                       }
-
-                       blurUniforms['dTheta'].value = radiansPerPixel;
-                       blurUniforms['mipInt'].value = LOD_MAX - lodIn;
-                       blurUniforms['inputEncoding'].value = ENCODINGS[targetIn.texture.encoding];
-                       blurUniforms['outputEncoding'].value = ENCODINGS[targetIn.texture.encoding];
-                       const outputSize = _sizeLods[lodOut];
-                       const x = 3 * Math.max(0, SIZE_MAX - 2 * outputSize);
-                       const y = (lodOut === 0 ? 0 : 2 * SIZE_MAX) + 2 * outputSize * (lodOut > LOD_MAX - LOD_MIN ? lodOut - LOD_MAX + LOD_MIN : 0);
-
-                       _setViewport(targetOut, x, y, 3 * outputSize, 2 * outputSize);
-
-                       renderer.setRenderTarget(targetOut);
-                       renderer.render(blurMesh, _flatCamera);
-               }
-
-       }
-
-       function _isLDR(texture) {
-               if (texture === undefined || texture.type !== UnsignedByteType) return false;
-               return texture.encoding === LinearEncoding || texture.encoding === sRGBEncoding || texture.encoding === GammaEncoding;
-       }
-
-       function _createPlanes() {
-               const _lodPlanes = [];
-               const _sizeLods = [];
-               const _sigmas = [];
-               let lod = LOD_MAX;
-
-               for (let i = 0; i < TOTAL_LODS; i++) {
-                       const sizeLod = Math.pow(2, lod);
-
-                       _sizeLods.push(sizeLod);
-
-                       let sigma = 1.0 / sizeLod;
-
-                       if (i > LOD_MAX - LOD_MIN) {
-                               sigma = EXTRA_LOD_SIGMA[i - LOD_MAX + LOD_MIN - 1];
-                       } else if (i == 0) {
-                               sigma = 0;
-                       }
-
-                       _sigmas.push(sigma);
-
-                       const texelSize = 1.0 / (sizeLod - 1);
-                       const min = -texelSize / 2;
-                       const max = 1 + texelSize / 2;
-                       const uv1 = [min, min, max, min, max, max, min, min, max, max, min, max];
-                       const cubeFaces = 6;
-                       const vertices = 6;
-                       const positionSize = 3;
-                       const uvSize = 2;
-                       const faceIndexSize = 1;
-                       const position = new Float32Array(positionSize * vertices * cubeFaces);
-                       const uv = new Float32Array(uvSize * vertices * cubeFaces);
-                       const faceIndex = new Float32Array(faceIndexSize * vertices * cubeFaces);
-
-                       for (let face = 0; face < cubeFaces; face++) {
-                               const x = face % 3 * 2 / 3 - 1;
-                               const y = face > 2 ? 0 : -1;
-                               const coordinates = [x, y, 0, x + 2 / 3, y, 0, x + 2 / 3, y + 1, 0, x, y, 0, x + 2 / 3, y + 1, 0, x, y + 1, 0];
-                               position.set(coordinates, positionSize * vertices * face);
-                               uv.set(uv1, uvSize * vertices * face);
-                               const fill = [face, face, face, face, face, face];
-                               faceIndex.set(fill, faceIndexSize * vertices * face);
-                       }
-
-                       const planes = new BufferGeometry();
-                       planes.setAttribute('position', new BufferAttribute(position, positionSize));
-                       planes.setAttribute('uv', new BufferAttribute(uv, uvSize));
-                       planes.setAttribute('faceIndex', new BufferAttribute(faceIndex, faceIndexSize));
-
-                       _lodPlanes.push(planes);
-
-                       if (lod > LOD_MIN) {
-                               lod--;
-                       }
-               }
-
-               return {
-                       _lodPlanes,
-                       _sizeLods,
-                       _sigmas
-               };
-       }
-
-       function _createRenderTarget(params) {
-               const cubeUVRenderTarget = new WebGLRenderTarget(3 * SIZE_MAX, 3 * SIZE_MAX, params);
-               cubeUVRenderTarget.texture.mapping = CubeUVReflectionMapping;
-               cubeUVRenderTarget.texture.name = 'PMREM.cubeUv';
-               cubeUVRenderTarget.scissorTest = true;
-               return cubeUVRenderTarget;
-       }
-
-       function _setViewport(target, x, y, width, height) {
-               target.viewport.set(x, y, width, height);
-               target.scissor.set(x, y, width, height);
-       }
-
-       function _getBlurShader(maxSamples) {
-               const weights = new Float32Array(maxSamples);
-               const poleAxis = new Vector3(0, 1, 0);
-               const shaderMaterial = new RawShaderMaterial({
-                       name: 'SphericalGaussianBlur',
-                       defines: {
-                               'n': maxSamples
-                       },
-                       uniforms: {
-                               'envMap': {
-                                       value: null
-                               },
-                               'samples': {
-                                       value: 1
-                               },
-                               'weights': {
-                                       value: weights
-                               },
-                               'latitudinal': {
-                                       value: false
-                               },
-                               'dTheta': {
-                                       value: 0
-                               },
-                               'mipInt': {
-                                       value: 0
-                               },
-                               'poleAxis': {
-                                       value: poleAxis
-                               },
-                               'inputEncoding': {
-                                       value: ENCODINGS[LinearEncoding]
-                               },
-                               'outputEncoding': {
-                                       value: ENCODINGS[LinearEncoding]
-                               }
-                       },
-                       vertexShader: _getCommonVertexShader(),
-                       fragmentShader:
-                       /* glsl */
-                       `
-
-                       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;
-
-                       ${_getEncodings()}
-
-                       #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 );
-
-                               }
-
-                               gl_FragColor = linearToOutputTexel( gl_FragColor );
-
-                       }
-               `,
-                       blending: NoBlending,
-                       depthTest: false,
-                       depthWrite: false
-               });
-               return shaderMaterial;
-       }
-
-       function _getEquirectShader() {
-               const texelSize = new Vector2(1, 1);
-               const shaderMaterial = new RawShaderMaterial({
-                       name: 'EquirectangularToCubeUV',
-                       uniforms: {
-                               'envMap': {
-                                       value: null
-                               },
-                               'texelSize': {
-                                       value: texelSize
-                               },
-                               'inputEncoding': {
-                                       value: ENCODINGS[LinearEncoding]
-                               },
-                               'outputEncoding': {
-                                       value: ENCODINGS[LinearEncoding]
-                               }
-                       },
-                       vertexShader: _getCommonVertexShader(),
-                       fragmentShader:
-                       /* glsl */
-                       `
-
-                       precision mediump float;
-                       precision mediump int;
-
-                       varying vec3 vOutputDirection;
-
-                       uniform sampler2D envMap;
-                       uniform vec2 texelSize;
-
-                       ${_getEncodings()}
-
-                       #include <common>
-
-                       void main() {
-
-                               gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );
-
-                               vec3 outputDirection = normalize( vOutputDirection );
-                               vec2 uv = equirectUv( outputDirection );
-
-                               vec2 f = fract( uv / texelSize - 0.5 );
-                               uv -= f * texelSize;
-                               vec3 tl = envMapTexelToLinear( texture2D ( envMap, uv ) ).rgb;
-                               uv.x += texelSize.x;
-                               vec3 tr = envMapTexelToLinear( texture2D ( envMap, uv ) ).rgb;
-                               uv.y += texelSize.y;
-                               vec3 br = envMapTexelToLinear( texture2D ( envMap, uv ) ).rgb;
-                               uv.x -= texelSize.x;
-                               vec3 bl = envMapTexelToLinear( texture2D ( envMap, uv ) ).rgb;
-
-                               vec3 tm = mix( tl, tr, f.x );
-                               vec3 bm = mix( bl, br, f.x );
-                               gl_FragColor.rgb = mix( tm, bm, f.y );
-
-                               gl_FragColor = linearToOutputTexel( gl_FragColor );
-
-                       }
-               `,
-                       blending: NoBlending,
-                       depthTest: false,
-                       depthWrite: false
-               });
-               return shaderMaterial;
-       }
-
-       function _getCubemapShader() {
-               const shaderMaterial = new RawShaderMaterial({
-                       name: 'CubemapToCubeUV',
-                       uniforms: {
-                               'envMap': {
-                                       value: null
-                               },
-                               'inputEncoding': {
-                                       value: ENCODINGS[LinearEncoding]
-                               },
-                               'outputEncoding': {
-                                       value: ENCODINGS[LinearEncoding]
-                               }
-                       },
-                       vertexShader: _getCommonVertexShader(),
-                       fragmentShader:
-                       /* glsl */
-                       `
-
-                       precision mediump float;
-                       precision mediump int;
-
-                       varying vec3 vOutputDirection;
-
-                       uniform samplerCube envMap;
-
-                       ${_getEncodings()}
-
-                       void main() {
-
-                               gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );
-                               gl_FragColor.rgb = envMapTexelToLinear( textureCube( envMap, vec3( - vOutputDirection.x, vOutputDirection.yz ) ) ).rgb;
-                               gl_FragColor = linearToOutputTexel( gl_FragColor );
-
-                       }
-               `,
-                       blending: NoBlending,
-                       depthTest: false,
-                       depthWrite: false
-               });
-               return shaderMaterial;
-       }
-
-       function _getCommonVertexShader() {
-               return (
-                       /* glsl */
-                       `
-
-               precision mediump float;
-               precision mediump int;
-
-               attribute vec3 position;
-               attribute vec2 uv;
-               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 _getEncodings() {
-               return (
-                       /* glsl */
-                       `
-
-               uniform int inputEncoding;
-               uniform int outputEncoding;
-
-               #include <encodings_pars_fragment>
-
-               vec4 inputTexelToLinear( vec4 value ) {
-
-                       if ( inputEncoding == 0 ) {
-
-                               return value;
-
-                       } else if ( inputEncoding == 1 ) {
-
-                               return sRGBToLinear( value );
-
-                       } else if ( inputEncoding == 2 ) {
-
-                               return RGBEToLinear( value );
-
-                       } else if ( inputEncoding == 3 ) {
-
-                               return RGBMToLinear( value, 7.0 );
-
-                       } else if ( inputEncoding == 4 ) {
-
-                               return RGBMToLinear( value, 16.0 );
-
-                       } else if ( inputEncoding == 5 ) {
-
-                               return RGBDToLinear( value, 256.0 );
-
-                       } else {
-
-                               return GammaToLinear( value, 2.2 );
-
-                       }
-
-               }
-
-               vec4 linearToOutputTexel( vec4 value ) {
-
-                       if ( outputEncoding == 0 ) {
-
-                               return value;
-
-                       } else if ( outputEncoding == 1 ) {
-
-                               return LinearTosRGB( value );
-
-                       } else if ( outputEncoding == 2 ) {
-
-                               return LinearToRGBE( value );
-
-                       } else if ( outputEncoding == 3 ) {
-
-                               return LinearToRGBM( value, 7.0 );
-
-                       } else if ( outputEncoding == 4 ) {
-
-                               return LinearToRGBM( value, 16.0 );
-
-                       } else if ( outputEncoding == 5 ) {
-
-                               return LinearToRGBD( value, 256.0 );
-
-                       } else {
-
-                               return LinearToGamma( value, 2.2 );
-
-                       }
-
-               }
-
-               vec4 envMapTexelToLinear( vec4 color ) {
-
-                       return inputTexelToLinear( color );
-
-               }
-       `
-               );
-       }
-
-       function WebGLCubeUVMaps(renderer) {
-               let cubeUVmaps = new WeakMap();
-               let pmremGenerator = null;
-
-               function get(texture) {
-                       if (texture && texture.isTexture && texture.isRenderTargetTexture === false) {
-                               const mapping = texture.mapping;
-                               const isEquirectMap = mapping === EquirectangularReflectionMapping || mapping === EquirectangularRefractionMapping;
-                               const isCubeMap = mapping === CubeReflectionMapping || mapping === CubeRefractionMapping;
-
-                               if (isEquirectMap || isCubeMap) {
-                                       // equirect/cube map to cubeUV conversion
-                                       if (cubeUVmaps.has(texture)) {
-                                               return cubeUVmaps.get(texture).texture;
-                                       } else {
-                                               const image = texture.image;
-
-                                               if (isEquirectMap && image && image.height > 0 || isCubeMap && image && isCubeTextureComplete(image)) {
-                                                       const currentRenderTarget = renderer.getRenderTarget();
-                                                       if (pmremGenerator === null) pmremGenerator = new PMREMGenerator(renderer);
-                                                       const renderTarget = isEquirectMap ? pmremGenerator.fromEquirectangular(texture) : pmremGenerator.fromCubemap(texture);
-                                                       cubeUVmaps.set(texture, renderTarget);
-                                                       renderer.setRenderTarget(currentRenderTarget);
-                                                       texture.addEventListener('dispose', onTextureDispose);
-                                                       return renderTarget.texture;
-                                               } else {
-                                                       // image not yet ready. try the conversion next frame
-                                                       return null;
-                                               }
-                                       }
-                               }
-                       }
-
-                       return texture;
-               }
-
-               function isCubeTextureComplete(image) {
-                       let count = 0;
-                       const length = 6;
-
-                       for (let i = 0; i < length; i++) {
-                               if (image[i] !== undefined) count++;
-                       }
-
-                       return count === length;
-               }
-
-               function onTextureDispose(event) {
-                       const texture = event.target;
-                       texture.removeEventListener('dispose', onTextureDispose);
-                       const cubemapUV = cubeUVmaps.get(texture);
-
-                       if (cubemapUV !== undefined) {
-                               cubeUVmaps.delete(texture);
-                               cubemapUV.dispose();
-                       }
-               }
-
-               function dispose() {
-                       cubeUVmaps = new WeakMap();
-
-                       if (pmremGenerator !== null) {
-                               pmremGenerator.dispose();
-                               pmremGenerator = null;
-                       }
-               }
-
-               return {
-                       get: get,
-                       dispose: dispose
-               };
-       }
-
-       function WebGLExtensions(gl) {
-               const extensions = {};
-
-               function getExtension(name) {
-                       if (extensions[name] !== undefined) {
-                               return extensions[name];
-                       }
-
-                       let extension;
-
-                       switch (name) {
-                               case 'WEBGL_depth_texture':
-                                       extension = gl.getExtension('WEBGL_depth_texture') || gl.getExtension('MOZ_WEBGL_depth_texture') || gl.getExtension('WEBKIT_WEBGL_depth_texture');
-                                       break;
-
-                               case 'EXT_texture_filter_anisotropic':
-                                       extension = gl.getExtension('EXT_texture_filter_anisotropic') || gl.getExtension('MOZ_EXT_texture_filter_anisotropic') || gl.getExtension('WEBKIT_EXT_texture_filter_anisotropic');
-                                       break;
-
-                               case 'WEBGL_compressed_texture_s3tc':
-                                       extension = gl.getExtension('WEBGL_compressed_texture_s3tc') || gl.getExtension('MOZ_WEBGL_compressed_texture_s3tc') || gl.getExtension('WEBKIT_WEBGL_compressed_texture_s3tc');
-                                       break;
-
-                               case 'WEBGL_compressed_texture_pvrtc':
-                                       extension = gl.getExtension('WEBGL_compressed_texture_pvrtc') || gl.getExtension('WEBKIT_WEBGL_compressed_texture_pvrtc');
-                                       break;
-
-                               default:
-                                       extension = gl.getExtension(name);
-                       }
-
-                       extensions[name] = extension;
-                       return extension;
-               }
-
-               return {
-                       has: function (name) {
-                               return getExtension(name) !== null;
-                       },
-                       init: function (capabilities) {
-                               if (capabilities.isWebGL2) {
-                                       getExtension('EXT_color_buffer_float');
-                               } else {
-                                       getExtension('WEBGL_depth_texture');
-                                       getExtension('OES_texture_float');
-                                       getExtension('OES_texture_half_float');
-                                       getExtension('OES_texture_half_float_linear');
-                                       getExtension('OES_standard_derivatives');
-                                       getExtension('OES_element_index_uint');
-                                       getExtension('OES_vertex_array_object');
-                                       getExtension('ANGLE_instanced_arrays');
-                               }
-
-                               getExtension('OES_texture_float_linear');
-                               getExtension('EXT_color_buffer_half_float');
-                       },
-                       get: function (name) {
-                               const extension = getExtension(name);
-
-                               if (extension === null) {
-                                       console.warn('THREE.WebGLRenderer: ' + name + ' extension not supported.');
-                               }
-
-                               return extension;
-                       }
-               };
-       }
-
-       function WebGLGeometries(gl, attributes, info, bindingStates) {
-               const geometries = {};
-               const wireframeAttributes = new WeakMap();
-
-               function onGeometryDispose(event) {
-                       const geometry = event.target;
-
-                       if (geometry.index !== null) {
-                               attributes.remove(geometry.index);
-                       }
-
-                       for (const name in geometry.attributes) {
-                               attributes.remove(geometry.attributes[name]);
-                       }
-
-                       geometry.removeEventListener('dispose', onGeometryDispose);
-                       delete geometries[geometry.id];
-                       const attribute = wireframeAttributes.get(geometry);
-
-                       if (attribute) {
-                               attributes.remove(attribute);
-                               wireframeAttributes.delete(geometry);
-                       }
-
-                       bindingStates.releaseStatesOfGeometry(geometry);
-
-                       if (geometry.isInstancedBufferGeometry === true) {
-                               delete geometry._maxInstanceCount;
-                       } //
-
-
-                       info.memory.geometries--;
-               }
-
-               function get(object, geometry) {
-                       if (geometries[geometry.id] === true) return geometry;
-                       geometry.addEventListener('dispose', onGeometryDispose);
-                       geometries[geometry.id] = true;
-                       info.memory.geometries++;
-                       return geometry;
-               }
-
-               function update(geometry) {
-                       const geometryAttributes = geometry.attributes; // Updating index buffer in VAO now. See WebGLBindingStates.
-
-                       for (const name in geometryAttributes) {
-                               attributes.update(geometryAttributes[name], gl.ARRAY_BUFFER);
-                       } // morph targets
-
-
-                       const morphAttributes = geometry.morphAttributes;
-
-                       for (const name in morphAttributes) {
-                               const array = morphAttributes[name];
-
-                               for (let i = 0, l = array.length; i < l; i++) {
-                                       attributes.update(array[i], gl.ARRAY_BUFFER);
-                               }
-                       }
-               }
-
-               function updateWireframeAttribute(geometry) {
-                       const indices = [];
-                       const geometryIndex = geometry.index;
-                       const geometryPosition = geometry.attributes.position;
-                       let version = 0;
-
-                       if (geometryIndex !== null) {
-                               const array = geometryIndex.array;
-                               version = geometryIndex.version;
-
-                               for (let i = 0, l = array.length; i < l; i += 3) {
-                                       const a = array[i + 0];
-                                       const b = array[i + 1];
-                                       const c = array[i + 2];
-                                       indices.push(a, b, b, c, c, a);
-                               }
-                       } else {
-                               const array = geometryPosition.array;
-                               version = geometryPosition.version;
-
-                               for (let i = 0, l = array.length / 3 - 1; i < l; i += 3) {
-                                       const a = i + 0;
-                                       const b = i + 1;
-                                       const c = i + 2;
-                                       indices.push(a, b, b, c, c, a);
-                               }
-                       }
-
-                       const attribute = new (arrayMax(indices) > 65535 ? Uint32BufferAttribute : Uint16BufferAttribute)(indices, 1);
-                       attribute.version = version; // Updating index buffer in VAO now. See WebGLBindingStates
-                       //
-
-                       const previousAttribute = wireframeAttributes.get(geometry);
-                       if (previousAttribute) attributes.remove(previousAttribute); //
-
-                       wireframeAttributes.set(geometry, attribute);
-               }
-
-               function getWireframeAttribute(geometry) {
-                       const currentAttribute = wireframeAttributes.get(geometry);
-
-                       if (currentAttribute) {
-                               const geometryIndex = geometry.index;
-
-                               if (geometryIndex !== null) {
-                                       // if the attribute is obsolete, create a new one
-                                       if (currentAttribute.version < geometryIndex.version) {
-                                               updateWireframeAttribute(geometry);
-                                       }
-                               }
-                       } else {
-                               updateWireframeAttribute(geometry);
-                       }
-
-                       return wireframeAttributes.get(geometry);
-               }
-
-               return {
-                       get: get,
-                       update: update,
-                       getWireframeAttribute: getWireframeAttribute
-               };
-       }
-
-       function WebGLIndexedBufferRenderer(gl, extensions, info, capabilities) {
-               const isWebGL2 = capabilities.isWebGL2;
-               let mode;
-
-               function setMode(value) {
-                       mode = value;
-               }
-
-               let type, bytesPerElement;
-
-               function setIndex(value) {
-                       type = value.type;
-                       bytesPerElement = value.bytesPerElement;
-               }
-
-               function render(start, count) {
-                       gl.drawElements(mode, count, type, start * bytesPerElement);
-                       info.update(count, mode, 1);
-               }
-
-               function renderInstances(start, count, primcount) {
-                       if (primcount === 0) return;
-                       let extension, methodName;
-
-                       if (isWebGL2) {
-                               extension = gl;
-                               methodName = 'drawElementsInstanced';
-                       } else {
-                               extension = extensions.get('ANGLE_instanced_arrays');
-                               methodName = 'drawElementsInstancedANGLE';
-
-                               if (extension === null) {
-                                       console.error('THREE.WebGLIndexedBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.');
-                                       return;
-                               }
-                       }
-
-                       extension[methodName](mode, count, type, start * bytesPerElement, primcount);
-                       info.update(count, mode, primcount);
-               } //
-
-
-               this.setMode = setMode;
-               this.setIndex = setIndex;
-               this.render = render;
-               this.renderInstances = renderInstances;
-       }
-
-       function WebGLInfo(gl) {
-               const memory = {
-                       geometries: 0,
-                       textures: 0
-               };
-               const render = {
-                       frame: 0,
-                       calls: 0,
-                       triangles: 0,
-                       points: 0,
-                       lines: 0
-               };
-
-               function update(count, mode, instanceCount) {
-                       render.calls++;
-
-                       switch (mode) {
-                               case gl.TRIANGLES:
-                                       render.triangles += instanceCount * (count / 3);
-                                       break;
-
-                               case gl.LINES:
-                                       render.lines += instanceCount * (count / 2);
-                                       break;
-
-                               case gl.LINE_STRIP:
-                                       render.lines += instanceCount * (count - 1);
-                                       break;
-
-                               case gl.LINE_LOOP:
-                                       render.lines += instanceCount * count;
-                                       break;
-
-                               case gl.POINTS:
-                                       render.points += instanceCount * count;
-                                       break;
-
-                               default:
-                                       console.error('THREE.WebGLInfo: Unknown draw mode:', mode);
-                                       break;
-                       }
-               }
-
-               function reset() {
-                       render.frame++;
-                       render.calls = 0;
-                       render.triangles = 0;
-                       render.points = 0;
-                       render.lines = 0;
-               }
-
-               return {
-                       memory: memory,
-                       render: render,
-                       programs: null,
-                       autoReset: true,
-                       reset: reset,
-                       update: update
-               };
-       }
-
-       function numericalSort(a, b) {
-               return a[0] - b[0];
-       }
-
-       function absNumericalSort(a, b) {
-               return Math.abs(b[1]) - Math.abs(a[1]);
-       }
-
-       function WebGLMorphtargets(gl) {
-               const influencesList = {};
-               const morphInfluences = new Float32Array(8);
-               const workInfluences = [];
-
-               for (let i = 0; i < 8; i++) {
-                       workInfluences[i] = [i, 0];
-               }
-
-               function update(object, geometry, material, program) {
-                       const objectInfluences = object.morphTargetInfluences; // When object doesn't have morph target influences defined, we treat it as a 0-length array
-                       // This is important to make sure we set up morphTargetBaseInfluence / morphTargetInfluences
-
-                       const length = objectInfluences === undefined ? 0 : objectInfluences.length;
-                       let influences = influencesList[geometry.id];
-
-                       if (influences === undefined || influences.length !== length) {
-                               // initialise list
-                               influences = [];
-
-                               for (let i = 0; i < length; i++) {
-                                       influences[i] = [i, 0];
-                               }
-
-                               influencesList[geometry.id] = influences;
-                       } // Collect influences
-
-
-                       for (let i = 0; i < length; i++) {
-                               const influence = influences[i];
-                               influence[0] = i;
-                               influence[1] = objectInfluences[i];
-                       }
-
-                       influences.sort(absNumericalSort);
-
-                       for (let i = 0; i < 8; i++) {
-                               if (i < length && influences[i][1]) {
-                                       workInfluences[i][0] = influences[i][0];
-                                       workInfluences[i][1] = influences[i][1];
-                               } else {
-                                       workInfluences[i][0] = Number.MAX_SAFE_INTEGER;
-                                       workInfluences[i][1] = 0;
-                               }
-                       }
-
-                       workInfluences.sort(numericalSort);
-                       const morphTargets = geometry.morphAttributes.position;
-                       const morphNormals = geometry.morphAttributes.normal;
-                       let morphInfluencesSum = 0;
-
-                       for (let i = 0; i < 8; i++) {
-                               const influence = workInfluences[i];
-                               const index = influence[0];
-                               const value = influence[1];
-
-                               if (index !== Number.MAX_SAFE_INTEGER && value) {
-                                       if (morphTargets && geometry.getAttribute('morphTarget' + i) !== morphTargets[index]) {
-                                               geometry.setAttribute('morphTarget' + i, morphTargets[index]);
-                                       }
-
-                                       if (morphNormals && geometry.getAttribute('morphNormal' + i) !== morphNormals[index]) {
-                                               geometry.setAttribute('morphNormal' + i, morphNormals[index]);
-                                       }
-
-                                       morphInfluences[i] = value;
-                                       morphInfluencesSum += value;
-                               } else {
-                                       if (morphTargets && geometry.hasAttribute('morphTarget' + i) === true) {
-                                               geometry.deleteAttribute('morphTarget' + i);
-                                       }
-
-                                       if (morphNormals && geometry.hasAttribute('morphNormal' + i) === true) {
-                                               geometry.deleteAttribute('morphNormal' + i);
-                                       }
-
-                                       morphInfluences[i] = 0;
-                               }
-                       } // GLSL shader uses formula baseinfluence * base + sum(target * influence)
-                       // This allows us to switch between absolute morphs and relative morphs without changing shader code
-                       // When baseinfluence = 1 - sum(influence), the above is equivalent to sum((target - base) * influence)
-
-
-                       const morphBaseInfluence = geometry.morphTargetsRelative ? 1 : 1 - morphInfluencesSum;
-                       program.getUniforms().setValue(gl, 'morphTargetBaseInfluence', morphBaseInfluence);
-                       program.getUniforms().setValue(gl, 'morphTargetInfluences', morphInfluences);
-               }
-
-               return {
-                       update: update
-               };
-       }
-
-       function WebGLObjects(gl, geometries, attributes, info) {
-               let updateMap = new WeakMap();
-
-               function update(object) {
-                       const frame = info.render.frame;
-                       const geometry = object.geometry;
-                       const buffergeometry = geometries.get(object, geometry); // Update once per frame
-
-                       if (updateMap.get(buffergeometry) !== frame) {
-                               geometries.update(buffergeometry);
-                               updateMap.set(buffergeometry, frame);
-                       }
-
-                       if (object.isInstancedMesh) {
-                               if (object.hasEventListener('dispose', onInstancedMeshDispose) === false) {
-                                       object.addEventListener('dispose', onInstancedMeshDispose);
-                               }
-
-                               attributes.update(object.instanceMatrix, gl.ARRAY_BUFFER);
-
-                               if (object.instanceColor !== null) {
-                                       attributes.update(object.instanceColor, gl.ARRAY_BUFFER);
-                               }
-                       }
-
-                       return buffergeometry;
-               }
-
-               function dispose() {
-                       updateMap = new WeakMap();
-               }
-
-               function onInstancedMeshDispose(event) {
-                       const instancedMesh = event.target;
-                       instancedMesh.removeEventListener('dispose', onInstancedMeshDispose);
-                       attributes.remove(instancedMesh.instanceMatrix);
-                       if (instancedMesh.instanceColor !== null) attributes.remove(instancedMesh.instanceColor);
-               }
-
-               return {
-                       update: update,
-                       dispose: dispose
-               };
-       }
-
-       class DataTexture2DArray extends Texture {
-               constructor(data = null, width = 1, height = 1, depth = 1) {
-                       super(null);
-                       this.image = {
-                               data,
-                               width,
-                               height,
-                               depth
-                       };
-                       this.magFilter = NearestFilter;
-                       this.minFilter = NearestFilter;
-                       this.wrapR = ClampToEdgeWrapping;
-                       this.generateMipmaps = false;
-                       this.flipY = false;
-                       this.unpackAlignment = 1;
-                       this.needsUpdate = true;
-               }
-
-       }
-
-       DataTexture2DArray.prototype.isDataTexture2DArray = true;
-
-       class DataTexture3D extends Texture {
-               constructor(data = null, width = 1, height = 1, depth = 1) {
-                       // We're going to add .setXXX() methods for setting properties later.
-                       // Users can still set in DataTexture3D directly.
-                       //
-                       //      const texture = new THREE.DataTexture3D( data, width, height, depth );
-                       //      texture.anisotropy = 16;
-                       //
-                       // See #14839
-                       super(null);
-                       this.image = {
-                               data,
-                               width,
-                               height,
-                               depth
-                       };
-                       this.magFilter = NearestFilter;
-                       this.minFilter = NearestFilter;
-                       this.wrapR = ClampToEdgeWrapping;
-                       this.generateMipmaps = false;
-                       this.flipY = false;
-                       this.unpackAlignment = 1;
-                       this.needsUpdate = true;
-               }
-
-       }
-
-       DataTexture3D.prototype.isDataTexture3D = true;
-
-       /**
-        * Uniforms of a program.
-        * Those form a tree structure with a special top-level container for the root,
-        * which you get by calling 'new WebGLUniforms( gl, program )'.
-        *
-        *
-        * Properties of inner nodes including the top-level container:
-        *
-        * .seq - array of nested uniforms
-        * .map - nested uniforms by name
-        *
-        *
-        * Methods of all nodes except the top-level container:
-        *
-        * .setValue( gl, value, [textures] )
-        *
-        *              uploads a uniform value(s)
-        *              the 'textures' parameter is needed for sampler uniforms
-        *
-        *
-        * Static methods of the top-level container (textures factorizations):
-        *
-        * .upload( gl, seq, values, textures )
-        *
-        *              sets uniforms in 'seq' to 'values[id].value'
-        *
-        * .seqWithValue( seq, values ) : filteredSeq
-        *
-        *              filters 'seq' entries with corresponding entry in values
-        *
-        *
-        * Methods of the top-level container (textures factorizations):
-        *
-        * .setValue( gl, name, value, textures )
-        *
-        *              sets uniform with       name 'name' to 'value'
-        *
-        * .setOptional( gl, obj, prop )
-        *
-        *              like .set for an optional property of the object
-        *
-        */
-       const emptyTexture = new Texture();
-       const emptyTexture2dArray = new DataTexture2DArray();
-       const emptyTexture3d = new DataTexture3D();
-       const emptyCubeTexture = new CubeTexture(); // --- Utilities ---
-       // Array Caches (provide typed arrays for temporary by size)
-
-       const arrayCacheF32 = [];
-       const arrayCacheI32 = []; // Float32Array caches used for uploading Matrix uniforms
-
-       const mat4array = new Float32Array(16);
-       const mat3array = new Float32Array(9);
-       const mat2array = new Float32Array(4); // Flattening for arrays of vectors and matrices
-
-       function flatten(array, nBlocks, blockSize) {
-               const firstElem = array[0];
-               if (firstElem <= 0 || firstElem > 0) return array; // unoptimized: ! isNaN( firstElem )
-               // see http://jacksondunstan.com/articles/983
-
-               const n = nBlocks * blockSize;
-               let r = arrayCacheF32[n];
-
-               if (r === undefined) {
-                       r = new Float32Array(n);
-                       arrayCacheF32[n] = r;
-               }
-
-               if (nBlocks !== 0) {
-                       firstElem.toArray(r, 0);
-
-                       for (let i = 1, offset = 0; i !== nBlocks; ++i) {
-                               offset += blockSize;
-                               array[i].toArray(r, offset);
-                       }
-               }
-
-               return r;
-       }
-
-       function arraysEqual(a, b) {
-               if (a.length !== b.length) return false;
-
-               for (let i = 0, l = a.length; i < l; i++) {
-                       if (a[i] !== b[i]) return false;
-               }
-
-               return true;
-       }
-
-       function copyArray(a, b) {
-               for (let i = 0, l = b.length; i < l; i++) {
-                       a[i] = b[i];
-               }
-       } // Texture unit allocation
-
-
-       function allocTexUnits(textures, n) {
-               let r = arrayCacheI32[n];
-
-               if (r === undefined) {
-                       r = new Int32Array(n);
-                       arrayCacheI32[n] = r;
-               }
-
-               for (let i = 0; i !== n; ++i) {
-                       r[i] = textures.allocateTextureUnit();
-               }
-
-               return r;
-       } // --- Setters ---
-       // Note: Defining these methods externally, because they come in a bunch
-       // and this way their names minify.
-       // Single scalar
-
-
-       function setValueV1f(gl, v) {
-               const cache = this.cache;
-               if (cache[0] === v) return;
-               gl.uniform1f(this.addr, v);
-               cache[0] = v;
-       } // Single float vector (from flat array or THREE.VectorN)
-
-
-       function setValueV2f(gl, v) {
-               const cache = this.cache;
-
-               if (v.x !== undefined) {
-                       if (cache[0] !== v.x || cache[1] !== v.y) {
-                               gl.uniform2f(this.addr, v.x, v.y);
-                               cache[0] = v.x;
-                               cache[1] = v.y;
-                       }
-               } else {
-                       if (arraysEqual(cache, v)) return;
-                       gl.uniform2fv(this.addr, v);
-                       copyArray(cache, v);
-               }
-       }
-
-       function setValueV3f(gl, v) {
-               const cache = this.cache;
-
-               if (v.x !== undefined) {
-                       if (cache[0] !== v.x || cache[1] !== v.y || cache[2] !== v.z) {
-                               gl.uniform3f(this.addr, v.x, v.y, v.z);
-                               cache[0] = v.x;
-                               cache[1] = v.y;
-                               cache[2] = v.z;
-                       }
-               } else if (v.r !== undefined) {
-                       if (cache[0] !== v.r || cache[1] !== v.g || cache[2] !== v.b) {
-                               gl.uniform3f(this.addr, v.r, v.g, v.b);
-                               cache[0] = v.r;
-                               cache[1] = v.g;
-                               cache[2] = v.b;
-                       }
-               } else {
-                       if (arraysEqual(cache, v)) return;
-                       gl.uniform3fv(this.addr, v);
-                       copyArray(cache, v);
-               }
-       }
-
-       function setValueV4f(gl, v) {
-               const cache = this.cache;
-
-               if (v.x !== undefined) {
-                       if (cache[0] !== v.x || cache[1] !== v.y || cache[2] !== v.z || cache[3] !== v.w) {
-                               gl.uniform4f(this.addr, v.x, v.y, v.z, v.w);
-                               cache[0] = v.x;
-                               cache[1] = v.y;
-                               cache[2] = v.z;
-                               cache[3] = v.w;
-                       }
-               } else {
-                       if (arraysEqual(cache, v)) return;
-                       gl.uniform4fv(this.addr, v);
-                       copyArray(cache, v);
-               }
-       } // Single matrix (from flat array or THREE.MatrixN)
-
-
-       function setValueM2(gl, v) {
-               const cache = this.cache;
-               const elements = v.elements;
-
-               if (elements === undefined) {
-                       if (arraysEqual(cache, v)) return;
-                       gl.uniformMatrix2fv(this.addr, false, v);
-                       copyArray(cache, v);
-               } else {
-                       if (arraysEqual(cache, elements)) return;
-                       mat2array.set(elements);
-                       gl.uniformMatrix2fv(this.addr, false, mat2array);
-                       copyArray(cache, elements);
-               }
-       }
-
-       function setValueM3(gl, v) {
-               const cache = this.cache;
-               const elements = v.elements;
-
-               if (elements === undefined) {
-                       if (arraysEqual(cache, v)) return;
-                       gl.uniformMatrix3fv(this.addr, false, v);
-                       copyArray(cache, v);
-               } else {
-                       if (arraysEqual(cache, elements)) return;
-                       mat3array.set(elements);
-                       gl.uniformMatrix3fv(this.addr, false, mat3array);
-                       copyArray(cache, elements);
-               }
-       }
-
-       function setValueM4(gl, v) {
-               const cache = this.cache;
-               const elements = v.elements;
-
-               if (elements === undefined) {
-                       if (arraysEqual(cache, v)) return;
-                       gl.uniformMatrix4fv(this.addr, false, v);
-                       copyArray(cache, v);
-               } else {
-                       if (arraysEqual(cache, elements)) return;
-                       mat4array.set(elements);
-                       gl.uniformMatrix4fv(this.addr, false, mat4array);
-                       copyArray(cache, elements);
-               }
-       } // Single integer / boolean
-
-
-       function setValueV1i(gl, v) {
-               const cache = this.cache;
-               if (cache[0] === v) return;
-               gl.uniform1i(this.addr, v);
-               cache[0] = v;
-       } // Single integer / boolean vector (from flat array)
-
-
-       function setValueV2i(gl, v) {
-               const cache = this.cache;
-               if (arraysEqual(cache, v)) return;
-               gl.uniform2iv(this.addr, v);
-               copyArray(cache, v);
-       }
-
-       function setValueV3i(gl, v) {
-               const cache = this.cache;
-               if (arraysEqual(cache, v)) return;
-               gl.uniform3iv(this.addr, v);
-               copyArray(cache, v);
-       }
-
-       function setValueV4i(gl, v) {
-               const cache = this.cache;
-               if (arraysEqual(cache, v)) return;
-               gl.uniform4iv(this.addr, v);
-               copyArray(cache, v);
-       } // Single unsigned integer
-
-
-       function setValueV1ui(gl, v) {
-               const cache = this.cache;
-               if (cache[0] === v) return;
-               gl.uniform1ui(this.addr, v);
-               cache[0] = v;
-       } // Single unsigned integer vector (from flat array)
-
-
-       function setValueV2ui(gl, v) {
-               const cache = this.cache;
-               if (arraysEqual(cache, v)) return;
-               gl.uniform2uiv(this.addr, v);
-               copyArray(cache, v);
-       }
-
-       function setValueV3ui(gl, v) {
-               const cache = this.cache;
-               if (arraysEqual(cache, v)) return;
-               gl.uniform3uiv(this.addr, v);
-               copyArray(cache, v);
-       }
-
-       function setValueV4ui(gl, v) {
-               const cache = this.cache;
-               if (arraysEqual(cache, v)) return;
-               gl.uniform4uiv(this.addr, v);
-               copyArray(cache, v);
-       } // Single texture (2D / Cube)
-
-
-       function setValueT1(gl, v, textures) {
-               const cache = this.cache;
-               const unit = textures.allocateTextureUnit();
-
-               if (cache[0] !== unit) {
-                       gl.uniform1i(this.addr, unit);
-                       cache[0] = unit;
-               }
-
-               textures.safeSetTexture2D(v || emptyTexture, unit);
-       }
-
-       function setValueT3D1(gl, v, textures) {
-               const cache = this.cache;
-               const unit = textures.allocateTextureUnit();
-
-               if (cache[0] !== unit) {
-                       gl.uniform1i(this.addr, unit);
-                       cache[0] = unit;
-               }
-
-               textures.setTexture3D(v || emptyTexture3d, unit);
-       }
-
-       function setValueT6(gl, v, textures) {
-               const cache = this.cache;
-               const unit = textures.allocateTextureUnit();
-
-               if (cache[0] !== unit) {
-                       gl.uniform1i(this.addr, unit);
-                       cache[0] = unit;
-               }
-
-               textures.safeSetTextureCube(v || emptyCubeTexture, unit);
-       }
-
-       function setValueT2DArray1(gl, v, textures) {
-               const cache = this.cache;
-               const unit = textures.allocateTextureUnit();
-
-               if (cache[0] !== unit) {
-                       gl.uniform1i(this.addr, unit);
-                       cache[0] = unit;
-               }
-
-               textures.setTexture2DArray(v || emptyTexture2dArray, unit);
-       } // Helper to pick the right setter for the singular case
-
-
-       function getSingularSetter(type) {
-               switch (type) {
-                       case 0x1406:
-                               return setValueV1f;
-                       // FLOAT
-
-                       case 0x8b50:
-                               return setValueV2f;
-                       // _VEC2
-
-                       case 0x8b51:
-                               return setValueV3f;
-                       // _VEC3
-
-                       case 0x8b52:
-                               return setValueV4f;
-                       // _VEC4
-
-                       case 0x8b5a:
-                               return setValueM2;
-                       // _MAT2
-
-                       case 0x8b5b:
-                               return setValueM3;
-                       // _MAT3
-
-                       case 0x8b5c:
-                               return setValueM4;
-                       // _MAT4
-
-                       case 0x1404:
-                       case 0x8b56:
-                               return setValueV1i;
-                       // INT, BOOL
-
-                       case 0x8b53:
-                       case 0x8b57:
-                               return setValueV2i;
-                       // _VEC2
-
-                       case 0x8b54:
-                       case 0x8b58:
-                               return setValueV3i;
-                       // _VEC3
-
-                       case 0x8b55:
-                       case 0x8b59:
-                               return setValueV4i;
-                       // _VEC4
-
-                       case 0x1405:
-                               return setValueV1ui;
-                       // UINT
-
-                       case 0x8dc6:
-                               return setValueV2ui;
-                       // _VEC2
-
-                       case 0x8dc7:
-                               return setValueV3ui;
-                       // _VEC3
-
-                       case 0x8dc8:
-                               return setValueV4ui;
-                       // _VEC4
-
-                       case 0x8b5e: // SAMPLER_2D
-
-                       case 0x8d66: // SAMPLER_EXTERNAL_OES
-
-                       case 0x8dca: // INT_SAMPLER_2D
-
-                       case 0x8dd2: // UNSIGNED_INT_SAMPLER_2D
-
-                       case 0x8b62:
-                               // SAMPLER_2D_SHADOW
-                               return setValueT1;
-
-                       case 0x8b5f: // SAMPLER_3D
-
-                       case 0x8dcb: // INT_SAMPLER_3D
-
-                       case 0x8dd3:
-                               // UNSIGNED_INT_SAMPLER_3D
-                               return setValueT3D1;
-
-                       case 0x8b60: // SAMPLER_CUBE
-
-                       case 0x8dcc: // INT_SAMPLER_CUBE
-
-                       case 0x8dd4: // UNSIGNED_INT_SAMPLER_CUBE
-
-                       case 0x8dc5:
-                               // SAMPLER_CUBE_SHADOW
-                               return setValueT6;
-
-                       case 0x8dc1: // SAMPLER_2D_ARRAY
-
-                       case 0x8dcf: // INT_SAMPLER_2D_ARRAY
-
-                       case 0x8dd7: // UNSIGNED_INT_SAMPLER_2D_ARRAY
-
-                       case 0x8dc4:
-                               // SAMPLER_2D_ARRAY_SHADOW
-                               return setValueT2DArray1;
-               }
-       } // Array of scalars
-
-
-       function setValueV1fArray(gl, v) {
-               gl.uniform1fv(this.addr, v);
-       } // Array of vectors (from flat array or array of THREE.VectorN)
-
-
-       function setValueV2fArray(gl, v) {
-               const data = flatten(v, this.size, 2);
-               gl.uniform2fv(this.addr, data);
-       }
-
-       function setValueV3fArray(gl, v) {
-               const data = flatten(v, this.size, 3);
-               gl.uniform3fv(this.addr, data);
-       }
-
-       function setValueV4fArray(gl, v) {
-               const data = flatten(v, this.size, 4);
-               gl.uniform4fv(this.addr, data);
-       } // Array of matrices (from flat array or array of THREE.MatrixN)
-
-
-       function setValueM2Array(gl, v) {
-               const data = flatten(v, this.size, 4);
-               gl.uniformMatrix2fv(this.addr, false, data);
-       }
-
-       function setValueM3Array(gl, v) {
-               const data = flatten(v, this.size, 9);
-               gl.uniformMatrix3fv(this.addr, false, data);
-       }
-
-       function setValueM4Array(gl, v) {
-               const data = flatten(v, this.size, 16);
-               gl.uniformMatrix4fv(this.addr, false, data);
-       } // Array of integer / boolean
-
-
-       function setValueV1iArray(gl, v) {
-               gl.uniform1iv(this.addr, v);
-       } // Array of integer / boolean vectors (from flat array)
-
-
-       function setValueV2iArray(gl, v) {
-               gl.uniform2iv(this.addr, v);
-       }
-
-       function setValueV3iArray(gl, v) {
-               gl.uniform3iv(this.addr, v);
-       }
-
-       function setValueV4iArray(gl, v) {
-               gl.uniform4iv(this.addr, v);
-       } // Array of unsigned integer
-
-
-       function setValueV1uiArray(gl, v) {
-               gl.uniform1uiv(this.addr, v);
-       } // Array of unsigned integer vectors (from flat array)
-
-
-       function setValueV2uiArray(gl, v) {
-               gl.uniform2uiv(this.addr, v);
-       }
-
-       function setValueV3uiArray(gl, v) {
-               gl.uniform3uiv(this.addr, v);
-       }
-
-       function setValueV4uiArray(gl, v) {
-               gl.uniform4uiv(this.addr, v);
-       } // Array of textures (2D / Cube)
-
-
-       function setValueT1Array(gl, v, textures) {
-               const n = v.length;
-               const units = allocTexUnits(textures, n);
-               gl.uniform1iv(this.addr, units);
-
-               for (let i = 0; i !== n; ++i) {
-                       textures.safeSetTexture2D(v[i] || emptyTexture, units[i]);
-               }
-       }
-
-       function setValueT6Array(gl, v, textures) {
-               const n = v.length;
-               const units = allocTexUnits(textures, n);
-               gl.uniform1iv(this.addr, units);
-
-               for (let i = 0; i !== n; ++i) {
-                       textures.safeSetTextureCube(v[i] || emptyCubeTexture, units[i]);
-               }
-       } // Helper to pick the right setter for a pure (bottom-level) array
-
-
-       function getPureArraySetter(type) {
-               switch (type) {
-                       case 0x1406:
-                               return setValueV1fArray;
-                       // FLOAT
-
-                       case 0x8b50:
-                               return setValueV2fArray;
-                       // _VEC2
-
-                       case 0x8b51:
-                               return setValueV3fArray;
-                       // _VEC3
-
-                       case 0x8b52:
-                               return setValueV4fArray;
-                       // _VEC4
-
-                       case 0x8b5a:
-                               return setValueM2Array;
-                       // _MAT2
-
-                       case 0x8b5b:
-                               return setValueM3Array;
-                       // _MAT3
-
-                       case 0x8b5c:
-                               return setValueM4Array;
-                       // _MAT4
-
-                       case 0x1404:
-                       case 0x8b56:
-                               return setValueV1iArray;
-                       // INT, BOOL
-
-                       case 0x8b53:
-                       case 0x8b57:
-                               return setValueV2iArray;
-                       // _VEC2
-
-                       case 0x8b54:
-                       case 0x8b58:
-                               return setValueV3iArray;
-                       // _VEC3
-
-                       case 0x8b55:
-                       case 0x8b59:
-                               return setValueV4iArray;
-                       // _VEC4
-
-                       case 0x1405:
-                               return setValueV1uiArray;
-                       // UINT
-
-                       case 0x8dc6:
-                               return setValueV2uiArray;
-                       // _VEC2
-
-                       case 0x8dc7:
-                               return setValueV3uiArray;
-                       // _VEC3
-
-                       case 0x8dc8:
-                               return setValueV4uiArray;
-                       // _VEC4
-
-                       case 0x8b5e: // SAMPLER_2D
-
-                       case 0x8d66: // SAMPLER_EXTERNAL_OES
-
-                       case 0x8dca: // INT_SAMPLER_2D
-
-                       case 0x8dd2: // UNSIGNED_INT_SAMPLER_2D
-
-                       case 0x8b62:
-                               // SAMPLER_2D_SHADOW
-                               return setValueT1Array;
-
-                       case 0x8b60: // SAMPLER_CUBE
-
-                       case 0x8dcc: // INT_SAMPLER_CUBE
-
-                       case 0x8dd4: // UNSIGNED_INT_SAMPLER_CUBE
-
-                       case 0x8dc5:
-                               // SAMPLER_CUBE_SHADOW
-                               return setValueT6Array;
-               }
-       } // --- Uniform Classes ---
-
-
-       function SingleUniform(id, activeInfo, addr) {
-               this.id = id;
-               this.addr = addr;
-               this.cache = [];
-               this.setValue = getSingularSetter(activeInfo.type); // this.path = activeInfo.name; // DEBUG
-       }
-
-       function PureArrayUniform(id, activeInfo, addr) {
-               this.id = id;
-               this.addr = addr;
-               this.cache = [];
-               this.size = activeInfo.size;
-               this.setValue = getPureArraySetter(activeInfo.type); // this.path = activeInfo.name; // DEBUG
-       }
-
-       PureArrayUniform.prototype.updateCache = function (data) {
-               const cache = this.cache;
-
-               if (data instanceof Float32Array && cache.length !== data.length) {
-                       this.cache = new Float32Array(data.length);
-               }
-
-               copyArray(cache, data);
-       };
-
-       function StructuredUniform(id) {
-               this.id = id;
-               this.seq = [];
-               this.map = {};
-       }
-
-       StructuredUniform.prototype.setValue = function (gl, value, textures) {
-               const seq = this.seq;
-
-               for (let i = 0, n = seq.length; i !== n; ++i) {
-                       const u = seq[i];
-                       u.setValue(gl, value[u.id], textures);
-               }
-       }; // --- Top-level ---
-       // Parser - builds up the property tree from the path strings
-
-
-       const RePathPart = /(\w+)(\])?(\[|\.)?/g; // extracts
-       //      - the identifier (member name or array index)
-       //      - followed by an optional right bracket (found when array index)
-       //      - followed by an optional left bracket or dot (type of subscript)
-       //
-       // Note: These portions can be read in a non-overlapping fashion and
-       // allow straightforward parsing of the hierarchy that WebGL encodes
-       // in the uniform names.
-
-       function addUniform(container, uniformObject) {
-               container.seq.push(uniformObject);
-               container.map[uniformObject.id] = uniformObject;
-       }
-
-       function parseUniform(activeInfo, addr, container) {
-               const path = activeInfo.name,
-                                       pathLength = path.length; // reset RegExp object, because of the early exit of a previous run
-
-               RePathPart.lastIndex = 0;
-
-               while (true) {
-                       const match = RePathPart.exec(path),
-                                               matchEnd = RePathPart.lastIndex;
-                       let id = match[1];
-                       const idIsIndex = match[2] === ']',
-                                               subscript = match[3];
-                       if (idIsIndex) id = id | 0; // convert to integer
-
-                       if (subscript === undefined || subscript === '[' && matchEnd + 2 === pathLength) {
-                               // bare name or "pure" bottom-level array "[0]" suffix
-                               addUniform(container, subscript === undefined ? new SingleUniform(id, activeInfo, addr) : new PureArrayUniform(id, activeInfo, addr));
-                               break;
-                       } else {
-                               // step into inner node / create it in case it doesn't exist
-                               const map = container.map;
-                               let next = map[id];
-
-                               if (next === undefined) {
-                                       next = new StructuredUniform(id);
-                                       addUniform(container, next);
-                               }
-
-                               container = next;
-                       }
-               }
-       } // Root Container
-
-
-       function WebGLUniforms(gl, program) {
-               this.seq = [];
-               this.map = {};
-               const n = gl.getProgramParameter(program, gl.ACTIVE_UNIFORMS);
-
-               for (let i = 0; i < n; ++i) {
-                       const info = gl.getActiveUniform(program, i),
-                                               addr = gl.getUniformLocation(program, info.name);
-                       parseUniform(info, addr, this);
-               }
-       }
-
-       WebGLUniforms.prototype.setValue = function (gl, name, value, textures) {
-               const u = this.map[name];
-               if (u !== undefined) u.setValue(gl, value, textures);
-       };
-
-       WebGLUniforms.prototype.setOptional = function (gl, object, name) {
-               const v = object[name];
-               if (v !== undefined) this.setValue(gl, name, v);
-       }; // Static interface
-
-
-       WebGLUniforms.upload = function (gl, seq, values, textures) {
-               for (let i = 0, n = seq.length; i !== n; ++i) {
-                       const u = seq[i],
-                                               v = values[u.id];
-
-                       if (v.needsUpdate !== false) {
-                               // note: always updating when .needsUpdate is undefined
-                               u.setValue(gl, v.value, textures);
-                       }
-               }
-       };
-
-       WebGLUniforms.seqWithValue = function (seq, values) {
-               const r = [];
-
-               for (let i = 0, n = seq.length; i !== n; ++i) {
-                       const u = seq[i];
-                       if (u.id in values) r.push(u);
-               }
-
-               return r;
-       };
-
-       function WebGLShader(gl, type, string) {
-               const shader = gl.createShader(type);
-               gl.shaderSource(shader, string);
-               gl.compileShader(shader);
-               return shader;
-       }
-
-       let programIdCount = 0;
-
-       function addLineNumbers(string) {
-               const lines = string.split('\n');
-
-               for (let i = 0; i < lines.length; i++) {
-                       lines[i] = i + 1 + ': ' + lines[i];
-               }
-
-               return lines.join('\n');
-       }
-
-       function getEncodingComponents(encoding) {
-               switch (encoding) {
-                       case LinearEncoding:
-                               return ['Linear', '( value )'];
-
-                       case sRGBEncoding:
-                               return ['sRGB', '( value )'];
-
-                       case RGBEEncoding:
-                               return ['RGBE', '( value )'];
-
-                       case RGBM7Encoding:
-                               return ['RGBM', '( value, 7.0 )'];
-
-                       case RGBM16Encoding:
-                               return ['RGBM', '( value, 16.0 )'];
-
-                       case RGBDEncoding:
-                               return ['RGBD', '( value, 256.0 )'];
-
-                       case GammaEncoding:
-                               return ['Gamma', '( value, float( GAMMA_FACTOR ) )'];
-
-                       case LogLuvEncoding:
-                               return ['LogLuv', '( value )'];
-
-                       default:
-                               console.warn('THREE.WebGLProgram: Unsupported encoding:', encoding);
-                               return ['Linear', '( value )'];
-               }
-       }
-
-       function getShaderErrors(gl, shader, type) {
-               const status = gl.getShaderParameter(shader, gl.COMPILE_STATUS);
-               const errors = gl.getShaderInfoLog(shader).trim();
-               if (status && errors === '') return ''; // --enable-privileged-webgl-extension
-               // console.log( '**' + type + '**', gl.getExtension( 'WEBGL_debug_shaders' ).getTranslatedShaderSource( shader ) );
-
-               return type.toUpperCase() + '\n\n' + errors + '\n\n' + addLineNumbers(gl.getShaderSource(shader));
-       }
-
-       function getTexelDecodingFunction(functionName, encoding) {
-               const components = getEncodingComponents(encoding);
-               return 'vec4 ' + functionName + '( vec4 value ) { return ' + components[0] + 'ToLinear' + components[1] + '; }';
-       }
-
-       function getTexelEncodingFunction(functionName, encoding) {
-               const components = getEncodingComponents(encoding);
-               return 'vec4 ' + functionName + '( vec4 value ) { return LinearTo' + components[0] + components[1] + '; }';
-       }
-
-       function getToneMappingFunction(functionName, toneMapping) {
-               let toneMappingName;
-
-               switch (toneMapping) {
-                       case LinearToneMapping:
-                               toneMappingName = 'Linear';
-                               break;
-
-                       case ReinhardToneMapping:
-                               toneMappingName = 'Reinhard';
-                               break;
-
-                       case CineonToneMapping:
-                               toneMappingName = 'OptimizedCineon';
-                               break;
-
-                       case ACESFilmicToneMapping:
-                               toneMappingName = 'ACESFilmic';
-                               break;
-
-                       case CustomToneMapping:
-                               toneMappingName = 'Custom';
-                               break;
-
-                       default:
-                               console.warn('THREE.WebGLProgram: Unsupported toneMapping:', toneMapping);
-                               toneMappingName = 'Linear';
-               }
-
-               return 'vec3 ' + functionName + '( vec3 color ) { return ' + toneMappingName + 'ToneMapping( color ); }';
-       }
-
-       function generateExtensions(parameters) {
-               const chunks = [parameters.extensionDerivatives || parameters.envMapCubeUV || parameters.bumpMap || parameters.tangentSpaceNormalMap || parameters.clearcoatNormalMap || parameters.flatShading || parameters.shaderID === 'physical' ? '#extension GL_OES_standard_derivatives : enable' : '', (parameters.extensionFragDepth || parameters.logarithmicDepthBuffer) && parameters.rendererExtensionFragDepth ? '#extension GL_EXT_frag_depth : enable' : '', parameters.extensionDrawBuffers && parameters.rendererExtensionDrawBuffers ? '#extension GL_EXT_draw_buffers : require' : '', (parameters.extensionShaderTextureLOD || parameters.envMap || parameters.transmission) && parameters.rendererExtensionShaderTextureLod ? '#extension GL_EXT_shader_texture_lod : enable' : ''];
-               return chunks.filter(filterEmptyLine).join('\n');
-       }
-
-       function generateDefines(defines) {
-               const chunks = [];
-
-               for (const name in defines) {
-                       const value = defines[name];
-                       if (value === false) continue;
-                       chunks.push('#define ' + name + ' ' + value);
-               }
-
-               return chunks.join('\n');
-       }
-
-       function fetchAttributeLocations(gl, program) {
-               const attributes = {};
-               const n = gl.getProgramParameter(program, gl.ACTIVE_ATTRIBUTES);
-
-               for (let i = 0; i < n; i++) {
-                       const info = gl.getActiveAttrib(program, i);
-                       const name = info.name;
-                       let locationSize = 1;
-                       if (info.type === gl.FLOAT_MAT2) locationSize = 2;
-                       if (info.type === gl.FLOAT_MAT3) locationSize = 3;
-                       if (info.type === gl.FLOAT_MAT4) locationSize = 4; // console.log( 'THREE.WebGLProgram: ACTIVE VERTEX ATTRIBUTE:', name, i );
-
-                       attributes[name] = {
-                               type: info.type,
-                               location: gl.getAttribLocation(program, name),
-                               locationSize: locationSize
-                       };
-               }
-
-               return attributes;
-       }
-
-       function filterEmptyLine(string) {
-               return string !== '';
-       }
-
-       function replaceLightNums(string, parameters) {
-               return string.replace(/NUM_DIR_LIGHTS/g, parameters.numDirLights).replace(/NUM_SPOT_LIGHTS/g, parameters.numSpotLights).replace(/NUM_RECT_AREA_LIGHTS/g, parameters.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g, parameters.numPointLights).replace(/NUM_HEMI_LIGHTS/g, parameters.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g, parameters.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS/g, parameters.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g, parameters.numPointLightShadows);
-       }
-
-       function replaceClippingPlaneNums(string, parameters) {
-               return string.replace(/NUM_CLIPPING_PLANES/g, parameters.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g, parameters.numClippingPlanes - parameters.numClipIntersection);
-       } // Resolve Includes
-
-
-       const includePattern = /^[ \t]*#include +<([\w\d./]+)>/gm;
-
-       function resolveIncludes(string) {
-               return string.replace(includePattern, includeReplacer);
-       }
-
-       function includeReplacer(match, include) {
-               const string = ShaderChunk[include];
-
-               if (string === undefined) {
-                       throw new Error('Can not resolve #include <' + include + '>');
-               }
-
-               return resolveIncludes(string);
-       } // Unroll Loops
-
-
-       const deprecatedUnrollLoopPattern = /#pragma unroll_loop[\s]+?for \( int i \= (\d+)\; i < (\d+)\; i \+\+ \) \{([\s\S]+?)(?=\})\}/g;
-       const unrollLoopPattern = /#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 unrollLoops(string) {
-               return string.replace(unrollLoopPattern, loopReplacer).replace(deprecatedUnrollLoopPattern, deprecatedLoopReplacer);
-       }
-
-       function deprecatedLoopReplacer(match, start, end, snippet) {
-               console.warn('WebGLProgram: #pragma unroll_loop shader syntax is deprecated. Please use #pragma unroll_loop_start syntax instead.');
-               return loopReplacer(match, start, end, snippet);
-       }
-
-       function loopReplacer(match, start, end, snippet) {
-               let string = '';
-
-               for (let i = parseInt(start); i < parseInt(end); i++) {
-                       string += snippet.replace(/\[\s*i\s*\]/g, '[ ' + i + ' ]').replace(/UNROLLED_LOOP_INDEX/g, i);
-               }
-
-               return string;
-       } //
-
-
-       function generatePrecision(parameters) {
-               let precisionstring = 'precision ' + parameters.precision + ' float;\nprecision ' + parameters.precision + ' int;';
-
-               if (parameters.precision === 'highp') {
-                       precisionstring += '\n#define HIGH_PRECISION';
-               } else if (parameters.precision === 'mediump') {
-                       precisionstring += '\n#define MEDIUM_PRECISION';
-               } else if (parameters.precision === 'lowp') {
-                       precisionstring += '\n#define LOW_PRECISION';
-               }
-
-               return precisionstring;
-       }
-
-       function generateShadowMapTypeDefine(parameters) {
-               let shadowMapTypeDefine = 'SHADOWMAP_TYPE_BASIC';
-
-               if (parameters.shadowMapType === PCFShadowMap) {
-                       shadowMapTypeDefine = 'SHADOWMAP_TYPE_PCF';
-               } else if (parameters.shadowMapType === PCFSoftShadowMap) {
-                       shadowMapTypeDefine = 'SHADOWMAP_TYPE_PCF_SOFT';
-               } else if (parameters.shadowMapType === VSMShadowMap) {
-                       shadowMapTypeDefine = 'SHADOWMAP_TYPE_VSM';
-               }
-
-               return shadowMapTypeDefine;
-       }
-
-       function generateEnvMapTypeDefine(parameters) {
-               let envMapTypeDefine = 'ENVMAP_TYPE_CUBE';
-
-               if (parameters.envMap) {
-                       switch (parameters.envMapMode) {
-                               case CubeReflectionMapping:
-                               case CubeRefractionMapping:
-                                       envMapTypeDefine = 'ENVMAP_TYPE_CUBE';
-                                       break;
-
-                               case CubeUVReflectionMapping:
-                               case CubeUVRefractionMapping:
-                                       envMapTypeDefine = 'ENVMAP_TYPE_CUBE_UV';
-                                       break;
-                       }
-               }
-
-               return envMapTypeDefine;
-       }
-
-       function generateEnvMapModeDefine(parameters) {
-               let envMapModeDefine = 'ENVMAP_MODE_REFLECTION';
-
-               if (parameters.envMap) {
-                       switch (parameters.envMapMode) {
-                               case CubeRefractionMapping:
-                               case CubeUVRefractionMapping:
-                                       envMapModeDefine = 'ENVMAP_MODE_REFRACTION';
-                                       break;
-                       }
-               }
-
-               return envMapModeDefine;
-       }
-
-       function generateEnvMapBlendingDefine(parameters) {
-               let envMapBlendingDefine = 'ENVMAP_BLENDING_NONE';
-
-               if (parameters.envMap) {
-                       switch (parameters.combine) {
-                               case MultiplyOperation:
-                                       envMapBlendingDefine = 'ENVMAP_BLENDING_MULTIPLY';
-                                       break;
-
-                               case MixOperation:
-                                       envMapBlendingDefine = 'ENVMAP_BLENDING_MIX';
-                                       break;
-
-                               case AddOperation:
-                                       envMapBlendingDefine = 'ENVMAP_BLENDING_ADD';
-                                       break;
-                       }
-               }
-
-               return envMapBlendingDefine;
-       }
-
-       function WebGLProgram(renderer, cacheKey, parameters, bindingStates) {
-               // TODO Send this event to Three.js DevTools
-               // console.log( 'WebGLProgram', cacheKey );
-               const gl = renderer.getContext();
-               const defines = parameters.defines;
-               let vertexShader = parameters.vertexShader;
-               let fragmentShader = parameters.fragmentShader;
-               const shadowMapTypeDefine = generateShadowMapTypeDefine(parameters);
-               const envMapTypeDefine = generateEnvMapTypeDefine(parameters);
-               const envMapModeDefine = generateEnvMapModeDefine(parameters);
-               const envMapBlendingDefine = generateEnvMapBlendingDefine(parameters);
-               const gammaFactorDefine = renderer.gammaFactor > 0 ? renderer.gammaFactor : 1.0;
-               const customExtensions = parameters.isWebGL2 ? '' : generateExtensions(parameters);
-               const customDefines = generateDefines(defines);
-               const program = gl.createProgram();
-               let prefixVertex, prefixFragment;
-               let versionString = parameters.glslVersion ? '#version ' + parameters.glslVersion + '\n' : '';
-
-               if (parameters.isRawShaderMaterial) {
-                       prefixVertex = [customDefines].filter(filterEmptyLine).join('\n');
-
-                       if (prefixVertex.length > 0) {
-                               prefixVertex += '\n';
-                       }
-
-                       prefixFragment = [customExtensions, customDefines].filter(filterEmptyLine).join('\n');
-
-                       if (prefixFragment.length > 0) {
-                               prefixFragment += '\n';
-                       }
-               } else {
-                       prefixVertex = [generatePrecision(parameters), '#define SHADER_NAME ' + parameters.shaderName, customDefines, parameters.instancing ? '#define USE_INSTANCING' : '', parameters.instancingColor ? '#define USE_INSTANCING_COLOR' : '', parameters.supportsVertexTextures ? '#define VERTEX_TEXTURES' : '', '#define GAMMA_FACTOR ' + gammaFactorDefine, '#define MAX_BONES ' + parameters.maxBones, parameters.useFog && parameters.fog ? '#define USE_FOG' : '', parameters.useFog && parameters.fogExp2 ? '#define FOG_EXP2' : '', parameters.map ? '#define USE_MAP' : '', parameters.envMap ? '#define USE_ENVMAP' : '', parameters.envMap ? '#define ' + envMapModeDefine : '', parameters.lightMap ? '#define USE_LIGHTMAP' : '', parameters.aoMap ? '#define USE_AOMAP' : '', parameters.emissiveMap ? '#define USE_EMISSIVEMAP' : '', parameters.bumpMap ? '#define USE_BUMPMAP' : '', parameters.normalMap ? '#define USE_NORMALMAP' : '', parameters.normalMap && parameters.objectSpaceNormalMap ? '#define OBJECTSPACE_NORMALMAP' : '', parameters.normalMap && parameters.tangentSpaceNormalMap ? '#define TANGENTSPACE_NORMALMAP' : '', parameters.clearcoatMap ? '#define USE_CLEARCOATMAP' : '', parameters.clearcoatRoughnessMap ? '#define USE_CLEARCOAT_ROUGHNESSMAP' : '', parameters.clearcoatNormalMap ? '#define USE_CLEARCOAT_NORMALMAP' : '', parameters.displacementMap && parameters.supportsVertexTextures ? '#define USE_DISPLACEMENTMAP' : '', parameters.specularMap ? '#define USE_SPECULARMAP' : '', parameters.specularIntensityMap ? '#define USE_SPECULARINTENSITYMAP' : '', parameters.specularTintMap ? '#define USE_SPECULARTINTMAP' : '', parameters.roughnessMap ? '#define USE_ROUGHNESSMAP' : '', parameters.metalnessMap ? '#define USE_METALNESSMAP' : '', parameters.alphaMap ? '#define USE_ALPHAMAP' : '', parameters.transmission ? '#define USE_TRANSMISSION' : '', parameters.transmissionMap ? '#define USE_TRANSMISSIONMAP' : '', parameters.thicknessMap ? '#define USE_THICKNESSMAP' : '', parameters.vertexTangents ? '#define USE_TANGENT' : '', parameters.vertexColors ? '#define USE_COLOR' : '', parameters.vertexAlphas ? '#define USE_COLOR_ALPHA' : '', parameters.vertexUvs ? '#define USE_UV' : '', parameters.uvsVertexOnly ? '#define UVS_VERTEX_ONLY' : '', parameters.flatShading ? '#define FLAT_SHADED' : '', parameters.skinning ? '#define USE_SKINNING' : '', parameters.useVertexTexture ? '#define BONE_TEXTURE' : '', parameters.morphTargets ? '#define USE_MORPHTARGETS' : '', parameters.morphNormals && parameters.flatShading === false ? '#define USE_MORPHNORMALS' : '', parameters.doubleSided ? '#define DOUBLE_SIDED' : '', parameters.flipSided ? '#define FLIP_SIDED' : '', parameters.shadowMapEnabled ? '#define USE_SHADOWMAP' : '', parameters.shadowMapEnabled ? '#define ' + shadowMapTypeDefine : '', parameters.sizeAttenuation ? '#define USE_SIZEATTENUATION' : '', parameters.logarithmicDepthBuffer ? '#define USE_LOGDEPTHBUF' : '', parameters.logarithmicDepthBuffer && parameters.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', '#ifdef USE_MORPHTARGETS', '  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', '\n'].filter(filterEmptyLine).join('\n');
-                       prefixFragment = [customExtensions, generatePrecision(parameters), '#define SHADER_NAME ' + parameters.shaderName, customDefines, '#define GAMMA_FACTOR ' + gammaFactorDefine, parameters.useFog && parameters.fog ? '#define USE_FOG' : '', parameters.useFog && parameters.fogExp2 ? '#define FOG_EXP2' : '', parameters.map ? '#define USE_MAP' : '', parameters.matcap ? '#define USE_MATCAP' : '', parameters.envMap ? '#define USE_ENVMAP' : '', parameters.envMap ? '#define ' + envMapTypeDefine : '', parameters.envMap ? '#define ' + envMapModeDefine : '', parameters.envMap ? '#define ' + envMapBlendingDefine : '', parameters.lightMap ? '#define USE_LIGHTMAP' : '', parameters.aoMap ? '#define USE_AOMAP' : '', parameters.emissiveMap ? '#define USE_EMISSIVEMAP' : '', parameters.bumpMap ? '#define USE_BUMPMAP' : '', parameters.normalMap ? '#define USE_NORMALMAP' : '', parameters.normalMap && parameters.objectSpaceNormalMap ? '#define OBJECTSPACE_NORMALMAP' : '', parameters.normalMap && parameters.tangentSpaceNormalMap ? '#define TANGENTSPACE_NORMALMAP' : '', parameters.clearcoat ? '#define USE_CLEARCOAT' : '', parameters.clearcoatMap ? '#define USE_CLEARCOATMAP' : '', parameters.clearcoatRoughnessMap ? '#define USE_CLEARCOAT_ROUGHNESSMAP' : '', parameters.clearcoatNormalMap ? '#define USE_CLEARCOAT_NORMALMAP' : '', parameters.specularMap ? '#define USE_SPECULARMAP' : '', parameters.specularIntensityMap ? '#define USE_SPECULARINTENSITYMAP' : '', parameters.specularTintMap ? '#define USE_SPECULARTINTMAP' : '', parameters.roughnessMap ? '#define USE_ROUGHNESSMAP' : '', parameters.metalnessMap ? '#define USE_METALNESSMAP' : '', parameters.alphaMap ? '#define USE_ALPHAMAP' : '', parameters.alphaTest ? '#define USE_ALPHATEST' : '', parameters.sheenTint ? '#define USE_SHEEN' : '', parameters.transmission ? '#define USE_TRANSMISSION' : '', parameters.transmissionMap ? '#define USE_TRANSMISSIONMAP' : '', parameters.thicknessMap ? '#define USE_THICKNESSMAP' : '', parameters.vertexTangents ? '#define USE_TANGENT' : '', parameters.vertexColors || parameters.instancingColor ? '#define USE_COLOR' : '', parameters.vertexAlphas ? '#define USE_COLOR_ALPHA' : '', parameters.vertexUvs ? '#define USE_UV' : '', parameters.uvsVertexOnly ? '#define UVS_VERTEX_ONLY' : '', parameters.gradientMap ? '#define USE_GRADIENTMAP' : '', parameters.flatShading ? '#define FLAT_SHADED' : '', parameters.doubleSided ? '#define DOUBLE_SIDED' : '', parameters.flipSided ? '#define FLIP_SIDED' : '', parameters.shadowMapEnabled ? '#define USE_SHADOWMAP' : '', parameters.shadowMapEnabled ? '#define ' + shadowMapTypeDefine : '', parameters.premultipliedAlpha ? '#define PREMULTIPLIED_ALPHA' : '', parameters.physicallyCorrectLights ? '#define PHYSICALLY_CORRECT_LIGHTS' : '', parameters.logarithmicDepthBuffer ? '#define USE_LOGDEPTHBUF' : '', parameters.logarithmicDepthBuffer && parameters.rendererExtensionFragDepth ? '#define USE_LOGDEPTHBUF_EXT' : '', (parameters.extensionShaderTextureLOD || parameters.envMap) && parameters.rendererExtensionShaderTextureLod ? '#define TEXTURE_LOD_EXT' : '', 'uniform mat4 viewMatrix;', 'uniform vec3 cameraPosition;', 'uniform bool isOrthographic;', parameters.toneMapping !== NoToneMapping ? '#define TONE_MAPPING' : '', parameters.toneMapping !== NoToneMapping ? ShaderChunk['tonemapping_pars_fragment'] : '', // this code is required here because it is used by the toneMapping() function defined below
-                       parameters.toneMapping !== NoToneMapping ? getToneMappingFunction('toneMapping', parameters.toneMapping) : '', parameters.dithering ? '#define DITHERING' : '', parameters.format === RGBFormat ? '#define OPAQUE' : '', ShaderChunk['encodings_pars_fragment'], // this code is required here because it is used by the various encoding/decoding function defined below
-                       parameters.map ? getTexelDecodingFunction('mapTexelToLinear', parameters.mapEncoding) : '', parameters.matcap ? getTexelDecodingFunction('matcapTexelToLinear', parameters.matcapEncoding) : '', parameters.envMap ? getTexelDecodingFunction('envMapTexelToLinear', parameters.envMapEncoding) : '', parameters.emissiveMap ? getTexelDecodingFunction('emissiveMapTexelToLinear', parameters.emissiveMapEncoding) : '', parameters.specularTintMap ? getTexelDecodingFunction('specularTintMapTexelToLinear', parameters.specularTintMapEncoding) : '', parameters.lightMap ? getTexelDecodingFunction('lightMapTexelToLinear', parameters.lightMapEncoding) : '', getTexelEncodingFunction('linearToOutputTexel', parameters.outputEncoding), parameters.depthPacking ? '#define DEPTH_PACKING ' + parameters.depthPacking : '', '\n'].filter(filterEmptyLine).join('\n');
-               }
-
-               vertexShader = resolveIncludes(vertexShader);
-               vertexShader = replaceLightNums(vertexShader, parameters);
-               vertexShader = replaceClippingPlaneNums(vertexShader, parameters);
-               fragmentShader = resolveIncludes(fragmentShader);
-               fragmentShader = replaceLightNums(fragmentShader, parameters);
-               fragmentShader = replaceClippingPlaneNums(fragmentShader, parameters);
-               vertexShader = unrollLoops(vertexShader);
-               fragmentShader = unrollLoops(fragmentShader);
-
-               if (parameters.isWebGL2 && parameters.isRawShaderMaterial !== true) {
-                       // GLSL 3.0 conversion for built-in materials and ShaderMaterial
-                       versionString = '#version 300 es\n';
-                       prefixVertex = ['#define attribute in', '#define varying out', '#define texture2D texture'].join('\n') + '\n' + prefixVertex;
-                       prefixFragment = ['#define varying in', parameters.glslVersion === GLSL3 ? '' : 'out highp vec4 pc_fragColor;', parameters.glslVersion === GLSL3 ? '' : '#define gl_FragColor pc_fragColor', '#define gl_FragDepthEXT gl_FragDepth', '#define texture2D texture', '#define textureCube texture', '#define texture2DProj textureProj', '#define texture2DLodEXT textureLod', '#define texture2DProjLodEXT textureProjLod', '#define textureCubeLodEXT textureLod', '#define texture2DGradEXT textureGrad', '#define texture2DProjGradEXT textureProjGrad', '#define textureCubeGradEXT textureGrad'].join('\n') + '\n' + prefixFragment;
-               }
-
-               const vertexGlsl = versionString + prefixVertex + vertexShader;
-               const fragmentGlsl = versionString + prefixFragment + fragmentShader; // console.log( '*VERTEX*', vertexGlsl );
-               // console.log( '*FRAGMENT*', fragmentGlsl );
-
-               const glVertexShader = WebGLShader(gl, gl.VERTEX_SHADER, vertexGlsl);
-               const glFragmentShader = WebGLShader(gl, gl.FRAGMENT_SHADER, fragmentGlsl);
-               gl.attachShader(program, glVertexShader);
-               gl.attachShader(program, glFragmentShader); // Force a particular attribute to index 0.
-
-               if (parameters.index0AttributeName !== undefined) {
-                       gl.bindAttribLocation(program, 0, parameters.index0AttributeName);
-               } else if (parameters.morphTargets === true) {
-                       // programs with morphTargets displace position out of attribute 0
-                       gl.bindAttribLocation(program, 0, 'position');
-               }
-
-               gl.linkProgram(program); // check for link errors
-
-               if (renderer.debug.checkShaderErrors) {
-                       const programLog = gl.getProgramInfoLog(program).trim();
-                       const vertexLog = gl.getShaderInfoLog(glVertexShader).trim();
-                       const fragmentLog = gl.getShaderInfoLog(glFragmentShader).trim();
-                       let runnable = true;
-                       let haveDiagnostics = true;
-
-                       if (gl.getProgramParameter(program, gl.LINK_STATUS) === false) {
-                               runnable = false;
-                               const vertexErrors = getShaderErrors(gl, glVertexShader, 'vertex');
-                               const fragmentErrors = getShaderErrors(gl, glFragmentShader, 'fragment');
-                               console.error('THREE.WebGLProgram: Shader Error ' + gl.getError() + ' - ' + 'VALIDATE_STATUS ' + gl.getProgramParameter(program, gl.VALIDATE_STATUS) + '\n\n' + 'Program Info Log: ' + programLog + '\n' + vertexErrors + '\n' + fragmentErrors);
-                       } else if (programLog !== '') {
-                               console.warn('THREE.WebGLProgram: Program Info Log:', programLog);
-                       } else if (vertexLog === '' || fragmentLog === '') {
-                               haveDiagnostics = false;
-                       }
-
-                       if (haveDiagnostics) {
-                               this.diagnostics = {
-                                       runnable: runnable,
-                                       programLog: programLog,
-                                       vertexShader: {
-                                               log: vertexLog,
-                                               prefix: prefixVertex
-                                       },
-                                       fragmentShader: {
-                                               log: fragmentLog,
-                                               prefix: prefixFragment
-                                       }
-                               };
-                       }
-               } // Clean up
-               // Crashes in iOS9 and iOS10. #18402
-               // gl.detachShader( program, glVertexShader );
-               // gl.detachShader( program, glFragmentShader );
-
-
-               gl.deleteShader(glVertexShader);
-               gl.deleteShader(glFragmentShader); // set up caching for uniform locations
-
-               let cachedUniforms;
-
-               this.getUniforms = function () {
-                       if (cachedUniforms === undefined) {
-                               cachedUniforms = new WebGLUniforms(gl, program);
-                       }
-
-                       return cachedUniforms;
-               }; // set up caching for attribute locations
-
-
-               let cachedAttributes;
-
-               this.getAttributes = function () {
-                       if (cachedAttributes === undefined) {
-                               cachedAttributes = fetchAttributeLocations(gl, program);
-                       }
-
-                       return cachedAttributes;
-               }; // free resource
-
-
-               this.destroy = function () {
-                       bindingStates.releaseStatesOfProgram(this);
-                       gl.deleteProgram(program);
-                       this.program = undefined;
-               }; //
-
-
-               this.name = parameters.shaderName;
-               this.id = programIdCount++;
-               this.cacheKey = cacheKey;
-               this.usedTimes = 1;
-               this.program = program;
-               this.vertexShader = glVertexShader;
-               this.fragmentShader = glFragmentShader;
-               return this;
-       }
-
-       function WebGLPrograms(renderer, cubemaps, cubeuvmaps, extensions, capabilities, bindingStates, clipping) {
-               const programs = [];
-               const isWebGL2 = capabilities.isWebGL2;
-               const logarithmicDepthBuffer = capabilities.logarithmicDepthBuffer;
-               const floatVertexTextures = capabilities.floatVertexTextures;
-               const maxVertexUniforms = capabilities.maxVertexUniforms;
-               const vertexTextures = capabilities.vertexTextures;
-               let precision = capabilities.precision;
-               const shaderIDs = {
-                       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'
-               };
-               const parameterNames = ['precision', 'isWebGL2', 'supportsVertexTextures', 'outputEncoding', 'instancing', 'instancingColor', 'map', 'mapEncoding', 'matcap', 'matcapEncoding', 'envMap', 'envMapMode', 'envMapEncoding', 'envMapCubeUV', 'lightMap', 'lightMapEncoding', 'aoMap', 'emissiveMap', 'emissiveMapEncoding', 'bumpMap', 'normalMap', 'objectSpaceNormalMap', 'tangentSpaceNormalMap', 'clearcoat', 'clearcoatMap', 'clearcoatRoughnessMap', 'clearcoatNormalMap', 'displacementMap', 'specularMap', 'specularIntensityMap', 'specularTintMap', 'specularTintMapEncoding', 'roughnessMap', 'metalnessMap', 'gradientMap', 'alphaMap', 'alphaTest', 'combine', 'vertexColors', 'vertexAlphas', 'vertexTangents', 'vertexUvs', 'uvsVertexOnly', 'fog', 'useFog', 'fogExp2', 'flatShading', 'sizeAttenuation', 'logarithmicDepthBuffer', 'skinning', 'maxBones', 'useVertexTexture', 'morphTargets', 'morphNormals', 'premultipliedAlpha', 'numDirLights', 'numPointLights', 'numSpotLights', 'numHemiLights', 'numRectAreaLights', 'numDirLightShadows', 'numPointLightShadows', 'numSpotLightShadows', 'shadowMapEnabled', 'shadowMapType', 'toneMapping', 'physicallyCorrectLights', 'doubleSided', 'flipSided', 'numClippingPlanes', 'numClipIntersection', 'depthPacking', 'dithering', 'format', 'sheenTint', 'transmission', 'transmissionMap', 'thicknessMap'];
-
-               function getMaxBones(object) {
-                       const skeleton = object.skeleton;
-                       const bones = skeleton.bones;
-
-                       if (floatVertexTextures) {
-                               return 1024;
-                       } else {
-                               // default for when object is not specified
-                               // ( for example when prebuilding shader to be used with multiple objects )
-                               //
-                               //      - leave some extra space for other uniforms
-                               //      - limit here is ANGLE's 254 max uniform vectors
-                               //              (up to 54 should be safe)
-                               const nVertexUniforms = maxVertexUniforms;
-                               const nVertexMatrices = Math.floor((nVertexUniforms - 20) / 4);
-                               const maxBones = Math.min(nVertexMatrices, bones.length);
-
-                               if (maxBones < bones.length) {
-                                       console.warn('THREE.WebGLRenderer: Skeleton has ' + bones.length + ' bones. This GPU supports ' + maxBones + '.');
-                                       return 0;
-                               }
-
-                               return maxBones;
-                       }
-               }
-
-               function getTextureEncodingFromMap(map) {
-                       let encoding;
-
-                       if (map && map.isTexture) {
-                               encoding = map.encoding;
-                       } else if (map && map.isWebGLRenderTarget) {
-                               console.warn('THREE.WebGLPrograms.getTextureEncodingFromMap: don\'t use render targets as textures. Use their .texture property instead.');
-                               encoding = map.texture.encoding;
-                       } else {
-                               encoding = LinearEncoding;
-                       }
-
-                       return encoding;
-               }
-
-               function getParameters(material, lights, shadows, scene, object) {
-                       const fog = scene.fog;
-                       const environment = material.isMeshStandardMaterial ? scene.environment : null;
-                       const envMap = (material.isMeshStandardMaterial ? cubeuvmaps : cubemaps).get(material.envMap || environment);
-                       const shaderID = shaderIDs[material.type]; // heuristics to create shader parameters according to lights in the scene
-                       // (not to blow over maxLights budget)
-
-                       const maxBones = object.isSkinnedMesh ? getMaxBones(object) : 0;
-
-                       if (material.precision !== null) {
-                               precision = capabilities.getMaxPrecision(material.precision);
-
-                               if (precision !== material.precision) {
-                                       console.warn('THREE.WebGLProgram.getParameters:', material.precision, 'not supported, using', precision, 'instead.');
-                               }
-                       }
-
-                       let vertexShader, fragmentShader;
-
-                       if (shaderID) {
-                               const shader = ShaderLib[shaderID];
-                               vertexShader = shader.vertexShader;
-                               fragmentShader = shader.fragmentShader;
-                       } else {
-                               vertexShader = material.vertexShader;
-                               fragmentShader = material.fragmentShader;
-                       }
-
-                       const currentRenderTarget = renderer.getRenderTarget();
-                       const useAlphaTest = material.alphaTest > 0;
-                       const useClearcoat = material.clearcoat > 0;
-                       const parameters = {
-                               isWebGL2: isWebGL2,
-                               shaderID: shaderID,
-                               shaderName: material.type,
-                               vertexShader: vertexShader,
-                               fragmentShader: fragmentShader,
-                               defines: material.defines,
-                               isRawShaderMaterial: material.isRawShaderMaterial === true,
-                               glslVersion: material.glslVersion,
-                               precision: precision,
-                               instancing: object.isInstancedMesh === true,
-                               instancingColor: object.isInstancedMesh === true && object.instanceColor !== null,
-                               supportsVertexTextures: vertexTextures,
-                               outputEncoding: currentRenderTarget !== null ? getTextureEncodingFromMap(currentRenderTarget.texture) : renderer.outputEncoding,
-                               map: !!material.map,
-                               mapEncoding: getTextureEncodingFromMap(material.map),
-                               matcap: !!material.matcap,
-                               matcapEncoding: getTextureEncodingFromMap(material.matcap),
-                               envMap: !!envMap,
-                               envMapMode: envMap && envMap.mapping,
-                               envMapEncoding: getTextureEncodingFromMap(envMap),
-                               envMapCubeUV: !!envMap && (envMap.mapping === CubeUVReflectionMapping || envMap.mapping === CubeUVRefractionMapping),
-                               lightMap: !!material.lightMap,
-                               lightMapEncoding: getTextureEncodingFromMap(material.lightMap),
-                               aoMap: !!material.aoMap,
-                               emissiveMap: !!material.emissiveMap,
-                               emissiveMapEncoding: getTextureEncodingFromMap(material.emissiveMap),
-                               bumpMap: !!material.bumpMap,
-                               normalMap: !!material.normalMap,
-                               objectSpaceNormalMap: material.normalMapType === ObjectSpaceNormalMap,
-                               tangentSpaceNormalMap: material.normalMapType === TangentSpaceNormalMap,
-                               clearcoat: useClearcoat,
-                               clearcoatMap: useClearcoat && !!material.clearcoatMap,
-                               clearcoatRoughnessMap: useClearcoat && !!material.clearcoatRoughnessMap,
-                               clearcoatNormalMap: useClearcoat && !!material.clearcoatNormalMap,
-                               displacementMap: !!material.displacementMap,
-                               roughnessMap: !!material.roughnessMap,
-                               metalnessMap: !!material.metalnessMap,
-                               specularMap: !!material.specularMap,
-                               specularIntensityMap: !!material.specularIntensityMap,
-                               specularTintMap: !!material.specularTintMap,
-                               specularTintMapEncoding: getTextureEncodingFromMap(material.specularTintMap),
-                               alphaMap: !!material.alphaMap,
-                               alphaTest: useAlphaTest,
-                               gradientMap: !!material.gradientMap,
-                               sheenTint: !!material.sheenTint && (material.sheenTint.r > 0 || material.sheenTint.g > 0 || material.sheenTint.b > 0),
-                               transmission: material.transmission > 0,
-                               transmissionMap: !!material.transmissionMap,
-                               thicknessMap: !!material.thicknessMap,
-                               combine: material.combine,
-                               vertexTangents: !!material.normalMap && !!object.geometry && !!object.geometry.attributes.tangent,
-                               vertexColors: material.vertexColors,
-                               vertexAlphas: material.vertexColors === true && !!object.geometry && !!object.geometry.attributes.color && object.geometry.attributes.color.itemSize === 4,
-                               vertexUvs: !!material.map || !!material.bumpMap || !!material.normalMap || !!material.specularMap || !!material.alphaMap || !!material.emissiveMap || !!material.roughnessMap || !!material.metalnessMap || !!material.clearcoatMap || !!material.clearcoatRoughnessMap || !!material.clearcoatNormalMap || !!material.displacementMap || !!material.transmissionMap || !!material.thicknessMap || !!material.specularIntensityMap || !!material.specularTintMap,
-                               uvsVertexOnly: !(!!material.map || !!material.bumpMap || !!material.normalMap || !!material.specularMap || !!material.alphaMap || !!material.emissiveMap || !!material.roughnessMap || !!material.metalnessMap || !!material.clearcoatNormalMap || material.transmission > 0 || !!material.transmissionMap || !!material.thicknessMap || !!material.specularIntensityMap || !!material.specularTintMap) && !!material.displacementMap,
-                               fog: !!fog,
-                               useFog: material.fog,
-                               fogExp2: fog && fog.isFogExp2,
-                               flatShading: !!material.flatShading,
-                               sizeAttenuation: material.sizeAttenuation,
-                               logarithmicDepthBuffer: logarithmicDepthBuffer,
-                               skinning: object.isSkinnedMesh === true && maxBones > 0,
-                               maxBones: maxBones,
-                               useVertexTexture: floatVertexTextures,
-                               morphTargets: !!object.geometry && !!object.geometry.morphAttributes.position,
-                               morphNormals: !!object.geometry && !!object.geometry.morphAttributes.normal,
-                               numDirLights: lights.directional.length,
-                               numPointLights: lights.point.length,
-                               numSpotLights: lights.spot.length,
-                               numRectAreaLights: lights.rectArea.length,
-                               numHemiLights: lights.hemi.length,
-                               numDirLightShadows: lights.directionalShadowMap.length,
-                               numPointLightShadows: lights.pointShadowMap.length,
-                               numSpotLightShadows: lights.spotShadowMap.length,
-                               numClippingPlanes: clipping.numPlanes,
-                               numClipIntersection: clipping.numIntersection,
-                               format: material.format,
-                               dithering: material.dithering,
-                               shadowMapEnabled: renderer.shadowMap.enabled && shadows.length > 0,
-                               shadowMapType: renderer.shadowMap.type,
-                               toneMapping: material.toneMapped ? renderer.toneMapping : NoToneMapping,
-                               physicallyCorrectLights: renderer.physicallyCorrectLights,
-                               premultipliedAlpha: material.premultipliedAlpha,
-                               doubleSided: material.side === DoubleSide,
-                               flipSided: material.side === BackSide,
-                               depthPacking: material.depthPacking !== undefined ? material.depthPacking : false,
-                               index0AttributeName: material.index0AttributeName,
-                               extensionDerivatives: material.extensions && material.extensions.derivatives,
-                               extensionFragDepth: material.extensions && material.extensions.fragDepth,
-                               extensionDrawBuffers: material.extensions && material.extensions.drawBuffers,
-                               extensionShaderTextureLOD: material.extensions && material.extensions.shaderTextureLOD,
-                               rendererExtensionFragDepth: isWebGL2 || extensions.has('EXT_frag_depth'),
-                               rendererExtensionDrawBuffers: isWebGL2 || extensions.has('WEBGL_draw_buffers'),
-                               rendererExtensionShaderTextureLod: isWebGL2 || extensions.has('EXT_shader_texture_lod'),
-                               customProgramCacheKey: material.customProgramCacheKey()
-                       };
-                       return parameters;
-               }
-
-               function getProgramCacheKey(parameters) {
-                       const array = [];
-
-                       if (parameters.shaderID) {
-                               array.push(parameters.shaderID);
-                       } else {
-                               array.push(parameters.fragmentShader);
-                               array.push(parameters.vertexShader);
-                       }
-
-                       if (parameters.defines !== undefined) {
-                               for (const name in parameters.defines) {
-                                       array.push(name);
-                                       array.push(parameters.defines[name]);
-                               }
-                       }
-
-                       if (parameters.isRawShaderMaterial === false) {
-                               for (let i = 0; i < parameterNames.length; i++) {
-                                       array.push(parameters[parameterNames[i]]);
-                               }
-
-                               array.push(renderer.outputEncoding);
-                               array.push(renderer.gammaFactor);
-                       }
-
-                       array.push(parameters.customProgramCacheKey);
-                       return array.join();
-               }
-
-               function getUniforms(material) {
-                       const shaderID = shaderIDs[material.type];
-                       let uniforms;
-
-                       if (shaderID) {
-                               const shader = ShaderLib[shaderID];
-                               uniforms = UniformsUtils.clone(shader.uniforms);
-                       } else {
-                               uniforms = material.uniforms;
-                       }
-
-                       return uniforms;
-               }
-
-               function acquireProgram(parameters, cacheKey) {
-                       let program; // Check if code has been already compiled
-
-                       for (let p = 0, pl = programs.length; p < pl; p++) {
-                               const preexistingProgram = programs[p];
-
-                               if (preexistingProgram.cacheKey === cacheKey) {
-                                       program = preexistingProgram;
-                                       ++program.usedTimes;
-                                       break;
-                               }
-                       }
-
-                       if (program === undefined) {
-                               program = new WebGLProgram(renderer, cacheKey, parameters, bindingStates);
-                               programs.push(program);
-                       }
-
-                       return program;
-               }
-
-               function releaseProgram(program) {
-                       if (--program.usedTimes === 0) {
-                               // Remove from unordered set
-                               const i = programs.indexOf(program);
-                               programs[i] = programs[programs.length - 1];
-                               programs.pop(); // Free WebGL resources
-
-                               program.destroy();
-                       }
-               }
-
-               return {
-                       getParameters: getParameters,
-                       getProgramCacheKey: getProgramCacheKey,
-                       getUniforms: getUniforms,
-                       acquireProgram: acquireProgram,
-                       releaseProgram: releaseProgram,
-                       // Exposed for resource monitoring & error feedback via renderer.info:
-                       programs: programs
-               };
-       }
-
-       function WebGLProperties() {
-               let properties = new WeakMap();
-
-               function get(object) {
-                       let map = properties.get(object);
-
-                       if (map === undefined) {
-                               map = {};
-                               properties.set(object, map);
-                       }
-
-                       return map;
-               }
-
-               function remove(object) {
-                       properties.delete(object);
-               }
-
-               function update(object, key, value) {
-                       properties.get(object)[key] = value;
-               }
-
-               function dispose() {
-                       properties = new WeakMap();
-               }
-
-               return {
-                       get: get,
-                       remove: remove,
-                       update: update,
-                       dispose: dispose
-               };
-       }
-
-       function painterSortStable(a, b) {
-               if (a.groupOrder !== b.groupOrder) {
-                       return a.groupOrder - b.groupOrder;
-               } else if (a.renderOrder !== b.renderOrder) {
-                       return a.renderOrder - b.renderOrder;
-               } else if (a.program !== b.program) {
-                       return a.program.id - b.program.id;
-               } else if (a.material.id !== b.material.id) {
-                       return a.material.id - b.material.id;
-               } else if (a.z !== b.z) {
-                       return a.z - b.z;
-               } else {
-                       return a.id - b.id;
-               }
-       }
-
-       function reversePainterSortStable(a, b) {
-               if (a.groupOrder !== b.groupOrder) {
-                       return a.groupOrder - b.groupOrder;
-               } else if (a.renderOrder !== b.renderOrder) {
-                       return a.renderOrder - b.renderOrder;
-               } else if (a.z !== b.z) {
-                       return b.z - a.z;
-               } else {
-                       return a.id - b.id;
-               }
-       }
-
-       function WebGLRenderList(properties) {
-               const renderItems = [];
-               let renderItemsIndex = 0;
-               const opaque = [];
-               const transmissive = [];
-               const transparent = [];
-               const defaultProgram = {
-                       id: -1
-               };
-
-               function init() {
-                       renderItemsIndex = 0;
-                       opaque.length = 0;
-                       transmissive.length = 0;
-                       transparent.length = 0;
-               }
-
-               function getNextRenderItem(object, geometry, material, groupOrder, z, group) {
-                       let renderItem = renderItems[renderItemsIndex];
-                       const materialProperties = properties.get(material);
-
-                       if (renderItem === undefined) {
-                               renderItem = {
-                                       id: object.id,
-                                       object: object,
-                                       geometry: geometry,
-                                       material: material,
-                                       program: materialProperties.program || defaultProgram,
-                                       groupOrder: groupOrder,
-                                       renderOrder: object.renderOrder,
-                                       z: z,
-                                       group: group
-                               };
-                               renderItems[renderItemsIndex] = renderItem;
-                       } else {
-                               renderItem.id = object.id;
-                               renderItem.object = object;
-                               renderItem.geometry = geometry;
-                               renderItem.material = material;
-                               renderItem.program = materialProperties.program || defaultProgram;
-                               renderItem.groupOrder = groupOrder;
-                               renderItem.renderOrder = object.renderOrder;
-                               renderItem.z = z;
-                               renderItem.group = group;
-                       }
-
-                       renderItemsIndex++;
-                       return renderItem;
-               }
-
-               function push(object, geometry, material, groupOrder, z, group) {
-                       const renderItem = getNextRenderItem(object, geometry, material, groupOrder, z, group);
-
-                       if (material.transmission > 0.0) {
-                               transmissive.push(renderItem);
-                       } else if (material.transparent === true) {
-                               transparent.push(renderItem);
-                       } else {
-                               opaque.push(renderItem);
-                       }
-               }
-
-               function unshift(object, geometry, material, groupOrder, z, group) {
-                       const renderItem = getNextRenderItem(object, geometry, material, groupOrder, z, group);
-
-                       if (material.transmission > 0.0) {
-                               transmissive.unshift(renderItem);
-                       } else if (material.transparent === true) {
-                               transparent.unshift(renderItem);
-                       } else {
-                               opaque.unshift(renderItem);
-                       }
-               }
-
-               function sort(customOpaqueSort, customTransparentSort) {
-                       if (opaque.length > 1) opaque.sort(customOpaqueSort || painterSortStable);
-                       if (transmissive.length > 1) transmissive.sort(customTransparentSort || reversePainterSortStable);
-                       if (transparent.length > 1) transparent.sort(customTransparentSort || reversePainterSortStable);
-               }
-
-               function finish() {
-                       // Clear references from inactive renderItems in the list
-                       for (let i = renderItemsIndex, il = renderItems.length; i < il; i++) {
-                               const renderItem = renderItems[i];
-                               if (renderItem.id === null) break;
-                               renderItem.id = null;
-                               renderItem.object = null;
-                               renderItem.geometry = null;
-                               renderItem.material = null;
-                               renderItem.program = null;
-                               renderItem.group = null;
-                       }
-               }
-
-               return {
-                       opaque: opaque,
-                       transmissive: transmissive,
-                       transparent: transparent,
-                       init: init,
-                       push: push,
-                       unshift: unshift,
-                       finish: finish,
-                       sort: sort
-               };
-       }
-
-       function WebGLRenderLists(properties) {
-               let lists = new WeakMap();
-
-               function get(scene, renderCallDepth) {
-                       let list;
-
-                       if (lists.has(scene) === false) {
-                               list = new WebGLRenderList(properties);
-                               lists.set(scene, [list]);
-                       } else {
-                               if (renderCallDepth >= lists.get(scene).length) {
-                                       list = new WebGLRenderList(properties);
-                                       lists.get(scene).push(list);
-                               } else {
-                                       list = lists.get(scene)[renderCallDepth];
-                               }
-                       }
-
-                       return list;
-               }
-
-               function dispose() {
-                       lists = new WeakMap();
-               }
-
-               return {
-                       get: get,
-                       dispose: dispose
-               };
-       }
-
-       function UniformsCache() {
-               const lights = {};
-               return {
-                       get: function (light) {
-                               if (lights[light.id] !== undefined) {
-                                       return lights[light.id];
-                               }
-
-                               let uniforms;
-
-                               switch (light.type) {
-                                       case 'DirectionalLight':
-                                               uniforms = {
-                                                       direction: new Vector3(),
-                                                       color: new Color()
-                                               };
-                                               break;
-
-                                       case 'SpotLight':
-                                               uniforms = {
-                                                       position: new Vector3(),
-                                                       direction: new Vector3(),
-                                                       color: new Color(),
-                                                       distance: 0,
-                                                       coneCos: 0,
-                                                       penumbraCos: 0,
-                                                       decay: 0
-                                               };
-                                               break;
-
-                                       case 'PointLight':
-                                               uniforms = {
-                                                       position: new Vector3(),
-                                                       color: new Color(),
-                                                       distance: 0,
-                                                       decay: 0
-                                               };
-                                               break;
-
-                                       case 'HemisphereLight':
-                                               uniforms = {
-                                                       direction: new Vector3(),
-                                                       skyColor: new Color(),
-                                                       groundColor: new Color()
-                                               };
-                                               break;
-
-                                       case 'RectAreaLight':
-                                               uniforms = {
-                                                       color: new Color(),
-                                                       position: new Vector3(),
-                                                       halfWidth: new Vector3(),
-                                                       halfHeight: new Vector3()
-                                               };
-                                               break;
-                               }
-
-                               lights[light.id] = uniforms;
-                               return uniforms;
-                       }
-               };
-       }
-
-       function ShadowUniformsCache() {
-               const lights = {};
-               return {
-                       get: function (light) {
-                               if (lights[light.id] !== undefined) {
-                                       return lights[light.id];
-                               }
-
-                               let uniforms;
-
-                               switch (light.type) {
-                                       case 'DirectionalLight':
-                                               uniforms = {
-                                                       shadowBias: 0,
-                                                       shadowNormalBias: 0,
-                                                       shadowRadius: 1,
-                                                       shadowMapSize: new Vector2()
-                                               };
-                                               break;
-
-                                       case 'SpotLight':
-                                               uniforms = {
-                                                       shadowBias: 0,
-                                                       shadowNormalBias: 0,
-                                                       shadowRadius: 1,
-                                                       shadowMapSize: new Vector2()
-                                               };
-                                               break;
-
-                                       case 'PointLight':
-                                               uniforms = {
-                                                       shadowBias: 0,
-                                                       shadowNormalBias: 0,
-                                                       shadowRadius: 1,
-                                                       shadowMapSize: new Vector2(),
-                                                       shadowCameraNear: 1,
-                                                       shadowCameraFar: 1000
-                                               };
-                                               break;
-                                       // TODO (abelnation): set RectAreaLight shadow uniforms
-                               }
-
-                               lights[light.id] = uniforms;
-                               return uniforms;
-                       }
-               };
-       }
-
-       let nextVersion = 0;
-
-       function shadowCastingLightsFirst(lightA, lightB) {
-               return (lightB.castShadow ? 1 : 0) - (lightA.castShadow ? 1 : 0);
-       }
-
-       function WebGLLights(extensions, capabilities) {
-               const cache = new UniformsCache();
-               const shadowCache = ShadowUniformsCache();
-               const state = {
-                       version: 0,
-                       hash: {
-                               directionalLength: -1,
-                               pointLength: -1,
-                               spotLength: -1,
-                               rectAreaLength: -1,
-                               hemiLength: -1,
-                               numDirectionalShadows: -1,
-                               numPointShadows: -1,
-                               numSpotShadows: -1
-                       },
-                       ambient: [0, 0, 0],
-                       probe: [],
-                       directional: [],
-                       directionalShadow: [],
-                       directionalShadowMap: [],
-                       directionalShadowMatrix: [],
-                       spot: [],
-                       spotShadow: [],
-                       spotShadowMap: [],
-                       spotShadowMatrix: [],
-                       rectArea: [],
-                       rectAreaLTC1: null,
-                       rectAreaLTC2: null,
-                       point: [],
-                       pointShadow: [],
-                       pointShadowMap: [],
-                       pointShadowMatrix: [],
-                       hemi: []
-               };
-
-               for (let i = 0; i < 9; i++) state.probe.push(new Vector3());
-
-               const vector3 = new Vector3();
-               const matrix4 = new Matrix4();
-               const matrix42 = new Matrix4();
-
-               function setup(lights, physicallyCorrectLights) {
-                       let r = 0,
-                                       g = 0,
-                                       b = 0;
-
-                       for (let i = 0; i < 9; i++) state.probe[i].set(0, 0, 0);
-
-                       let directionalLength = 0;
-                       let pointLength = 0;
-                       let spotLength = 0;
-                       let rectAreaLength = 0;
-                       let hemiLength = 0;
-                       let numDirectionalShadows = 0;
-                       let numPointShadows = 0;
-                       let numSpotShadows = 0;
-                       lights.sort(shadowCastingLightsFirst); // artist-friendly light intensity scaling factor
-
-                       const scaleFactor = physicallyCorrectLights !== true ? Math.PI : 1;
-
-                       for (let i = 0, l = lights.length; i < l; i++) {
-                               const light = lights[i];
-                               const color = light.color;
-                               const intensity = light.intensity;
-                               const distance = light.distance;
-                               const shadowMap = light.shadow && light.shadow.map ? light.shadow.map.texture : null;
-
-                               if (light.isAmbientLight) {
-                                       r += color.r * intensity * scaleFactor;
-                                       g += color.g * intensity * scaleFactor;
-                                       b += color.b * intensity * scaleFactor;
-                               } else if (light.isLightProbe) {
-                                       for (let j = 0; j < 9; j++) {
-                                               state.probe[j].addScaledVector(light.sh.coefficients[j], intensity);
-                                       }
-                               } else if (light.isDirectionalLight) {
-                                       const uniforms = cache.get(light);
-                                       uniforms.color.copy(light.color).multiplyScalar(light.intensity * scaleFactor);
-
-                                       if (light.castShadow) {
-                                               const shadow = light.shadow;
-                                               const shadowUniforms = shadowCache.get(light);
-                                               shadowUniforms.shadowBias = shadow.bias;
-                                               shadowUniforms.shadowNormalBias = shadow.normalBias;
-                                               shadowUniforms.shadowRadius = shadow.radius;
-                                               shadowUniforms.shadowMapSize = shadow.mapSize;
-                                               state.directionalShadow[directionalLength] = shadowUniforms;
-                                               state.directionalShadowMap[directionalLength] = shadowMap;
-                                               state.directionalShadowMatrix[directionalLength] = light.shadow.matrix;
-                                               numDirectionalShadows++;
-                                       }
-
-                                       state.directional[directionalLength] = uniforms;
-                                       directionalLength++;
-                               } else if (light.isSpotLight) {
-                                       const uniforms = cache.get(light);
-                                       uniforms.position.setFromMatrixPosition(light.matrixWorld);
-                                       uniforms.color.copy(color).multiplyScalar(intensity * scaleFactor);
-                                       uniforms.distance = distance;
-                                       uniforms.coneCos = Math.cos(light.angle);
-                                       uniforms.penumbraCos = Math.cos(light.angle * (1 - light.penumbra));
-                                       uniforms.decay = light.decay;
-
-                                       if (light.castShadow) {
-                                               const shadow = light.shadow;
-                                               const shadowUniforms = shadowCache.get(light);
-                                               shadowUniforms.shadowBias = shadow.bias;
-                                               shadowUniforms.shadowNormalBias = shadow.normalBias;
-                                               shadowUniforms.shadowRadius = shadow.radius;
-                                               shadowUniforms.shadowMapSize = shadow.mapSize;
-                                               state.spotShadow[spotLength] = shadowUniforms;
-                                               state.spotShadowMap[spotLength] = shadowMap;
-                                               state.spotShadowMatrix[spotLength] = light.shadow.matrix;
-                                               numSpotShadows++;
-                                       }
-
-                                       state.spot[spotLength] = uniforms;
-                                       spotLength++;
-                               } else if (light.isRectAreaLight) {
-                                       const uniforms = cache.get(light); // (a) intensity is the total visible light emitted
-                                       //uniforms.color.copy( color ).multiplyScalar( intensity / ( light.width * light.height * Math.PI ) );
-                                       // (b) intensity is the brightness of the light
-
-                                       uniforms.color.copy(color).multiplyScalar(intensity);
-                                       uniforms.halfWidth.set(light.width * 0.5, 0.0, 0.0);
-                                       uniforms.halfHeight.set(0.0, light.height * 0.5, 0.0);
-                                       state.rectArea[rectAreaLength] = uniforms;
-                                       rectAreaLength++;
-                               } else if (light.isPointLight) {
-                                       const uniforms = cache.get(light);
-                                       uniforms.color.copy(light.color).multiplyScalar(light.intensity * scaleFactor);
-                                       uniforms.distance = light.distance;
-                                       uniforms.decay = light.decay;
-
-                                       if (light.castShadow) {
-                                               const shadow = light.shadow;
-                                               const shadowUniforms = shadowCache.get(light);
-                                               shadowUniforms.shadowBias = shadow.bias;
-                                               shadowUniforms.shadowNormalBias = shadow.normalBias;
-                                               shadowUniforms.shadowRadius = shadow.radius;
-                                               shadowUniforms.shadowMapSize = shadow.mapSize;
-                                               shadowUniforms.shadowCameraNear = shadow.camera.near;
-                                               shadowUniforms.shadowCameraFar = shadow.camera.far;
-                                               state.pointShadow[pointLength] = shadowUniforms;
-                                               state.pointShadowMap[pointLength] = shadowMap;
-                                               state.pointShadowMatrix[pointLength] = light.shadow.matrix;
-                                               numPointShadows++;
-                                       }
-
-                                       state.point[pointLength] = uniforms;
-                                       pointLength++;
-                               } else if (light.isHemisphereLight) {
-                                       const uniforms = cache.get(light);
-                                       uniforms.skyColor.copy(light.color).multiplyScalar(intensity * scaleFactor);
-                                       uniforms.groundColor.copy(light.groundColor).multiplyScalar(intensity * scaleFactor);
-                                       state.hemi[hemiLength] = uniforms;
-                                       hemiLength++;
-                               }
-                       }
-
-                       if (rectAreaLength > 0) {
-                               if (capabilities.isWebGL2) {
-                                       // WebGL 2
-                                       state.rectAreaLTC1 = UniformsLib.LTC_FLOAT_1;
-                                       state.rectAreaLTC2 = UniformsLib.LTC_FLOAT_2;
-                               } else {
-                                       // WebGL 1
-                                       if (extensions.has('OES_texture_float_linear') === true) {
-                                               state.rectAreaLTC1 = UniformsLib.LTC_FLOAT_1;
-                                               state.rectAreaLTC2 = UniformsLib.LTC_FLOAT_2;
-                                       } else if (extensions.has('OES_texture_half_float_linear') === true) {
-                                               state.rectAreaLTC1 = UniformsLib.LTC_HALF_1;
-                                               state.rectAreaLTC2 = UniformsLib.LTC_HALF_2;
-                                       } else {
-                                               console.error('THREE.WebGLRenderer: Unable to use RectAreaLight. Missing WebGL extensions.');
-                                       }
-                               }
-                       }
-
-                       state.ambient[0] = r;
-                       state.ambient[1] = g;
-                       state.ambient[2] = b;
-                       const hash = state.hash;
-
-                       if (hash.directionalLength !== directionalLength || hash.pointLength !== pointLength || hash.spotLength !== spotLength || hash.rectAreaLength !== rectAreaLength || hash.hemiLength !== hemiLength || hash.numDirectionalShadows !== numDirectionalShadows || hash.numPointShadows !== numPointShadows || hash.numSpotShadows !== numSpotShadows) {
-                               state.directional.length = directionalLength;
-                               state.spot.length = spotLength;
-                               state.rectArea.length = rectAreaLength;
-                               state.point.length = pointLength;
-                               state.hemi.length = hemiLength;
-                               state.directionalShadow.length = numDirectionalShadows;
-                               state.directionalShadowMap.length = numDirectionalShadows;
-                               state.pointShadow.length = numPointShadows;
-                               state.pointShadowMap.length = numPointShadows;
-                               state.spotShadow.length = numSpotShadows;
-                               state.spotShadowMap.length = numSpotShadows;
-                               state.directionalShadowMatrix.length = numDirectionalShadows;
-                               state.pointShadowMatrix.length = numPointShadows;
-                               state.spotShadowMatrix.length = numSpotShadows;
-                               hash.directionalLength = directionalLength;
-                               hash.pointLength = pointLength;
-                               hash.spotLength = spotLength;
-                               hash.rectAreaLength = rectAreaLength;
-                               hash.hemiLength = hemiLength;
-                               hash.numDirectionalShadows = numDirectionalShadows;
-                               hash.numPointShadows = numPointShadows;
-                               hash.numSpotShadows = numSpotShadows;
-                               state.version = nextVersion++;
-                       }
-               }
-
-               function setupView(lights, camera) {
-                       let directionalLength = 0;
-                       let pointLength = 0;
-                       let spotLength = 0;
-                       let rectAreaLength = 0;
-                       let hemiLength = 0;
-                       const viewMatrix = camera.matrixWorldInverse;
-
-                       for (let i = 0, l = lights.length; i < l; i++) {
-                               const light = lights[i];
-
-                               if (light.isDirectionalLight) {
-                                       const uniforms = state.directional[directionalLength];
-                                       uniforms.direction.setFromMatrixPosition(light.matrixWorld);
-                                       vector3.setFromMatrixPosition(light.target.matrixWorld);
-                                       uniforms.direction.sub(vector3);
-                                       uniforms.direction.transformDirection(viewMatrix);
-                                       directionalLength++;
-                               } else if (light.isSpotLight) {
-                                       const uniforms = state.spot[spotLength];
-                                       uniforms.position.setFromMatrixPosition(light.matrixWorld);
-                                       uniforms.position.applyMatrix4(viewMatrix);
-                                       uniforms.direction.setFromMatrixPosition(light.matrixWorld);
-                                       vector3.setFromMatrixPosition(light.target.matrixWorld);
-                                       uniforms.direction.sub(vector3);
-                                       uniforms.direction.transformDirection(viewMatrix);
-                                       spotLength++;
-                               } else if (light.isRectAreaLight) {
-                                       const uniforms = state.rectArea[rectAreaLength];
-                                       uniforms.position.setFromMatrixPosition(light.matrixWorld);
-                                       uniforms.position.applyMatrix4(viewMatrix); // extract local rotation of light to derive width/height half vectors
-
-                                       matrix42.identity();
-                                       matrix4.copy(light.matrixWorld);
-                                       matrix4.premultiply(viewMatrix);
-                                       matrix42.extractRotation(matrix4);
-                                       uniforms.halfWidth.set(light.width * 0.5, 0.0, 0.0);
-                                       uniforms.halfHeight.set(0.0, light.height * 0.5, 0.0);
-                                       uniforms.halfWidth.applyMatrix4(matrix42);
-                                       uniforms.halfHeight.applyMatrix4(matrix42);
-                                       rectAreaLength++;
-                               } else if (light.isPointLight) {
-                                       const uniforms = state.point[pointLength];
-                                       uniforms.position.setFromMatrixPosition(light.matrixWorld);
-                                       uniforms.position.applyMatrix4(viewMatrix);
-                                       pointLength++;
-                               } else if (light.isHemisphereLight) {
-                                       const uniforms = state.hemi[hemiLength];
-                                       uniforms.direction.setFromMatrixPosition(light.matrixWorld);
-                                       uniforms.direction.transformDirection(viewMatrix);
-                                       uniforms.direction.normalize();
-                                       hemiLength++;
-                               }
-                       }
-               }
-
-               return {
-                       setup: setup,
-                       setupView: setupView,
-                       state: state
-               };
-       }
-
-       function WebGLRenderState(extensions, capabilities) {
-               const lights = new WebGLLights(extensions, capabilities);
-               const lightsArray = [];
-               const shadowsArray = [];
-
-               function init() {
-                       lightsArray.length = 0;
-                       shadowsArray.length = 0;
-               }
-
-               function pushLight(light) {
-                       lightsArray.push(light);
-               }
-
-               function pushShadow(shadowLight) {
-                       shadowsArray.push(shadowLight);
-               }
-
-               function setupLights(physicallyCorrectLights) {
-                       lights.setup(lightsArray, physicallyCorrectLights);
-               }
-
-               function setupLightsView(camera) {
-                       lights.setupView(lightsArray, camera);
-               }
-
-               const state = {
-                       lightsArray: lightsArray,
-                       shadowsArray: shadowsArray,
-                       lights: lights
-               };
-               return {
-                       init: init,
-                       state: state,
-                       setupLights: setupLights,
-                       setupLightsView: setupLightsView,
-                       pushLight: pushLight,
-                       pushShadow: pushShadow
-               };
-       }
-
-       function WebGLRenderStates(extensions, capabilities) {
-               let renderStates = new WeakMap();
-
-               function get(scene, renderCallDepth = 0) {
-                       let renderState;
-
-                       if (renderStates.has(scene) === false) {
-                               renderState = new WebGLRenderState(extensions, capabilities);
-                               renderStates.set(scene, [renderState]);
-                       } else {
-                               if (renderCallDepth >= renderStates.get(scene).length) {
-                                       renderState = new WebGLRenderState(extensions, capabilities);
-                                       renderStates.get(scene).push(renderState);
-                               } else {
-                                       renderState = renderStates.get(scene)[renderCallDepth];
-                               }
-                       }
-
-                       return renderState;
-               }
-
-               function dispose() {
-                       renderStates = new WeakMap();
-               }
-
-               return {
-                       get: get,
-                       dispose: dispose
-               };
-       }
-
-       /**
-        * parameters = {
-        *
-        *      opacity: <float>,
-        *
-        *      map: new THREE.Texture( <Image> ),
-        *
-        *      alphaMap: new THREE.Texture( <Image> ),
-        *
-        *      displacementMap: new THREE.Texture( <Image> ),
-        *      displacementScale: <float>,
-        *      displacementBias: <float>,
-        *
-        *      wireframe: <boolean>,
-        *      wireframeLinewidth: <float>
-        * }
-        */
-
-       class MeshDepthMaterial extends Material {
-               constructor(parameters) {
-                       super();
-                       this.type = 'MeshDepthMaterial';
-                       this.depthPacking = BasicDepthPacking;
-                       this.map = null;
-                       this.alphaMap = null;
-                       this.displacementMap = null;
-                       this.displacementScale = 1;
-                       this.displacementBias = 0;
-                       this.wireframe = false;
-                       this.wireframeLinewidth = 1;
-                       this.fog = false;
-                       this.setValues(parameters);
-               }
-
-               copy(source) {
-                       super.copy(source);
-                       this.depthPacking = source.depthPacking;
-                       this.map = source.map;
-                       this.alphaMap = source.alphaMap;
-                       this.displacementMap = source.displacementMap;
-                       this.displacementScale = source.displacementScale;
-                       this.displacementBias = source.displacementBias;
-                       this.wireframe = source.wireframe;
-                       this.wireframeLinewidth = source.wireframeLinewidth;
-                       return this;
-               }
-
-       }
-
-       MeshDepthMaterial.prototype.isMeshDepthMaterial = true;
-
-       /**
-        * parameters = {
-        *
-        *      referencePosition: <float>,
-        *      nearDistance: <float>,
-        *      farDistance: <float>,
-        *
-        *      map: new THREE.Texture( <Image> ),
-        *
-        *      alphaMap: new THREE.Texture( <Image> ),
-        *
-        *      displacementMap: new THREE.Texture( <Image> ),
-        *      displacementScale: <float>,
-        *      displacementBias: <float>
-        *
-        * }
-        */
-
-       class MeshDistanceMaterial extends Material {
-               constructor(parameters) {
-                       super();
-                       this.type = 'MeshDistanceMaterial';
-                       this.referencePosition = new Vector3();
-                       this.nearDistance = 1;
-                       this.farDistance = 1000;
-                       this.map = null;
-                       this.alphaMap = null;
-                       this.displacementMap = null;
-                       this.displacementScale = 1;
-                       this.displacementBias = 0;
-                       this.fog = false;
-                       this.setValues(parameters);
-               }
-
-               copy(source) {
-                       super.copy(source);
-                       this.referencePosition.copy(source.referencePosition);
-                       this.nearDistance = source.nearDistance;
-                       this.farDistance = source.farDistance;
-                       this.map = source.map;
-                       this.alphaMap = source.alphaMap;
-                       this.displacementMap = source.displacementMap;
-                       this.displacementScale = source.displacementScale;
-                       this.displacementBias = source.displacementBias;
-                       return this;
-               }
-
-       }
-
-       MeshDistanceMaterial.prototype.isMeshDistanceMaterial = true;
-
-       var vsm_frag = "uniform sampler2D shadow_pass;\nuniform vec2 resolution;\nuniform float radius;\nuniform float samples;\n#include <packing>\nvoid main() {\n\tfloat mean = 0.0;\n\tfloat squared_mean = 0.0;\n\tfloat uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 );\n\tfloat uvStart = samples <= 1.0 ? 0.0 : - 1.0;\n\tfor ( float i = 0.0; i < samples; i ++ ) {\n\t\tfloat uvOffset = uvStart + i * uvStride;\n\t\t#ifdef HORIZONTAL_PASS\n\t\t\tvec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ) );\n\t\t\tmean += distribution.x;\n\t\t\tsquared_mean += distribution.y * distribution.y + distribution.x * distribution.x;\n\t\t#else\n\t\t\tfloat depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ) );\n\t\t\tmean += depth;\n\t\t\tsquared_mean += depth * depth;\n\t\t#endif\n\t}\n\tmean = mean / samples;\n\tsquared_mean = squared_mean / samples;\n\tfloat std_dev = sqrt( squared_mean - mean * mean );\n\tgl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );\n}";
-
-       var vsm_vert = "void main() {\n\tgl_Position = vec4( position, 1.0 );\n}";
-
-       function WebGLShadowMap(_renderer, _objects, _capabilities) {
-               let _frustum = new Frustum();
-
-               const _shadowMapSize = new Vector2(),
-                                       _viewportSize = new Vector2(),
-                                       _viewport = new Vector4(),
-                                       _depthMaterial = new MeshDepthMaterial({
-                       depthPacking: RGBADepthPacking
-               }),
-                                       _distanceMaterial = new MeshDistanceMaterial(),
-                                       _materialCache = {},
-                                       _maxTextureSize = _capabilities.maxTextureSize;
-
-               const shadowSide = {
-                       0: BackSide,
-                       1: FrontSide,
-                       2: DoubleSide
-               };
-               const shadowMaterialVertical = new ShaderMaterial({
-                       uniforms: {
-                               shadow_pass: {
-                                       value: null
-                               },
-                               resolution: {
-                                       value: new Vector2()
-                               },
-                               radius: {
-                                       value: 4.0
-                               },
-                               samples: {
-                                       value: 8.0
-                               }
-                       },
-                       vertexShader: vsm_vert,
-                       fragmentShader: vsm_frag
-               });
-               const shadowMaterialHorizontal = shadowMaterialVertical.clone();
-               shadowMaterialHorizontal.defines.HORIZONTAL_PASS = 1;
-               const fullScreenTri = new BufferGeometry();
-               fullScreenTri.setAttribute('position', new BufferAttribute(new Float32Array([-1, -1, 0.5, 3, -1, 0.5, -1, 3, 0.5]), 3));
-               const fullScreenMesh = new Mesh(fullScreenTri, shadowMaterialVertical);
-               const scope = this;
-               this.enabled = false;
-               this.autoUpdate = true;
-               this.needsUpdate = false;
-               this.type = PCFShadowMap;
-
-               this.render = function (lights, scene, camera) {
-                       if (scope.enabled === false) return;
-                       if (scope.autoUpdate === false && scope.needsUpdate === false) return;
-                       if (lights.length === 0) return;
-
-                       const currentRenderTarget = _renderer.getRenderTarget();
-
-                       const activeCubeFace = _renderer.getActiveCubeFace();
-
-                       const activeMipmapLevel = _renderer.getActiveMipmapLevel();
-
-                       const _state = _renderer.state; // Set GL state for depth map.
-
-                       _state.setBlending(NoBlending);
-
-                       _state.buffers.color.setClear(1, 1, 1, 1);
-
-                       _state.buffers.depth.setTest(true);
-
-                       _state.setScissorTest(false); // render depth map
-
-
-                       for (let i = 0, il = lights.length; i < il; i++) {
-                               const light = lights[i];
-                               const shadow = light.shadow;
-
-                               if (shadow === undefined) {
-                                       console.warn('THREE.WebGLShadowMap:', light, 'has no shadow.');
-                                       continue;
-                               }
-
-                               if (shadow.autoUpdate === false && shadow.needsUpdate === false) continue;
-
-                               _shadowMapSize.copy(shadow.mapSize);
-
-                               const shadowFrameExtents = shadow.getFrameExtents();
-
-                               _shadowMapSize.multiply(shadowFrameExtents);
-
-                               _viewportSize.copy(shadow.mapSize);
-
-                               if (_shadowMapSize.x > _maxTextureSize || _shadowMapSize.y > _maxTextureSize) {
-                                       if (_shadowMapSize.x > _maxTextureSize) {
-                                               _viewportSize.x = Math.floor(_maxTextureSize / shadowFrameExtents.x);
-                                               _shadowMapSize.x = _viewportSize.x * shadowFrameExtents.x;
-                                               shadow.mapSize.x = _viewportSize.x;
-                                       }
-
-                                       if (_shadowMapSize.y > _maxTextureSize) {
-                                               _viewportSize.y = Math.floor(_maxTextureSize / shadowFrameExtents.y);
-                                               _shadowMapSize.y = _viewportSize.y * shadowFrameExtents.y;
-                                               shadow.mapSize.y = _viewportSize.y;
-                                       }
-                               }
-
-                               if (shadow.map === null && !shadow.isPointLightShadow && this.type === VSMShadowMap) {
-                                       const pars = {
-                                               minFilter: LinearFilter,
-                                               magFilter: LinearFilter,
-                                               format: RGBAFormat
-                                       };
-                                       shadow.map = new WebGLRenderTarget(_shadowMapSize.x, _shadowMapSize.y, pars);
-                                       shadow.map.texture.name = light.name + '.shadowMap';
-                                       shadow.mapPass = new WebGLRenderTarget(_shadowMapSize.x, _shadowMapSize.y, pars);
-                                       shadow.camera.updateProjectionMatrix();
-                               }
-
-                               if (shadow.map === null) {
-                                       const pars = {
-                                               minFilter: NearestFilter,
-                                               magFilter: NearestFilter,
-                                               format: RGBAFormat
-                                       };
-                                       shadow.map = new WebGLRenderTarget(_shadowMapSize.x, _shadowMapSize.y, pars);
-                                       shadow.map.texture.name = light.name + '.shadowMap';
-                                       shadow.camera.updateProjectionMatrix();
-                               }
-
-                               _renderer.setRenderTarget(shadow.map);
-
-                               _renderer.clear();
-
-                               const viewportCount = shadow.getViewportCount();
-
-                               for (let vp = 0; vp < viewportCount; vp++) {
-                                       const viewport = shadow.getViewport(vp);
-
-                                       _viewport.set(_viewportSize.x * viewport.x, _viewportSize.y * viewport.y, _viewportSize.x * viewport.z, _viewportSize.y * viewport.w);
-
-                                       _state.viewport(_viewport);
-
-                                       shadow.updateMatrices(light, vp);
-                                       _frustum = shadow.getFrustum();
-                                       renderObject(scene, camera, shadow.camera, light, this.type);
-                               } // do blur pass for VSM
-
-
-                               if (!shadow.isPointLightShadow && this.type === VSMShadowMap) {
-                                       VSMPass(shadow, camera);
-                               }
-
-                               shadow.needsUpdate = false;
-                       }
-
-                       scope.needsUpdate = false;
-
-                       _renderer.setRenderTarget(currentRenderTarget, activeCubeFace, activeMipmapLevel);
-               };
-
-               function VSMPass(shadow, camera) {
-                       const geometry = _objects.update(fullScreenMesh); // vertical pass
-
-
-                       shadowMaterialVertical.uniforms.shadow_pass.value = shadow.map.texture;
-                       shadowMaterialVertical.uniforms.resolution.value = shadow.mapSize;
-                       shadowMaterialVertical.uniforms.radius.value = shadow.radius;
-                       shadowMaterialVertical.uniforms.samples.value = shadow.blurSamples;
-
-                       _renderer.setRenderTarget(shadow.mapPass);
-
-                       _renderer.clear();
-
-                       _renderer.renderBufferDirect(camera, null, geometry, shadowMaterialVertical, fullScreenMesh, null); // horizontal pass
-
-
-                       shadowMaterialHorizontal.uniforms.shadow_pass.value = shadow.mapPass.texture;
-                       shadowMaterialHorizontal.uniforms.resolution.value = shadow.mapSize;
-                       shadowMaterialHorizontal.uniforms.radius.value = shadow.radius;
-                       shadowMaterialHorizontal.uniforms.samples.value = shadow.blurSamples;
-
-                       _renderer.setRenderTarget(shadow.map);
-
-                       _renderer.clear();
-
-                       _renderer.renderBufferDirect(camera, null, geometry, shadowMaterialHorizontal, fullScreenMesh, null);
-               }
-
-               function getDepthMaterial(object, geometry, material, light, shadowCameraNear, shadowCameraFar, type) {
-                       let result = null;
-                       const customMaterial = light.isPointLight === true ? object.customDistanceMaterial : object.customDepthMaterial;
-
-                       if (customMaterial !== undefined) {
-                               result = customMaterial;
-                       } else {
-                               result = light.isPointLight === true ? _distanceMaterial : _depthMaterial;
-                       }
-
-                       if (_renderer.localClippingEnabled && material.clipShadows === true && material.clippingPlanes.length !== 0 || material.displacementMap && material.displacementScale !== 0 || material.alphaMap && material.alphaTest > 0) {
-                               // in this case we need a unique material instance reflecting the
-                               // appropriate state
-                               const keyA = result.uuid,
-                                                       keyB = material.uuid;
-                               let materialsForVariant = _materialCache[keyA];
-
-                               if (materialsForVariant === undefined) {
-                                       materialsForVariant = {};
-                                       _materialCache[keyA] = materialsForVariant;
-                               }
-
-                               let cachedMaterial = materialsForVariant[keyB];
-
-                               if (cachedMaterial === undefined) {
-                                       cachedMaterial = result.clone();
-                                       materialsForVariant[keyB] = cachedMaterial;
-                               }
-
-                               result = cachedMaterial;
-                       }
-
-                       result.visible = material.visible;
-                       result.wireframe = material.wireframe;
-
-                       if (type === VSMShadowMap) {
-                               result.side = material.shadowSide !== null ? material.shadowSide : material.side;
-                       } else {
-                               result.side = material.shadowSide !== null ? material.shadowSide : shadowSide[material.side];
-                       }
-
-                       result.alphaMap = material.alphaMap;
-                       result.alphaTest = material.alphaTest;
-                       result.clipShadows = material.clipShadows;
-                       result.clippingPlanes = material.clippingPlanes;
-                       result.clipIntersection = material.clipIntersection;
-                       result.displacementMap = material.displacementMap;
-                       result.displacementScale = material.displacementScale;
-                       result.displacementBias = material.displacementBias;
-                       result.wireframeLinewidth = material.wireframeLinewidth;
-                       result.linewidth = material.linewidth;
-
-                       if (light.isPointLight === true && result.isMeshDistanceMaterial === true) {
-                               result.referencePosition.setFromMatrixPosition(light.matrixWorld);
-                               result.nearDistance = shadowCameraNear;
-                               result.farDistance = shadowCameraFar;
-                       }
-
-                       return result;
-               }
-
-               function renderObject(object, camera, shadowCamera, light, type) {
-                       if (object.visible === false) return;
-                       const visible = object.layers.test(camera.layers);
-
-                       if (visible && (object.isMesh || object.isLine || object.isPoints)) {
-                               if ((object.castShadow || object.receiveShadow && type === VSMShadowMap) && (!object.frustumCulled || _frustum.intersectsObject(object))) {
-                                       object.modelViewMatrix.multiplyMatrices(shadowCamera.matrixWorldInverse, object.matrixWorld);
-
-                                       const geometry = _objects.update(object);
-
-                                       const material = object.material;
-
-                                       if (Array.isArray(material)) {
-                                               const groups = geometry.groups;
-
-                                               for (let k = 0, kl = groups.length; k < kl; k++) {
-                                                       const group = groups[k];
-                                                       const groupMaterial = material[group.materialIndex];
-
-                                                       if (groupMaterial && groupMaterial.visible) {
-                                                               const depthMaterial = getDepthMaterial(object, geometry, groupMaterial, light, shadowCamera.near, shadowCamera.far, type);
-
-                                                               _renderer.renderBufferDirect(shadowCamera, null, geometry, depthMaterial, object, group);
-                                                       }
-                                               }
-                                       } else if (material.visible) {
-                                               const depthMaterial = getDepthMaterial(object, geometry, material, light, shadowCamera.near, shadowCamera.far, type);
-
-                                               _renderer.renderBufferDirect(shadowCamera, null, geometry, depthMaterial, object, null);
-                                       }
-                               }
-                       }
-
-                       const children = object.children;
-
-                       for (let i = 0, l = children.length; i < l; i++) {
-                               renderObject(children[i], camera, shadowCamera, light, type);
-                       }
-               }
-       }
-
-       function WebGLState(gl, extensions, capabilities) {
-               const isWebGL2 = capabilities.isWebGL2;
-
-               function ColorBuffer() {
-                       let locked = false;
-                       const color = new Vector4();
-                       let currentColorMask = null;
-                       const currentColorClear = new Vector4(0, 0, 0, 0);
-                       return {
-                               setMask: function (colorMask) {
-                                       if (currentColorMask !== colorMask && !locked) {
-                                               gl.colorMask(colorMask, colorMask, colorMask, colorMask);
-                                               currentColorMask = colorMask;
-                                       }
-                               },
-                               setLocked: function (lock) {
-                                       locked = lock;
-                               },
-                               setClear: function (r, g, b, a, premultipliedAlpha) {
-                                       if (premultipliedAlpha === true) {
-                                               r *= a;
-                                               g *= a;
-                                               b *= a;
-                                       }
-
-                                       color.set(r, g, b, a);
-
-                                       if (currentColorClear.equals(color) === false) {
-                                               gl.clearColor(r, g, b, a);
-                                               currentColorClear.copy(color);
-                                       }
-                               },
-                               reset: function () {
-                                       locked = false;
-                                       currentColorMask = null;
-                                       currentColorClear.set(-1, 0, 0, 0); // set to invalid state
-                               }
-                       };
-               }
-
-               function DepthBuffer() {
-                       let locked = false;
-                       let currentDepthMask = null;
-                       let currentDepthFunc = null;
-                       let currentDepthClear = null;
-                       return {
-                               setTest: function (depthTest) {
-                                       if (depthTest) {
-                                               enable(gl.DEPTH_TEST);
-                                       } else {
-                                               disable(gl.DEPTH_TEST);
-                                       }
-                               },
-                               setMask: function (depthMask) {
-                                       if (currentDepthMask !== depthMask && !locked) {
-                                               gl.depthMask(depthMask);
-                                               currentDepthMask = depthMask;
-                                       }
-                               },
-                               setFunc: function (depthFunc) {
-                                       if (currentDepthFunc !== depthFunc) {
-                                               if (depthFunc) {
-                                                       switch (depthFunc) {
-                                                               case NeverDepth:
-                                                                       gl.depthFunc(gl.NEVER);
-                                                                       break;
-
-                                                               case AlwaysDepth:
-                                                                       gl.depthFunc(gl.ALWAYS);
-                                                                       break;
-
-                                                               case LessDepth:
-                                                                       gl.depthFunc(gl.LESS);
-                                                                       break;
-
-                                                               case LessEqualDepth:
-                                                                       gl.depthFunc(gl.LEQUAL);
-                                                                       break;
-
-                                                               case EqualDepth:
-                                                                       gl.depthFunc(gl.EQUAL);
-                                                                       break;
-
-                                                               case GreaterEqualDepth:
-                                                                       gl.depthFunc(gl.GEQUAL);
-                                                                       break;
-
-                                                               case GreaterDepth:
-                                                                       gl.depthFunc(gl.GREATER);
-                                                                       break;
-
-                                                               case NotEqualDepth:
-                                                                       gl.depthFunc(gl.NOTEQUAL);
-                                                                       break;
-
-                                                               default:
-                                                                       gl.depthFunc(gl.LEQUAL);
-                                                       }
-                                               } else {
-                                                       gl.depthFunc(gl.LEQUAL);
-                                               }
-
-                                               currentDepthFunc = depthFunc;
-                                       }
-                               },
-                               setLocked: function (lock) {
-                                       locked = lock;
-                               },
-                               setClear: function (depth) {
-                                       if (currentDepthClear !== depth) {
-                                               gl.clearDepth(depth);
-                                               currentDepthClear = depth;
-                                       }
-                               },
-                               reset: function () {
-                                       locked = false;
-                                       currentDepthMask = null;
-                                       currentDepthFunc = null;
-                                       currentDepthClear = null;
-                               }
-                       };
-               }
-
-               function StencilBuffer() {
-                       let locked = false;
-                       let currentStencilMask = null;
-                       let currentStencilFunc = null;
-                       let currentStencilRef = null;
-                       let currentStencilFuncMask = null;
-                       let currentStencilFail = null;
-                       let currentStencilZFail = null;
-                       let currentStencilZPass = null;
-                       let currentStencilClear = null;
-                       return {
-                               setTest: function (stencilTest) {
-                                       if (!locked) {
-                                               if (stencilTest) {
-                                                       enable(gl.STENCIL_TEST);
-                                               } else {
-                                                       disable(gl.STENCIL_TEST);
-                                               }
-                                       }
-                               },
-                               setMask: function (stencilMask) {
-                                       if (currentStencilMask !== stencilMask && !locked) {
-                                               gl.stencilMask(stencilMask);
-                                               currentStencilMask = stencilMask;
-                                       }
-                               },
-                               setFunc: function (stencilFunc, stencilRef, stencilMask) {
-                                       if (currentStencilFunc !== stencilFunc || currentStencilRef !== stencilRef || currentStencilFuncMask !== stencilMask) {
-                                               gl.stencilFunc(stencilFunc, stencilRef, stencilMask);
-                                               currentStencilFunc = stencilFunc;
-                                               currentStencilRef = stencilRef;
-                                               currentStencilFuncMask = stencilMask;
-                                       }
-                               },
-                               setOp: function (stencilFail, stencilZFail, stencilZPass) {
-                                       if (currentStencilFail !== stencilFail || currentStencilZFail !== stencilZFail || currentStencilZPass !== stencilZPass) {
-                                               gl.stencilOp(stencilFail, stencilZFail, stencilZPass);
-                                               currentStencilFail = stencilFail;
-                                               currentStencilZFail = stencilZFail;
-                                               currentStencilZPass = stencilZPass;
-                                       }
-                               },
-                               setLocked: function (lock) {
-                                       locked = lock;
-                               },
-                               setClear: function (stencil) {
-                                       if (currentStencilClear !== stencil) {
-                                               gl.clearStencil(stencil);
-                                               currentStencilClear = stencil;
-                                       }
-                               },
-                               reset: function () {
-                                       locked = false;
-                                       currentStencilMask = null;
-                                       currentStencilFunc = null;
-                                       currentStencilRef = null;
-                                       currentStencilFuncMask = null;
-                                       currentStencilFail = null;
-                                       currentStencilZFail = null;
-                                       currentStencilZPass = null;
-                                       currentStencilClear = null;
-                               }
-                       };
-               } //
-
-
-               const colorBuffer = new ColorBuffer();
-               const depthBuffer = new DepthBuffer();
-               const stencilBuffer = new StencilBuffer();
-               let enabledCapabilities = {};
-               let xrFramebuffer = null;
-               let currentBoundFramebuffers = {};
-               let currentProgram = null;
-               let currentBlendingEnabled = false;
-               let currentBlending = null;
-               let currentBlendEquation = null;
-               let currentBlendSrc = null;
-               let currentBlendDst = null;
-               let currentBlendEquationAlpha = null;
-               let currentBlendSrcAlpha = null;
-               let currentBlendDstAlpha = null;
-               let currentPremultipledAlpha = false;
-               let currentFlipSided = null;
-               let currentCullFace = null;
-               let currentLineWidth = null;
-               let currentPolygonOffsetFactor = null;
-               let currentPolygonOffsetUnits = null;
-               const maxTextures = gl.getParameter(gl.MAX_COMBINED_TEXTURE_IMAGE_UNITS);
-               let lineWidthAvailable = false;
-               let version = 0;
-               const glVersion = gl.getParameter(gl.VERSION);
-
-               if (glVersion.indexOf('WebGL') !== -1) {
-                       version = parseFloat(/^WebGL (\d)/.exec(glVersion)[1]);
-                       lineWidthAvailable = version >= 1.0;
-               } else if (glVersion.indexOf('OpenGL ES') !== -1) {
-                       version = parseFloat(/^OpenGL ES (\d)/.exec(glVersion)[1]);
-                       lineWidthAvailable = version >= 2.0;
-               }
-
-               let currentTextureSlot = null;
-               let currentBoundTextures = {};
-               const scissorParam = gl.getParameter(gl.SCISSOR_BOX);
-               const viewportParam = gl.getParameter(gl.VIEWPORT);
-               const currentScissor = new Vector4().fromArray(scissorParam);
-               const currentViewport = new Vector4().fromArray(viewportParam);
-
-               function createTexture(type, target, count) {
-                       const data = new Uint8Array(4); // 4 is required to match default unpack alignment of 4.
-
-                       const texture = gl.createTexture();
-                       gl.bindTexture(type, texture);
-                       gl.texParameteri(type, gl.TEXTURE_MIN_FILTER, gl.NEAREST);
-                       gl.texParameteri(type, gl.TEXTURE_MAG_FILTER, gl.NEAREST);
-
-                       for (let i = 0; i < count; i++) {
-                               gl.texImage2D(target + i, 0, gl.RGBA, 1, 1, 0, gl.RGBA, gl.UNSIGNED_BYTE, data);
-                       }
-
-                       return texture;
-               }
-
-               const emptyTextures = {};
-               emptyTextures[gl.TEXTURE_2D] = createTexture(gl.TEXTURE_2D, gl.TEXTURE_2D, 1);
-               emptyTextures[gl.TEXTURE_CUBE_MAP] = createTexture(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_CUBE_MAP_POSITIVE_X, 6); // init
-
-               colorBuffer.setClear(0, 0, 0, 1);
-               depthBuffer.setClear(1);
-               stencilBuffer.setClear(0);
-               enable(gl.DEPTH_TEST);
-               depthBuffer.setFunc(LessEqualDepth);
-               setFlipSided(false);
-               setCullFace(CullFaceBack);
-               enable(gl.CULL_FACE);
-               setBlending(NoBlending); //
-
-               function enable(id) {
-                       if (enabledCapabilities[id] !== true) {
-                               gl.enable(id);
-                               enabledCapabilities[id] = true;
-                       }
-               }
-
-               function disable(id) {
-                       if (enabledCapabilities[id] !== false) {
-                               gl.disable(id);
-                               enabledCapabilities[id] = false;
-                       }
-               }
-
-               function bindXRFramebuffer(framebuffer) {
-                       if (framebuffer !== xrFramebuffer) {
-                               gl.bindFramebuffer(gl.FRAMEBUFFER, framebuffer);
-                               xrFramebuffer = framebuffer;
-                       }
-               }
-
-               function bindFramebuffer(target, framebuffer) {
-                       if (framebuffer === null && xrFramebuffer !== null) framebuffer = xrFramebuffer; // use active XR framebuffer if available
-
-                       if (currentBoundFramebuffers[target] !== framebuffer) {
-                               gl.bindFramebuffer(target, framebuffer);
-                               currentBoundFramebuffers[target] = framebuffer;
-
-                               if (isWebGL2) {
-                                       // gl.DRAW_FRAMEBUFFER is equivalent to gl.FRAMEBUFFER
-                                       if (target === gl.DRAW_FRAMEBUFFER) {
-                                               currentBoundFramebuffers[gl.FRAMEBUFFER] = framebuffer;
-                                       }
-
-                                       if (target === gl.FRAMEBUFFER) {
-                                               currentBoundFramebuffers[gl.DRAW_FRAMEBUFFER] = framebuffer;
-                                       }
-                               }
-
-                               return true;
-                       }
-
-                       return false;
-               }
-
-               function useProgram(program) {
-                       if (currentProgram !== program) {
-                               gl.useProgram(program);
-                               currentProgram = program;
-                               return true;
-                       }
-
-                       return false;
-               }
-
-               const equationToGL = {
-                       [AddEquation]: gl.FUNC_ADD,
-                       [SubtractEquation]: gl.FUNC_SUBTRACT,
-                       [ReverseSubtractEquation]: gl.FUNC_REVERSE_SUBTRACT
-               };
-
-               if (isWebGL2) {
-                       equationToGL[MinEquation] = gl.MIN;
-                       equationToGL[MaxEquation] = gl.MAX;
-               } else {
-                       const extension = extensions.get('EXT_blend_minmax');
-
-                       if (extension !== null) {
-                               equationToGL[MinEquation] = extension.MIN_EXT;
-                               equationToGL[MaxEquation] = extension.MAX_EXT;
-                       }
-               }
-
-               const factorToGL = {
-                       [ZeroFactor]: gl.ZERO,
-                       [OneFactor]: gl.ONE,
-                       [SrcColorFactor]: gl.SRC_COLOR,
-                       [SrcAlphaFactor]: gl.SRC_ALPHA,
-                       [SrcAlphaSaturateFactor]: gl.SRC_ALPHA_SATURATE,
-                       [DstColorFactor]: gl.DST_COLOR,
-                       [DstAlphaFactor]: gl.DST_ALPHA,
-                       [OneMinusSrcColorFactor]: gl.ONE_MINUS_SRC_COLOR,
-                       [OneMinusSrcAlphaFactor]: gl.ONE_MINUS_SRC_ALPHA,
-                       [OneMinusDstColorFactor]: gl.ONE_MINUS_DST_COLOR,
-                       [OneMinusDstAlphaFactor]: gl.ONE_MINUS_DST_ALPHA
-               };
-
-               function setBlending(blending, blendEquation, blendSrc, blendDst, blendEquationAlpha, blendSrcAlpha, blendDstAlpha, premultipliedAlpha) {
-                       if (blending === NoBlending) {
-                               if (currentBlendingEnabled === true) {
-                                       disable(gl.BLEND);
-                                       currentBlendingEnabled = false;
-                               }
-
-                               return;
-                       }
-
-                       if (currentBlendingEnabled === false) {
-                               enable(gl.BLEND);
-                               currentBlendingEnabled = true;
-                       }
-
-                       if (blending !== CustomBlending) {
-                               if (blending !== currentBlending || premultipliedAlpha !== currentPremultipledAlpha) {
-                                       if (currentBlendEquation !== AddEquation || currentBlendEquationAlpha !== AddEquation) {
-                                               gl.blendEquation(gl.FUNC_ADD);
-                                               currentBlendEquation = AddEquation;
-                                               currentBlendEquationAlpha = AddEquation;
-                                       }
-
-                                       if (premultipliedAlpha) {
-                                               switch (blending) {
-                                                       case NormalBlending:
-                                                               gl.blendFuncSeparate(gl.ONE, gl.ONE_MINUS_SRC_ALPHA, gl.ONE, gl.ONE_MINUS_SRC_ALPHA);
-                                                               break;
-
-                                                       case AdditiveBlending:
-                                                               gl.blendFunc(gl.ONE, gl.ONE);
-                                                               break;
-
-                                                       case SubtractiveBlending:
-                                                               gl.blendFuncSeparate(gl.ZERO, gl.ZERO, gl.ONE_MINUS_SRC_COLOR, gl.ONE_MINUS_SRC_ALPHA);
-                                                               break;
-
-                                                       case MultiplyBlending:
-                                                               gl.blendFuncSeparate(gl.ZERO, gl.SRC_COLOR, gl.ZERO, gl.SRC_ALPHA);
-                                                               break;
-
-                                                       default:
-                                                               console.error('THREE.WebGLState: Invalid blending: ', blending);
-                                                               break;
-                                               }
-                                       } else {
-                                               switch (blending) {
-                                                       case NormalBlending:
-                                                               gl.blendFuncSeparate(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA, gl.ONE, gl.ONE_MINUS_SRC_ALPHA);
-                                                               break;
-
-                                                       case AdditiveBlending:
-                                                               gl.blendFunc(gl.SRC_ALPHA, gl.ONE);
-                                                               break;
-
-                                                       case SubtractiveBlending:
-                                                               gl.blendFunc(gl.ZERO, gl.ONE_MINUS_SRC_COLOR);
-                                                               break;
-
-                                                       case MultiplyBlending:
-                                                               gl.blendFunc(gl.ZERO, gl.SRC_COLOR);
-                                                               break;
-
-                                                       default:
-                                                               console.error('THREE.WebGLState: Invalid blending: ', blending);
-                                                               break;
-                                               }
-                                       }
-
-                                       currentBlendSrc = null;
-                                       currentBlendDst = null;
-                                       currentBlendSrcAlpha = null;
-                                       currentBlendDstAlpha = null;
-                                       currentBlending = blending;
-                                       currentPremultipledAlpha = premultipliedAlpha;
-                               }
-
-                               return;
-                       } // custom blending
-
-
-                       blendEquationAlpha = blendEquationAlpha || blendEquation;
-                       blendSrcAlpha = blendSrcAlpha || blendSrc;
-                       blendDstAlpha = blendDstAlpha || blendDst;
-
-                       if (blendEquation !== currentBlendEquation || blendEquationAlpha !== currentBlendEquationAlpha) {
-                               gl.blendEquationSeparate(equationToGL[blendEquation], equationToGL[blendEquationAlpha]);
-                               currentBlendEquation = blendEquation;
-                               currentBlendEquationAlpha = blendEquationAlpha;
-                       }
-
-                       if (blendSrc !== currentBlendSrc || blendDst !== currentBlendDst || blendSrcAlpha !== currentBlendSrcAlpha || blendDstAlpha !== currentBlendDstAlpha) {
-                               gl.blendFuncSeparate(factorToGL[blendSrc], factorToGL[blendDst], factorToGL[blendSrcAlpha], factorToGL[blendDstAlpha]);
-                               currentBlendSrc = blendSrc;
-                               currentBlendDst = blendDst;
-                               currentBlendSrcAlpha = blendSrcAlpha;
-                               currentBlendDstAlpha = blendDstAlpha;
-                       }
-
-                       currentBlending = blending;
-                       currentPremultipledAlpha = null;
-               }
-
-               function setMaterial(material, frontFaceCW) {
-                       material.side === DoubleSide ? disable(gl.CULL_FACE) : enable(gl.CULL_FACE);
-                       let flipSided = material.side === BackSide;
-                       if (frontFaceCW) flipSided = !flipSided;
-                       setFlipSided(flipSided);
-                       material.blending === NormalBlending && material.transparent === false ? setBlending(NoBlending) : setBlending(material.blending, material.blendEquation, material.blendSrc, material.blendDst, material.blendEquationAlpha, material.blendSrcAlpha, material.blendDstAlpha, material.premultipliedAlpha);
-                       depthBuffer.setFunc(material.depthFunc);
-                       depthBuffer.setTest(material.depthTest);
-                       depthBuffer.setMask(material.depthWrite);
-                       colorBuffer.setMask(material.colorWrite);
-                       const stencilWrite = material.stencilWrite;
-                       stencilBuffer.setTest(stencilWrite);
-
-                       if (stencilWrite) {
-                               stencilBuffer.setMask(material.stencilWriteMask);
-                               stencilBuffer.setFunc(material.stencilFunc, material.stencilRef, material.stencilFuncMask);
-                               stencilBuffer.setOp(material.stencilFail, material.stencilZFail, material.stencilZPass);
-                       }
-
-                       setPolygonOffset(material.polygonOffset, material.polygonOffsetFactor, material.polygonOffsetUnits);
-                       material.alphaToCoverage === true ? enable(gl.SAMPLE_ALPHA_TO_COVERAGE) : disable(gl.SAMPLE_ALPHA_TO_COVERAGE);
-               } //
-
-
-               function setFlipSided(flipSided) {
-                       if (currentFlipSided !== flipSided) {
-                               if (flipSided) {
-                                       gl.frontFace(gl.CW);
-                               } else {
-                                       gl.frontFace(gl.CCW);
-                               }
-
-                               currentFlipSided = flipSided;
-                       }
-               }
-
-               function setCullFace(cullFace) {
-                       if (cullFace !== CullFaceNone) {
-                               enable(gl.CULL_FACE);
-
-                               if (cullFace !== currentCullFace) {
-                                       if (cullFace === CullFaceBack) {
-                                               gl.cullFace(gl.BACK);
-                                       } else if (cullFace === CullFaceFront) {
-                                               gl.cullFace(gl.FRONT);
-                                       } else {
-                                               gl.cullFace(gl.FRONT_AND_BACK);
-                                       }
-                               }
-                       } else {
-                               disable(gl.CULL_FACE);
-                       }
-
-                       currentCullFace = cullFace;
-               }
-
-               function setLineWidth(width) {
-                       if (width !== currentLineWidth) {
-                               if (lineWidthAvailable) gl.lineWidth(width);
-                               currentLineWidth = width;
-                       }
-               }
-
-               function setPolygonOffset(polygonOffset, factor, units) {
-                       if (polygonOffset) {
-                               enable(gl.POLYGON_OFFSET_FILL);
-
-                               if (currentPolygonOffsetFactor !== factor || currentPolygonOffsetUnits !== units) {
-                                       gl.polygonOffset(factor, units);
-                                       currentPolygonOffsetFactor = factor;
-                                       currentPolygonOffsetUnits = units;
-                               }
-                       } else {
-                               disable(gl.POLYGON_OFFSET_FILL);
-                       }
-               }
-
-               function setScissorTest(scissorTest) {
-                       if (scissorTest) {
-                               enable(gl.SCISSOR_TEST);
-                       } else {
-                               disable(gl.SCISSOR_TEST);
-                       }
-               } // texture
-
-
-               function activeTexture(webglSlot) {
-                       if (webglSlot === undefined) webglSlot = gl.TEXTURE0 + maxTextures - 1;
-
-                       if (currentTextureSlot !== webglSlot) {
-                               gl.activeTexture(webglSlot);
-                               currentTextureSlot = webglSlot;
-                       }
-               }
-
-               function bindTexture(webglType, webglTexture) {
-                       if (currentTextureSlot === null) {
-                               activeTexture();
-                       }
-
-                       let boundTexture = currentBoundTextures[currentTextureSlot];
-
-                       if (boundTexture === undefined) {
-                               boundTexture = {
-                                       type: undefined,
-                                       texture: undefined
-                               };
-                               currentBoundTextures[currentTextureSlot] = boundTexture;
-                       }
-
-                       if (boundTexture.type !== webglType || boundTexture.texture !== webglTexture) {
-                               gl.bindTexture(webglType, webglTexture || emptyTextures[webglType]);
-                               boundTexture.type = webglType;
-                               boundTexture.texture = webglTexture;
-                       }
-               }
-
-               function unbindTexture() {
-                       const boundTexture = currentBoundTextures[currentTextureSlot];
-
-                       if (boundTexture !== undefined && boundTexture.type !== undefined) {
-                               gl.bindTexture(boundTexture.type, null);
-                               boundTexture.type = undefined;
-                               boundTexture.texture = undefined;
-                       }
-               }
-
-               function compressedTexImage2D() {
-                       try {
-                               gl.compressedTexImage2D.apply(gl, arguments);
-                       } catch (error) {
-                               console.error('THREE.WebGLState:', error);
-                       }
-               }
-
-               function texImage2D() {
-                       try {
-                               gl.texImage2D.apply(gl, arguments);
-                       } catch (error) {
-                               console.error('THREE.WebGLState:', error);
-                       }
-               }
-
-               function texImage3D() {
-                       try {
-                               gl.texImage3D.apply(gl, arguments);
-                       } catch (error) {
-                               console.error('THREE.WebGLState:', error);
-                       }
-               } //
-
-
-               function scissor(scissor) {
-                       if (currentScissor.equals(scissor) === false) {
-                               gl.scissor(scissor.x, scissor.y, scissor.z, scissor.w);
-                               currentScissor.copy(scissor);
-                       }
-               }
-
-               function viewport(viewport) {
-                       if (currentViewport.equals(viewport) === false) {
-                               gl.viewport(viewport.x, viewport.y, viewport.z, viewport.w);
-                               currentViewport.copy(viewport);
-                       }
-               } //
-
-
-               function reset() {
-                       // reset state
-                       gl.disable(gl.BLEND);
-                       gl.disable(gl.CULL_FACE);
-                       gl.disable(gl.DEPTH_TEST);
-                       gl.disable(gl.POLYGON_OFFSET_FILL);
-                       gl.disable(gl.SCISSOR_TEST);
-                       gl.disable(gl.STENCIL_TEST);
-                       gl.disable(gl.SAMPLE_ALPHA_TO_COVERAGE);
-                       gl.blendEquation(gl.FUNC_ADD);
-                       gl.blendFunc(gl.ONE, gl.ZERO);
-                       gl.blendFuncSeparate(gl.ONE, gl.ZERO, gl.ONE, gl.ZERO);
-                       gl.colorMask(true, true, true, true);
-                       gl.clearColor(0, 0, 0, 0);
-                       gl.depthMask(true);
-                       gl.depthFunc(gl.LESS);
-                       gl.clearDepth(1);
-                       gl.stencilMask(0xffffffff);
-                       gl.stencilFunc(gl.ALWAYS, 0, 0xffffffff);
-                       gl.stencilOp(gl.KEEP, gl.KEEP, gl.KEEP);
-                       gl.clearStencil(0);
-                       gl.cullFace(gl.BACK);
-                       gl.frontFace(gl.CCW);
-                       gl.polygonOffset(0, 0);
-                       gl.activeTexture(gl.TEXTURE0);
-                       gl.bindFramebuffer(gl.FRAMEBUFFER, null);
-
-                       if (isWebGL2 === true) {
-                               gl.bindFramebuffer(gl.DRAW_FRAMEBUFFER, null);
-                               gl.bindFramebuffer(gl.READ_FRAMEBUFFER, null);
-                       }
-
-                       gl.useProgram(null);
-                       gl.lineWidth(1);
-                       gl.scissor(0, 0, gl.canvas.width, gl.canvas.height);
-                       gl.viewport(0, 0, gl.canvas.width, gl.canvas.height); // reset internals
-
-                       enabledCapabilities = {};
-                       currentTextureSlot = null;
-                       currentBoundTextures = {};
-                       xrFramebuffer = null;
-                       currentBoundFramebuffers = {};
-                       currentProgram = null;
-                       currentBlendingEnabled = false;
-                       currentBlending = null;
-                       currentBlendEquation = null;
-                       currentBlendSrc = null;
-                       currentBlendDst = null;
-                       currentBlendEquationAlpha = null;
-                       currentBlendSrcAlpha = null;
-                       currentBlendDstAlpha = null;
-                       currentPremultipledAlpha = false;
-                       currentFlipSided = null;
-                       currentCullFace = null;
-                       currentLineWidth = null;
-                       currentPolygonOffsetFactor = null;
-                       currentPolygonOffsetUnits = null;
-                       currentScissor.set(0, 0, gl.canvas.width, gl.canvas.height);
-                       currentViewport.set(0, 0, gl.canvas.width, gl.canvas.height);
-                       colorBuffer.reset();
-                       depthBuffer.reset();
-                       stencilBuffer.reset();
-               }
-
-               return {
-                       buffers: {
-                               color: colorBuffer,
-                               depth: depthBuffer,
-                               stencil: stencilBuffer
-                       },
-                       enable: enable,
-                       disable: disable,
-                       bindFramebuffer: bindFramebuffer,
-                       bindXRFramebuffer: bindXRFramebuffer,
-                       useProgram: useProgram,
-                       setBlending: setBlending,
-                       setMaterial: setMaterial,
-                       setFlipSided: setFlipSided,
-                       setCullFace: setCullFace,
-                       setLineWidth: setLineWidth,
-                       setPolygonOffset: setPolygonOffset,
-                       setScissorTest: setScissorTest,
-                       activeTexture: activeTexture,
-                       bindTexture: bindTexture,
-                       unbindTexture: unbindTexture,
-                       compressedTexImage2D: compressedTexImage2D,
-                       texImage2D: texImage2D,
-                       texImage3D: texImage3D,
-                       scissor: scissor,
-                       viewport: viewport,
-                       reset: reset
-               };
-       }
-
-       function WebGLTextures(_gl, extensions, state, properties, capabilities, utils, info) {
-               const isWebGL2 = capabilities.isWebGL2;
-               const maxTextures = capabilities.maxTextures;
-               const maxCubemapSize = capabilities.maxCubemapSize;
-               const maxTextureSize = capabilities.maxTextureSize;
-               const maxSamples = capabilities.maxSamples;
-
-               const _videoTextures = new WeakMap();
-
-               let _canvas; // cordova iOS (as of 5.0) still uses UIWebView, which provides OffscreenCanvas,
-               // also OffscreenCanvas.getContext("webgl"), but not OffscreenCanvas.getContext("2d")!
-               // Some implementations may only implement OffscreenCanvas partially (e.g. lacking 2d).
-
-
-               let useOffscreenCanvas = false;
-
-               try {
-                       useOffscreenCanvas = typeof OffscreenCanvas !== 'undefined' && new OffscreenCanvas(1, 1).getContext('2d') !== null;
-               } catch (err) {// Ignore any errors
-               }
-
-               function createCanvas(width, height) {
-                       // Use OffscreenCanvas when available. Specially needed in web workers
-                       return useOffscreenCanvas ? new OffscreenCanvas(width, height) : document.createElementNS('http://www.w3.org/1999/xhtml', 'canvas');
-               }
-
-               function resizeImage(image, needsPowerOfTwo, needsNewCanvas, maxSize) {
-                       let scale = 1; // handle case if texture exceeds max size
-
-                       if (image.width > maxSize || image.height > maxSize) {
-                               scale = maxSize / Math.max(image.width, image.height);
-                       } // only perform resize if necessary
-
-
-                       if (scale < 1 || needsPowerOfTwo === true) {
-                               // only perform resize for certain image types
-                               if (typeof HTMLImageElement !== 'undefined' && image instanceof HTMLImageElement || typeof HTMLCanvasElement !== 'undefined' && image instanceof HTMLCanvasElement || typeof ImageBitmap !== 'undefined' && image instanceof ImageBitmap) {
-                                       const floor = needsPowerOfTwo ? floorPowerOfTwo : Math.floor;
-                                       const width = floor(scale * image.width);
-                                       const height = floor(scale * image.height);
-                                       if (_canvas === undefined) _canvas = createCanvas(width, height); // cube textures can't reuse the same canvas
-
-                                       const canvas = needsNewCanvas ? createCanvas(width, height) : _canvas;
-                                       canvas.width = width;
-                                       canvas.height = height;
-                                       const context = canvas.getContext('2d');
-                                       context.drawImage(image, 0, 0, width, height);
-                                       console.warn('THREE.WebGLRenderer: Texture has been resized from (' + image.width + 'x' + image.height + ') to (' + width + 'x' + height + ').');
-                                       return canvas;
-                               } else {
-                                       if ('data' in image) {
-                                               console.warn('THREE.WebGLRenderer: Image in DataTexture is too big (' + image.width + 'x' + image.height + ').');
-                                       }
-
-                                       return image;
-                               }
-                       }
-
-                       return image;
-               }
-
-               function isPowerOfTwo$1(image) {
-                       return isPowerOfTwo(image.width) && isPowerOfTwo(image.height);
-               }
-
-               function textureNeedsPowerOfTwo(texture) {
-                       if (isWebGL2) return false;
-                       return texture.wrapS !== ClampToEdgeWrapping || texture.wrapT !== ClampToEdgeWrapping || texture.minFilter !== NearestFilter && texture.minFilter !== LinearFilter;
-               }
-
-               function textureNeedsGenerateMipmaps(texture, supportsMips) {
-                       return texture.generateMipmaps && supportsMips && texture.minFilter !== NearestFilter && texture.minFilter !== LinearFilter;
-               }
-
-               function generateMipmap(target, texture, width, height, depth = 1) {
-                       _gl.generateMipmap(target);
-
-                       const textureProperties = properties.get(texture);
-                       textureProperties.__maxMipLevel = Math.log2(Math.max(width, height, depth));
-               }
-
-               function getInternalFormat(internalFormatName, glFormat, glType) {
-                       if (isWebGL2 === false) return glFormat;
-
-                       if (internalFormatName !== null) {
-                               if (_gl[internalFormatName] !== undefined) return _gl[internalFormatName];
-                               console.warn('THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format \'' + internalFormatName + '\'');
-                       }
-
-                       let internalFormat = glFormat;
-
-                       if (glFormat === _gl.RED) {
-                               if (glType === _gl.FLOAT) internalFormat = _gl.R32F;
-                               if (glType === _gl.HALF_FLOAT) internalFormat = _gl.R16F;
-                               if (glType === _gl.UNSIGNED_BYTE) internalFormat = _gl.R8;
-                       }
-
-                       if (glFormat === _gl.RGB) {
-                               if (glType === _gl.FLOAT) internalFormat = _gl.RGB32F;
-                               if (glType === _gl.HALF_FLOAT) internalFormat = _gl.RGB16F;
-                               if (glType === _gl.UNSIGNED_BYTE) internalFormat = _gl.RGB8;
-                       }
-
-                       if (glFormat === _gl.RGBA) {
-                               if (glType === _gl.FLOAT) internalFormat = _gl.RGBA32F;
-                               if (glType === _gl.HALF_FLOAT) internalFormat = _gl.RGBA16F;
-                               if (glType === _gl.UNSIGNED_BYTE) internalFormat = _gl.RGBA8;
-                       }
-
-                       if (internalFormat === _gl.R16F || internalFormat === _gl.R32F || internalFormat === _gl.RGBA16F || internalFormat === _gl.RGBA32F) {
-                               extensions.get('EXT_color_buffer_float');
-                       }
-
-                       return internalFormat;
-               } // Fallback filters for non-power-of-2 textures
-
-
-               function filterFallback(f) {
-                       if (f === NearestFilter || f === NearestMipmapNearestFilter || f === NearestMipmapLinearFilter) {
-                               return _gl.NEAREST;
-                       }
-
-                       return _gl.LINEAR;
-               } //
-
-
-               function onTextureDispose(event) {
-                       const texture = event.target;
-                       texture.removeEventListener('dispose', onTextureDispose);
-                       deallocateTexture(texture);
-
-                       if (texture.isVideoTexture) {
-                               _videoTextures.delete(texture);
-                       }
-
-                       info.memory.textures--;
-               }
-
-               function onRenderTargetDispose(event) {
-                       const renderTarget = event.target;
-                       renderTarget.removeEventListener('dispose', onRenderTargetDispose);
-                       deallocateRenderTarget(renderTarget);
-               } //
-
-
-               function deallocateTexture(texture) {
-                       const textureProperties = properties.get(texture);
-                       if (textureProperties.__webglInit === undefined) return;
-
-                       _gl.deleteTexture(textureProperties.__webglTexture);
-
-                       properties.remove(texture);
-               }
-
-               function deallocateRenderTarget(renderTarget) {
-                       const texture = renderTarget.texture;
-                       const renderTargetProperties = properties.get(renderTarget);
-                       const textureProperties = properties.get(texture);
-                       if (!renderTarget) return;
-
-                       if (textureProperties.__webglTexture !== undefined) {
-                               _gl.deleteTexture(textureProperties.__webglTexture);
-
-                               info.memory.textures--;
-                       }
-
-                       if (renderTarget.depthTexture) {
-                               renderTarget.depthTexture.dispose();
-                       }
-
-                       if (renderTarget.isWebGLCubeRenderTarget) {
-                               for (let i = 0; i < 6; i++) {
-                                       _gl.deleteFramebuffer(renderTargetProperties.__webglFramebuffer[i]);
-
-                                       if (renderTargetProperties.__webglDepthbuffer) _gl.deleteRenderbuffer(renderTargetProperties.__webglDepthbuffer[i]);
-                               }
-                       } else {
-                               _gl.deleteFramebuffer(renderTargetProperties.__webglFramebuffer);
-
-                               if (renderTargetProperties.__webglDepthbuffer) _gl.deleteRenderbuffer(renderTargetProperties.__webglDepthbuffer);
-                               if (renderTargetProperties.__webglMultisampledFramebuffer) _gl.deleteFramebuffer(renderTargetProperties.__webglMultisampledFramebuffer);
-                               if (renderTargetProperties.__webglColorRenderbuffer) _gl.deleteRenderbuffer(renderTargetProperties.__webglColorRenderbuffer);
-                               if (renderTargetProperties.__webglDepthRenderbuffer) _gl.deleteRenderbuffer(renderTargetProperties.__webglDepthRenderbuffer);
-                       }
-
-                       if (renderTarget.isWebGLMultipleRenderTargets) {
-                               for (let i = 0, il = texture.length; i < il; i++) {
-                                       const attachmentProperties = properties.get(texture[i]);
-
-                                       if (attachmentProperties.__webglTexture) {
-                                               _gl.deleteTexture(attachmentProperties.__webglTexture);
-
-                                               info.memory.textures--;
-                                       }
-
-                                       properties.remove(texture[i]);
-                               }
-                       }
-
-                       properties.remove(texture);
-                       properties.remove(renderTarget);
-               } //
-
-
-               let textureUnits = 0;
-
-               function resetTextureUnits() {
-                       textureUnits = 0;
-               }
-
-               function allocateTextureUnit() {
-                       const textureUnit = textureUnits;
-
-                       if (textureUnit >= maxTextures) {
-                               console.warn('THREE.WebGLTextures: Trying to use ' + textureUnit + ' texture units while this GPU supports only ' + maxTextures);
-                       }
-
-                       textureUnits += 1;
-                       return textureUnit;
-               } //
-
-
-               function setTexture2D(texture, slot) {
-                       const textureProperties = properties.get(texture);
-                       if (texture.isVideoTexture) updateVideoTexture(texture);
-
-                       if (texture.version > 0 && textureProperties.__version !== texture.version) {
-                               const image = texture.image;
-
-                               if (image === undefined) {
-                                       console.warn('THREE.WebGLRenderer: Texture marked for update but image is undefined');
-                               } else if (image.complete === false) {
-                                       console.warn('THREE.WebGLRenderer: Texture marked for update but image is incomplete');
-                               } else {
-                                       uploadTexture(textureProperties, texture, slot);
-                                       return;
-                               }
-                       }
-
-                       state.activeTexture(_gl.TEXTURE0 + slot);
-                       state.bindTexture(_gl.TEXTURE_2D, textureProperties.__webglTexture);
-               }
-
-               function setTexture2DArray(texture, slot) {
-                       const textureProperties = properties.get(texture);
-
-                       if (texture.version > 0 && textureProperties.__version !== texture.version) {
-                               uploadTexture(textureProperties, texture, slot);
-                               return;
-                       }
-
-                       state.activeTexture(_gl.TEXTURE0 + slot);
-                       state.bindTexture(_gl.TEXTURE_2D_ARRAY, textureProperties.__webglTexture);
-               }
-
-               function setTexture3D(texture, slot) {
-                       const textureProperties = properties.get(texture);
-
-                       if (texture.version > 0 && textureProperties.__version !== texture.version) {
-                               uploadTexture(textureProperties, texture, slot);
-                               return;
-                       }
-
-                       state.activeTexture(_gl.TEXTURE0 + slot);
-                       state.bindTexture(_gl.TEXTURE_3D, textureProperties.__webglTexture);
-               }
-
-               function setTextureCube(texture, slot) {
-                       const textureProperties = properties.get(texture);
-
-                       if (texture.version > 0 && textureProperties.__version !== texture.version) {
-                               uploadCubeTexture(textureProperties, texture, slot);
-                               return;
-                       }
-
-                       state.activeTexture(_gl.TEXTURE0 + slot);
-                       state.bindTexture(_gl.TEXTURE_CUBE_MAP, textureProperties.__webglTexture);
-               }
-
-               const wrappingToGL = {
-                       [RepeatWrapping]: _gl.REPEAT,
-                       [ClampToEdgeWrapping]: _gl.CLAMP_TO_EDGE,
-                       [MirroredRepeatWrapping]: _gl.MIRRORED_REPEAT
-               };
-               const filterToGL = {
-                       [NearestFilter]: _gl.NEAREST,
-                       [NearestMipmapNearestFilter]: _gl.NEAREST_MIPMAP_NEAREST,
-                       [NearestMipmapLinearFilter]: _gl.NEAREST_MIPMAP_LINEAR,
-                       [LinearFilter]: _gl.LINEAR,
-                       [LinearMipmapNearestFilter]: _gl.LINEAR_MIPMAP_NEAREST,
-                       [LinearMipmapLinearFilter]: _gl.LINEAR_MIPMAP_LINEAR
-               };
-
-               function setTextureParameters(textureType, texture, supportsMips) {
-                       if (supportsMips) {
-                               _gl.texParameteri(textureType, _gl.TEXTURE_WRAP_S, wrappingToGL[texture.wrapS]);
-
-                               _gl.texParameteri(textureType, _gl.TEXTURE_WRAP_T, wrappingToGL[texture.wrapT]);
-
-                               if (textureType === _gl.TEXTURE_3D || textureType === _gl.TEXTURE_2D_ARRAY) {
-                                       _gl.texParameteri(textureType, _gl.TEXTURE_WRAP_R, wrappingToGL[texture.wrapR]);
-                               }
-
-                               _gl.texParameteri(textureType, _gl.TEXTURE_MAG_FILTER, filterToGL[texture.magFilter]);
-
-                               _gl.texParameteri(textureType, _gl.TEXTURE_MIN_FILTER, filterToGL[texture.minFilter]);
-                       } else {
-                               _gl.texParameteri(textureType, _gl.TEXTURE_WRAP_S, _gl.CLAMP_TO_EDGE);
-
-                               _gl.texParameteri(textureType, _gl.TEXTURE_WRAP_T, _gl.CLAMP_TO_EDGE);
-
-                               if (textureType === _gl.TEXTURE_3D || textureType === _gl.TEXTURE_2D_ARRAY) {
-                                       _gl.texParameteri(textureType, _gl.TEXTURE_WRAP_R, _gl.CLAMP_TO_EDGE);
-                               }
-
-                               if (texture.wrapS !== ClampToEdgeWrapping || texture.wrapT !== ClampToEdgeWrapping) {
-                                       console.warn('THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping.');
-                               }
-
-                               _gl.texParameteri(textureType, _gl.TEXTURE_MAG_FILTER, filterFallback(texture.magFilter));
-
-                               _gl.texParameteri(textureType, _gl.TEXTURE_MIN_FILTER, filterFallback(texture.minFilter));
-
-                               if (texture.minFilter !== NearestFilter && texture.minFilter !== LinearFilter) {
-                                       console.warn('THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.');
-                               }
-                       }
-
-                       if (extensions.has('EXT_texture_filter_anisotropic') === true) {
-                               const extension = extensions.get('EXT_texture_filter_anisotropic');
-                               if (texture.type === FloatType && extensions.has('OES_texture_float_linear') === false) return; // verify extension for WebGL 1 and WebGL 2
-
-                               if (isWebGL2 === false && texture.type === HalfFloatType && extensions.has('OES_texture_half_float_linear') === false) return; // verify extension for WebGL 1 only
-
-                               if (texture.anisotropy > 1 || properties.get(texture).__currentAnisotropy) {
-                                       _gl.texParameterf(textureType, extension.TEXTURE_MAX_ANISOTROPY_EXT, Math.min(texture.anisotropy, capabilities.getMaxAnisotropy()));
-
-                                       properties.get(texture).__currentAnisotropy = texture.anisotropy;
-                               }
-                       }
-               }
-
-               function initTexture(textureProperties, texture) {
-                       if (textureProperties.__webglInit === undefined) {
-                               textureProperties.__webglInit = true;
-                               texture.addEventListener('dispose', onTextureDispose);
-                               textureProperties.__webglTexture = _gl.createTexture();
-                               info.memory.textures++;
-                       }
-               }
-
-               function uploadTexture(textureProperties, texture, slot) {
-                       let textureType = _gl.TEXTURE_2D;
-                       if (texture.isDataTexture2DArray) textureType = _gl.TEXTURE_2D_ARRAY;
-                       if (texture.isDataTexture3D) textureType = _gl.TEXTURE_3D;
-                       initTexture(textureProperties, texture);
-                       state.activeTexture(_gl.TEXTURE0 + slot);
-                       state.bindTexture(textureType, textureProperties.__webglTexture);
-
-                       _gl.pixelStorei(_gl.UNPACK_FLIP_Y_WEBGL, texture.flipY);
-
-                       _gl.pixelStorei(_gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, texture.premultiplyAlpha);
-
-                       _gl.pixelStorei(_gl.UNPACK_ALIGNMENT, texture.unpackAlignment);
-
-                       _gl.pixelStorei(_gl.UNPACK_COLORSPACE_CONVERSION_WEBGL, _gl.NONE);
-
-                       const needsPowerOfTwo = textureNeedsPowerOfTwo(texture) && isPowerOfTwo$1(texture.image) === false;
-                       const image = resizeImage(texture.image, needsPowerOfTwo, false, maxTextureSize);
-                       const supportsMips = isPowerOfTwo$1(image) || isWebGL2,
-                                               glFormat = utils.convert(texture.format);
-                       let glType = utils.convert(texture.type),
-                                       glInternalFormat = getInternalFormat(texture.internalFormat, glFormat, glType);
-                       setTextureParameters(textureType, texture, supportsMips);
-                       let mipmap;
-                       const mipmaps = texture.mipmaps;
-
-                       if (texture.isDepthTexture) {
-                               // populate depth texture with dummy data
-                               glInternalFormat = _gl.DEPTH_COMPONENT;
-
-                               if (isWebGL2) {
-                                       if (texture.type === FloatType) {
-                                               glInternalFormat = _gl.DEPTH_COMPONENT32F;
-                                       } else if (texture.type === UnsignedIntType) {
-                                               glInternalFormat = _gl.DEPTH_COMPONENT24;
-                                       } else if (texture.type === UnsignedInt248Type) {
-                                               glInternalFormat = _gl.DEPTH24_STENCIL8;
-                                       } else {
-                                               glInternalFormat = _gl.DEPTH_COMPONENT16; // WebGL2 requires sized internalformat for glTexImage2D
-                                       }
-                               } else {
-                                       if (texture.type === FloatType) {
-                                               console.error('WebGLRenderer: Floating point depth texture requires WebGL2.');
-                                       }
-                               } // validation checks for WebGL 1
-
-
-                               if (texture.format === DepthFormat && glInternalFormat === _gl.DEPTH_COMPONENT) {
-                                       // The error INVALID_OPERATION is generated by texImage2D if format and internalformat are
-                                       // DEPTH_COMPONENT and type is not UNSIGNED_SHORT or UNSIGNED_INT
-                                       // (https://www.khronos.org/registry/webgl/extensions/WEBGL_depth_texture/)
-                                       if (texture.type !== UnsignedShortType && texture.type !== UnsignedIntType) {
-                                               console.warn('THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture.');
-                                               texture.type = UnsignedShortType;
-                                               glType = utils.convert(texture.type);
-                                       }
-                               }
-
-                               if (texture.format === DepthStencilFormat && glInternalFormat === _gl.DEPTH_COMPONENT) {
-                                       // Depth stencil textures need the DEPTH_STENCIL internal format
-                                       // (https://www.khronos.org/registry/webgl/extensions/WEBGL_depth_texture/)
-                                       glInternalFormat = _gl.DEPTH_STENCIL; // The error INVALID_OPERATION is generated by texImage2D if format and internalformat are
-                                       // DEPTH_STENCIL and type is not UNSIGNED_INT_24_8_WEBGL.
-                                       // (https://www.khronos.org/registry/webgl/extensions/WEBGL_depth_texture/)
-
-                                       if (texture.type !== UnsignedInt248Type) {
-                                               console.warn('THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture.');
-                                               texture.type = UnsignedInt248Type;
-                                               glType = utils.convert(texture.type);
-                                       }
-                               } //
-
-
-                               state.texImage2D(_gl.TEXTURE_2D, 0, glInternalFormat, image.width, image.height, 0, glFormat, glType, null);
-                       } else if (texture.isDataTexture) {
-                               // use manually created mipmaps if available
-                               // if there are no manual mipmaps
-                               // set 0 level mipmap and then use GL to generate other mipmap levels
-                               if (mipmaps.length > 0 && supportsMips) {
-                                       for (let i = 0, il = mipmaps.length; i < il; i++) {
-                                               mipmap = mipmaps[i];
-                                               state.texImage2D(_gl.TEXTURE_2D, i, glInternalFormat, mipmap.width, mipmap.height, 0, glFormat, glType, mipmap.data);
-                                       }
-
-                                       texture.generateMipmaps = false;
-                                       textureProperties.__maxMipLevel = mipmaps.length - 1;
-                               } else {
-                                       state.texImage2D(_gl.TEXTURE_2D, 0, glInternalFormat, image.width, image.height, 0, glFormat, glType, image.data);
-                                       textureProperties.__maxMipLevel = 0;
-                               }
-                       } else if (texture.isCompressedTexture) {
-                               for (let i = 0, il = mipmaps.length; i < il; i++) {
-                                       mipmap = mipmaps[i];
-
-                                       if (texture.format !== RGBAFormat && texture.format !== RGBFormat) {
-                                               if (glFormat !== null) {
-                                                       state.compressedTexImage2D(_gl.TEXTURE_2D, i, glInternalFormat, mipmap.width, mipmap.height, 0, mipmap.data);
-                                               } else {
-                                                       console.warn('THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()');
-                                               }
-                                       } else {
-                                               state.texImage2D(_gl.TEXTURE_2D, i, glInternalFormat, mipmap.width, mipmap.height, 0, glFormat, glType, mipmap.data);
-                                       }
-                               }
-
-                               textureProperties.__maxMipLevel = mipmaps.length - 1;
-                       } else if (texture.isDataTexture2DArray) {
-                               state.texImage3D(_gl.TEXTURE_2D_ARRAY, 0, glInternalFormat, image.width, image.height, image.depth, 0, glFormat, glType, image.data);
-                               textureProperties.__maxMipLevel = 0;
-                       } else if (texture.isDataTexture3D) {
-                               state.texImage3D(_gl.TEXTURE_3D, 0, glInternalFormat, image.width, image.height, image.depth, 0, glFormat, glType, image.data);
-                               textureProperties.__maxMipLevel = 0;
-                       } else {
-                               // regular Texture (image, video, canvas)
-                               // use manually created mipmaps if available
-                               // if there are no manual mipmaps
-                               // set 0 level mipmap and then use GL to generate other mipmap levels
-                               if (mipmaps.length > 0 && supportsMips) {
-                                       for (let i = 0, il = mipmaps.length; i < il; i++) {
-                                               mipmap = mipmaps[i];
-                                               state.texImage2D(_gl.TEXTURE_2D, i, glInternalFormat, glFormat, glType, mipmap);
-                                       }
-
-                                       texture.generateMipmaps = false;
-                                       textureProperties.__maxMipLevel = mipmaps.length - 1;
-                               } else {
-                                       state.texImage2D(_gl.TEXTURE_2D, 0, glInternalFormat, glFormat, glType, image);
-                                       textureProperties.__maxMipLevel = 0;
-                               }
-                       }
-
-                       if (textureNeedsGenerateMipmaps(texture, supportsMips)) {
-                               generateMipmap(textureType, texture, image.width, image.height);
-                       }
-
-                       textureProperties.__version = texture.version;
-                       if (texture.onUpdate) texture.onUpdate(texture);
-               }
-
-               function uploadCubeTexture(textureProperties, texture, slot) {
-                       if (texture.image.length !== 6) return;
-                       initTexture(textureProperties, texture);
-                       state.activeTexture(_gl.TEXTURE0 + slot);
-                       state.bindTexture(_gl.TEXTURE_CUBE_MAP, textureProperties.__webglTexture);
-
-                       _gl.pixelStorei(_gl.UNPACK_FLIP_Y_WEBGL, texture.flipY);
-
-                       _gl.pixelStorei(_gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, texture.premultiplyAlpha);
-
-                       _gl.pixelStorei(_gl.UNPACK_ALIGNMENT, texture.unpackAlignment);
-
-                       _gl.pixelStorei(_gl.UNPACK_COLORSPACE_CONVERSION_WEBGL, _gl.NONE);
-
-                       const isCompressed = texture && (texture.isCompressedTexture || texture.image[0].isCompressedTexture);
-                       const isDataTexture = texture.image[0] && texture.image[0].isDataTexture;
-                       const cubeImage = [];
-
-                       for (let i = 0; i < 6; i++) {
-                               if (!isCompressed && !isDataTexture) {
-                                       cubeImage[i] = resizeImage(texture.image[i], false, true, maxCubemapSize);
-                               } else {
-                                       cubeImage[i] = isDataTexture ? texture.image[i].image : texture.image[i];
-                               }
-                       }
-
-                       const image = cubeImage[0],
-                                               supportsMips = isPowerOfTwo$1(image) || isWebGL2,
-                                               glFormat = utils.convert(texture.format),
-                                               glType = utils.convert(texture.type),
-                                               glInternalFormat = getInternalFormat(texture.internalFormat, glFormat, glType);
-                       setTextureParameters(_gl.TEXTURE_CUBE_MAP, texture, supportsMips);
-                       let mipmaps;
-
-                       if (isCompressed) {
-                               for (let i = 0; i < 6; i++) {
-                                       mipmaps = cubeImage[i].mipmaps;
-
-                                       for (let j = 0; j < mipmaps.length; j++) {
-                                               const mipmap = mipmaps[j];
-
-                                               if (texture.format !== RGBAFormat && texture.format !== RGBFormat) {
-                                                       if (glFormat !== null) {
-                                                               state.compressedTexImage2D(_gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, j, glInternalFormat, mipmap.width, mipmap.height, 0, mipmap.data);
-                                                       } else {
-                                                               console.warn('THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()');
-                                                       }
-                                               } else {
-                                                       state.texImage2D(_gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, j, glInternalFormat, mipmap.width, mipmap.height, 0, glFormat, glType, mipmap.data);
-                                               }
-                                       }
-                               }
-
-                               textureProperties.__maxMipLevel = mipmaps.length - 1;
-                       } else {
-                               mipmaps = texture.mipmaps;
-
-                               for (let i = 0; i < 6; i++) {
-                                       if (isDataTexture) {
-                                               state.texImage2D(_gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, 0, glInternalFormat, cubeImage[i].width, cubeImage[i].height, 0, glFormat, glType, cubeImage[i].data);
-
-                                               for (let j = 0; j < mipmaps.length; j++) {
-                                                       const mipmap = mipmaps[j];
-                                                       const mipmapImage = mipmap.image[i].image;
-                                                       state.texImage2D(_gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, j + 1, glInternalFormat, mipmapImage.width, mipmapImage.height, 0, glFormat, glType, mipmapImage.data);
-                                               }
-                                       } else {
-                                               state.texImage2D(_gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, 0, glInternalFormat, glFormat, glType, cubeImage[i]);
-
-                                               for (let j = 0; j < mipmaps.length; j++) {
-                                                       const mipmap = mipmaps[j];
-                                                       state.texImage2D(_gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, j + 1, glInternalFormat, glFormat, glType, mipmap.image[i]);
-                                               }
-                                       }
-                               }
-
-                               textureProperties.__maxMipLevel = mipmaps.length;
-                       }
-
-                       if (textureNeedsGenerateMipmaps(texture, supportsMips)) {
-                               // We assume images for cube map have the same size.
-                               generateMipmap(_gl.TEXTURE_CUBE_MAP, texture, image.width, image.height);
-                       }
-
-                       textureProperties.__version = texture.version;
-                       if (texture.onUpdate) texture.onUpdate(texture);
-               } // Render targets
-               // Setup storage for target texture and bind it to correct framebuffer
-
-
-               function setupFrameBufferTexture(framebuffer, renderTarget, texture, attachment, textureTarget) {
-                       const glFormat = utils.convert(texture.format);
-                       const glType = utils.convert(texture.type);
-                       const glInternalFormat = getInternalFormat(texture.internalFormat, glFormat, glType);
-
-                       if (textureTarget === _gl.TEXTURE_3D || textureTarget === _gl.TEXTURE_2D_ARRAY) {
-                               state.texImage3D(textureTarget, 0, glInternalFormat, renderTarget.width, renderTarget.height, renderTarget.depth, 0, glFormat, glType, null);
-                       } else {
-                               state.texImage2D(textureTarget, 0, glInternalFormat, renderTarget.width, renderTarget.height, 0, glFormat, glType, null);
-                       }
-
-                       state.bindFramebuffer(_gl.FRAMEBUFFER, framebuffer);
-
-                       _gl.framebufferTexture2D(_gl.FRAMEBUFFER, attachment, textureTarget, properties.get(texture).__webglTexture, 0);
-
-                       state.bindFramebuffer(_gl.FRAMEBUFFER, null);
-               } // Setup storage for internal depth/stencil buffers and bind to correct framebuffer
-
-
-               function setupRenderBufferStorage(renderbuffer, renderTarget, isMultisample) {
-                       _gl.bindRenderbuffer(_gl.RENDERBUFFER, renderbuffer);
-
-                       if (renderTarget.depthBuffer && !renderTarget.stencilBuffer) {
-                               let glInternalFormat = _gl.DEPTH_COMPONENT16;
-
-                               if (isMultisample) {
-                                       const depthTexture = renderTarget.depthTexture;
-
-                                       if (depthTexture && depthTexture.isDepthTexture) {
-                                               if (depthTexture.type === FloatType) {
-                                                       glInternalFormat = _gl.DEPTH_COMPONENT32F;
-                                               } else if (depthTexture.type === UnsignedIntType) {
-                                                       glInternalFormat = _gl.DEPTH_COMPONENT24;
-                                               }
-                                       }
-
-                                       const samples = getRenderTargetSamples(renderTarget);
-
-                                       _gl.renderbufferStorageMultisample(_gl.RENDERBUFFER, samples, glInternalFormat, renderTarget.width, renderTarget.height);
-                               } else {
-                                       _gl.renderbufferStorage(_gl.RENDERBUFFER, glInternalFormat, renderTarget.width, renderTarget.height);
-                               }
-
-                               _gl.framebufferRenderbuffer(_gl.FRAMEBUFFER, _gl.DEPTH_ATTACHMENT, _gl.RENDERBUFFER, renderbuffer);
-                       } else if (renderTarget.depthBuffer && renderTarget.stencilBuffer) {
-                               if (isMultisample) {
-                                       const samples = getRenderTargetSamples(renderTarget);
-
-                                       _gl.renderbufferStorageMultisample(_gl.RENDERBUFFER, samples, _gl.DEPTH24_STENCIL8, renderTarget.width, renderTarget.height);
-                               } else {
-                                       _gl.renderbufferStorage(_gl.RENDERBUFFER, _gl.DEPTH_STENCIL, renderTarget.width, renderTarget.height);
-                               }
-
-                               _gl.framebufferRenderbuffer(_gl.FRAMEBUFFER, _gl.DEPTH_STENCIL_ATTACHMENT, _gl.RENDERBUFFER, renderbuffer);
-                       } else {
-                               // Use the first texture for MRT so far
-                               const texture = renderTarget.isWebGLMultipleRenderTargets === true ? renderTarget.texture[0] : renderTarget.texture;
-                               const glFormat = utils.convert(texture.format);
-                               const glType = utils.convert(texture.type);
-                               const glInternalFormat = getInternalFormat(texture.internalFormat, glFormat, glType);
-
-                               if (isMultisample) {
-                                       const samples = getRenderTargetSamples(renderTarget);
-
-                                       _gl.renderbufferStorageMultisample(_gl.RENDERBUFFER, samples, glInternalFormat, renderTarget.width, renderTarget.height);
-                               } else {
-                                       _gl.renderbufferStorage(_gl.RENDERBUFFER, glInternalFormat, renderTarget.width, renderTarget.height);
-                               }
-                       }
-
-                       _gl.bindRenderbuffer(_gl.RENDERBUFFER, null);
-               } // Setup resources for a Depth Texture for a FBO (needs an extension)
-
-
-               function setupDepthTexture(framebuffer, renderTarget) {
-                       const isCube = renderTarget && renderTarget.isWebGLCubeRenderTarget;
-                       if (isCube) throw new Error('Depth Texture with cube render targets is not supported');
-                       state.bindFramebuffer(_gl.FRAMEBUFFER, framebuffer);
-
-                       if (!(renderTarget.depthTexture && renderTarget.depthTexture.isDepthTexture)) {
-                               throw new Error('renderTarget.depthTexture must be an instance of THREE.DepthTexture');
-                       } // upload an empty depth texture with framebuffer size
-
-
-                       if (!properties.get(renderTarget.depthTexture).__webglTexture || renderTarget.depthTexture.image.width !== renderTarget.width || renderTarget.depthTexture.image.height !== renderTarget.height) {
-                               renderTarget.depthTexture.image.width = renderTarget.width;
-                               renderTarget.depthTexture.image.height = renderTarget.height;
-                               renderTarget.depthTexture.needsUpdate = true;
-                       }
-
-                       setTexture2D(renderTarget.depthTexture, 0);
-
-                       const webglDepthTexture = properties.get(renderTarget.depthTexture).__webglTexture;
-
-                       if (renderTarget.depthTexture.format === DepthFormat) {
-                               _gl.framebufferTexture2D(_gl.FRAMEBUFFER, _gl.DEPTH_ATTACHMENT, _gl.TEXTURE_2D, webglDepthTexture, 0);
-                       } else if (renderTarget.depthTexture.format === DepthStencilFormat) {
-                               _gl.framebufferTexture2D(_gl.FRAMEBUFFER, _gl.DEPTH_STENCIL_ATTACHMENT, _gl.TEXTURE_2D, webglDepthTexture, 0);
-                       } else {
-                               throw new Error('Unknown depthTexture format');
-                       }
-               } // Setup GL resources for a non-texture depth buffer
-
-
-               function setupDepthRenderbuffer(renderTarget) {
-                       const renderTargetProperties = properties.get(renderTarget);
-                       const isCube = renderTarget.isWebGLCubeRenderTarget === true;
-
-                       if (renderTarget.depthTexture) {
-                               if (isCube) throw new Error('target.depthTexture not supported in Cube render targets');
-                               setupDepthTexture(renderTargetProperties.__webglFramebuffer, renderTarget);
-                       } else {
-                               if (isCube) {
-                                       renderTargetProperties.__webglDepthbuffer = [];
-
-                                       for (let i = 0; i < 6; i++) {
-                                               state.bindFramebuffer(_gl.FRAMEBUFFER, renderTargetProperties.__webglFramebuffer[i]);
-                                               renderTargetProperties.__webglDepthbuffer[i] = _gl.createRenderbuffer();
-                                               setupRenderBufferStorage(renderTargetProperties.__webglDepthbuffer[i], renderTarget, false);
-                                       }
-                               } else {
-                                       state.bindFramebuffer(_gl.FRAMEBUFFER, renderTargetProperties.__webglFramebuffer);
-                                       renderTargetProperties.__webglDepthbuffer = _gl.createRenderbuffer();
-                                       setupRenderBufferStorage(renderTargetProperties.__webglDepthbuffer, renderTarget, false);
-                               }
-                       }
-
-                       state.bindFramebuffer(_gl.FRAMEBUFFER, null);
-               } // Set up GL resources for the render target
-
-
-               function setupRenderTarget(renderTarget) {
-                       const texture = renderTarget.texture;
-                       const renderTargetProperties = properties.get(renderTarget);
-                       const textureProperties = properties.get(texture);
-                       renderTarget.addEventListener('dispose', onRenderTargetDispose);
-
-                       if (renderTarget.isWebGLMultipleRenderTargets !== true) {
-                               textureProperties.__webglTexture = _gl.createTexture();
-                               textureProperties.__version = texture.version;
-                               info.memory.textures++;
-                       }
-
-                       const isCube = renderTarget.isWebGLCubeRenderTarget === true;
-                       const isMultipleRenderTargets = renderTarget.isWebGLMultipleRenderTargets === true;
-                       const isMultisample = renderTarget.isWebGLMultisampleRenderTarget === true;
-                       const isRenderTarget3D = texture.isDataTexture3D || texture.isDataTexture2DArray;
-                       const supportsMips = isPowerOfTwo$1(renderTarget) || isWebGL2; // Handles WebGL2 RGBFormat fallback - #18858
-
-                       if (isWebGL2 && texture.format === RGBFormat && (texture.type === FloatType || texture.type === HalfFloatType)) {
-                               texture.format = RGBAFormat;
-                               console.warn('THREE.WebGLRenderer: Rendering to textures with RGB format is not supported. Using RGBA format instead.');
-                       } // Setup framebuffer
-
-
-                       if (isCube) {
-                               renderTargetProperties.__webglFramebuffer = [];
-
-                               for (let i = 0; i < 6; i++) {
-                                       renderTargetProperties.__webglFramebuffer[i] = _gl.createFramebuffer();
-                               }
-                       } else {
-                               renderTargetProperties.__webglFramebuffer = _gl.createFramebuffer();
-
-                               if (isMultipleRenderTargets) {
-                                       if (capabilities.drawBuffers) {
-                                               const textures = renderTarget.texture;
-
-                                               for (let i = 0, il = textures.length; i < il; i++) {
-                                                       const attachmentProperties = properties.get(textures[i]);
-
-                                                       if (attachmentProperties.__webglTexture === undefined) {
-                                                               attachmentProperties.__webglTexture = _gl.createTexture();
-                                                               info.memory.textures++;
-                                                       }
-                                               }
-                                       } else {
-                                               console.warn('THREE.WebGLRenderer: WebGLMultipleRenderTargets can only be used with WebGL2 or WEBGL_draw_buffers extension.');
-                                       }
-                               } else if (isMultisample) {
-                                       if (isWebGL2) {
-                                               renderTargetProperties.__webglMultisampledFramebuffer = _gl.createFramebuffer();
-                                               renderTargetProperties.__webglColorRenderbuffer = _gl.createRenderbuffer();
-
-                                               _gl.bindRenderbuffer(_gl.RENDERBUFFER, renderTargetProperties.__webglColorRenderbuffer);
-
-                                               const glFormat = utils.convert(texture.format);
-                                               const glType = utils.convert(texture.type);
-                                               const glInternalFormat = getInternalFormat(texture.internalFormat, glFormat, glType);
-                                               const samples = getRenderTargetSamples(renderTarget);
-
-                                               _gl.renderbufferStorageMultisample(_gl.RENDERBUFFER, samples, glInternalFormat, renderTarget.width, renderTarget.height);
-
-                                               state.bindFramebuffer(_gl.FRAMEBUFFER, renderTargetProperties.__webglMultisampledFramebuffer);
-
-                                               _gl.framebufferRenderbuffer(_gl.FRAMEBUFFER, _gl.COLOR_ATTACHMENT0, _gl.RENDERBUFFER, renderTargetProperties.__webglColorRenderbuffer);
-
-                                               _gl.bindRenderbuffer(_gl.RENDERBUFFER, null);
-
-                                               if (renderTarget.depthBuffer) {
-                                                       renderTargetProperties.__webglDepthRenderbuffer = _gl.createRenderbuffer();
-                                                       setupRenderBufferStorage(renderTargetProperties.__webglDepthRenderbuffer, renderTarget, true);
-                                               }
-
-                                               state.bindFramebuffer(_gl.FRAMEBUFFER, null);
-                                       } else {
-                                               console.warn('THREE.WebGLRenderer: WebGLMultisampleRenderTarget can only be used with WebGL2.');
-                                       }
-                               }
-                       } // Setup color buffer
-
-
-                       if (isCube) {
-                               state.bindTexture(_gl.TEXTURE_CUBE_MAP, textureProperties.__webglTexture);
-                               setTextureParameters(_gl.TEXTURE_CUBE_MAP, texture, supportsMips);
-
-                               for (let i = 0; i < 6; i++) {
-                                       setupFrameBufferTexture(renderTargetProperties.__webglFramebuffer[i], renderTarget, texture, _gl.COLOR_ATTACHMENT0, _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i);
-                               }
-
-                               if (textureNeedsGenerateMipmaps(texture, supportsMips)) {
-                                       generateMipmap(_gl.TEXTURE_CUBE_MAP, texture, renderTarget.width, renderTarget.height);
-                               }
-
-                               state.unbindTexture();
-                       } else if (isMultipleRenderTargets) {
-                               const textures = renderTarget.texture;
-
-                               for (let i = 0, il = textures.length; i < il; i++) {
-                                       const attachment = textures[i];
-                                       const attachmentProperties = properties.get(attachment);
-                                       state.bindTexture(_gl.TEXTURE_2D, attachmentProperties.__webglTexture);
-                                       setTextureParameters(_gl.TEXTURE_2D, attachment, supportsMips);
-                                       setupFrameBufferTexture(renderTargetProperties.__webglFramebuffer, renderTarget, attachment, _gl.COLOR_ATTACHMENT0 + i, _gl.TEXTURE_2D);
-
-                                       if (textureNeedsGenerateMipmaps(attachment, supportsMips)) {
-                                               generateMipmap(_gl.TEXTURE_2D, attachment, renderTarget.width, renderTarget.height);
-                                       }
-                               }
-
-                               state.unbindTexture();
-                       } else {
-                               let glTextureType = _gl.TEXTURE_2D;
-
-                               if (isRenderTarget3D) {
-                                       // Render targets containing layers, i.e: Texture 3D and 2d arrays
-                                       if (isWebGL2) {
-                                               const isTexture3D = texture.isDataTexture3D;
-                                               glTextureType = isTexture3D ? _gl.TEXTURE_3D : _gl.TEXTURE_2D_ARRAY;
-                                       } else {
-                                               console.warn('THREE.DataTexture3D and THREE.DataTexture2DArray only supported with WebGL2.');
-                                       }
-                               }
-
-                               state.bindTexture(glTextureType, textureProperties.__webglTexture);
-                               setTextureParameters(glTextureType, texture, supportsMips);
-                               setupFrameBufferTexture(renderTargetProperties.__webglFramebuffer, renderTarget, texture, _gl.COLOR_ATTACHMENT0, glTextureType);
-
-                               if (textureNeedsGenerateMipmaps(texture, supportsMips)) {
-                                       generateMipmap(glTextureType, texture, renderTarget.width, renderTarget.height, renderTarget.depth);
-                               }
-
-                               state.unbindTexture();
-                       } // Setup depth and stencil buffers
-
-
-                       if (renderTarget.depthBuffer) {
-                               setupDepthRenderbuffer(renderTarget);
-                       }
-               }
-
-               function updateRenderTargetMipmap(renderTarget) {
-                       const supportsMips = isPowerOfTwo$1(renderTarget) || isWebGL2;
-                       const textures = renderTarget.isWebGLMultipleRenderTargets === true ? renderTarget.texture : [renderTarget.texture];
-
-                       for (let i = 0, il = textures.length; i < il; i++) {
-                               const texture = textures[i];
-
-                               if (textureNeedsGenerateMipmaps(texture, supportsMips)) {
-                                       const target = renderTarget.isWebGLCubeRenderTarget ? _gl.TEXTURE_CUBE_MAP : _gl.TEXTURE_2D;
-
-                                       const webglTexture = properties.get(texture).__webglTexture;
-
-                                       state.bindTexture(target, webglTexture);
-                                       generateMipmap(target, texture, renderTarget.width, renderTarget.height);
-                                       state.unbindTexture();
-                               }
-                       }
-               }
-
-               function updateMultisampleRenderTarget(renderTarget) {
-                       if (renderTarget.isWebGLMultisampleRenderTarget) {
-                               if (isWebGL2) {
-                                       const width = renderTarget.width;
-                                       const height = renderTarget.height;
-                                       let mask = _gl.COLOR_BUFFER_BIT;
-                                       if (renderTarget.depthBuffer) mask |= _gl.DEPTH_BUFFER_BIT;
-                                       if (renderTarget.stencilBuffer) mask |= _gl.STENCIL_BUFFER_BIT;
-                                       const renderTargetProperties = properties.get(renderTarget);
-                                       state.bindFramebuffer(_gl.READ_FRAMEBUFFER, renderTargetProperties.__webglMultisampledFramebuffer);
-                                       state.bindFramebuffer(_gl.DRAW_FRAMEBUFFER, renderTargetProperties.__webglFramebuffer);
-
-                                       _gl.blitFramebuffer(0, 0, width, height, 0, 0, width, height, mask, _gl.NEAREST);
-
-                                       state.bindFramebuffer(_gl.READ_FRAMEBUFFER, null);
-                                       state.bindFramebuffer(_gl.DRAW_FRAMEBUFFER, renderTargetProperties.__webglMultisampledFramebuffer);
-                               } else {
-                                       console.warn('THREE.WebGLRenderer: WebGLMultisampleRenderTarget can only be used with WebGL2.');
-                               }
-                       }
-               }
-
-               function getRenderTargetSamples(renderTarget) {
-                       return isWebGL2 && renderTarget.isWebGLMultisampleRenderTarget ? Math.min(maxSamples, renderTarget.samples) : 0;
-               }
-
-               function updateVideoTexture(texture) {
-                       const frame = info.render.frame; // Check the last frame we updated the VideoTexture
-
-                       if (_videoTextures.get(texture) !== frame) {
-                               _videoTextures.set(texture, frame);
-
-                               texture.update();
-                       }
-               } // backwards compatibility
-
-
-               let warnedTexture2D = false;
-               let warnedTextureCube = false;
-
-               function safeSetTexture2D(texture, slot) {
-                       if (texture && texture.isWebGLRenderTarget) {
-                               if (warnedTexture2D === false) {
-                                       console.warn('THREE.WebGLTextures.safeSetTexture2D: don\'t use render targets as textures. Use their .texture property instead.');
-                                       warnedTexture2D = true;
-                               }
-
-                               texture = texture.texture;
-                       }
-
-                       setTexture2D(texture, slot);
-               }
-
-               function safeSetTextureCube(texture, slot) {
-                       if (texture && texture.isWebGLCubeRenderTarget) {
-                               if (warnedTextureCube === false) {
-                                       console.warn('THREE.WebGLTextures.safeSetTextureCube: don\'t use cube render targets as textures. Use their .texture property instead.');
-                                       warnedTextureCube = true;
-                               }
-
-                               texture = texture.texture;
-                       }
-
-                       setTextureCube(texture, slot);
-               } //
-
-
-               this.allocateTextureUnit = allocateTextureUnit;
-               this.resetTextureUnits = resetTextureUnits;
-               this.setTexture2D = setTexture2D;
-               this.setTexture2DArray = setTexture2DArray;
-               this.setTexture3D = setTexture3D;
-               this.setTextureCube = setTextureCube;
-               this.setupRenderTarget = setupRenderTarget;
-               this.updateRenderTargetMipmap = updateRenderTargetMipmap;
-               this.updateMultisampleRenderTarget = updateMultisampleRenderTarget;
-               this.safeSetTexture2D = safeSetTexture2D;
-               this.safeSetTextureCube = safeSetTextureCube;
-       }
-
-       function WebGLUtils(gl, extensions, capabilities) {
-               const isWebGL2 = capabilities.isWebGL2;
-
-               function convert(p) {
-                       let extension;
-                       if (p === UnsignedByteType) return gl.UNSIGNED_BYTE;
-                       if (p === UnsignedShort4444Type) return gl.UNSIGNED_SHORT_4_4_4_4;
-                       if (p === UnsignedShort5551Type) return gl.UNSIGNED_SHORT_5_5_5_1;
-                       if (p === UnsignedShort565Type) return gl.UNSIGNED_SHORT_5_6_5;
-                       if (p === ByteType) return gl.BYTE;
-                       if (p === ShortType) return gl.SHORT;
-                       if (p === UnsignedShortType) return gl.UNSIGNED_SHORT;
-                       if (p === IntType) return gl.INT;
-                       if (p === UnsignedIntType) return gl.UNSIGNED_INT;
-                       if (p === FloatType) return gl.FLOAT;
-
-                       if (p === HalfFloatType) {
-                               if (isWebGL2) return gl.HALF_FLOAT;
-                               extension = extensions.get('OES_texture_half_float');
-
-                               if (extension !== null) {
-                                       return extension.HALF_FLOAT_OES;
-                               } else {
-                                       return null;
-                               }
-                       }
-
-                       if (p === AlphaFormat) return gl.ALPHA;
-                       if (p === RGBFormat) return gl.RGB;
-                       if (p === RGBAFormat) return gl.RGBA;
-                       if (p === LuminanceFormat) return gl.LUMINANCE;
-                       if (p === LuminanceAlphaFormat) return gl.LUMINANCE_ALPHA;
-                       if (p === DepthFormat) return gl.DEPTH_COMPONENT;
-                       if (p === DepthStencilFormat) return gl.DEPTH_STENCIL;
-                       if (p === RedFormat) return gl.RED; // WebGL2 formats.
-
-                       if (p === RedIntegerFormat) return gl.RED_INTEGER;
-                       if (p === RGFormat) return gl.RG;
-                       if (p === RGIntegerFormat) return gl.RG_INTEGER;
-                       if (p === RGBIntegerFormat) return gl.RGB_INTEGER;
-                       if (p === RGBAIntegerFormat) return gl.RGBA_INTEGER;
-
-                       if (p === RGB_S3TC_DXT1_Format || p === RGBA_S3TC_DXT1_Format || p === RGBA_S3TC_DXT3_Format || p === RGBA_S3TC_DXT5_Format) {
-                               extension = extensions.get('WEBGL_compressed_texture_s3tc');
-
-                               if (extension !== null) {
-                                       if (p === RGB_S3TC_DXT1_Format) return extension.COMPRESSED_RGB_S3TC_DXT1_EXT;
-                                       if (p === RGBA_S3TC_DXT1_Format) return extension.COMPRESSED_RGBA_S3TC_DXT1_EXT;
-                                       if (p === RGBA_S3TC_DXT3_Format) return extension.COMPRESSED_RGBA_S3TC_DXT3_EXT;
-                                       if (p === RGBA_S3TC_DXT5_Format) return extension.COMPRESSED_RGBA_S3TC_DXT5_EXT;
-                               } else {
-                                       return null;
-                               }
-                       }
-
-                       if (p === RGB_PVRTC_4BPPV1_Format || p === RGB_PVRTC_2BPPV1_Format || p === RGBA_PVRTC_4BPPV1_Format || p === RGBA_PVRTC_2BPPV1_Format) {
-                               extension = extensions.get('WEBGL_compressed_texture_pvrtc');
-
-                               if (extension !== null) {
-                                       if (p === RGB_PVRTC_4BPPV1_Format) return extension.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;
-                                       if (p === RGB_PVRTC_2BPPV1_Format) return extension.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;
-                                       if (p === RGBA_PVRTC_4BPPV1_Format) return extension.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;
-                                       if (p === RGBA_PVRTC_2BPPV1_Format) return extension.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG;
-                               } else {
-                                       return null;
-                               }
-                       }
-
-                       if (p === RGB_ETC1_Format) {
-                               extension = extensions.get('WEBGL_compressed_texture_etc1');
-
-                               if (extension !== null) {
-                                       return extension.COMPRESSED_RGB_ETC1_WEBGL;
-                               } else {
-                                       return null;
-                               }
-                       }
-
-                       if (p === RGB_ETC2_Format || p === RGBA_ETC2_EAC_Format) {
-                               extension = extensions.get('WEBGL_compressed_texture_etc');
-
-                               if (extension !== null) {
-                                       if (p === RGB_ETC2_Format) return extension.COMPRESSED_RGB8_ETC2;
-                                       if (p === RGBA_ETC2_EAC_Format) return extension.COMPRESSED_RGBA8_ETC2_EAC;
-                               }
-                       }
-
-                       if (p === RGBA_ASTC_4x4_Format || p === RGBA_ASTC_5x4_Format || p === RGBA_ASTC_5x5_Format || p === RGBA_ASTC_6x5_Format || p === RGBA_ASTC_6x6_Format || p === RGBA_ASTC_8x5_Format || p === RGBA_ASTC_8x6_Format || p === RGBA_ASTC_8x8_Format || p === RGBA_ASTC_10x5_Format || p === RGBA_ASTC_10x6_Format || p === RGBA_ASTC_10x8_Format || p === RGBA_ASTC_10x10_Format || p === RGBA_ASTC_12x10_Format || p === RGBA_ASTC_12x12_Format || p === SRGB8_ALPHA8_ASTC_4x4_Format || p === SRGB8_ALPHA8_ASTC_5x4_Format || p === SRGB8_ALPHA8_ASTC_5x5_Format || p === SRGB8_ALPHA8_ASTC_6x5_Format || p === SRGB8_ALPHA8_ASTC_6x6_Format || p === SRGB8_ALPHA8_ASTC_8x5_Format || p === SRGB8_ALPHA8_ASTC_8x6_Format || p === SRGB8_ALPHA8_ASTC_8x8_Format || p === SRGB8_ALPHA8_ASTC_10x5_Format || p === SRGB8_ALPHA8_ASTC_10x6_Format || p === SRGB8_ALPHA8_ASTC_10x8_Format || p === SRGB8_ALPHA8_ASTC_10x10_Format || p === SRGB8_ALPHA8_ASTC_12x10_Format || p === SRGB8_ALPHA8_ASTC_12x12_Format) {
-                               extension = extensions.get('WEBGL_compressed_texture_astc');
-
-                               if (extension !== null) {
-                                       // TODO Complete?
-                                       return p;
-                               } else {
-                                       return null;
-                               }
-                       }
-
-                       if (p === RGBA_BPTC_Format) {
-                               extension = extensions.get('EXT_texture_compression_bptc');
-
-                               if (extension !== null) {
-                                       // TODO Complete?
-                                       return p;
-                               } else {
-                                       return null;
-                               }
-                       }
-
-                       if (p === UnsignedInt248Type) {
-                               if (isWebGL2) return gl.UNSIGNED_INT_24_8;
-                               extension = extensions.get('WEBGL_depth_texture');
-
-                               if (extension !== null) {
-                                       return extension.UNSIGNED_INT_24_8_WEBGL;
-                               } else {
-                                       return null;
-                               }
-                       }
-               }
-
-               return {
-                       convert: convert
-               };
-       }
-
-       class ArrayCamera extends PerspectiveCamera {
-               constructor(array = []) {
-                       super();
-                       this.cameras = array;
-               }
-
-       }
-
-       ArrayCamera.prototype.isArrayCamera = true;
-
-       class Group extends Object3D {
-               constructor() {
-                       super();
-                       this.type = 'Group';
-               }
-
-       }
-
-       Group.prototype.isGroup = true;
-
-       const _moveEvent = {
-               type: 'move'
-       };
-
-       class WebXRController {
-               constructor() {
-                       this._targetRay = null;
-                       this._grip = null;
-                       this._hand = null;
-               }
-
-               getHandSpace() {
-                       if (this._hand === null) {
-                               this._hand = new Group();
-                               this._hand.matrixAutoUpdate = false;
-                               this._hand.visible = false;
-                               this._hand.joints = {};
-                               this._hand.inputState = {
-                                       pinching: false
-                               };
-                       }
-
-                       return this._hand;
-               }
-
-               getTargetRaySpace() {
-                       if (this._targetRay === null) {
-                               this._targetRay = new Group();
-                               this._targetRay.matrixAutoUpdate = false;
-                               this._targetRay.visible = false;
-                               this._targetRay.hasLinearVelocity = false;
-                               this._targetRay.linearVelocity = new Vector3();
-                               this._targetRay.hasAngularVelocity = false;
-                               this._targetRay.angularVelocity = new Vector3();
-                       }
-
-                       return this._targetRay;
-               }
-
-               getGripSpace() {
-                       if (this._grip === null) {
-                               this._grip = new Group();
-                               this._grip.matrixAutoUpdate = false;
-                               this._grip.visible = false;
-                               this._grip.hasLinearVelocity = false;
-                               this._grip.linearVelocity = new Vector3();
-                               this._grip.hasAngularVelocity = false;
-                               this._grip.angularVelocity = new Vector3();
-                       }
-
-                       return this._grip;
-               }
-
-               dispatchEvent(event) {
-                       if (this._targetRay !== null) {
-                               this._targetRay.dispatchEvent(event);
-                       }
-
-                       if (this._grip !== null) {
-                               this._grip.dispatchEvent(event);
-                       }
-
-                       if (this._hand !== null) {
-                               this._hand.dispatchEvent(event);
-                       }
-
-                       return this;
-               }
-
-               disconnect(inputSource) {
-                       this.dispatchEvent({
-                               type: 'disconnected',
-                               data: inputSource
-                       });
-
-                       if (this._targetRay !== null) {
-                               this._targetRay.visible = false;
-                       }
-
-                       if (this._grip !== null) {
-                               this._grip.visible = false;
-                       }
-
-                       if (this._hand !== null) {
-                               this._hand.visible = false;
-                       }
-
-                       return this;
-               }
-
-               update(inputSource, frame, referenceSpace) {
-                       let inputPose = null;
-                       let gripPose = null;
-                       let handPose = null;
-                       const targetRay = this._targetRay;
-                       const grip = this._grip;
-                       const hand = this._hand;
-
-                       if (inputSource && frame.session.visibilityState !== 'visible-blurred') {
-                               if (targetRay !== null) {
-                                       inputPose = frame.getPose(inputSource.targetRaySpace, referenceSpace);
-
-                                       if (inputPose !== null) {
-                                               targetRay.matrix.fromArray(inputPose.transform.matrix);
-                                               targetRay.matrix.decompose(targetRay.position, targetRay.rotation, targetRay.scale);
-
-                                               if (inputPose.linearVelocity) {
-                                                       targetRay.hasLinearVelocity = true;
-                                                       targetRay.linearVelocity.copy(inputPose.linearVelocity);
-                                               } else {
-                                                       targetRay.hasLinearVelocity = false;
-                                               }
-
-                                               if (inputPose.angularVelocity) {
-                                                       targetRay.hasAngularVelocity = true;
-                                                       targetRay.angularVelocity.copy(inputPose.angularVelocity);
-                                               } else {
-                                                       targetRay.hasAngularVelocity = false;
-                                               }
-
-                                               this.dispatchEvent(_moveEvent);
-                                       }
-                               }
-
-                               if (hand && inputSource.hand) {
-                                       handPose = true;
-
-                                       for (const inputjoint of inputSource.hand.values()) {
-                                               // Update the joints groups with the XRJoint poses
-                                               const jointPose = frame.getJointPose(inputjoint, referenceSpace);
-
-                                               if (hand.joints[inputjoint.jointName] === undefined) {
-                                                       // The transform of this joint will be updated with the joint pose on each frame
-                                                       const joint = new Group();
-                                                       joint.matrixAutoUpdate = false;
-                                                       joint.visible = false;
-                                                       hand.joints[inputjoint.jointName] = joint; // ??
-
-                                                       hand.add(joint);
-                                               }
-
-                                               const joint = hand.joints[inputjoint.jointName];
-
-                                               if (jointPose !== null) {
-                                                       joint.matrix.fromArray(jointPose.transform.matrix);
-                                                       joint.matrix.decompose(joint.position, joint.rotation, joint.scale);
-                                                       joint.jointRadius = jointPose.radius;
-                                               }
-
-                                               joint.visible = jointPose !== null;
-                                       } // Custom events
-                                       // Check pinchz
-
-
-                                       const indexTip = hand.joints['index-finger-tip'];
-                                       const thumbTip = hand.joints['thumb-tip'];
-                                       const distance = indexTip.position.distanceTo(thumbTip.position);
-                                       const distanceToPinch = 0.02;
-                                       const threshold = 0.005;
-
-                                       if (hand.inputState.pinching && distance > distanceToPinch + threshold) {
-                                               hand.inputState.pinching = false;
-                                               this.dispatchEvent({
-                                                       type: 'pinchend',
-                                                       handedness: inputSource.handedness,
-                                                       target: this
-                                               });
-                                       } else if (!hand.inputState.pinching && distance <= distanceToPinch - threshold) {
-                                               hand.inputState.pinching = true;
-                                               this.dispatchEvent({
-                                                       type: 'pinchstart',
-                                                       handedness: inputSource.handedness,
-                                                       target: this
-                                               });
-                                       }
-                               } else {
-                                       if (grip !== null && inputSource.gripSpace) {
-                                               gripPose = frame.getPose(inputSource.gripSpace, referenceSpace);
-
-                                               if (gripPose !== null) {
-                                                       grip.matrix.fromArray(gripPose.transform.matrix);
-                                                       grip.matrix.decompose(grip.position, grip.rotation, grip.scale);
-
-                                                       if (gripPose.linearVelocity) {
-                                                               grip.hasLinearVelocity = true;
-                                                               grip.linearVelocity.copy(gripPose.linearVelocity);
-                                                       } else {
-                                                               grip.hasLinearVelocity = false;
-                                                       }
-
-                                                       if (gripPose.angularVelocity) {
-                                                               grip.hasAngularVelocity = true;
-                                                               grip.angularVelocity.copy(gripPose.angularVelocity);
-                                                       } else {
-                                                               grip.hasAngularVelocity = false;
-                                                       }
-                                               }
-                                       }
-                               }
-                       }
-
-                       if (targetRay !== null) {
-                               targetRay.visible = inputPose !== null;
-                       }
-
-                       if (grip !== null) {
-                               grip.visible = gripPose !== null;
-                       }
-
-                       if (hand !== null) {
-                               hand.visible = handPose !== null;
-                       }
-
-                       return this;
-               }
-
-       }
-
-       class WebXRManager extends EventDispatcher {
-               constructor(renderer, gl) {
-                       super();
-                       const scope = this;
-                       const state = renderer.state;
-                       let session = null;
-                       let framebufferScaleFactor = 1.0;
-                       let referenceSpace = null;
-                       let referenceSpaceType = 'local-floor';
-                       let pose = null;
-                       let glBinding = null;
-                       let glFramebuffer = null;
-                       let glProjLayer = null;
-                       let glBaseLayer = null;
-                       let isMultisample = false;
-                       let glMultisampledFramebuffer = null;
-                       let glColorRenderbuffer = null;
-                       let glDepthRenderbuffer = null;
-                       let xrFrame = null;
-                       let depthStyle = null;
-                       let clearStyle = null;
-                       const controllers = [];
-                       const inputSourcesMap = new Map(); //
-
-                       const cameraL = new PerspectiveCamera();
-                       cameraL.layers.enable(1);
-                       cameraL.viewport = new Vector4();
-                       const cameraR = new PerspectiveCamera();
-                       cameraR.layers.enable(2);
-                       cameraR.viewport = new Vector4();
-                       const cameras = [cameraL, cameraR];
-                       const cameraVR = new ArrayCamera();
-                       cameraVR.layers.enable(1);
-                       cameraVR.layers.enable(2);
-                       let _currentDepthNear = null;
-                       let _currentDepthFar = null; //
-
-                       this.cameraAutoUpdate = true;
-                       this.enabled = false;
-                       this.isPresenting = false;
-
-                       this.getController = function (index) {
-                               let controller = controllers[index];
-
-                               if (controller === undefined) {
-                                       controller = new WebXRController();
-                                       controllers[index] = controller;
-                               }
-
-                               return controller.getTargetRaySpace();
-                       };
-
-                       this.getControllerGrip = function (index) {
-                               let controller = controllers[index];
-
-                               if (controller === undefined) {
-                                       controller = new WebXRController();
-                                       controllers[index] = controller;
-                               }
-
-                               return controller.getGripSpace();
-                       };
-
-                       this.getHand = function (index) {
-                               let controller = controllers[index];
-
-                               if (controller === undefined) {
-                                       controller = new WebXRController();
-                                       controllers[index] = controller;
-                               }
-
-                               return controller.getHandSpace();
-                       }; //
-
-
-                       function onSessionEvent(event) {
-                               const controller = inputSourcesMap.get(event.inputSource);
-
-                               if (controller) {
-                                       controller.dispatchEvent({
-                                               type: event.type,
-                                               data: event.inputSource
-                                       });
-                               }
-                       }
-
-                       function onSessionEnd() {
-                               inputSourcesMap.forEach(function (controller, inputSource) {
-                                       controller.disconnect(inputSource);
-                               });
-                               inputSourcesMap.clear();
-                               _currentDepthNear = null;
-                               _currentDepthFar = null; // restore framebuffer/rendering state
-
-                               state.bindXRFramebuffer(null);
-                               renderer.setRenderTarget(renderer.getRenderTarget());
-                               if (glFramebuffer) gl.deleteFramebuffer(glFramebuffer);
-                               if (glMultisampledFramebuffer) gl.deleteFramebuffer(glMultisampledFramebuffer);
-                               if (glColorRenderbuffer) gl.deleteRenderbuffer(glColorRenderbuffer);
-                               if (glDepthRenderbuffer) gl.deleteRenderbuffer(glDepthRenderbuffer);
-                               glFramebuffer = null;
-                               glMultisampledFramebuffer = null;
-                               glColorRenderbuffer = null;
-                               glDepthRenderbuffer = null;
-                               glBaseLayer = null;
-                               glProjLayer = null;
-                               glBinding = null;
-                               session = null; //
-
-                               animation.stop();
-                               scope.isPresenting = false;
-                               scope.dispatchEvent({
-                                       type: 'sessionend'
-                               });
-                       }
-
-                       this.setFramebufferScaleFactor = function (value) {
-                               framebufferScaleFactor = value;
-
-                               if (scope.isPresenting === true) {
-                                       console.warn('THREE.WebXRManager: Cannot change framebuffer scale while presenting.');
-                               }
-                       };
-
-                       this.setReferenceSpaceType = function (value) {
-                               referenceSpaceType = value;
-
-                               if (scope.isPresenting === true) {
-                                       console.warn('THREE.WebXRManager: Cannot change reference space type while presenting.');
-                               }
-                       };
-
-                       this.getReferenceSpace = function () {
-                               return referenceSpace;
-                       };
-
-                       this.getBaseLayer = function () {
-                               return glProjLayer !== null ? glProjLayer : glBaseLayer;
-                       };
-
-                       this.getBinding = function () {
-                               return glBinding;
-                       };
-
-                       this.getFrame = function () {
-                               return xrFrame;
-                       };
-
-                       this.getSession = function () {
-                               return session;
-                       };
-
-                       this.setSession = async function (value) {
-                               session = value;
-
-                               if (session !== null) {
-                                       session.addEventListener('select', onSessionEvent);
-                                       session.addEventListener('selectstart', onSessionEvent);
-                                       session.addEventListener('selectend', onSessionEvent);
-                                       session.addEventListener('squeeze', onSessionEvent);
-                                       session.addEventListener('squeezestart', onSessionEvent);
-                                       session.addEventListener('squeezeend', onSessionEvent);
-                                       session.addEventListener('end', onSessionEnd);
-                                       session.addEventListener('inputsourceschange', onInputSourcesChange);
-                                       const attributes = gl.getContextAttributes();
-
-                                       if (attributes.xrCompatible !== true) {
-                                               await gl.makeXRCompatible();
-                                       }
-
-                                       if (session.renderState.layers === undefined) {
-                                               const layerInit = {
-                                                       antialias: attributes.antialias,
-                                                       alpha: attributes.alpha,
-                                                       depth: attributes.depth,
-                                                       stencil: attributes.stencil,
-                                                       framebufferScaleFactor: framebufferScaleFactor
-                                               };
-                                               glBaseLayer = new XRWebGLLayer(session, gl, layerInit);
-                                               session.updateRenderState({
-                                                       baseLayer: glBaseLayer
-                                               });
-                                       } else if (gl instanceof WebGLRenderingContext) {
-                                               // Use old style webgl layer because we can't use MSAA
-                                               // WebGL2 support.
-                                               const layerInit = {
-                                                       antialias: true,
-                                                       alpha: attributes.alpha,
-                                                       depth: attributes.depth,
-                                                       stencil: attributes.stencil,
-                                                       framebufferScaleFactor: framebufferScaleFactor
-                                               };
-                                               glBaseLayer = new XRWebGLLayer(session, gl, layerInit);
-                                               session.updateRenderState({
-                                                       layers: [glBaseLayer]
-                                               });
-                                       } else {
-                                               isMultisample = attributes.antialias;
-                                               let depthFormat = null;
-
-                                               if (attributes.depth) {
-                                                       clearStyle = gl.DEPTH_BUFFER_BIT;
-                                                       if (attributes.stencil) clearStyle |= gl.STENCIL_BUFFER_BIT;
-                                                       depthStyle = attributes.stencil ? gl.DEPTH_STENCIL_ATTACHMENT : gl.DEPTH_ATTACHMENT;
-                                                       depthFormat = attributes.stencil ? gl.DEPTH24_STENCIL8 : gl.DEPTH_COMPONENT24;
-                                               }
-
-                                               const projectionlayerInit = {
-                                                       colorFormat: attributes.alpha ? gl.RGBA8 : gl.RGB8,
-                                                       depthFormat: depthFormat,
-                                                       scaleFactor: framebufferScaleFactor
-                                               };
-                                               glBinding = new XRWebGLBinding(session, gl);
-                                               glProjLayer = glBinding.createProjectionLayer(projectionlayerInit);
-                                               glFramebuffer = gl.createFramebuffer();
-                                               session.updateRenderState({
-                                                       layers: [glProjLayer]
-                                               });
-
-                                               if (isMultisample) {
-                                                       glMultisampledFramebuffer = gl.createFramebuffer();
-                                                       glColorRenderbuffer = gl.createRenderbuffer();
-                                                       gl.bindRenderbuffer(gl.RENDERBUFFER, glColorRenderbuffer);
-                                                       gl.renderbufferStorageMultisample(gl.RENDERBUFFER, 4, gl.RGBA8, glProjLayer.textureWidth, glProjLayer.textureHeight);
-                                                       state.bindFramebuffer(gl.FRAMEBUFFER, glMultisampledFramebuffer);
-                                                       gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.RENDERBUFFER, glColorRenderbuffer);
-                                                       gl.bindRenderbuffer(gl.RENDERBUFFER, null);
-
-                                                       if (depthFormat !== null) {
-                                                               glDepthRenderbuffer = gl.createRenderbuffer();
-                                                               gl.bindRenderbuffer(gl.RENDERBUFFER, glDepthRenderbuffer);
-                                                               gl.renderbufferStorageMultisample(gl.RENDERBUFFER, 4, depthFormat, glProjLayer.textureWidth, glProjLayer.textureHeight);
-                                                               gl.framebufferRenderbuffer(gl.FRAMEBUFFER, depthStyle, gl.RENDERBUFFER, glDepthRenderbuffer);
-                                                               gl.bindRenderbuffer(gl.RENDERBUFFER, null);
-                                                       }
-
-                                                       state.bindFramebuffer(gl.FRAMEBUFFER, null);
-                                               }
-                                       }
-
-                                       referenceSpace = await session.requestReferenceSpace(referenceSpaceType);
-                                       animation.setContext(session);
-                                       animation.start();
-                                       scope.isPresenting = true;
-                                       scope.dispatchEvent({
-                                               type: 'sessionstart'
-                                       });
-                               }
-                       };
-
-                       function onInputSourcesChange(event) {
-                               const inputSources = session.inputSources; // Assign inputSources to available controllers
-
-                               for (let i = 0; i < controllers.length; i++) {
-                                       inputSourcesMap.set(inputSources[i], controllers[i]);
-                               } // Notify disconnected
-
-
-                               for (let i = 0; i < event.removed.length; i++) {
-                                       const inputSource = event.removed[i];
-                                       const controller = inputSourcesMap.get(inputSource);
-
-                                       if (controller) {
-                                               controller.dispatchEvent({
-                                                       type: 'disconnected',
-                                                       data: inputSource
-                                               });
-                                               inputSourcesMap.delete(inputSource);
-                                       }
-                               } // Notify connected
-
-
-                               for (let i = 0; i < event.added.length; i++) {
-                                       const inputSource = event.added[i];
-                                       const controller = inputSourcesMap.get(inputSource);
-
-                                       if (controller) {
-                                               controller.dispatchEvent({
-                                                       type: 'connected',
-                                                       data: inputSource
-                                               });
-                                       }
-                               }
-                       } //
-
-
-                       const cameraLPos = new Vector3();
-                       const cameraRPos = new Vector3();
-                       /**
-                        * Assumes 2 cameras that are parallel and share an X-axis, and that
-                        * the cameras' projection and world matrices have already been set.
-                        * And that near and far planes are identical for both cameras.
-                        * Visualization of this technique: https://computergraphics.stackexchange.com/a/4765
-                        */
-
-                       function setProjectionFromUnion(camera, cameraL, cameraR) {
-                               cameraLPos.setFromMatrixPosition(cameraL.matrixWorld);
-                               cameraRPos.setFromMatrixPosition(cameraR.matrixWorld);
-                               const ipd = cameraLPos.distanceTo(cameraRPos);
-                               const projL = cameraL.projectionMatrix.elements;
-                               const projR = cameraR.projectionMatrix.elements; // VR systems will have identical far and near planes, and
-                               // most likely identical top and bottom frustum extents.
-                               // Use the left camera for these values.
-
-                               const near = projL[14] / (projL[10] - 1);
-                               const far = projL[14] / (projL[10] + 1);
-                               const topFov = (projL[9] + 1) / projL[5];
-                               const bottomFov = (projL[9] - 1) / projL[5];
-                               const leftFov = (projL[8] - 1) / projL[0];
-                               const rightFov = (projR[8] + 1) / projR[0];
-                               const left = near * leftFov;
-                               const right = near * rightFov; // Calculate the new camera's position offset from the
-                               // left camera. xOffset should be roughly half `ipd`.
-
-                               const zOffset = ipd / (-leftFov + rightFov);
-                               const xOffset = zOffset * -leftFov; // TODO: Better way to apply this offset?
-
-                               cameraL.matrixWorld.decompose(camera.position, camera.quaternion, camera.scale);
-                               camera.translateX(xOffset);
-                               camera.translateZ(zOffset);
-                               camera.matrixWorld.compose(camera.position, camera.quaternion, camera.scale);
-                               camera.matrixWorldInverse.copy(camera.matrixWorld).invert(); // Find the union of the frustum values of the cameras and scale
-                               // the values so that the near plane's position does not change in world space,
-                               // although must now be relative to the new union camera.
-
-                               const near2 = near + zOffset;
-                               const far2 = far + zOffset;
-                               const left2 = left - xOffset;
-                               const right2 = right + (ipd - xOffset);
-                               const top2 = topFov * far / far2 * near2;
-                               const bottom2 = bottomFov * far / far2 * near2;
-                               camera.projectionMatrix.makePerspective(left2, right2, top2, bottom2, near2, far2);
-                       }
-
-                       function updateCamera(camera, parent) {
-                               if (parent === null) {
-                                       camera.matrixWorld.copy(camera.matrix);
-                               } else {
-                                       camera.matrixWorld.multiplyMatrices(parent.matrixWorld, camera.matrix);
-                               }
-
-                               camera.matrixWorldInverse.copy(camera.matrixWorld).invert();
-                       }
-
-                       this.updateCamera = function (camera) {
-                               if (session === null) return;
-                               cameraVR.near = cameraR.near = cameraL.near = camera.near;
-                               cameraVR.far = cameraR.far = cameraL.far = camera.far;
-
-                               if (_currentDepthNear !== cameraVR.near || _currentDepthFar !== cameraVR.far) {
-                                       // Note that the new renderState won't apply until the next frame. See #18320
-                                       session.updateRenderState({
-                                               depthNear: cameraVR.near,
-                                               depthFar: cameraVR.far
-                                       });
-                                       _currentDepthNear = cameraVR.near;
-                                       _currentDepthFar = cameraVR.far;
-                               }
-
-                               const parent = camera.parent;
-                               const cameras = cameraVR.cameras;
-                               updateCamera(cameraVR, parent);
-
-                               for (let i = 0; i < cameras.length; i++) {
-                                       updateCamera(cameras[i], parent);
-                               }
-
-                               cameraVR.matrixWorld.decompose(cameraVR.position, cameraVR.quaternion, cameraVR.scale); // update user camera and its children
-
-                               camera.position.copy(cameraVR.position);
-                               camera.quaternion.copy(cameraVR.quaternion);
-                               camera.scale.copy(cameraVR.scale);
-                               camera.matrix.copy(cameraVR.matrix);
-                               camera.matrixWorld.copy(cameraVR.matrixWorld);
-                               const children = camera.children;
-
-                               for (let i = 0, l = children.length; i < l; i++) {
-                                       children[i].updateMatrixWorld(true);
-                               } // update projection matrix for proper view frustum culling
-
-
-                               if (cameras.length === 2) {
-                                       setProjectionFromUnion(cameraVR, cameraL, cameraR);
-                               } else {
-                                       // assume single camera setup (AR)
-                                       cameraVR.projectionMatrix.copy(cameraL.projectionMatrix);
-                               }
-                       };
-
-                       this.getCamera = function () {
-                               return cameraVR;
-                       };
-
-                       this.getFoveation = function () {
-                               if (glProjLayer !== null) {
-                                       return glProjLayer.fixedFoveation;
-                               }
-
-                               if (glBaseLayer !== null) {
-                                       return glBaseLayer.fixedFoveation;
-                               }
-
-                               return undefined;
-                       };
-
-                       this.setFoveation = function (foveation) {
-                               // 0 = no foveation = full resolution
-                               // 1 = maximum foveation = the edges render at lower resolution
-                               if (glProjLayer !== null) {
-                                       glProjLayer.fixedFoveation = foveation;
-                               }
-
-                               if (glBaseLayer !== null && glBaseLayer.fixedFoveation !== undefined) {
-                                       glBaseLayer.fixedFoveation = foveation;
-                               }
-                       }; // Animation Loop
-
-
-                       let onAnimationFrameCallback = null;
-
-                       function onAnimationFrame(time, frame) {
-                               pose = frame.getViewerPose(referenceSpace);
-                               xrFrame = frame;
-
-                               if (pose !== null) {
-                                       const views = pose.views;
-
-                                       if (glBaseLayer !== null) {
-                                               state.bindXRFramebuffer(glBaseLayer.framebuffer);
-                                       }
-
-                                       let cameraVRNeedsUpdate = false; // check if it's necessary to rebuild cameraVR's camera list
-
-                                       if (views.length !== cameraVR.cameras.length) {
-                                               cameraVR.cameras.length = 0;
-                                               cameraVRNeedsUpdate = true;
-                                       }
-
-                                       for (let i = 0; i < views.length; i++) {
-                                               const view = views[i];
-                                               let viewport = null;
-
-                                               if (glBaseLayer !== null) {
-                                                       viewport = glBaseLayer.getViewport(view);
-                                               } else {
-                                                       const glSubImage = glBinding.getViewSubImage(glProjLayer, view);
-                                                       state.bindXRFramebuffer(glFramebuffer);
-
-                                                       if (glSubImage.depthStencilTexture !== undefined) {
-                                                               gl.framebufferTexture2D(gl.FRAMEBUFFER, depthStyle, gl.TEXTURE_2D, glSubImage.depthStencilTexture, 0);
-                                                       }
-
-                                                       gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, glSubImage.colorTexture, 0);
-                                                       viewport = glSubImage.viewport;
-                                               }
-
-                                               const camera = cameras[i];
-                                               camera.matrix.fromArray(view.transform.matrix);
-                                               camera.projectionMatrix.fromArray(view.projectionMatrix);
-                                               camera.viewport.set(viewport.x, viewport.y, viewport.width, viewport.height);
-
-                                               if (i === 0) {
-                                                       cameraVR.matrix.copy(camera.matrix);
-                                               }
-
-                                               if (cameraVRNeedsUpdate === true) {
-                                                       cameraVR.cameras.push(camera);
-                                               }
-                                       }
-
-                                       if (isMultisample) {
-                                               state.bindXRFramebuffer(glMultisampledFramebuffer);
-                                               if (clearStyle !== null) gl.clear(clearStyle);
-                                       }
-                               } //
-
-
-                               const inputSources = session.inputSources;
-
-                               for (let i = 0; i < controllers.length; i++) {
-                                       const controller = controllers[i];
-                                       const inputSource = inputSources[i];
-                                       controller.update(inputSource, frame, referenceSpace);
-                               }
-
-                               if (onAnimationFrameCallback) onAnimationFrameCallback(time, frame);
-
-                               if (isMultisample) {
-                                       const width = glProjLayer.textureWidth;
-                                       const height = glProjLayer.textureHeight;
-                                       state.bindFramebuffer(gl.READ_FRAMEBUFFER, glMultisampledFramebuffer);
-                                       state.bindFramebuffer(gl.DRAW_FRAMEBUFFER, glFramebuffer); // Invalidate the depth here to avoid flush of the depth data to main memory.
-
-                                       gl.invalidateFramebuffer(gl.READ_FRAMEBUFFER, [depthStyle]);
-                                       gl.invalidateFramebuffer(gl.DRAW_FRAMEBUFFER, [depthStyle]);
-                                       gl.blitFramebuffer(0, 0, width, height, 0, 0, width, height, gl.COLOR_BUFFER_BIT, gl.NEAREST); // Invalidate the MSAA buffer because it's not needed anymore.
-
-                                       gl.invalidateFramebuffer(gl.READ_FRAMEBUFFER, [gl.COLOR_ATTACHMENT0]);
-                                       state.bindFramebuffer(gl.READ_FRAMEBUFFER, null);
-                                       state.bindFramebuffer(gl.DRAW_FRAMEBUFFER, null);
-                                       state.bindFramebuffer(gl.FRAMEBUFFER, glMultisampledFramebuffer);
-                               }
-
-                               xrFrame = null;
-                       }
-
-                       const animation = new WebGLAnimation();
-                       animation.setAnimationLoop(onAnimationFrame);
-
-                       this.setAnimationLoop = function (callback) {
-                               onAnimationFrameCallback = callback;
-                       };
-
-                       this.dispose = function () {};
-               }
-
-       }
-
-       function WebGLMaterials(properties) {
-               function refreshFogUniforms(uniforms, fog) {
-                       uniforms.fogColor.value.copy(fog.color);
-
-                       if (fog.isFog) {
-                               uniforms.fogNear.value = fog.near;
-                               uniforms.fogFar.value = fog.far;
-                       } else if (fog.isFogExp2) {
-                               uniforms.fogDensity.value = fog.density;
-                       }
-               }
-
-               function refreshMaterialUniforms(uniforms, material, pixelRatio, height, transmissionRenderTarget) {
-                       if (material.isMeshBasicMaterial) {
-                               refreshUniformsCommon(uniforms, material);
-                       } else if (material.isMeshLambertMaterial) {
-                               refreshUniformsCommon(uniforms, material);
-                               refreshUniformsLambert(uniforms, material);
-                       } else if (material.isMeshToonMaterial) {
-                               refreshUniformsCommon(uniforms, material);
-                               refreshUniformsToon(uniforms, material);
-                       } else if (material.isMeshPhongMaterial) {
-                               refreshUniformsCommon(uniforms, material);
-                               refreshUniformsPhong(uniforms, material);
-                       } else if (material.isMeshStandardMaterial) {
-                               refreshUniformsCommon(uniforms, material);
-
-                               if (material.isMeshPhysicalMaterial) {
-                                       refreshUniformsPhysical(uniforms, material, transmissionRenderTarget);
-                               } else {
-                                       refreshUniformsStandard(uniforms, material);
-                               }
-                       } else if (material.isMeshMatcapMaterial) {
-                               refreshUniformsCommon(uniforms, material);
-                               refreshUniformsMatcap(uniforms, material);
-                       } else if (material.isMeshDepthMaterial) {
-                               refreshUniformsCommon(uniforms, material);
-                               refreshUniformsDepth(uniforms, material);
-                       } else if (material.isMeshDistanceMaterial) {
-                               refreshUniformsCommon(uniforms, material);
-                               refreshUniformsDistance(uniforms, material);
-                       } else if (material.isMeshNormalMaterial) {
-                               refreshUniformsCommon(uniforms, material);
-                               refreshUniformsNormal(uniforms, material);
-                       } else if (material.isLineBasicMaterial) {
-                               refreshUniformsLine(uniforms, material);
-
-                               if (material.isLineDashedMaterial) {
-                                       refreshUniformsDash(uniforms, material);
-                               }
-                       } else if (material.isPointsMaterial) {
-                               refreshUniformsPoints(uniforms, material, pixelRatio, height);
-                       } else if (material.isSpriteMaterial) {
-                               refreshUniformsSprites(uniforms, material);
-                       } else if (material.isShadowMaterial) {
-                               uniforms.color.value.copy(material.color);
-                               uniforms.opacity.value = material.opacity;
-                       } else if (material.isShaderMaterial) {
-                               material.uniformsNeedUpdate = false; // #15581
-                       }
-               }
-
-               function refreshUniformsCommon(uniforms, material) {
-                       uniforms.opacity.value = material.opacity;
-
-                       if (material.color) {
-                               uniforms.diffuse.value.copy(material.color);
-                       }
-
-                       if (material.emissive) {
-                               uniforms.emissive.value.copy(material.emissive).multiplyScalar(material.emissiveIntensity);
-                       }
-
-                       if (material.map) {
-                               uniforms.map.value = material.map;
-                       }
-
-                       if (material.alphaMap) {
-                               uniforms.alphaMap.value = material.alphaMap;
-                       }
-
-                       if (material.specularMap) {
-                               uniforms.specularMap.value = material.specularMap;
-                       }
-
-                       if (material.alphaTest > 0) {
-                               uniforms.alphaTest.value = material.alphaTest;
-                       }
-
-                       const envMap = properties.get(material).envMap;
-
-                       if (envMap) {
-                               uniforms.envMap.value = envMap;
-                               uniforms.flipEnvMap.value = envMap.isCubeTexture && envMap.isRenderTargetTexture === false ? -1 : 1;
-                               uniforms.reflectivity.value = material.reflectivity;
-                               uniforms.ior.value = material.ior;
-                               uniforms.refractionRatio.value = material.refractionRatio;
-
-                               const maxMipLevel = properties.get(envMap).__maxMipLevel;
-
-                               if (maxMipLevel !== undefined) {
-                                       uniforms.maxMipLevel.value = maxMipLevel;
-                               }
-                       }
-
-                       if (material.lightMap) {
-                               uniforms.lightMap.value = material.lightMap;
-                               uniforms.lightMapIntensity.value = material.lightMapIntensity;
-                       }
-
-                       if (material.aoMap) {
-                               uniforms.aoMap.value = material.aoMap;
-                               uniforms.aoMapIntensity.value = material.aoMapIntensity;
-                       } // uv repeat and offset setting priorities
-                       // 1. color map
-                       // 2. specular map
-                       // 3. displacementMap map
-                       // 4. normal map
-                       // 5. bump map
-                       // 6. roughnessMap map
-                       // 7. metalnessMap map
-                       // 8. alphaMap map
-                       // 9. emissiveMap map
-                       // 10. clearcoat map
-                       // 11. clearcoat normal map
-                       // 12. clearcoat roughnessMap map
-                       // 13. specular intensity map
-                       // 14. specular tint map
-                       // 15. transmission map
-                       // 16. thickness map
-
-
-                       let uvScaleMap;
-
-                       if (material.map) {
-                               uvScaleMap = material.map;
-                       } else if (material.specularMap) {
-                               uvScaleMap = material.specularMap;
-                       } else if (material.displacementMap) {
-                               uvScaleMap = material.displacementMap;
-                       } else if (material.normalMap) {
-                               uvScaleMap = material.normalMap;
-                       } else if (material.bumpMap) {
-                               uvScaleMap = material.bumpMap;
-                       } else if (material.roughnessMap) {
-                               uvScaleMap = material.roughnessMap;
-                       } else if (material.metalnessMap) {
-                               uvScaleMap = material.metalnessMap;
-                       } else if (material.alphaMap) {
-                               uvScaleMap = material.alphaMap;
-                       } else if (material.emissiveMap) {
-                               uvScaleMap = material.emissiveMap;
-                       } else if (material.clearcoatMap) {
-                               uvScaleMap = material.clearcoatMap;
-                       } else if (material.clearcoatNormalMap) {
-                               uvScaleMap = material.clearcoatNormalMap;
-                       } else if (material.clearcoatRoughnessMap) {
-                               uvScaleMap = material.clearcoatRoughnessMap;
-                       } else if (material.specularIntensityMap) {
-                               uvScaleMap = material.specularIntensityMap;
-                       } else if (material.specularTintMap) {
-                               uvScaleMap = material.specularTintMap;
-                       } else if (material.transmissionMap) {
-                               uvScaleMap = material.transmissionMap;
-                       } else if (material.thicknessMap) {
-                               uvScaleMap = material.thicknessMap;
-                       }
-
-                       if (uvScaleMap !== undefined) {
-                               // backwards compatibility
-                               if (uvScaleMap.isWebGLRenderTarget) {
-                                       uvScaleMap = uvScaleMap.texture;
-                               }
-
-                               if (uvScaleMap.matrixAutoUpdate === true) {
-                                       uvScaleMap.updateMatrix();
-                               }
-
-                               uniforms.uvTransform.value.copy(uvScaleMap.matrix);
-                       } // uv repeat and offset setting priorities for uv2
-                       // 1. ao map
-                       // 2. light map
-
-
-                       let uv2ScaleMap;
-
-                       if (material.aoMap) {
-                               uv2ScaleMap = material.aoMap;
-                       } else if (material.lightMap) {
-                               uv2ScaleMap = material.lightMap;
-                       }
-
-                       if (uv2ScaleMap !== undefined) {
-                               // backwards compatibility
-                               if (uv2ScaleMap.isWebGLRenderTarget) {
-                                       uv2ScaleMap = uv2ScaleMap.texture;
-                               }
-
-                               if (uv2ScaleMap.matrixAutoUpdate === true) {
-                                       uv2ScaleMap.updateMatrix();
-                               }
-
-                               uniforms.uv2Transform.value.copy(uv2ScaleMap.matrix);
-                       }
-               }
-
-               function refreshUniformsLine(uniforms, material) {
-                       uniforms.diffuse.value.copy(material.color);
-                       uniforms.opacity.value = material.opacity;
-               }
-
-               function refreshUniformsDash(uniforms, material) {
-                       uniforms.dashSize.value = material.dashSize;
-                       uniforms.totalSize.value = material.dashSize + material.gapSize;
-                       uniforms.scale.value = material.scale;
-               }
-
-               function refreshUniformsPoints(uniforms, material, pixelRatio, height) {
-                       uniforms.diffuse.value.copy(material.color);
-                       uniforms.opacity.value = material.opacity;
-                       uniforms.size.value = material.size * pixelRatio;
-                       uniforms.scale.value = height * 0.5;
-
-                       if (material.map) {
-                               uniforms.map.value = material.map;
-                       }
-
-                       if (material.alphaMap) {
-                               uniforms.alphaMap.value = material.alphaMap;
-                       }
-
-                       if (material.alphaTest > 0) {
-                               uniforms.alphaTest.value = material.alphaTest;
-                       } // uv repeat and offset setting priorities
-                       // 1. color map
-                       // 2. alpha map
-
-
-                       let uvScaleMap;
-
-                       if (material.map) {
-                               uvScaleMap = material.map;
-                       } else if (material.alphaMap) {
-                               uvScaleMap = material.alphaMap;
-                       }
-
-                       if (uvScaleMap !== undefined) {
-                               if (uvScaleMap.matrixAutoUpdate === true) {
-                                       uvScaleMap.updateMatrix();
-                               }
-
-                               uniforms.uvTransform.value.copy(uvScaleMap.matrix);
-                       }
-               }
-
-               function refreshUniformsSprites(uniforms, material) {
-                       uniforms.diffuse.value.copy(material.color);
-                       uniforms.opacity.value = material.opacity;
-                       uniforms.rotation.value = material.rotation;
-
-                       if (material.map) {
-                               uniforms.map.value = material.map;
-                       }
-
-                       if (material.alphaMap) {
-                               uniforms.alphaMap.value = material.alphaMap;
-                       }
-
-                       if (material.alphaTest > 0) {
-                               uniforms.alphaTest.value = material.alphaTest;
-                       } // uv repeat and offset setting priorities
-                       // 1. color map
-                       // 2. alpha map
-
-
-                       let uvScaleMap;
-
-                       if (material.map) {
-                               uvScaleMap = material.map;
-                       } else if (material.alphaMap) {
-                               uvScaleMap = material.alphaMap;
-                       }
-
-                       if (uvScaleMap !== undefined) {
-                               if (uvScaleMap.matrixAutoUpdate === true) {
-                                       uvScaleMap.updateMatrix();
-                               }
-
-                               uniforms.uvTransform.value.copy(uvScaleMap.matrix);
-                       }
-               }
-
-               function refreshUniformsLambert(uniforms, material) {
-                       if (material.emissiveMap) {
-                               uniforms.emissiveMap.value = material.emissiveMap;
-                       }
-               }
-
-               function refreshUniformsPhong(uniforms, material) {
-                       uniforms.specular.value.copy(material.specular);
-                       uniforms.shininess.value = Math.max(material.shininess, 1e-4); // to prevent pow( 0.0, 0.0 )
-
-                       if (material.emissiveMap) {
-                               uniforms.emissiveMap.value = material.emissiveMap;
-                       }
-
-                       if (material.bumpMap) {
-                               uniforms.bumpMap.value = material.bumpMap;
-                               uniforms.bumpScale.value = material.bumpScale;
-                               if (material.side === BackSide) uniforms.bumpScale.value *= -1;
-                       }
-
-                       if (material.normalMap) {
-                               uniforms.normalMap.value = material.normalMap;
-                               uniforms.normalScale.value.copy(material.normalScale);
-                               if (material.side === BackSide) uniforms.normalScale.value.negate();
-                       }
-
-                       if (material.displacementMap) {
-                               uniforms.displacementMap.value = material.displacementMap;
-                               uniforms.displacementScale.value = material.displacementScale;
-                               uniforms.displacementBias.value = material.displacementBias;
-                       }
-               }
-
-               function refreshUniformsToon(uniforms, material) {
-                       if (material.gradientMap) {
-                               uniforms.gradientMap.value = material.gradientMap;
-                       }
-
-                       if (material.emissiveMap) {
-                               uniforms.emissiveMap.value = material.emissiveMap;
-                       }
-
-                       if (material.bumpMap) {
-                               uniforms.bumpMap.value = material.bumpMap;
-                               uniforms.bumpScale.value = material.bumpScale;
-                               if (material.side === BackSide) uniforms.bumpScale.value *= -1;
-                       }
-
-                       if (material.normalMap) {
-                               uniforms.normalMap.value = material.normalMap;
-                               uniforms.normalScale.value.copy(material.normalScale);
-                               if (material.side === BackSide) uniforms.normalScale.value.negate();
-                       }
-
-                       if (material.displacementMap) {
-                               uniforms.displacementMap.value = material.displacementMap;
-                               uniforms.displacementScale.value = material.displacementScale;
-                               uniforms.displacementBias.value = material.displacementBias;
-                       }
-               }
-
-               function refreshUniformsStandard(uniforms, material) {
-                       uniforms.roughness.value = material.roughness;
-                       uniforms.metalness.value = material.metalness;
-
-                       if (material.roughnessMap) {
-                               uniforms.roughnessMap.value = material.roughnessMap;
-                       }
-
-                       if (material.metalnessMap) {
-                               uniforms.metalnessMap.value = material.metalnessMap;
-                       }
-
-                       if (material.emissiveMap) {
-                               uniforms.emissiveMap.value = material.emissiveMap;
-                       }
-
-                       if (material.bumpMap) {
-                               uniforms.bumpMap.value = material.bumpMap;
-                               uniforms.bumpScale.value = material.bumpScale;
-                               if (material.side === BackSide) uniforms.bumpScale.value *= -1;
-                       }
-
-                       if (material.normalMap) {
-                               uniforms.normalMap.value = material.normalMap;
-                               uniforms.normalScale.value.copy(material.normalScale);
-                               if (material.side === BackSide) uniforms.normalScale.value.negate();
-                       }
-
-                       if (material.displacementMap) {
-                               uniforms.displacementMap.value = material.displacementMap;
-                               uniforms.displacementScale.value = material.displacementScale;
-                               uniforms.displacementBias.value = material.displacementBias;
-                       }
-
-                       const envMap = properties.get(material).envMap;
-
-                       if (envMap) {
-                               //uniforms.envMap.value = material.envMap; // part of uniforms common
-                               uniforms.envMapIntensity.value = material.envMapIntensity;
-                       }
-               }
-
-               function refreshUniformsPhysical(uniforms, material, transmissionRenderTarget) {
-                       refreshUniformsStandard(uniforms, material);
-                       uniforms.ior.value = material.ior; // also part of uniforms common
-
-                       if (material.sheenTint) uniforms.sheenTint.value.copy(material.sheenTint);
-
-                       if (material.clearcoat > 0) {
-                               uniforms.clearcoat.value = material.clearcoat;
-                               uniforms.clearcoatRoughness.value = material.clearcoatRoughness;
-
-                               if (material.clearcoatMap) {
-                                       uniforms.clearcoatMap.value = material.clearcoatMap;
-                               }
-
-                               if (material.clearcoatRoughnessMap) {
-                                       uniforms.clearcoatRoughnessMap.value = material.clearcoatRoughnessMap;
-                               }
-
-                               if (material.clearcoatNormalMap) {
-                                       uniforms.clearcoatNormalScale.value.copy(material.clearcoatNormalScale);
-                                       uniforms.clearcoatNormalMap.value = material.clearcoatNormalMap;
-
-                                       if (material.side === BackSide) {
-                                               uniforms.clearcoatNormalScale.value.negate();
-                                       }
-                               }
-                       }
-
-                       if (material.transmission > 0) {
-                               uniforms.transmission.value = material.transmission;
-                               uniforms.transmissionSamplerMap.value = transmissionRenderTarget.texture;
-                               uniforms.transmissionSamplerSize.value.set(transmissionRenderTarget.width, transmissionRenderTarget.height);
-
-                               if (material.transmissionMap) {
-                                       uniforms.transmissionMap.value = material.transmissionMap;
-                               }
-
-                               uniforms.thickness.value = material.thickness;
-
-                               if (material.thicknessMap) {
-                                       uniforms.thicknessMap.value = material.thicknessMap;
-                               }
-
-                               uniforms.attenuationDistance.value = material.attenuationDistance;
-                               uniforms.attenuationTint.value.copy(material.attenuationTint);
-                       }
-
-                       uniforms.specularIntensity.value = material.specularIntensity;
-                       uniforms.specularTint.value.copy(material.specularTint);
-
-                       if (material.specularIntensityMap) {
-                               uniforms.specularIntensityMap.value = material.specularIntensityMap;
-                       }
-
-                       if (material.specularTintMap) {
-                               uniforms.specularTintMap.value = material.specularTintMap;
-                       }
-               }
-
-               function refreshUniformsMatcap(uniforms, material) {
-                       if (material.matcap) {
-                               uniforms.matcap.value = material.matcap;
-                       }
-
-                       if (material.bumpMap) {
-                               uniforms.bumpMap.value = material.bumpMap;
-                               uniforms.bumpScale.value = material.bumpScale;
-                               if (material.side === BackSide) uniforms.bumpScale.value *= -1;
-                       }
-
-                       if (material.normalMap) {
-                               uniforms.normalMap.value = material.normalMap;
-                               uniforms.normalScale.value.copy(material.normalScale);
-                               if (material.side === BackSide) uniforms.normalScale.value.negate();
-                       }
-
-                       if (material.displacementMap) {
-                               uniforms.displacementMap.value = material.displacementMap;
-                               uniforms.displacementScale.value = material.displacementScale;
-                               uniforms.displacementBias.value = material.displacementBias;
-                       }
-               }
-
-               function refreshUniformsDepth(uniforms, material) {
-                       if (material.displacementMap) {
-                               uniforms.displacementMap.value = material.displacementMap;
-                               uniforms.displacementScale.value = material.displacementScale;
-                               uniforms.displacementBias.value = material.displacementBias;
-                       }
-               }
-
-               function refreshUniformsDistance(uniforms, material) {
-                       if (material.displacementMap) {
-                               uniforms.displacementMap.value = material.displacementMap;
-                               uniforms.displacementScale.value = material.displacementScale;
-                               uniforms.displacementBias.value = material.displacementBias;
-                       }
-
-                       uniforms.referencePosition.value.copy(material.referencePosition);
-                       uniforms.nearDistance.value = material.nearDistance;
-                       uniforms.farDistance.value = material.farDistance;
-               }
-
-               function refreshUniformsNormal(uniforms, material) {
-                       if (material.bumpMap) {
-                               uniforms.bumpMap.value = material.bumpMap;
-                               uniforms.bumpScale.value = material.bumpScale;
-                               if (material.side === BackSide) uniforms.bumpScale.value *= -1;
-                       }
-
-                       if (material.normalMap) {
-                               uniforms.normalMap.value = material.normalMap;
-                               uniforms.normalScale.value.copy(material.normalScale);
-                               if (material.side === BackSide) uniforms.normalScale.value.negate();
-                       }
-
-                       if (material.displacementMap) {
-                               uniforms.displacementMap.value = material.displacementMap;
-                               uniforms.displacementScale.value = material.displacementScale;
-                               uniforms.displacementBias.value = material.displacementBias;
-                       }
-               }
-
-               return {
-                       refreshFogUniforms: refreshFogUniforms,
-                       refreshMaterialUniforms: refreshMaterialUniforms
-               };
-       }
-
-       function createCanvasElement() {
-               const canvas = document.createElementNS('http://www.w3.org/1999/xhtml', 'canvas');
-               canvas.style.display = 'block';
-               return canvas;
-       }
-
-       function WebGLRenderer(parameters = {}) {
-               const _canvas = parameters.canvas !== undefined ? parameters.canvas : createCanvasElement(),
-                                       _context = parameters.context !== undefined ? parameters.context : null,
-                                       _alpha = parameters.alpha !== undefined ? parameters.alpha : false,
-                                       _depth = parameters.depth !== undefined ? parameters.depth : true,
-                                       _stencil = parameters.stencil !== undefined ? parameters.stencil : true,
-                                       _antialias = parameters.antialias !== undefined ? parameters.antialias : false,
-                                       _premultipliedAlpha = parameters.premultipliedAlpha !== undefined ? parameters.premultipliedAlpha : true,
-                                       _preserveDrawingBuffer = parameters.preserveDrawingBuffer !== undefined ? parameters.preserveDrawingBuffer : false,
-                                       _powerPreference = parameters.powerPreference !== undefined ? parameters.powerPreference : 'default',
-                                       _failIfMajorPerformanceCaveat = parameters.failIfMajorPerformanceCaveat !== undefined ? parameters.failIfMajorPerformanceCaveat : false;
-
-               let currentRenderList = null;
-               let currentRenderState = null; // render() can be called from within a callback triggered by another render.
-               // We track this so that the nested render call gets its list and state isolated from the parent render call.
-
-               const renderListStack = [];
-               const renderStateStack = []; // public properties
-
-               this.domElement = _canvas; // Debug configuration container
-
-               this.debug = {
-                       /**
-                        * Enables error checking and reporting when shader programs are being compiled
-                        * @type {boolean}
-                        */
-                       checkShaderErrors: true
-               }; // clearing
-
-               this.autoClear = true;
-               this.autoClearColor = true;
-               this.autoClearDepth = true;
-               this.autoClearStencil = true; // scene graph
-
-               this.sortObjects = true; // user-defined clipping
-
-               this.clippingPlanes = [];
-               this.localClippingEnabled = false; // physically based shading
-
-               this.gammaFactor = 2.0; // for backwards compatibility
-
-               this.outputEncoding = LinearEncoding; // physical lights
-
-               this.physicallyCorrectLights = false; // tone mapping
-
-               this.toneMapping = NoToneMapping;
-               this.toneMappingExposure = 1.0; // internal properties
-
-               const _this = this;
-
-               let _isContextLost = false; // internal state cache
-
-               let _currentActiveCubeFace = 0;
-               let _currentActiveMipmapLevel = 0;
-               let _currentRenderTarget = null;
-
-               let _currentMaterialId = -1;
-
-               let _currentCamera = null;
-
-               const _currentViewport = new Vector4();
-
-               const _currentScissor = new Vector4();
-
-               let _currentScissorTest = null; //
-
-               let _width = _canvas.width;
-               let _height = _canvas.height;
-               let _pixelRatio = 1;
-               let _opaqueSort = null;
-               let _transparentSort = null;
-
-               const _viewport = new Vector4(0, 0, _width, _height);
-
-               const _scissor = new Vector4(0, 0, _width, _height);
-
-               let _scissorTest = false; //
-
-               const _currentDrawBuffers = []; // frustum
-
-               const _frustum = new Frustum(); // clipping
-
-
-               let _clippingEnabled = false;
-               let _localClippingEnabled = false; // transmission
-
-               let _transmissionRenderTarget = null; // camera matrices cache
-
-               const _projScreenMatrix = new Matrix4();
-
-               const _vector3 = new Vector3();
-
-               const _emptyScene = {
-                       background: null,
-                       fog: null,
-                       environment: null,
-                       overrideMaterial: null,
-                       isScene: true
-               };
-
-               function getTargetPixelRatio() {
-                       return _currentRenderTarget === null ? _pixelRatio : 1;
-               } // initialize
-
-
-               let _gl = _context;
-
-               function getContext(contextNames, contextAttributes) {
-                       for (let i = 0; i < contextNames.length; i++) {
-                               const contextName = contextNames[i];
-
-                               const context = _canvas.getContext(contextName, contextAttributes);
-
-                               if (context !== null) return context;
-                       }
-
-                       return null;
-               }
-
-               try {
-                       const contextAttributes = {
-                               alpha: _alpha,
-                               depth: _depth,
-                               stencil: _stencil,
-                               antialias: _antialias,
-                               premultipliedAlpha: _premultipliedAlpha,
-                               preserveDrawingBuffer: _preserveDrawingBuffer,
-                               powerPreference: _powerPreference,
-                               failIfMajorPerformanceCaveat: _failIfMajorPerformanceCaveat
-                       }; // event listeners must be registered before WebGL context is created, see #12753
-
-                       _canvas.addEventListener('webglcontextlost', onContextLost, false);
-
-                       _canvas.addEventListener('webglcontextrestored', onContextRestore, false);
-
-                       if (_gl === null) {
-                               const contextNames = ['webgl2', 'webgl', 'experimental-webgl'];
-
-                               if (_this.isWebGL1Renderer === true) {
-                                       contextNames.shift();
-                               }
-
-                               _gl = getContext(contextNames, contextAttributes);
-
-                               if (_gl === null) {
-                                       if (getContext(contextNames)) {
-                                               throw new Error('Error creating WebGL context with your selected attributes.');
-                                       } else {
-                                               throw new Error('Error creating WebGL context.');
-                                       }
-                               }
-                       } // Some experimental-webgl implementations do not have getShaderPrecisionFormat
-
-
-                       if (_gl.getShaderPrecisionFormat === undefined) {
-                               _gl.getShaderPrecisionFormat = function () {
-                                       return {
-                                               'rangeMin': 1,
-                                               'rangeMax': 1,
-                                               'precision': 1
-                                       };
-                               };
-                       }
-               } catch (error) {
-                       console.error('THREE.WebGLRenderer: ' + error.message);
-                       throw error;
-               }
-
-               let extensions, capabilities, state, info;
-               let properties, textures, cubemaps, cubeuvmaps, attributes, geometries, objects;
-               let programCache, materials, renderLists, renderStates, clipping, shadowMap;
-               let background, morphtargets, bufferRenderer, indexedBufferRenderer;
-               let utils, bindingStates;
-
-               function initGLContext() {
-                       extensions = new WebGLExtensions(_gl);
-                       capabilities = new WebGLCapabilities(_gl, extensions, parameters);
-                       extensions.init(capabilities);
-                       utils = new WebGLUtils(_gl, extensions, capabilities);
-                       state = new WebGLState(_gl, extensions, capabilities);
-                       _currentDrawBuffers[0] = _gl.BACK;
-                       info = new WebGLInfo(_gl);
-                       properties = new WebGLProperties();
-                       textures = new WebGLTextures(_gl, extensions, state, properties, capabilities, utils, info);
-                       cubemaps = new WebGLCubeMaps(_this);
-                       cubeuvmaps = new WebGLCubeUVMaps(_this);
-                       attributes = new WebGLAttributes(_gl, capabilities);
-                       bindingStates = new WebGLBindingStates(_gl, extensions, attributes, capabilities);
-                       geometries = new WebGLGeometries(_gl, attributes, info, bindingStates);
-                       objects = new WebGLObjects(_gl, geometries, attributes, info);
-                       morphtargets = new WebGLMorphtargets(_gl);
-                       clipping = new WebGLClipping(properties);
-                       programCache = new WebGLPrograms(_this, cubemaps, cubeuvmaps, extensions, capabilities, bindingStates, clipping);
-                       materials = new WebGLMaterials(properties);
-                       renderLists = new WebGLRenderLists(properties);
-                       renderStates = new WebGLRenderStates(extensions, capabilities);
-                       background = new WebGLBackground(_this, cubemaps, state, objects, _premultipliedAlpha);
-                       shadowMap = new WebGLShadowMap(_this, objects, capabilities);
-                       bufferRenderer = new WebGLBufferRenderer(_gl, extensions, info, capabilities);
-                       indexedBufferRenderer = new WebGLIndexedBufferRenderer(_gl, extensions, info, capabilities);
-                       info.programs = programCache.programs;
-                       _this.capabilities = capabilities;
-                       _this.extensions = extensions;
-                       _this.properties = properties;
-                       _this.renderLists = renderLists;
-                       _this.shadowMap = shadowMap;
-                       _this.state = state;
-                       _this.info = info;
-               }
-
-               initGLContext(); // xr
-
-               const xr = new WebXRManager(_this, _gl);
-               this.xr = xr; // API
-
-               this.getContext = function () {
-                       return _gl;
-               };
-
-               this.getContextAttributes = function () {
-                       return _gl.getContextAttributes();
-               };
-
-               this.forceContextLoss = function () {
-                       const extension = extensions.get('WEBGL_lose_context');
-                       if (extension) extension.loseContext();
-               };
-
-               this.forceContextRestore = function () {
-                       const extension = extensions.get('WEBGL_lose_context');
-                       if (extension) extension.restoreContext();
-               };
-
-               this.getPixelRatio = function () {
-                       return _pixelRatio;
-               };
-
-               this.setPixelRatio = function (value) {
-                       if (value === undefined) return;
-                       _pixelRatio = value;
-                       this.setSize(_width, _height, false);
-               };
-
-               this.getSize = function (target) {
-                       return target.set(_width, _height);
-               };
-
-               this.setSize = function (width, height, updateStyle) {
-                       if (xr.isPresenting) {
-                               console.warn('THREE.WebGLRenderer: Can\'t change size while VR device is presenting.');
-                               return;
-                       }
-
-                       _width = width;
-                       _height = height;
-                       _canvas.width = Math.floor(width * _pixelRatio);
-                       _canvas.height = Math.floor(height * _pixelRatio);
-
-                       if (updateStyle !== false) {
-                               _canvas.style.width = width + 'px';
-                               _canvas.style.height = height + 'px';
-                       }
-
-                       this.setViewport(0, 0, width, height);
-               };
-
-               this.getDrawingBufferSize = function (target) {
-                       return target.set(_width * _pixelRatio, _height * _pixelRatio).floor();
-               };
-
-               this.setDrawingBufferSize = function (width, height, pixelRatio) {
-                       _width = width;
-                       _height = height;
-                       _pixelRatio = pixelRatio;
-                       _canvas.width = Math.floor(width * pixelRatio);
-                       _canvas.height = Math.floor(height * pixelRatio);
-                       this.setViewport(0, 0, width, height);
-               };
-
-               this.getCurrentViewport = function (target) {
-                       return target.copy(_currentViewport);
-               };
-
-               this.getViewport = function (target) {
-                       return target.copy(_viewport);
-               };
-
-               this.setViewport = function (x, y, width, height) {
-                       if (x.isVector4) {
-                               _viewport.set(x.x, x.y, x.z, x.w);
-                       } else {
-                               _viewport.set(x, y, width, height);
-                       }
-
-                       state.viewport(_currentViewport.copy(_viewport).multiplyScalar(_pixelRatio).floor());
-               };
-
-               this.getScissor = function (target) {
-                       return target.copy(_scissor);
-               };
-
-               this.setScissor = function (x, y, width, height) {
-                       if (x.isVector4) {
-                               _scissor.set(x.x, x.y, x.z, x.w);
-                       } else {
-                               _scissor.set(x, y, width, height);
-                       }
-
-                       state.scissor(_currentScissor.copy(_scissor).multiplyScalar(_pixelRatio).floor());
-               };
-
-               this.getScissorTest = function () {
-                       return _scissorTest;
-               };
-
-               this.setScissorTest = function (boolean) {
-                       state.setScissorTest(_scissorTest = boolean);
-               };
-
-               this.setOpaqueSort = function (method) {
-                       _opaqueSort = method;
-               };
-
-               this.setTransparentSort = function (method) {
-                       _transparentSort = method;
-               }; // Clearing
-
-
-               this.getClearColor = function (target) {
-                       return target.copy(background.getClearColor());
-               };
-
-               this.setClearColor = function () {
-                       background.setClearColor.apply(background, arguments);
-               };
-
-               this.getClearAlpha = function () {
-                       return background.getClearAlpha();
-               };
-
-               this.setClearAlpha = function () {
-                       background.setClearAlpha.apply(background, arguments);
-               };
-
-               this.clear = function (color, depth, stencil) {
-                       let bits = 0;
-                       if (color === undefined || color) bits |= _gl.COLOR_BUFFER_BIT;
-                       if (depth === undefined || depth) bits |= _gl.DEPTH_BUFFER_BIT;
-                       if (stencil === undefined || stencil) bits |= _gl.STENCIL_BUFFER_BIT;
-
-                       _gl.clear(bits);
-               };
-
-               this.clearColor = function () {
-                       this.clear(true, false, false);
-               };
-
-               this.clearDepth = function () {
-                       this.clear(false, true, false);
-               };
-
-               this.clearStencil = function () {
-                       this.clear(false, false, true);
-               }; //
-
-
-               this.dispose = function () {
-                       _canvas.removeEventListener('webglcontextlost', onContextLost, false);
-
-                       _canvas.removeEventListener('webglcontextrestored', onContextRestore, false);
-
-                       renderLists.dispose();
-                       renderStates.dispose();
-                       properties.dispose();
-                       cubemaps.dispose();
-                       cubeuvmaps.dispose();
-                       objects.dispose();
-                       bindingStates.dispose();
-                       xr.dispose();
-                       xr.removeEventListener('sessionstart', onXRSessionStart);
-                       xr.removeEventListener('sessionend', onXRSessionEnd);
-
-                       if (_transmissionRenderTarget) {
-                               _transmissionRenderTarget.dispose();
-
-                               _transmissionRenderTarget = null;
-                       }
-
-                       animation.stop();
-               }; // Events
-
-
-               function onContextLost(event) {
-                       event.preventDefault();
-                       console.log('THREE.WebGLRenderer: Context Lost.');
-                       _isContextLost = true;
-               }
-
-               function onContextRestore() {
-                       console.log('THREE.WebGLRenderer: Context Restored.');
-                       _isContextLost = false;
-                       const infoAutoReset = info.autoReset;
-                       const shadowMapEnabled = shadowMap.enabled;
-                       const shadowMapAutoUpdate = shadowMap.autoUpdate;
-                       const shadowMapNeedsUpdate = shadowMap.needsUpdate;
-                       const shadowMapType = shadowMap.type;
-                       initGLContext();
-                       info.autoReset = infoAutoReset;
-                       shadowMap.enabled = shadowMapEnabled;
-                       shadowMap.autoUpdate = shadowMapAutoUpdate;
-                       shadowMap.needsUpdate = shadowMapNeedsUpdate;
-                       shadowMap.type = shadowMapType;
-               }
-
-               function onMaterialDispose(event) {
-                       const material = event.target;
-                       material.removeEventListener('dispose', onMaterialDispose);
-                       deallocateMaterial(material);
-               } // Buffer deallocation
-
-
-               function deallocateMaterial(material) {
-                       releaseMaterialProgramReferences(material);
-                       properties.remove(material);
-               }
-
-               function releaseMaterialProgramReferences(material) {
-                       const programs = properties.get(material).programs;
-
-                       if (programs !== undefined) {
-                               programs.forEach(function (program) {
-                                       programCache.releaseProgram(program);
-                               });
-                       }
-               } // Buffer rendering
-
-
-               function renderObjectImmediate(object, program) {
-                       object.render(function (object) {
-                               _this.renderBufferImmediate(object, program);
-                       });
-               }
-
-               this.renderBufferImmediate = function (object, program) {
-                       bindingStates.initAttributes();
-                       const buffers = properties.get(object);
-                       if (object.hasPositions && !buffers.position) buffers.position = _gl.createBuffer();
-                       if (object.hasNormals && !buffers.normal) buffers.normal = _gl.createBuffer();
-                       if (object.hasUvs && !buffers.uv) buffers.uv = _gl.createBuffer();
-                       if (object.hasColors && !buffers.color) buffers.color = _gl.createBuffer();
-                       const programAttributes = program.getAttributes();
-
-                       if (object.hasPositions) {
-                               _gl.bindBuffer(_gl.ARRAY_BUFFER, buffers.position);
-
-                               _gl.bufferData(_gl.ARRAY_BUFFER, object.positionArray, _gl.DYNAMIC_DRAW);
-
-                               bindingStates.enableAttribute(programAttributes.position.location);
-
-                               _gl.vertexAttribPointer(programAttributes.position.location, 3, _gl.FLOAT, false, 0, 0);
-                       }
-
-                       if (object.hasNormals) {
-                               _gl.bindBuffer(_gl.ARRAY_BUFFER, buffers.normal);
-
-                               _gl.bufferData(_gl.ARRAY_BUFFER, object.normalArray, _gl.DYNAMIC_DRAW);
-
-                               bindingStates.enableAttribute(programAttributes.normal.location);
-
-                               _gl.vertexAttribPointer(programAttributes.normal.location, 3, _gl.FLOAT, false, 0, 0);
-                       }
-
-                       if (object.hasUvs) {
-                               _gl.bindBuffer(_gl.ARRAY_BUFFER, buffers.uv);
-
-                               _gl.bufferData(_gl.ARRAY_BUFFER, object.uvArray, _gl.DYNAMIC_DRAW);
-
-                               bindingStates.enableAttribute(programAttributes.uv.location);
-
-                               _gl.vertexAttribPointer(programAttributes.uv.location, 2, _gl.FLOAT, false, 0, 0);
-                       }
-
-                       if (object.hasColors) {
-                               _gl.bindBuffer(_gl.ARRAY_BUFFER, buffers.color);
-
-                               _gl.bufferData(_gl.ARRAY_BUFFER, object.colorArray, _gl.DYNAMIC_DRAW);
-
-                               bindingStates.enableAttribute(programAttributes.color.location);
-
-                               _gl.vertexAttribPointer(programAttributes.color.location, 3, _gl.FLOAT, false, 0, 0);
-                       }
-
-                       bindingStates.disableUnusedAttributes();
-
-                       _gl.drawArrays(_gl.TRIANGLES, 0, object.count);
-
-                       object.count = 0;
-               };
-
-               this.renderBufferDirect = function (camera, scene, geometry, material, object, group) {
-                       if (scene === null) scene = _emptyScene; // renderBufferDirect second parameter used to be fog (could be null)
-
-                       const frontFaceCW = object.isMesh && object.matrixWorld.determinant() < 0;
-                       const program = setProgram(camera, scene, material, object);
-                       state.setMaterial(material, frontFaceCW); //
-
-                       let index = geometry.index;
-                       const position = geometry.attributes.position; //
-
-                       if (index === null) {
-                               if (position === undefined || position.count === 0) return;
-                       } else if (index.count === 0) {
-                               return;
-                       } //
-
-
-                       let rangeFactor = 1;
-
-                       if (material.wireframe === true) {
-                               index = geometries.getWireframeAttribute(geometry);
-                               rangeFactor = 2;
-                       }
-
-                       if (geometry.morphAttributes.position !== undefined || geometry.morphAttributes.normal !== undefined) {
-                               morphtargets.update(object, geometry, material, program);
-                       }
-
-                       bindingStates.setup(object, material, program, geometry, index);
-                       let attribute;
-                       let renderer = bufferRenderer;
-
-                       if (index !== null) {
-                               attribute = attributes.get(index);
-                               renderer = indexedBufferRenderer;
-                               renderer.setIndex(attribute);
-                       } //
-
-
-                       const dataCount = index !== null ? index.count : position.count;
-                       const rangeStart = geometry.drawRange.start * rangeFactor;
-                       const rangeCount = geometry.drawRange.count * rangeFactor;
-                       const groupStart = group !== null ? group.start * rangeFactor : 0;
-                       const groupCount = group !== null ? group.count * rangeFactor : Infinity;
-                       const drawStart = Math.max(rangeStart, groupStart);
-                       const drawEnd = Math.min(dataCount, rangeStart + rangeCount, groupStart + groupCount) - 1;
-                       const drawCount = Math.max(0, drawEnd - drawStart + 1);
-                       if (drawCount === 0) return; //
-
-                       if (object.isMesh) {
-                               if (material.wireframe === true) {
-                                       state.setLineWidth(material.wireframeLinewidth * getTargetPixelRatio());
-                                       renderer.setMode(_gl.LINES);
-                               } else {
-                                       renderer.setMode(_gl.TRIANGLES);
-                               }
-                       } else if (object.isLine) {
-                               let lineWidth = material.linewidth;
-                               if (lineWidth === undefined) lineWidth = 1; // Not using Line*Material
-
-                               state.setLineWidth(lineWidth * getTargetPixelRatio());
-
-                               if (object.isLineSegments) {
-                                       renderer.setMode(_gl.LINES);
-                               } else if (object.isLineLoop) {
-                                       renderer.setMode(_gl.LINE_LOOP);
-                               } else {
-                                       renderer.setMode(_gl.LINE_STRIP);
-                               }
-                       } else if (object.isPoints) {
-                               renderer.setMode(_gl.POINTS);
-                       } else if (object.isSprite) {
-                               renderer.setMode(_gl.TRIANGLES);
-                       }
-
-                       if (object.isInstancedMesh) {
-                               renderer.renderInstances(drawStart, drawCount, object.count);
-                       } else if (geometry.isInstancedBufferGeometry) {
-                               const instanceCount = Math.min(geometry.instanceCount, geometry._maxInstanceCount);
-                               renderer.renderInstances(drawStart, drawCount, instanceCount);
-                       } else {
-                               renderer.render(drawStart, drawCount);
-                       }
-               }; // Compile
-
-
-               this.compile = function (scene, camera) {
-                       currentRenderState = renderStates.get(scene);
-                       currentRenderState.init();
-                       renderStateStack.push(currentRenderState);
-                       scene.traverseVisible(function (object) {
-                               if (object.isLight && object.layers.test(camera.layers)) {
-                                       currentRenderState.pushLight(object);
-
-                                       if (object.castShadow) {
-                                               currentRenderState.pushShadow(object);
-                                       }
-                               }
-                       });
-                       currentRenderState.setupLights(_this.physicallyCorrectLights);
-                       scene.traverse(function (object) {
-                               const material = object.material;
-
-                               if (material) {
-                                       if (Array.isArray(material)) {
-                                               for (let i = 0; i < material.length; i++) {
-                                                       const material2 = material[i];
-                                                       getProgram(material2, scene, object);
-                                               }
-                                       } else {
-                                               getProgram(material, scene, object);
-                                       }
-                               }
-                       });
-                       renderStateStack.pop();
-                       currentRenderState = null;
-               }; // Animation Loop
-
-
-               let onAnimationFrameCallback = null;
-
-               function onAnimationFrame(time) {
-                       if (onAnimationFrameCallback) onAnimationFrameCallback(time);
-               }
-
-               function onXRSessionStart() {
-                       animation.stop();
-               }
-
-               function onXRSessionEnd() {
-                       animation.start();
-               }
-
-               const animation = new WebGLAnimation();
-               animation.setAnimationLoop(onAnimationFrame);
-               if (typeof window !== 'undefined') animation.setContext(window);
-
-               this.setAnimationLoop = function (callback) {
-                       onAnimationFrameCallback = callback;
-                       xr.setAnimationLoop(callback);
-                       callback === null ? animation.stop() : animation.start();
-               };
-
-               xr.addEventListener('sessionstart', onXRSessionStart);
-               xr.addEventListener('sessionend', onXRSessionEnd); // Rendering
-
-               this.render = function (scene, camera) {
-                       if (camera !== undefined && camera.isCamera !== true) {
-                               console.error('THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.');
-                               return;
-                       }
-
-                       if (_isContextLost === true) return; // update scene graph
-
-                       if (scene.autoUpdate === true) scene.updateMatrixWorld(); // update camera matrices and frustum
-
-                       if (camera.parent === null) camera.updateMatrixWorld();
-
-                       if (xr.enabled === true && xr.isPresenting === true) {
-                               if (xr.cameraAutoUpdate === true) xr.updateCamera(camera);
-                               camera = xr.getCamera(); // use XR camera for rendering
-                       } //
-
-
-                       if (scene.isScene === true) scene.onBeforeRender(_this, scene, camera, _currentRenderTarget);
-                       currentRenderState = renderStates.get(scene, renderStateStack.length);
-                       currentRenderState.init();
-                       renderStateStack.push(currentRenderState);
-
-                       _projScreenMatrix.multiplyMatrices(camera.projectionMatrix, camera.matrixWorldInverse);
-
-                       _frustum.setFromProjectionMatrix(_projScreenMatrix);
-
-                       _localClippingEnabled = this.localClippingEnabled;
-                       _clippingEnabled = clipping.init(this.clippingPlanes, _localClippingEnabled, camera);
-                       currentRenderList = renderLists.get(scene, renderListStack.length);
-                       currentRenderList.init();
-                       renderListStack.push(currentRenderList);
-                       projectObject(scene, camera, 0, _this.sortObjects);
-                       currentRenderList.finish();
-
-                       if (_this.sortObjects === true) {
-                               currentRenderList.sort(_opaqueSort, _transparentSort);
-                       } //
-
-
-                       if (_clippingEnabled === true) clipping.beginShadows();
-                       const shadowsArray = currentRenderState.state.shadowsArray;
-                       shadowMap.render(shadowsArray, scene, camera);
-                       if (_clippingEnabled === true) clipping.endShadows(); //
-
-                       if (this.info.autoReset === true) this.info.reset(); //
-
-                       background.render(currentRenderList, scene); // render scene
-
-                       currentRenderState.setupLights(_this.physicallyCorrectLights);
-
-                       if (camera.isArrayCamera) {
-                               const cameras = camera.cameras;
-
-                               for (let i = 0, l = cameras.length; i < l; i++) {
-                                       const camera2 = cameras[i];
-                                       renderScene(currentRenderList, scene, camera2, camera2.viewport);
-                               }
-                       } else {
-                               renderScene(currentRenderList, scene, camera);
-                       } //
-
-
-                       if (_currentRenderTarget !== null) {
-                               // resolve multisample renderbuffers to a single-sample texture if necessary
-                               textures.updateMultisampleRenderTarget(_currentRenderTarget); // Generate mipmap if we're using any kind of mipmap filtering
-
-                               textures.updateRenderTargetMipmap(_currentRenderTarget);
-                       } //
-
-
-                       if (scene.isScene === true) scene.onAfterRender(_this, scene, camera); // Ensure depth buffer writing is enabled so it can be cleared on next render
-
-                       state.buffers.depth.setTest(true);
-                       state.buffers.depth.setMask(true);
-                       state.buffers.color.setMask(true);
-                       state.setPolygonOffset(false); // _gl.finish();
-
-                       bindingStates.resetDefaultState();
-                       _currentMaterialId = -1;
-                       _currentCamera = null;
-                       renderStateStack.pop();
-
-                       if (renderStateStack.length > 0) {
-                               currentRenderState = renderStateStack[renderStateStack.length - 1];
-                       } else {
-                               currentRenderState = null;
-                       }
-
-                       renderListStack.pop();
-
-                       if (renderListStack.length > 0) {
-                               currentRenderList = renderListStack[renderListStack.length - 1];
-                       } else {
-                               currentRenderList = null;
-                       }
-               };
-
-               function projectObject(object, camera, groupOrder, sortObjects) {
-                       if (object.visible === false) return;
-                       const visible = object.layers.test(camera.layers);
-
-                       if (visible) {
-                               if (object.isGroup) {
-                                       groupOrder = object.renderOrder;
-                               } else if (object.isLOD) {
-                                       if (object.autoUpdate === true) object.update(camera);
-                               } else if (object.isLight) {
-                                       currentRenderState.pushLight(object);
-
-                                       if (object.castShadow) {
-                                               currentRenderState.pushShadow(object);
-                                       }
-                               } else if (object.isSprite) {
-                                       if (!object.frustumCulled || _frustum.intersectsSprite(object)) {
-                                               if (sortObjects) {
-                                                       _vector3.setFromMatrixPosition(object.matrixWorld).applyMatrix4(_projScreenMatrix);
-                                               }
-
-                                               const geometry = objects.update(object);
-                                               const material = object.material;
-
-                                               if (material.visible) {
-                                                       currentRenderList.push(object, geometry, material, groupOrder, _vector3.z, null);
-                                               }
-                                       }
-                               } else if (object.isImmediateRenderObject) {
-                                       if (sortObjects) {
-                                               _vector3.setFromMatrixPosition(object.matrixWorld).applyMatrix4(_projScreenMatrix);
-                                       }
-
-                                       currentRenderList.push(object, null, object.material, groupOrder, _vector3.z, null);
-                               } else if (object.isMesh || object.isLine || object.isPoints) {
-                                       if (object.isSkinnedMesh) {
-                                               // update skeleton only once in a frame
-                                               if (object.skeleton.frame !== info.render.frame) {
-                                                       object.skeleton.update();
-                                                       object.skeleton.frame = info.render.frame;
-                                               }
-                                       }
-
-                                       if (!object.frustumCulled || _frustum.intersectsObject(object)) {
-                                               if (sortObjects) {
-                                                       _vector3.setFromMatrixPosition(object.matrixWorld).applyMatrix4(_projScreenMatrix);
-                                               }
-
-                                               const geometry = objects.update(object);
-                                               const material = object.material;
-
-                                               if (Array.isArray(material)) {
-                                                       const groups = geometry.groups;
-
-                                                       for (let i = 0, l = groups.length; i < l; i++) {
-                                                               const group = groups[i];
-                                                               const groupMaterial = material[group.materialIndex];
-
-                                                               if (groupMaterial && groupMaterial.visible) {
-                                                                       currentRenderList.push(object, geometry, groupMaterial, groupOrder, _vector3.z, group);
-                                                               }
-                                                       }
-                                               } else if (material.visible) {
-                                                       currentRenderList.push(object, geometry, material, groupOrder, _vector3.z, null);
-                                               }
-                                       }
-                               }
-                       }
-
-                       const children = object.children;
-
-                       for (let i = 0, l = children.length; i < l; i++) {
-                               projectObject(children[i], camera, groupOrder, sortObjects);
-                       }
-               }
-
-               function renderScene(currentRenderList, scene, camera, viewport) {
-                       const opaqueObjects = currentRenderList.opaque;
-                       const transmissiveObjects = currentRenderList.transmissive;
-                       const transparentObjects = currentRenderList.transparent;
-                       currentRenderState.setupLightsView(camera);
-                       if (transmissiveObjects.length > 0) renderTransmissionPass(opaqueObjects, scene, camera);
-                       if (viewport) state.viewport(_currentViewport.copy(viewport));
-                       if (opaqueObjects.length > 0) renderObjects(opaqueObjects, scene, camera);
-                       if (transmissiveObjects.length > 0) renderObjects(transmissiveObjects, scene, camera);
-                       if (transparentObjects.length > 0) renderObjects(transparentObjects, scene, camera);
-               }
-
-               function renderTransmissionPass(opaqueObjects, scene, camera) {
-                       if (_transmissionRenderTarget === null) {
-                               const needsAntialias = _antialias === true && capabilities.isWebGL2 === true;
-                               const renderTargetType = needsAntialias ? WebGLMultisampleRenderTarget : WebGLRenderTarget;
-                               _transmissionRenderTarget = new renderTargetType(1024, 1024, {
-                                       generateMipmaps: true,
-                                       type: utils.convert(HalfFloatType) !== null ? HalfFloatType : UnsignedByteType,
-                                       minFilter: LinearMipmapLinearFilter,
-                                       magFilter: NearestFilter,
-                                       wrapS: ClampToEdgeWrapping,
-                                       wrapT: ClampToEdgeWrapping
-                               });
-                       }
-
-                       const currentRenderTarget = _this.getRenderTarget();
-
-                       _this.setRenderTarget(_transmissionRenderTarget);
-
-                       _this.clear(); // Turn off the features which can affect the frag color for opaque objects pass.
-                       // Otherwise they are applied twice in opaque objects pass and transmission objects pass.
-
-
-                       const currentToneMapping = _this.toneMapping;
-                       _this.toneMapping = NoToneMapping;
-                       renderObjects(opaqueObjects, scene, camera);
-                       _this.toneMapping = currentToneMapping;
-                       textures.updateMultisampleRenderTarget(_transmissionRenderTarget);
-                       textures.updateRenderTargetMipmap(_transmissionRenderTarget);
-
-                       _this.setRenderTarget(currentRenderTarget);
-               }
-
-               function renderObjects(renderList, scene, camera) {
-                       const overrideMaterial = scene.isScene === true ? scene.overrideMaterial : null;
-
-                       for (let i = 0, l = renderList.length; i < l; i++) {
-                               const renderItem = renderList[i];
-                               const object = renderItem.object;
-                               const geometry = renderItem.geometry;
-                               const material = overrideMaterial === null ? renderItem.material : overrideMaterial;
-                               const group = renderItem.group;
-
-                               if (object.layers.test(camera.layers)) {
-                                       renderObject(object, scene, camera, geometry, material, group);
-                               }
-                       }
-               }
-
-               function renderObject(object, scene, camera, geometry, material, group) {
-                       object.onBeforeRender(_this, scene, camera, geometry, material, group);
-                       object.modelViewMatrix.multiplyMatrices(camera.matrixWorldInverse, object.matrixWorld);
-                       object.normalMatrix.getNormalMatrix(object.modelViewMatrix);
-
-                       if (object.isImmediateRenderObject) {
-                               const program = setProgram(camera, scene, material, object);
-                               state.setMaterial(material);
-                               bindingStates.reset();
-                               renderObjectImmediate(object, program);
-                       } else {
-                               if (material.transparent === true && material.side === DoubleSide) {
-                                       material.side = BackSide;
-                                       material.needsUpdate = true;
-
-                                       _this.renderBufferDirect(camera, scene, geometry, material, object, group);
-
-                                       material.side = FrontSide;
-                                       material.needsUpdate = true;
-
-                                       _this.renderBufferDirect(camera, scene, geometry, material, object, group);
-
-                                       material.side = DoubleSide;
-                               } else {
-                                       _this.renderBufferDirect(camera, scene, geometry, material, object, group);
-                               }
-                       }
-
-                       object.onAfterRender(_this, scene, camera, geometry, material, group);
-               }
-
-               function getProgram(material, scene, object) {
-                       if (scene.isScene !== true) scene = _emptyScene; // scene could be a Mesh, Line, Points, ...
-
-                       const materialProperties = properties.get(material);
-                       const lights = currentRenderState.state.lights;
-                       const shadowsArray = currentRenderState.state.shadowsArray;
-                       const lightsStateVersion = lights.state.version;
-                       const parameters = programCache.getParameters(material, lights.state, shadowsArray, scene, object);
-                       const programCacheKey = programCache.getProgramCacheKey(parameters);
-                       let programs = materialProperties.programs; // always update environment and fog - changing these trigger an getProgram call, but it's possible that the program doesn't change
-
-                       materialProperties.environment = material.isMeshStandardMaterial ? scene.environment : null;
-                       materialProperties.fog = scene.fog;
-                       materialProperties.envMap = (material.isMeshStandardMaterial ? cubeuvmaps : cubemaps).get(material.envMap || materialProperties.environment);
-
-                       if (programs === undefined) {
-                               // new material
-                               material.addEventListener('dispose', onMaterialDispose);
-                               programs = new Map();
-                               materialProperties.programs = programs;
-                       }
-
-                       let program = programs.get(programCacheKey);
-
-                       if (program !== undefined) {
-                               // early out if program and light state is identical
-                               if (materialProperties.currentProgram === program && materialProperties.lightsStateVersion === lightsStateVersion) {
-                                       updateCommonMaterialProperties(material, parameters);
-                                       return program;
-                               }
-                       } else {
-                               parameters.uniforms = programCache.getUniforms(material);
-                               material.onBuild(parameters, _this);
-                               material.onBeforeCompile(parameters, _this);
-                               program = programCache.acquireProgram(parameters, programCacheKey);
-                               programs.set(programCacheKey, program);
-                               materialProperties.uniforms = parameters.uniforms;
-                       }
-
-                       const uniforms = materialProperties.uniforms;
-
-                       if (!material.isShaderMaterial && !material.isRawShaderMaterial || material.clipping === true) {
-                               uniforms.clippingPlanes = clipping.uniform;
-                       }
-
-                       updateCommonMaterialProperties(material, parameters); // store the light setup it was created for
-
-                       materialProperties.needsLights = materialNeedsLights(material);
-                       materialProperties.lightsStateVersion = lightsStateVersion;
-
-                       if (materialProperties.needsLights) {
-                               // wire up the material to this renderer's lighting state
-                               uniforms.ambientLightColor.value = lights.state.ambient;
-                               uniforms.lightProbe.value = lights.state.probe;
-                               uniforms.directionalLights.value = lights.state.directional;
-                               uniforms.directionalLightShadows.value = lights.state.directionalShadow;
-                               uniforms.spotLights.value = lights.state.spot;
-                               uniforms.spotLightShadows.value = lights.state.spotShadow;
-                               uniforms.rectAreaLights.value = lights.state.rectArea;
-                               uniforms.ltc_1.value = lights.state.rectAreaLTC1;
-                               uniforms.ltc_2.value = lights.state.rectAreaLTC2;
-                               uniforms.pointLights.value = lights.state.point;
-                               uniforms.pointLightShadows.value = lights.state.pointShadow;
-                               uniforms.hemisphereLights.value = lights.state.hemi;
-                               uniforms.directionalShadowMap.value = lights.state.directionalShadowMap;
-                               uniforms.directionalShadowMatrix.value = lights.state.directionalShadowMatrix;
-                               uniforms.spotShadowMap.value = lights.state.spotShadowMap;
-                               uniforms.spotShadowMatrix.value = lights.state.spotShadowMatrix;
-                               uniforms.pointShadowMap.value = lights.state.pointShadowMap;
-                               uniforms.pointShadowMatrix.value = lights.state.pointShadowMatrix; // TODO (abelnation): add area lights shadow info to uniforms
-                       }
-
-                       const progUniforms = program.getUniforms();
-                       const uniformsList = WebGLUniforms.seqWithValue(progUniforms.seq, uniforms);
-                       materialProperties.currentProgram = program;
-                       materialProperties.uniformsList = uniformsList;
-                       return program;
-               }
-
-               function updateCommonMaterialProperties(material, parameters) {
-                       const materialProperties = properties.get(material);
-                       materialProperties.outputEncoding = parameters.outputEncoding;
-                       materialProperties.instancing = parameters.instancing;
-                       materialProperties.skinning = parameters.skinning;
-                       materialProperties.morphTargets = parameters.morphTargets;
-                       materialProperties.morphNormals = parameters.morphNormals;
-                       materialProperties.numClippingPlanes = parameters.numClippingPlanes;
-                       materialProperties.numIntersection = parameters.numClipIntersection;
-                       materialProperties.vertexAlphas = parameters.vertexAlphas;
-                       materialProperties.vertexTangents = parameters.vertexTangents;
-               }
-
-               function setProgram(camera, scene, material, object) {
-                       if (scene.isScene !== true) scene = _emptyScene; // scene could be a Mesh, Line, Points, ...
-
-                       textures.resetTextureUnits();
-                       const fog = scene.fog;
-                       const environment = material.isMeshStandardMaterial ? scene.environment : null;
-                       const encoding = _currentRenderTarget === null ? _this.outputEncoding : _currentRenderTarget.texture.encoding;
-                       const envMap = (material.isMeshStandardMaterial ? cubeuvmaps : cubemaps).get(material.envMap || environment);
-                       const vertexAlphas = material.vertexColors === true && !!object.geometry && !!object.geometry.attributes.color && object.geometry.attributes.color.itemSize === 4;
-                       const vertexTangents = !!object.geometry && !!object.geometry.attributes.tangent;
-                       const morphTargets = !!object.geometry && !!object.geometry.morphAttributes.position;
-                       const morphNormals = !!object.geometry && !!object.geometry.morphAttributes.normal;
-                       const materialProperties = properties.get(material);
-                       const lights = currentRenderState.state.lights;
-
-                       if (_clippingEnabled === true) {
-                               if (_localClippingEnabled === true || camera !== _currentCamera) {
-                                       const useCache = camera === _currentCamera && material.id === _currentMaterialId; // we might want to call this function with some ClippingGroup
-                                       // object instead of the material, once it becomes feasible
-                                       // (#8465, #8379)
-
-                                       clipping.setState(material, camera, useCache);
-                               }
-                       } //
-
-
-                       let needsProgramChange = false;
-
-                       if (material.version === materialProperties.__version) {
-                               if (materialProperties.needsLights && materialProperties.lightsStateVersion !== lights.state.version) {
-                                       needsProgramChange = true;
-                               } else if (materialProperties.outputEncoding !== encoding) {
-                                       needsProgramChange = true;
-                               } else if (object.isInstancedMesh && materialProperties.instancing === false) {
-                                       needsProgramChange = true;
-                               } else if (!object.isInstancedMesh && materialProperties.instancing === true) {
-                                       needsProgramChange = true;
-                               } else if (object.isSkinnedMesh && materialProperties.skinning === false) {
-                                       needsProgramChange = true;
-                               } else if (!object.isSkinnedMesh && materialProperties.skinning === true) {
-                                       needsProgramChange = true;
-                               } else if (materialProperties.envMap !== envMap) {
-                                       needsProgramChange = true;
-                               } else if (material.fog && materialProperties.fog !== fog) {
-                                       needsProgramChange = true;
-                               } else if (materialProperties.numClippingPlanes !== undefined && (materialProperties.numClippingPlanes !== clipping.numPlanes || materialProperties.numIntersection !== clipping.numIntersection)) {
-                                       needsProgramChange = true;
-                               } else if (materialProperties.vertexAlphas !== vertexAlphas) {
-                                       needsProgramChange = true;
-                               } else if (materialProperties.vertexTangents !== vertexTangents) {
-                                       needsProgramChange = true;
-                               } else if (materialProperties.morphTargets !== morphTargets) {
-                                       needsProgramChange = true;
-                               } else if (materialProperties.morphNormals !== morphNormals) {
-                                       needsProgramChange = true;
-                               }
-                       } else {
-                               needsProgramChange = true;
-                               materialProperties.__version = material.version;
-                       } //
-
-
-                       let program = materialProperties.currentProgram;
-
-                       if (needsProgramChange === true) {
-                               program = getProgram(material, scene, object);
-                       }
-
-                       let refreshProgram = false;
-                       let refreshMaterial = false;
-                       let refreshLights = false;
-                       const p_uniforms = program.getUniforms(),
-                                               m_uniforms = materialProperties.uniforms;
-
-                       if (state.useProgram(program.program)) {
-                               refreshProgram = true;
-                               refreshMaterial = true;
-                               refreshLights = true;
-                       }
-
-                       if (material.id !== _currentMaterialId) {
-                               _currentMaterialId = material.id;
-                               refreshMaterial = true;
-                       }
-
-                       if (refreshProgram || _currentCamera !== camera) {
-                               p_uniforms.setValue(_gl, 'projectionMatrix', camera.projectionMatrix);
-
-                               if (capabilities.logarithmicDepthBuffer) {
-                                       p_uniforms.setValue(_gl, 'logDepthBufFC', 2.0 / (Math.log(camera.far + 1.0) / Math.LN2));
-                               }
-
-                               if (_currentCamera !== camera) {
-                                       _currentCamera = camera; // lighting uniforms depend on the camera so enforce an update
-                                       // now, in case this material supports lights - or later, when
-                                       // the next material that does gets activated:
-
-                                       refreshMaterial = true; // set to true on material change
-
-                                       refreshLights = true; // remains set until update done
-                               } // load material specific uniforms
-                               // (shader material also gets them for the sake of genericity)
-
-
-                               if (material.isShaderMaterial || material.isMeshPhongMaterial || material.isMeshToonMaterial || material.isMeshStandardMaterial || material.envMap) {
-                                       const uCamPos = p_uniforms.map.cameraPosition;
-
-                                       if (uCamPos !== undefined) {
-                                               uCamPos.setValue(_gl, _vector3.setFromMatrixPosition(camera.matrixWorld));
-                                       }
-                               }
-
-                               if (material.isMeshPhongMaterial || material.isMeshToonMaterial || material.isMeshLambertMaterial || material.isMeshBasicMaterial || material.isMeshStandardMaterial || material.isShaderMaterial) {
-                                       p_uniforms.setValue(_gl, 'isOrthographic', camera.isOrthographicCamera === true);
-                               }
-
-                               if (material.isMeshPhongMaterial || material.isMeshToonMaterial || material.isMeshLambertMaterial || material.isMeshBasicMaterial || material.isMeshStandardMaterial || material.isShaderMaterial || material.isShadowMaterial || object.isSkinnedMesh) {
-                                       p_uniforms.setValue(_gl, 'viewMatrix', camera.matrixWorldInverse);
-                               }
-                       } // skinning uniforms must be set even if material didn't change
-                       // auto-setting of texture unit for bone texture must go before other textures
-                       // otherwise textures used for skinning can take over texture units reserved for other material textures
-
-
-                       if (object.isSkinnedMesh) {
-                               p_uniforms.setOptional(_gl, object, 'bindMatrix');
-                               p_uniforms.setOptional(_gl, object, 'bindMatrixInverse');
-                               const skeleton = object.skeleton;
-
-                               if (skeleton) {
-                                       if (capabilities.floatVertexTextures) {
-                                               if (skeleton.boneTexture === null) skeleton.computeBoneTexture();
-                                               p_uniforms.setValue(_gl, 'boneTexture', skeleton.boneTexture, textures);
-                                               p_uniforms.setValue(_gl, 'boneTextureSize', skeleton.boneTextureSize);
-                                       } else {
-                                               p_uniforms.setOptional(_gl, skeleton, 'boneMatrices');
-                                       }
-                               }
-                       }
-
-                       if (refreshMaterial || materialProperties.receiveShadow !== object.receiveShadow) {
-                               materialProperties.receiveShadow = object.receiveShadow;
-                               p_uniforms.setValue(_gl, 'receiveShadow', object.receiveShadow);
-                       }
-
-                       if (refreshMaterial) {
-                               p_uniforms.setValue(_gl, 'toneMappingExposure', _this.toneMappingExposure);
-
-                               if (materialProperties.needsLights) {
-                                       // the current material requires lighting info
-                                       // note: all lighting uniforms are always set correctly
-                                       // they simply reference the renderer's state for their
-                                       // values
-                                       //
-                                       // use the current material's .needsUpdate flags to set
-                                       // the GL state when required
-                                       markUniformsLightsNeedsUpdate(m_uniforms, refreshLights);
-                               } // refresh uniforms common to several materials
-
-
-                               if (fog && material.fog) {
-                                       materials.refreshFogUniforms(m_uniforms, fog);
-                               }
-
-                               materials.refreshMaterialUniforms(m_uniforms, material, _pixelRatio, _height, _transmissionRenderTarget);
-                               WebGLUniforms.upload(_gl, materialProperties.uniformsList, m_uniforms, textures);
-                       }
-
-                       if (material.isShaderMaterial && material.uniformsNeedUpdate === true) {
-                               WebGLUniforms.upload(_gl, materialProperties.uniformsList, m_uniforms, textures);
-                               material.uniformsNeedUpdate = false;
-                       }
-
-                       if (material.isSpriteMaterial) {
-                               p_uniforms.setValue(_gl, 'center', object.center);
-                       } // common matrices
-
-
-                       p_uniforms.setValue(_gl, 'modelViewMatrix', object.modelViewMatrix);
-                       p_uniforms.setValue(_gl, 'normalMatrix', object.normalMatrix);
-                       p_uniforms.setValue(_gl, 'modelMatrix', object.matrixWorld);
-                       return program;
-               } // If uniforms are marked as clean, they don't need to be loaded to the GPU.
-
-
-               function markUniformsLightsNeedsUpdate(uniforms, value) {
-                       uniforms.ambientLightColor.needsUpdate = value;
-                       uniforms.lightProbe.needsUpdate = value;
-                       uniforms.directionalLights.needsUpdate = value;
-                       uniforms.directionalLightShadows.needsUpdate = value;
-                       uniforms.pointLights.needsUpdate = value;
-                       uniforms.pointLightShadows.needsUpdate = value;
-                       uniforms.spotLights.needsUpdate = value;
-                       uniforms.spotLightShadows.needsUpdate = value;
-                       uniforms.rectAreaLights.needsUpdate = value;
-                       uniforms.hemisphereLights.needsUpdate = value;
-               }
-
-               function materialNeedsLights(material) {
-                       return material.isMeshLambertMaterial || material.isMeshToonMaterial || material.isMeshPhongMaterial || material.isMeshStandardMaterial || material.isShadowMaterial || material.isShaderMaterial && material.lights === true;
-               }
-
-               this.getActiveCubeFace = function () {
-                       return _currentActiveCubeFace;
-               };
-
-               this.getActiveMipmapLevel = function () {
-                       return _currentActiveMipmapLevel;
-               };
-
-               this.getRenderTarget = function () {
-                       return _currentRenderTarget;
-               };
-
-               this.setRenderTarget = function (renderTarget, activeCubeFace = 0, activeMipmapLevel = 0) {
-                       _currentRenderTarget = renderTarget;
-                       _currentActiveCubeFace = activeCubeFace;
-                       _currentActiveMipmapLevel = activeMipmapLevel;
-
-                       if (renderTarget && properties.get(renderTarget).__webglFramebuffer === undefined) {
-                               textures.setupRenderTarget(renderTarget);
-                       }
-
-                       let framebuffer = null;
-                       let isCube = false;
-                       let isRenderTarget3D = false;
-
-                       if (renderTarget) {
-                               const texture = renderTarget.texture;
-
-                               if (texture.isDataTexture3D || texture.isDataTexture2DArray) {
-                                       isRenderTarget3D = true;
-                               }
-
-                               const __webglFramebuffer = properties.get(renderTarget).__webglFramebuffer;
-
-                               if (renderTarget.isWebGLCubeRenderTarget) {
-                                       framebuffer = __webglFramebuffer[activeCubeFace];
-                                       isCube = true;
-                               } else if (renderTarget.isWebGLMultisampleRenderTarget) {
-                                       framebuffer = properties.get(renderTarget).__webglMultisampledFramebuffer;
-                               } else {
-                                       framebuffer = __webglFramebuffer;
-                               }
-
-                               _currentViewport.copy(renderTarget.viewport);
-
-                               _currentScissor.copy(renderTarget.scissor);
-
-                               _currentScissorTest = renderTarget.scissorTest;
-                       } else {
-                               _currentViewport.copy(_viewport).multiplyScalar(_pixelRatio).floor();
-
-                               _currentScissor.copy(_scissor).multiplyScalar(_pixelRatio).floor();
-
-                               _currentScissorTest = _scissorTest;
-                       }
-
-                       const framebufferBound = state.bindFramebuffer(_gl.FRAMEBUFFER, framebuffer);
-
-                       if (framebufferBound && capabilities.drawBuffers) {
-                               let needsUpdate = false;
-
-                               if (renderTarget) {
-                                       if (renderTarget.isWebGLMultipleRenderTargets) {
-                                               const textures = renderTarget.texture;
-
-                                               if (_currentDrawBuffers.length !== textures.length || _currentDrawBuffers[0] !== _gl.COLOR_ATTACHMENT0) {
-                                                       for (let i = 0, il = textures.length; i < il; i++) {
-                                                               _currentDrawBuffers[i] = _gl.COLOR_ATTACHMENT0 + i;
-                                                       }
-
-                                                       _currentDrawBuffers.length = textures.length;
-                                                       needsUpdate = true;
-                                               }
-                                       } else {
-                                               if (_currentDrawBuffers.length !== 1 || _currentDrawBuffers[0] !== _gl.COLOR_ATTACHMENT0) {
-                                                       _currentDrawBuffers[0] = _gl.COLOR_ATTACHMENT0;
-                                                       _currentDrawBuffers.length = 1;
-                                                       needsUpdate = true;
-                                               }
-                                       }
-                               } else {
-                                       if (_currentDrawBuffers.length !== 1 || _currentDrawBuffers[0] !== _gl.BACK) {
-                                               _currentDrawBuffers[0] = _gl.BACK;
-                                               _currentDrawBuffers.length = 1;
-                                               needsUpdate = true;
-                                       }
-                               }
-
-                               if (needsUpdate) {
-                                       if (capabilities.isWebGL2) {
-                                               _gl.drawBuffers(_currentDrawBuffers);
-                                       } else {
-                                               extensions.get('WEBGL_draw_buffers').drawBuffersWEBGL(_currentDrawBuffers);
-                                       }
-                               }
-                       }
-
-                       state.viewport(_currentViewport);
-                       state.scissor(_currentScissor);
-                       state.setScissorTest(_currentScissorTest);
-
-                       if (isCube) {
-                               const textureProperties = properties.get(renderTarget.texture);
-
-                               _gl.framebufferTexture2D(_gl.FRAMEBUFFER, _gl.COLOR_ATTACHMENT0, _gl.TEXTURE_CUBE_MAP_POSITIVE_X + activeCubeFace, textureProperties.__webglTexture, activeMipmapLevel);
-                       } else if (isRenderTarget3D) {
-                               const textureProperties = properties.get(renderTarget.texture);
-                               const layer = activeCubeFace || 0;
-
-                               _gl.framebufferTextureLayer(_gl.FRAMEBUFFER, _gl.COLOR_ATTACHMENT0, textureProperties.__webglTexture, activeMipmapLevel || 0, layer);
-                       }
-
-                       _currentMaterialId = -1; // reset current material to ensure correct uniform bindings
-               };
-
-               this.readRenderTargetPixels = function (renderTarget, x, y, width, height, buffer, activeCubeFaceIndex) {
-                       if (!(renderTarget && renderTarget.isWebGLRenderTarget)) {
-                               console.error('THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.');
-                               return;
-                       }
-
-                       let framebuffer = properties.get(renderTarget).__webglFramebuffer;
-
-                       if (renderTarget.isWebGLCubeRenderTarget && activeCubeFaceIndex !== undefined) {
-                               framebuffer = framebuffer[activeCubeFaceIndex];
-                       }
-
-                       if (framebuffer) {
-                               state.bindFramebuffer(_gl.FRAMEBUFFER, framebuffer);
-
-                               try {
-                                       const texture = renderTarget.texture;
-                                       const textureFormat = texture.format;
-                                       const textureType = texture.type;
-
-                                       if (textureFormat !== RGBAFormat && utils.convert(textureFormat) !== _gl.getParameter(_gl.IMPLEMENTATION_COLOR_READ_FORMAT)) {
-                                               console.error('THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.');
-                                               return;
-                                       }
-
-                                       const halfFloatSupportedByExt = textureType === HalfFloatType && (extensions.has('EXT_color_buffer_half_float') || capabilities.isWebGL2 && extensions.has('EXT_color_buffer_float'));
-
-                                       if (textureType !== UnsignedByteType && utils.convert(textureType) !== _gl.getParameter(_gl.IMPLEMENTATION_COLOR_READ_TYPE) && // Edge and Chrome Mac < 52 (#9513)
-                                       !(textureType === FloatType && (capabilities.isWebGL2 || extensions.has('OES_texture_float') || extensions.has('WEBGL_color_buffer_float'))) && // Chrome Mac >= 52 and Firefox
-                                       !halfFloatSupportedByExt) {
-                                               console.error('THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.');
-                                               return;
-                                       }
-
-                                       if (_gl.checkFramebufferStatus(_gl.FRAMEBUFFER) === _gl.FRAMEBUFFER_COMPLETE) {
-                                               // the following if statement ensures valid read requests (no out-of-bounds pixels, see #8604)
-                                               if (x >= 0 && x <= renderTarget.width - width && y >= 0 && y <= renderTarget.height - height) {
-                                                       _gl.readPixels(x, y, width, height, utils.convert(textureFormat), utils.convert(textureType), buffer);
-                                               }
-                                       } else {
-                                               console.error('THREE.WebGLRenderer.readRenderTargetPixels: readPixels from renderTarget failed. Framebuffer not complete.');
-                                       }
-                               } finally {
-                                       // restore framebuffer of current render target if necessary
-                                       const framebuffer = _currentRenderTarget !== null ? properties.get(_currentRenderTarget).__webglFramebuffer : null;
-                                       state.bindFramebuffer(_gl.FRAMEBUFFER, framebuffer);
-                               }
-                       }
-               };
-
-               this.copyFramebufferToTexture = function (position, texture, level = 0) {
-                       const levelScale = Math.pow(2, -level);
-                       const width = Math.floor(texture.image.width * levelScale);
-                       const height = Math.floor(texture.image.height * levelScale);
-                       let glFormat = utils.convert(texture.format);
-
-                       if (capabilities.isWebGL2) {
-                               // Workaround for https://bugs.chromium.org/p/chromium/issues/detail?id=1120100
-                               // Not needed in Chrome 93+
-                               if (glFormat === _gl.RGB) glFormat = _gl.RGB8;
-                               if (glFormat === _gl.RGBA) glFormat = _gl.RGBA8;
-                       }
-
-                       textures.setTexture2D(texture, 0);
-
-                       _gl.copyTexImage2D(_gl.TEXTURE_2D, level, glFormat, position.x, position.y, width, height, 0);
-
-                       state.unbindTexture();
-               };
-
-               this.copyTextureToTexture = function (position, srcTexture, dstTexture, level = 0) {
-                       const width = srcTexture.image.width;
-                       const height = srcTexture.image.height;
-                       const glFormat = utils.convert(dstTexture.format);
-                       const glType = utils.convert(dstTexture.type);
-                       textures.setTexture2D(dstTexture, 0); // As another texture upload may have changed pixelStorei
-                       // parameters, make sure they are correct for the dstTexture
-
-                       _gl.pixelStorei(_gl.UNPACK_FLIP_Y_WEBGL, dstTexture.flipY);
-
-                       _gl.pixelStorei(_gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, dstTexture.premultiplyAlpha);
-
-                       _gl.pixelStorei(_gl.UNPACK_ALIGNMENT, dstTexture.unpackAlignment);
-
-                       if (srcTexture.isDataTexture) {
-                               _gl.texSubImage2D(_gl.TEXTURE_2D, level, position.x, position.y, width, height, glFormat, glType, srcTexture.image.data);
-                       } else {
-                               if (srcTexture.isCompressedTexture) {
-                                       _gl.compressedTexSubImage2D(_gl.TEXTURE_2D, level, position.x, position.y, srcTexture.mipmaps[0].width, srcTexture.mipmaps[0].height, glFormat, srcTexture.mipmaps[0].data);
-                               } else {
-                                       _gl.texSubImage2D(_gl.TEXTURE_2D, level, position.x, position.y, glFormat, glType, srcTexture.image);
-                               }
-                       } // Generate mipmaps only when copying level 0
-
-
-                       if (level === 0 && dstTexture.generateMipmaps) _gl.generateMipmap(_gl.TEXTURE_2D);
-                       state.unbindTexture();
-               };
-
-               this.copyTextureToTexture3D = function (sourceBox, position, srcTexture, dstTexture, level = 0) {
-                       if (_this.isWebGL1Renderer) {
-                               console.warn('THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.');
-                               return;
-                       }
-
-                       const width = sourceBox.max.x - sourceBox.min.x + 1;
-                       const height = sourceBox.max.y - sourceBox.min.y + 1;
-                       const depth = sourceBox.max.z - sourceBox.min.z + 1;
-                       const glFormat = utils.convert(dstTexture.format);
-                       const glType = utils.convert(dstTexture.type);
-                       let glTarget;
-
-                       if (dstTexture.isDataTexture3D) {
-                               textures.setTexture3D(dstTexture, 0);
-                               glTarget = _gl.TEXTURE_3D;
-                       } else if (dstTexture.isDataTexture2DArray) {
-                               textures.setTexture2DArray(dstTexture, 0);
-                               glTarget = _gl.TEXTURE_2D_ARRAY;
-                       } else {
-                               console.warn('THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.');
-                               return;
-                       }
-
-                       _gl.pixelStorei(_gl.UNPACK_FLIP_Y_WEBGL, dstTexture.flipY);
-
-                       _gl.pixelStorei(_gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, dstTexture.premultiplyAlpha);
-
-                       _gl.pixelStorei(_gl.UNPACK_ALIGNMENT, dstTexture.unpackAlignment);
-
-                       const unpackRowLen = _gl.getParameter(_gl.UNPACK_ROW_LENGTH);
-
-                       const unpackImageHeight = _gl.getParameter(_gl.UNPACK_IMAGE_HEIGHT);
-
-                       const unpackSkipPixels = _gl.getParameter(_gl.UNPACK_SKIP_PIXELS);
-
-                       const unpackSkipRows = _gl.getParameter(_gl.UNPACK_SKIP_ROWS);
-
-                       const unpackSkipImages = _gl.getParameter(_gl.UNPACK_SKIP_IMAGES);
-
-                       const image = srcTexture.isCompressedTexture ? srcTexture.mipmaps[0] : srcTexture.image;
-
-                       _gl.pixelStorei(_gl.UNPACK_ROW_LENGTH, image.width);
-
-                       _gl.pixelStorei(_gl.UNPACK_IMAGE_HEIGHT, image.height);
-
-                       _gl.pixelStorei(_gl.UNPACK_SKIP_PIXELS, sourceBox.min.x);
-
-                       _gl.pixelStorei(_gl.UNPACK_SKIP_ROWS, sourceBox.min.y);
-
-                       _gl.pixelStorei(_gl.UNPACK_SKIP_IMAGES, sourceBox.min.z);
-
-                       if (srcTexture.isDataTexture || srcTexture.isDataTexture3D) {
-                               _gl.texSubImage3D(glTarget, level, position.x, position.y, position.z, width, height, depth, glFormat, glType, image.data);
-                       } else {
-                               if (srcTexture.isCompressedTexture) {
-                                       console.warn('THREE.WebGLRenderer.copyTextureToTexture3D: untested support for compressed srcTexture.');
-
-                                       _gl.compressedTexSubImage3D(glTarget, level, position.x, position.y, position.z, width, height, depth, glFormat, image.data);
-                               } else {
-                                       _gl.texSubImage3D(glTarget, level, position.x, position.y, position.z, width, height, depth, glFormat, glType, image);
-                               }
-                       }
-
-                       _gl.pixelStorei(_gl.UNPACK_ROW_LENGTH, unpackRowLen);
-
-                       _gl.pixelStorei(_gl.UNPACK_IMAGE_HEIGHT, unpackImageHeight);
-
-                       _gl.pixelStorei(_gl.UNPACK_SKIP_PIXELS, unpackSkipPixels);
-
-                       _gl.pixelStorei(_gl.UNPACK_SKIP_ROWS, unpackSkipRows);
-
-                       _gl.pixelStorei(_gl.UNPACK_SKIP_IMAGES, unpackSkipImages); // Generate mipmaps only when copying level 0
-
-
-                       if (level === 0 && dstTexture.generateMipmaps) _gl.generateMipmap(glTarget);
-                       state.unbindTexture();
-               };
-
-               this.initTexture = function (texture) {
-                       textures.setTexture2D(texture, 0);
-                       state.unbindTexture();
-               };
-
-               this.resetState = function () {
-                       _currentActiveCubeFace = 0;
-                       _currentActiveMipmapLevel = 0;
-                       _currentRenderTarget = null;
-                       state.reset();
-                       bindingStates.reset();
-               };
-
-               if (typeof __THREE_DEVTOOLS__ !== 'undefined') {
-                       __THREE_DEVTOOLS__.dispatchEvent(new CustomEvent('observe', {
-                               detail: this
-                       })); // eslint-disable-line no-undef
-
-               }
-       }
-
-       class WebGL1Renderer extends WebGLRenderer {}
-
-       WebGL1Renderer.prototype.isWebGL1Renderer = true;
-
-       class FogExp2 {
-               constructor(color, density = 0.00025) {
-                       this.name = '';
-                       this.color = new Color(color);
-                       this.density = density;
-               }
-
-               clone() {
-                       return new FogExp2(this.color, this.density);
-               }
-
-               toJSON() {
-                       return {
-                               type: 'FogExp2',
-                               color: this.color.getHex(),
-                               density: this.density
-                       };
-               }
-
-       }
-
-       FogExp2.prototype.isFogExp2 = true;
-
-       class Fog {
-               constructor(color, near = 1, far = 1000) {
-                       this.name = '';
-                       this.color = new Color(color);
-                       this.near = near;
-                       this.far = far;
-               }
-
-               clone() {
-                       return new Fog(this.color, this.near, this.far);
-               }
-
-               toJSON() {
-                       return {
-                               type: 'Fog',
-                               color: this.color.getHex(),
-                               near: this.near,
-                               far: this.far
-                       };
-               }
-
-       }
-
-       Fog.prototype.isFog = true;
-
-       class Scene extends Object3D {
-               constructor() {
-                       super();
-                       this.type = 'Scene';
-                       this.background = null;
-                       this.environment = null;
-                       this.fog = null;
-                       this.overrideMaterial = null;
-                       this.autoUpdate = true; // checked by the renderer
-
-                       if (typeof __THREE_DEVTOOLS__ !== 'undefined') {
-                               __THREE_DEVTOOLS__.dispatchEvent(new CustomEvent('observe', {
-                                       detail: this
-                               })); // eslint-disable-line no-undef
-
-                       }
-               }
-
-               copy(source, recursive) {
-                       super.copy(source, recursive);
-                       if (source.background !== null) this.background = source.background.clone();
-                       if (source.environment !== null) this.environment = source.environment.clone();
-                       if (source.fog !== null) this.fog = source.fog.clone();
-                       if (source.overrideMaterial !== null) this.overrideMaterial = source.overrideMaterial.clone();
-                       this.autoUpdate = source.autoUpdate;
-                       this.matrixAutoUpdate = source.matrixAutoUpdate;
-                       return this;
-               }
-
-               toJSON(meta) {
-                       const data = super.toJSON(meta);
-                       if (this.fog !== null) data.object.fog = this.fog.toJSON();
-                       return data;
-               }
-
-       }
-
-       Scene.prototype.isScene = true;
-
-       class InterleavedBuffer {
-               constructor(array, stride) {
-                       this.array = array;
-                       this.stride = stride;
-                       this.count = array !== undefined ? array.length / stride : 0;
-                       this.usage = StaticDrawUsage;
-                       this.updateRange = {
-                               offset: 0,
-                               count: -1
-                       };
-                       this.version = 0;
-                       this.uuid = generateUUID();
-               }
-
-               onUploadCallback() {}
-
-               set needsUpdate(value) {
-                       if (value === true) this.version++;
-               }
-
-               setUsage(value) {
-                       this.usage = value;
-                       return this;
-               }
-
-               copy(source) {
-                       this.array = new source.array.constructor(source.array);
-                       this.count = source.count;
-                       this.stride = source.stride;
-                       this.usage = source.usage;
-                       return this;
-               }
-
-               copyAt(index1, attribute, index2) {
-                       index1 *= this.stride;
-                       index2 *= attribute.stride;
-
-                       for (let i = 0, l = this.stride; i < l; i++) {
-                               this.array[index1 + i] = attribute.array[index2 + i];
-                       }
-
-                       return this;
-               }
-
-               set(value, offset = 0) {
-                       this.array.set(value, offset);
-                       return this;
-               }
-
-               clone(data) {
-                       if (data.arrayBuffers === undefined) {
-                               data.arrayBuffers = {};
-                       }
-
-                       if (this.array.buffer._uuid === undefined) {
-                               this.array.buffer._uuid = generateUUID();
-                       }
-
-                       if (data.arrayBuffers[this.array.buffer._uuid] === undefined) {
-                               data.arrayBuffers[this.array.buffer._uuid] = this.array.slice(0).buffer;
-                       }
-
-                       const array = new this.array.constructor(data.arrayBuffers[this.array.buffer._uuid]);
-                       const ib = new this.constructor(array, this.stride);
-                       ib.setUsage(this.usage);
-                       return ib;
-               }
-
-               onUpload(callback) {
-                       this.onUploadCallback = callback;
-                       return this;
-               }
-
-               toJSON(data) {
-                       if (data.arrayBuffers === undefined) {
-                               data.arrayBuffers = {};
-                       } // generate UUID for array buffer if necessary
-
-
-                       if (this.array.buffer._uuid === undefined) {
-                               this.array.buffer._uuid = generateUUID();
-                       }
-
-                       if (data.arrayBuffers[this.array.buffer._uuid] === undefined) {
-                               data.arrayBuffers[this.array.buffer._uuid] = Array.prototype.slice.call(new Uint32Array(this.array.buffer));
-                       } //
-
-
-                       return {
-                               uuid: this.uuid,
-                               buffer: this.array.buffer._uuid,
-                               type: this.array.constructor.name,
-                               stride: this.stride
-                       };
-               }
-
-       }
-
-       InterleavedBuffer.prototype.isInterleavedBuffer = true;
-
-       const _vector$6 = /*@__PURE__*/new Vector3();
-
-       class InterleavedBufferAttribute {
-               constructor(interleavedBuffer, itemSize, offset, normalized = false) {
-                       this.name = '';
-                       this.data = interleavedBuffer;
-                       this.itemSize = itemSize;
-                       this.offset = offset;
-                       this.normalized = normalized === true;
-               }
-
-               get count() {
-                       return this.data.count;
-               }
-
-               get array() {
-                       return this.data.array;
-               }
-
-               set needsUpdate(value) {
-                       this.data.needsUpdate = value;
-               }
-
-               applyMatrix4(m) {
-                       for (let i = 0, l = this.data.count; i < l; i++) {
-                               _vector$6.x = this.getX(i);
-                               _vector$6.y = this.getY(i);
-                               _vector$6.z = this.getZ(i);
-
-                               _vector$6.applyMatrix4(m);
-
-                               this.setXYZ(i, _vector$6.x, _vector$6.y, _vector$6.z);
-                       }
-
-                       return this;
-               }
-
-               applyNormalMatrix(m) {
-                       for (let i = 0, l = this.count; i < l; i++) {
-                               _vector$6.x = this.getX(i);
-                               _vector$6.y = this.getY(i);
-                               _vector$6.z = this.getZ(i);
-
-                               _vector$6.applyNormalMatrix(m);
-
-                               this.setXYZ(i, _vector$6.x, _vector$6.y, _vector$6.z);
-                       }
-
-                       return this;
-               }
-
-               transformDirection(m) {
-                       for (let i = 0, l = this.count; i < l; i++) {
-                               _vector$6.x = this.getX(i);
-                               _vector$6.y = this.getY(i);
-                               _vector$6.z = this.getZ(i);
-
-                               _vector$6.transformDirection(m);
-
-                               this.setXYZ(i, _vector$6.x, _vector$6.y, _vector$6.z);
-                       }
-
-                       return this;
-               }
-
-               setX(index, x) {
-                       this.data.array[index * this.data.stride + this.offset] = x;
-                       return this;
-               }
-
-               setY(index, y) {
-                       this.data.array[index * this.data.stride + this.offset + 1] = y;
-                       return this;
-               }
-
-               setZ(index, z) {
-                       this.data.array[index * this.data.stride + this.offset + 2] = z;
-                       return this;
-               }
-
-               setW(index, w) {
-                       this.data.array[index * this.data.stride + this.offset + 3] = w;
-                       return this;
-               }
-
-               getX(index) {
-                       return this.data.array[index * this.data.stride + this.offset];
-               }
-
-               getY(index) {
-                       return this.data.array[index * this.data.stride + this.offset + 1];
-               }
-
-               getZ(index) {
-                       return this.data.array[index * this.data.stride + this.offset + 2];
-               }
-
-               getW(index) {
-                       return this.data.array[index * this.data.stride + this.offset + 3];
-               }
-
-               setXY(index, x, y) {
-                       index = index * this.data.stride + this.offset;
-                       this.data.array[index + 0] = x;
-                       this.data.array[index + 1] = y;
-                       return this;
-               }
-
-               setXYZ(index, x, y, z) {
-                       index = index * this.data.stride + this.offset;
-                       this.data.array[index + 0] = x;
-                       this.data.array[index + 1] = y;
-                       this.data.array[index + 2] = z;
-                       return this;
-               }
-
-               setXYZW(index, x, y, z, w) {
-                       index = index * this.data.stride + this.offset;
-                       this.data.array[index + 0] = x;
-                       this.data.array[index + 1] = y;
-                       this.data.array[index + 2] = z;
-                       this.data.array[index + 3] = w;
-                       return this;
-               }
-
-               clone(data) {
-                       if (data === undefined) {
-                               console.log('THREE.InterleavedBufferAttribute.clone(): Cloning an interlaved buffer attribute will deinterleave buffer data.');
-                               const array = [];
-
-                               for (let i = 0; i < this.count; i++) {
-                                       const index = i * this.data.stride + this.offset;
-
-                                       for (let j = 0; j < this.itemSize; j++) {
-                                               array.push(this.data.array[index + j]);
-                                       }
-                               }
-
-                               return new BufferAttribute(new this.array.constructor(array), this.itemSize, this.normalized);
-                       } else {
-                               if (data.interleavedBuffers === undefined) {
-                                       data.interleavedBuffers = {};
-                               }
-
-                               if (data.interleavedBuffers[this.data.uuid] === undefined) {
-                                       data.interleavedBuffers[this.data.uuid] = this.data.clone(data);
-                               }
-
-                               return new InterleavedBufferAttribute(data.interleavedBuffers[this.data.uuid], this.itemSize, this.offset, this.normalized);
-                       }
-               }
-
-               toJSON(data) {
-                       if (data === undefined) {
-                               console.log('THREE.InterleavedBufferAttribute.toJSON(): Serializing an interlaved buffer attribute will deinterleave buffer data.');
-                               const array = [];
-
-                               for (let i = 0; i < this.count; i++) {
-                                       const index = i * this.data.stride + this.offset;
-
-                                       for (let j = 0; j < this.itemSize; j++) {
-                                               array.push(this.data.array[index + j]);
-                                       }
-                               } // deinterleave data and save it as an ordinary buffer attribute for now
-
-
-                               return {
-                                       itemSize: this.itemSize,
-                                       type: this.array.constructor.name,
-                                       array: array,
-                                       normalized: this.normalized
-                               };
-                       } else {
-                               // save as true interlaved attribtue
-                               if (data.interleavedBuffers === undefined) {
-                                       data.interleavedBuffers = {};
-                               }
-
-                               if (data.interleavedBuffers[this.data.uuid] === undefined) {
-                                       data.interleavedBuffers[this.data.uuid] = this.data.toJSON(data);
-                               }
-
-                               return {
-                                       isInterleavedBufferAttribute: true,
-                                       itemSize: this.itemSize,
-                                       data: this.data.uuid,
-                                       offset: this.offset,
-                                       normalized: this.normalized
-                               };
-                       }
-               }
-
-       }
-
-       InterleavedBufferAttribute.prototype.isInterleavedBufferAttribute = true;
-
-       /**
-        * parameters = {
-        *      color: <hex>,
-        *      map: new THREE.Texture( <Image> ),
-        *      alphaMap: new THREE.Texture( <Image> ),
-        *      rotation: <float>,
-        *      sizeAttenuation: <bool>
-        * }
-        */
-
-       class SpriteMaterial extends Material {
-               constructor(parameters) {
-                       super();
-                       this.type = 'SpriteMaterial';
-                       this.color = new Color(0xffffff);
-                       this.map = null;
-                       this.alphaMap = null;
-                       this.rotation = 0;
-                       this.sizeAttenuation = true;
-                       this.transparent = true;
-                       this.setValues(parameters);
-               }
-
-               copy(source) {
-                       super.copy(source);
-                       this.color.copy(source.color);
-                       this.map = source.map;
-                       this.alphaMap = source.alphaMap;
-                       this.rotation = source.rotation;
-                       this.sizeAttenuation = source.sizeAttenuation;
-                       return this;
-               }
-
-       }
-
-       SpriteMaterial.prototype.isSpriteMaterial = true;
-
-       let _geometry;
-
-       const _intersectPoint = /*@__PURE__*/new Vector3();
-
-       const _worldScale = /*@__PURE__*/new Vector3();
-
-       const _mvPosition = /*@__PURE__*/new Vector3();
-
-       const _alignedPosition = /*@__PURE__*/new Vector2();
-
-       const _rotatedPosition = /*@__PURE__*/new Vector2();
-
-       const _viewWorldMatrix = /*@__PURE__*/new Matrix4();
-
-       const _vA = /*@__PURE__*/new Vector3();
-
-       const _vB = /*@__PURE__*/new Vector3();
-
-       const _vC = /*@__PURE__*/new Vector3();
-
-       const _uvA = /*@__PURE__*/new Vector2();
-
-       const _uvB = /*@__PURE__*/new Vector2();
-
-       const _uvC = /*@__PURE__*/new Vector2();
-
-       class Sprite extends Object3D {
-               constructor(material) {
-                       super();
-                       this.type = 'Sprite';
-
-                       if (_geometry === undefined) {
-                               _geometry = new BufferGeometry();
-                               const float32Array = new Float32Array([-0.5, -0.5, 0, 0, 0, 0.5, -0.5, 0, 1, 0, 0.5, 0.5, 0, 1, 1, -0.5, 0.5, 0, 0, 1]);
-                               const interleavedBuffer = new InterleavedBuffer(float32Array, 5);
-
-                               _geometry.setIndex([0, 1, 2, 0, 2, 3]);
-
-                               _geometry.setAttribute('position', new InterleavedBufferAttribute(interleavedBuffer, 3, 0, false));
-
-                               _geometry.setAttribute('uv', new InterleavedBufferAttribute(interleavedBuffer, 2, 3, false));
-                       }
-
-                       this.geometry = _geometry;
-                       this.material = material !== undefined ? material : new SpriteMaterial();
-                       this.center = new Vector2(0.5, 0.5);
-               }
-
-               raycast(raycaster, intersects) {
-                       if (raycaster.camera === null) {
-                               console.error('THREE.Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.');
-                       }
-
-                       _worldScale.setFromMatrixScale(this.matrixWorld);
-
-                       _viewWorldMatrix.copy(raycaster.camera.matrixWorld);
-
-                       this.modelViewMatrix.multiplyMatrices(raycaster.camera.matrixWorldInverse, this.matrixWorld);
-
-                       _mvPosition.setFromMatrixPosition(this.modelViewMatrix);
-
-                       if (raycaster.camera.isPerspectiveCamera && this.material.sizeAttenuation === false) {
-                               _worldScale.multiplyScalar(-_mvPosition.z);
-                       }
-
-                       const rotation = this.material.rotation;
-                       let sin, cos;
-
-                       if (rotation !== 0) {
-                               cos = Math.cos(rotation);
-                               sin = Math.sin(rotation);
-                       }
-
-                       const center = this.center;
-                       transformVertex(_vA.set(-0.5, -0.5, 0), _mvPosition, center, _worldScale, sin, cos);
-                       transformVertex(_vB.set(0.5, -0.5, 0), _mvPosition, center, _worldScale, sin, cos);
-                       transformVertex(_vC.set(0.5, 0.5, 0), _mvPosition, center, _worldScale, sin, cos);
-
-                       _uvA.set(0, 0);
-
-                       _uvB.set(1, 0);
-
-                       _uvC.set(1, 1); // check first triangle
-
-
-                       let intersect = raycaster.ray.intersectTriangle(_vA, _vB, _vC, false, _intersectPoint);
-
-                       if (intersect === null) {
-                               // check second triangle
-                               transformVertex(_vB.set(-0.5, 0.5, 0), _mvPosition, center, _worldScale, sin, cos);
-
-                               _uvB.set(0, 1);
-
-                               intersect = raycaster.ray.intersectTriangle(_vA, _vC, _vB, false, _intersectPoint);
-
-                               if (intersect === null) {
-                                       return;
-                               }
-                       }
-
-                       const distance = raycaster.ray.origin.distanceTo(_intersectPoint);
-                       if (distance < raycaster.near || distance > raycaster.far) return;
-                       intersects.push({
-                               distance: distance,
-                               point: _intersectPoint.clone(),
-                               uv: Triangle.getUV(_intersectPoint, _vA, _vB, _vC, _uvA, _uvB, _uvC, new Vector2()),
-                               face: null,
-                               object: this
-                       });
-               }
-
-               copy(source) {
-                       super.copy(source);
-                       if (source.center !== undefined) this.center.copy(source.center);
-                       this.material = source.material;
-                       return this;
-               }
-
-       }
-
-       Sprite.prototype.isSprite = true;
-
-       function transformVertex(vertexPosition, mvPosition, center, scale, sin, cos) {
-               // compute position in camera space
-               _alignedPosition.subVectors(vertexPosition, center).addScalar(0.5).multiply(scale); // to check if rotation is not zero
-
-
-               if (sin !== undefined) {
-                       _rotatedPosition.x = cos * _alignedPosition.x - sin * _alignedPosition.y;
-                       _rotatedPosition.y = sin * _alignedPosition.x + cos * _alignedPosition.y;
-               } else {
-                       _rotatedPosition.copy(_alignedPosition);
-               }
-
-               vertexPosition.copy(mvPosition);
-               vertexPosition.x += _rotatedPosition.x;
-               vertexPosition.y += _rotatedPosition.y; // transform to world space
-
-               vertexPosition.applyMatrix4(_viewWorldMatrix);
-       }
-
-       const _v1$2 = /*@__PURE__*/new Vector3();
-
-       const _v2$1 = /*@__PURE__*/new Vector3();
-
-       class LOD extends Object3D {
-               constructor() {
-                       super();
-                       this._currentLevel = 0;
-                       this.type = 'LOD';
-                       Object.defineProperties(this, {
-                               levels: {
-                                       enumerable: true,
-                                       value: []
-                               },
-                               isLOD: {
-                                       value: true
-                               }
-                       });
-                       this.autoUpdate = true;
-               }
-
-               copy(source) {
-                       super.copy(source, false);
-                       const levels = source.levels;
-
-                       for (let i = 0, l = levels.length; i < l; i++) {
-                               const level = levels[i];
-                               this.addLevel(level.object.clone(), level.distance);
-                       }
-
-                       this.autoUpdate = source.autoUpdate;
-                       return this;
-               }
-
-               addLevel(object, distance = 0) {
-                       distance = Math.abs(distance);
-                       const levels = this.levels;
-                       let l;
-
-                       for (l = 0; l < levels.length; l++) {
-                               if (distance < levels[l].distance) {
-                                       break;
-                               }
-                       }
-
-                       levels.splice(l, 0, {
-                               distance: distance,
-                               object: object
-                       });
-                       this.add(object);
-                       return this;
-               }
-
-               getCurrentLevel() {
-                       return this._currentLevel;
-               }
-
-               getObjectForDistance(distance) {
-                       const levels = this.levels;
-
-                       if (levels.length > 0) {
-                               let i, l;
-
-                               for (i = 1, l = levels.length; i < l; i++) {
-                                       if (distance < levels[i].distance) {
-                                               break;
-                                       }
-                               }
-
-                               return levels[i - 1].object;
-                       }
-
-                       return null;
-               }
-
-               raycast(raycaster, intersects) {
-                       const levels = this.levels;
-
-                       if (levels.length > 0) {
-                               _v1$2.setFromMatrixPosition(this.matrixWorld);
-
-                               const distance = raycaster.ray.origin.distanceTo(_v1$2);
-                               this.getObjectForDistance(distance).raycast(raycaster, intersects);
-                       }
-               }
-
-               update(camera) {
-                       const levels = this.levels;
-
-                       if (levels.length > 1) {
-                               _v1$2.setFromMatrixPosition(camera.matrixWorld);
-
-                               _v2$1.setFromMatrixPosition(this.matrixWorld);
-
-                               const distance = _v1$2.distanceTo(_v2$1) / camera.zoom;
-                               levels[0].object.visible = true;
-                               let i, l;
-
-                               for (i = 1, l = levels.length; i < l; i++) {
-                                       if (distance >= levels[i].distance) {
-                                               levels[i - 1].object.visible = false;
-                                               levels[i].object.visible = true;
-                                       } else {
-                                               break;
-                                       }
-                               }
-
-                               this._currentLevel = i - 1;
-
-                               for (; i < l; i++) {
-                                       levels[i].object.visible = false;
-                               }
-                       }
-               }
-
-               toJSON(meta) {
-                       const data = super.toJSON(meta);
-                       if (this.autoUpdate === false) data.object.autoUpdate = false;
-                       data.object.levels = [];
-                       const levels = this.levels;
-
-                       for (let i = 0, l = levels.length; i < l; i++) {
-                               const level = levels[i];
-                               data.object.levels.push({
-                                       object: level.object.uuid,
-                                       distance: level.distance
-                               });
-                       }
-
-                       return data;
-               }
-
-       }
-
-       const _basePosition = /*@__PURE__*/new Vector3();
-
-       const _skinIndex = /*@__PURE__*/new Vector4();
-
-       const _skinWeight = /*@__PURE__*/new Vector4();
-
-       const _vector$5 = /*@__PURE__*/new Vector3();
-
-       const _matrix = /*@__PURE__*/new Matrix4();
-
-       class SkinnedMesh extends Mesh {
-               constructor(geometry, material) {
-                       super(geometry, material);
-                       this.type = 'SkinnedMesh';
-                       this.bindMode = 'attached';
-                       this.bindMatrix = new Matrix4();
-                       this.bindMatrixInverse = new Matrix4();
-               }
-
-               copy(source) {
-                       super.copy(source);
-                       this.bindMode = source.bindMode;
-                       this.bindMatrix.copy(source.bindMatrix);
-                       this.bindMatrixInverse.copy(source.bindMatrixInverse);
-                       this.skeleton = source.skeleton;
-                       return this;
-               }
-
-               bind(skeleton, bindMatrix) {
-                       this.skeleton = skeleton;
-
-                       if (bindMatrix === undefined) {
-                               this.updateMatrixWorld(true);
-                               this.skeleton.calculateInverses();
-                               bindMatrix = this.matrixWorld;
-                       }
-
-                       this.bindMatrix.copy(bindMatrix);
-                       this.bindMatrixInverse.copy(bindMatrix).invert();
-               }
-
-               pose() {
-                       this.skeleton.pose();
-               }
-
-               normalizeSkinWeights() {
-                       const vector = new Vector4();
-                       const skinWeight = this.geometry.attributes.skinWeight;
-
-                       for (let i = 0, l = skinWeight.count; i < l; i++) {
-                               vector.x = skinWeight.getX(i);
-                               vector.y = skinWeight.getY(i);
-                               vector.z = skinWeight.getZ(i);
-                               vector.w = skinWeight.getW(i);
-                               const scale = 1.0 / vector.manhattanLength();
-
-                               if (scale !== Infinity) {
-                                       vector.multiplyScalar(scale);
-                               } else {
-                                       vector.set(1, 0, 0, 0); // do something reasonable
-                               }
-
-                               skinWeight.setXYZW(i, vector.x, vector.y, vector.z, vector.w);
-                       }
-               }
-
-               updateMatrixWorld(force) {
-                       super.updateMatrixWorld(force);
-
-                       if (this.bindMode === 'attached') {
-                               this.bindMatrixInverse.copy(this.matrixWorld).invert();
-                       } else if (this.bindMode === 'detached') {
-                               this.bindMatrixInverse.copy(this.bindMatrix).invert();
-                       } else {
-                               console.warn('THREE.SkinnedMesh: Unrecognized bindMode: ' + this.bindMode);
-                       }
-               }
-
-               boneTransform(index, target) {
-                       const skeleton = this.skeleton;
-                       const geometry = this.geometry;
-
-                       _skinIndex.fromBufferAttribute(geometry.attributes.skinIndex, index);
-
-                       _skinWeight.fromBufferAttribute(geometry.attributes.skinWeight, index);
-
-                       _basePosition.fromBufferAttribute(geometry.attributes.position, index).applyMatrix4(this.bindMatrix);
-
-                       target.set(0, 0, 0);
-
-                       for (let i = 0; i < 4; i++) {
-                               const weight = _skinWeight.getComponent(i);
-
-                               if (weight !== 0) {
-                                       const boneIndex = _skinIndex.getComponent(i);
-
-                                       _matrix.multiplyMatrices(skeleton.bones[boneIndex].matrixWorld, skeleton.boneInverses[boneIndex]);
-
-                                       target.addScaledVector(_vector$5.copy(_basePosition).applyMatrix4(_matrix), weight);
-                               }
-                       }
-
-                       return target.applyMatrix4(this.bindMatrixInverse);
-               }
-
-       }
-
-       SkinnedMesh.prototype.isSkinnedMesh = true;
-
-       class Bone extends Object3D {
-               constructor() {
-                       super();
-                       this.type = 'Bone';
-               }
-
-       }
-
-       Bone.prototype.isBone = true;
-
-       class DataTexture extends Texture {
-               constructor(data = null, width = 1, height = 1, format, type, mapping, wrapS, wrapT, magFilter = NearestFilter, minFilter = NearestFilter, anisotropy, encoding) {
-                       super(null, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy, encoding);
-                       this.image = {
-                               data: data,
-                               width: width,
-                               height: height
-                       };
-                       this.magFilter = magFilter;
-                       this.minFilter = minFilter;
-                       this.generateMipmaps = false;
-                       this.flipY = false;
-                       this.unpackAlignment = 1;
-                       this.needsUpdate = true;
-               }
-
-       }
-
-       DataTexture.prototype.isDataTexture = true;
-
-       const _offsetMatrix = /*@__PURE__*/new Matrix4();
-
-       const _identityMatrix = /*@__PURE__*/new Matrix4();
-
-       class Skeleton {
-               constructor(bones = [], boneInverses = []) {
-                       this.uuid = generateUUID();
-                       this.bones = bones.slice(0);
-                       this.boneInverses = boneInverses;
-                       this.boneMatrices = null;
-                       this.boneTexture = null;
-                       this.boneTextureSize = 0;
-                       this.frame = -1;
-                       this.init();
-               }
-
-               init() {
-                       const bones = this.bones;
-                       const boneInverses = this.boneInverses;
-                       this.boneMatrices = new Float32Array(bones.length * 16); // calculate inverse bone matrices if necessary
-
-                       if (boneInverses.length === 0) {
-                               this.calculateInverses();
-                       } else {
-                               // handle special case
-                               if (bones.length !== boneInverses.length) {
-                                       console.warn('THREE.Skeleton: Number of inverse bone matrices does not match amount of bones.');
-                                       this.boneInverses = [];
-
-                                       for (let i = 0, il = this.bones.length; i < il; i++) {
-                                               this.boneInverses.push(new Matrix4());
-                                       }
-                               }
-                       }
-               }
-
-               calculateInverses() {
-                       this.boneInverses.length = 0;
-
-                       for (let i = 0, il = this.bones.length; i < il; i++) {
-                               const inverse = new Matrix4();
-
-                               if (this.bones[i]) {
-                                       inverse.copy(this.bones[i].matrixWorld).invert();
-                               }
-
-                               this.boneInverses.push(inverse);
-                       }
-               }
-
-               pose() {
-                       // recover the bind-time world matrices
-                       for (let i = 0, il = this.bones.length; i < il; i++) {
-                               const bone = this.bones[i];
-
-                               if (bone) {
-                                       bone.matrixWorld.copy(this.boneInverses[i]).invert();
-                               }
-                       } // compute the local matrices, positions, rotations and scales
-
-
-                       for (let i = 0, il = this.bones.length; i < il; i++) {
-                               const bone = this.bones[i];
-
-                               if (bone) {
-                                       if (bone.parent && bone.parent.isBone) {
-                                               bone.matrix.copy(bone.parent.matrixWorld).invert();
-                                               bone.matrix.multiply(bone.matrixWorld);
-                                       } else {
-                                               bone.matrix.copy(bone.matrixWorld);
-                                       }
-
-                                       bone.matrix.decompose(bone.position, bone.quaternion, bone.scale);
-                               }
-                       }
-               }
-
-               update() {
-                       const bones = this.bones;
-                       const boneInverses = this.boneInverses;
-                       const boneMatrices = this.boneMatrices;
-                       const boneTexture = this.boneTexture; // flatten bone matrices to array
-
-                       for (let i = 0, il = bones.length; i < il; i++) {
-                               // compute the offset between the current and the original transform
-                               const matrix = bones[i] ? bones[i].matrixWorld : _identityMatrix;
-
-                               _offsetMatrix.multiplyMatrices(matrix, boneInverses[i]);
-
-                               _offsetMatrix.toArray(boneMatrices, i * 16);
-                       }
-
-                       if (boneTexture !== null) {
-                               boneTexture.needsUpdate = true;
-                       }
-               }
-
-               clone() {
-                       return new Skeleton(this.bones, this.boneInverses);
-               }
-
-               computeBoneTexture() {
-                       // layout (1 matrix = 4 pixels)
-                       //                      RGBA RGBA RGBA RGBA (=> column1, column2, column3, column4)
-                       //      with    8x8     pixel texture max        16 bones * 4 pixels =  (8 * 8)
-                       //                       16x16 pixel texture max         64 bones * 4 pixels = (16 * 16)
-                       //                       32x32 pixel texture max        256 bones * 4 pixels = (32 * 32)
-                       //                       64x64 pixel texture max 1024 bones * 4 pixels = (64 * 64)
-                       let size = Math.sqrt(this.bones.length * 4); // 4 pixels needed for 1 matrix
-
-                       size = ceilPowerOfTwo(size);
-                       size = Math.max(size, 4);
-                       const boneMatrices = new Float32Array(size * size * 4); // 4 floats per RGBA pixel
-
-                       boneMatrices.set(this.boneMatrices); // copy current values
-
-                       const boneTexture = new DataTexture(boneMatrices, size, size, RGBAFormat, FloatType);
-                       this.boneMatrices = boneMatrices;
-                       this.boneTexture = boneTexture;
-                       this.boneTextureSize = size;
-                       return this;
-               }
-
-               getBoneByName(name) {
-                       for (let i = 0, il = this.bones.length; i < il; i++) {
-                               const bone = this.bones[i];
-
-                               if (bone.name === name) {
-                                       return bone;
-                               }
-                       }
-
-                       return undefined;
-               }
-
-               dispose() {
-                       if (this.boneTexture !== null) {
-                               this.boneTexture.dispose();
-                               this.boneTexture = null;
-                       }
-               }
-
-               fromJSON(json, bones) {
-                       this.uuid = json.uuid;
-
-                       for (let i = 0, l = json.bones.length; i < l; i++) {
-                               const uuid = json.bones[i];
-                               let bone = bones[uuid];
-
-                               if (bone === undefined) {
-                                       console.warn('THREE.Skeleton: No bone found with UUID:', uuid);
-                                       bone = new Bone();
-                               }
-
-                               this.bones.push(bone);
-                               this.boneInverses.push(new Matrix4().fromArray(json.boneInverses[i]));
-                       }
-
-                       this.init();
-                       return this;
-               }
-
-               toJSON() {
-                       const data = {
-                               metadata: {
-                                       version: 4.5,
-                                       type: 'Skeleton',
-                                       generator: 'Skeleton.toJSON'
-                               },
-                               bones: [],
-                               boneInverses: []
-                       };
-                       data.uuid = this.uuid;
-                       const bones = this.bones;
-                       const boneInverses = this.boneInverses;
-
-                       for (let i = 0, l = bones.length; i < l; i++) {
-                               const bone = bones[i];
-                               data.bones.push(bone.uuid);
-                               const boneInverse = boneInverses[i];
-                               data.boneInverses.push(boneInverse.toArray());
-                       }
-
-                       return data;
-               }
-
-       }
-
-       class InstancedBufferAttribute extends BufferAttribute {
-               constructor(array, itemSize, normalized, meshPerAttribute = 1) {
-                       if (typeof normalized === 'number') {
-                               meshPerAttribute = normalized;
-                               normalized = false;
-                               console.error('THREE.InstancedBufferAttribute: The constructor now expects normalized as the third argument.');
-                       }
-
-                       super(array, itemSize, normalized);
-                       this.meshPerAttribute = meshPerAttribute;
-               }
-
-               copy(source) {
-                       super.copy(source);
-                       this.meshPerAttribute = source.meshPerAttribute;
-                       return this;
-               }
-
-               toJSON() {
-                       const data = super.toJSON();
-                       data.meshPerAttribute = this.meshPerAttribute;
-                       data.isInstancedBufferAttribute = true;
-                       return data;
-               }
-
-       }
-
-       InstancedBufferAttribute.prototype.isInstancedBufferAttribute = true;
-
-       const _instanceLocalMatrix = /*@__PURE__*/new Matrix4();
-
-       const _instanceWorldMatrix = /*@__PURE__*/new Matrix4();
-
-       const _instanceIntersects = [];
-
-       const _mesh = /*@__PURE__*/new Mesh();
-
-       class InstancedMesh extends Mesh {
-               constructor(geometry, material, count) {
-                       super(geometry, material);
-                       this.instanceMatrix = new InstancedBufferAttribute(new Float32Array(count * 16), 16);
-                       this.instanceColor = null;
-                       this.count = count;
-                       this.frustumCulled = false;
-               }
-
-               copy(source) {
-                       super.copy(source);
-                       this.instanceMatrix.copy(source.instanceMatrix);
-                       if (source.instanceColor !== null) this.instanceColor = source.instanceColor.clone();
-                       this.count = source.count;
-                       return this;
-               }
-
-               getColorAt(index, color) {
-                       color.fromArray(this.instanceColor.array, index * 3);
-               }
-
-               getMatrixAt(index, matrix) {
-                       matrix.fromArray(this.instanceMatrix.array, index * 16);
-               }
-
-               raycast(raycaster, intersects) {
-                       const matrixWorld = this.matrixWorld;
-                       const raycastTimes = this.count;
-                       _mesh.geometry = this.geometry;
-                       _mesh.material = this.material;
-                       if (_mesh.material === undefined) return;
-
-                       for (let instanceId = 0; instanceId < raycastTimes; instanceId++) {
-                               // calculate the world matrix for each instance
-                               this.getMatrixAt(instanceId, _instanceLocalMatrix);
-
-                               _instanceWorldMatrix.multiplyMatrices(matrixWorld, _instanceLocalMatrix); // the mesh represents this single instance
-
-
-                               _mesh.matrixWorld = _instanceWorldMatrix;
-
-                               _mesh.raycast(raycaster, _instanceIntersects); // process the result of raycast
-
-
-                               for (let i = 0, l = _instanceIntersects.length; i < l; i++) {
-                                       const intersect = _instanceIntersects[i];
-                                       intersect.instanceId = instanceId;
-                                       intersect.object = this;
-                                       intersects.push(intersect);
-                               }
-
-                               _instanceIntersects.length = 0;
-                       }
-               }
-
-               setColorAt(index, color) {
-                       if (this.instanceColor === null) {
-                               this.instanceColor = new InstancedBufferAttribute(new Float32Array(this.instanceMatrix.count * 3), 3);
-                       }
-
-                       color.toArray(this.instanceColor.array, index * 3);
-               }
-
-               setMatrixAt(index, matrix) {
-                       matrix.toArray(this.instanceMatrix.array, index * 16);
-               }
-
-               updateMorphTargets() {}
-
-               dispose() {
-                       this.dispatchEvent({
-                               type: 'dispose'
-                       });
-               }
-
-       }
-
-       InstancedMesh.prototype.isInstancedMesh = true;
-
-       /**
-        * parameters = {
-        *      color: <hex>,
-        *      opacity: <float>,
-        *
-        *      linewidth: <float>,
-        *      linecap: "round",
-        *      linejoin: "round"
-        * }
-        */
-
-       class LineBasicMaterial extends Material {
-               constructor(parameters) {
-                       super();
-                       this.type = 'LineBasicMaterial';
-                       this.color = new Color(0xffffff);
-                       this.linewidth = 1;
-                       this.linecap = 'round';
-                       this.linejoin = 'round';
-                       this.setValues(parameters);
-               }
-
-               copy(source) {
-                       super.copy(source);
-                       this.color.copy(source.color);
-                       this.linewidth = source.linewidth;
-                       this.linecap = source.linecap;
-                       this.linejoin = source.linejoin;
-                       return this;
-               }
-
-       }
-
-       LineBasicMaterial.prototype.isLineBasicMaterial = true;
-
-       const _start$1 = /*@__PURE__*/new Vector3();
-
-       const _end$1 = /*@__PURE__*/new Vector3();
-
-       const _inverseMatrix$1 = /*@__PURE__*/new Matrix4();
-
-       const _ray$1 = /*@__PURE__*/new Ray();
-
-       const _sphere$1 = /*@__PURE__*/new Sphere();
-
-       class Line extends Object3D {
-               constructor(geometry = new BufferGeometry(), material = new LineBasicMaterial()) {
-                       super();
-                       this.type = 'Line';
-                       this.geometry = geometry;
-                       this.material = material;
-                       this.updateMorphTargets();
-               }
-
-               copy(source) {
-                       super.copy(source);
-                       this.material = source.material;
-                       this.geometry = source.geometry;
-                       return this;
-               }
-
-               computeLineDistances() {
-                       const geometry = this.geometry;
-
-                       if (geometry.isBufferGeometry) {
-                               // we assume non-indexed geometry
-                               if (geometry.index === null) {
-                                       const positionAttribute = geometry.attributes.position;
-                                       const lineDistances = [0];
-
-                                       for (let i = 1, l = positionAttribute.count; i < l; i++) {
-                                               _start$1.fromBufferAttribute(positionAttribute, i - 1);
-
-                                               _end$1.fromBufferAttribute(positionAttribute, i);
-
-                                               lineDistances[i] = lineDistances[i - 1];
-                                               lineDistances[i] += _start$1.distanceTo(_end$1);
-                                       }
-
-                                       geometry.setAttribute('lineDistance', new Float32BufferAttribute(lineDistances, 1));
-                               } else {
-                                       console.warn('THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.');
-                               }
-                       } else if (geometry.isGeometry) {
-                               console.error('THREE.Line.computeLineDistances() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.');
-                       }
-
-                       return this;
-               }
-
-               raycast(raycaster, intersects) {
-                       const geometry = this.geometry;
-                       const matrixWorld = this.matrixWorld;
-                       const threshold = raycaster.params.Line.threshold;
-                       const drawRange = geometry.drawRange; // Checking boundingSphere distance to ray
-
-                       if (geometry.boundingSphere === null) geometry.computeBoundingSphere();
-
-                       _sphere$1.copy(geometry.boundingSphere);
-
-                       _sphere$1.applyMatrix4(matrixWorld);
-
-                       _sphere$1.radius += threshold;
-                       if (raycaster.ray.intersectsSphere(_sphere$1) === false) return; //
-
-                       _inverseMatrix$1.copy(matrixWorld).invert();
-
-                       _ray$1.copy(raycaster.ray).applyMatrix4(_inverseMatrix$1);
-
-                       const localThreshold = threshold / ((this.scale.x + this.scale.y + this.scale.z) / 3);
-                       const localThresholdSq = localThreshold * localThreshold;
-                       const vStart = new Vector3();
-                       const vEnd = new Vector3();
-                       const interSegment = new Vector3();
-                       const interRay = new Vector3();
-                       const step = this.isLineSegments ? 2 : 1;
-
-                       if (geometry.isBufferGeometry) {
-                               const index = geometry.index;
-                               const attributes = geometry.attributes;
-                               const positionAttribute = attributes.position;
-
-                               if (index !== null) {
-                                       const start = Math.max(0, drawRange.start);
-                                       const end = Math.min(index.count, drawRange.start + drawRange.count);
-
-                                       for (let i = start, l = end - 1; i < l; i += step) {
-                                               const a = index.getX(i);
-                                               const b = index.getX(i + 1);
-                                               vStart.fromBufferAttribute(positionAttribute, a);
-                                               vEnd.fromBufferAttribute(positionAttribute, b);
-
-                                               const distSq = _ray$1.distanceSqToSegment(vStart, vEnd, interRay, interSegment);
-
-                                               if (distSq > localThresholdSq) continue;
-                                               interRay.applyMatrix4(this.matrixWorld); //Move back to world space for distance calculation
-
-                                               const distance = raycaster.ray.origin.distanceTo(interRay);
-                                               if (distance < raycaster.near || distance > raycaster.far) continue;
-                                               intersects.push({
-                                                       distance: distance,
-                                                       // What do we want? intersection point on the ray or on the segment??
-                                                       // point: raycaster.ray.at( distance ),
-                                                       point: interSegment.clone().applyMatrix4(this.matrixWorld),
-                                                       index: i,
-                                                       face: null,
-                                                       faceIndex: null,
-                                                       object: this
-                                               });
-                                       }
-                               } else {
-                                       const start = Math.max(0, drawRange.start);
-                                       const end = Math.min(positionAttribute.count, drawRange.start + drawRange.count);
-
-                                       for (let i = start, l = end - 1; i < l; i += step) {
-                                               vStart.fromBufferAttribute(positionAttribute, i);
-                                               vEnd.fromBufferAttribute(positionAttribute, i + 1);
-
-                                               const distSq = _ray$1.distanceSqToSegment(vStart, vEnd, interRay, interSegment);
-
-                                               if (distSq > localThresholdSq) continue;
-                                               interRay.applyMatrix4(this.matrixWorld); //Move back to world space for distance calculation
-
-                                               const distance = raycaster.ray.origin.distanceTo(interRay);
-                                               if (distance < raycaster.near || distance > raycaster.far) continue;
-                                               intersects.push({
-                                                       distance: distance,
-                                                       // What do we want? intersection point on the ray or on the segment??
-                                                       // point: raycaster.ray.at( distance ),
-                                                       point: interSegment.clone().applyMatrix4(this.matrixWorld),
-                                                       index: i,
-                                                       face: null,
-                                                       faceIndex: null,
-                                                       object: this
-                                               });
-                                       }
-                               }
-                       } else if (geometry.isGeometry) {
-                               console.error('THREE.Line.raycast() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.');
-                       }
-               }
-
-               updateMorphTargets() {
-                       const geometry = this.geometry;
-
-                       if (geometry.isBufferGeometry) {
-                               const morphAttributes = geometry.morphAttributes;
-                               const keys = Object.keys(morphAttributes);
-
-                               if (keys.length > 0) {
-                                       const morphAttribute = morphAttributes[keys[0]];
-
-                                       if (morphAttribute !== undefined) {
-                                               this.morphTargetInfluences = [];
-                                               this.morphTargetDictionary = {};
-
-                                               for (let m = 0, ml = morphAttribute.length; m < ml; m++) {
-                                                       const name = morphAttribute[m].name || String(m);
-                                                       this.morphTargetInfluences.push(0);
-                                                       this.morphTargetDictionary[name] = m;
-                                               }
-                                       }
-                               }
-                       } else {
-                               const morphTargets = geometry.morphTargets;
-
-                               if (morphTargets !== undefined && morphTargets.length > 0) {
-                                       console.error('THREE.Line.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.');
-                               }
-                       }
-               }
-
-       }
-
-       Line.prototype.isLine = true;
-
-       const _start = /*@__PURE__*/new Vector3();
-
-       const _end = /*@__PURE__*/new Vector3();
-
-       class LineSegments extends Line {
-               constructor(geometry, material) {
-                       super(geometry, material);
-                       this.type = 'LineSegments';
-               }
-
-               computeLineDistances() {
-                       const geometry = this.geometry;
-
-                       if (geometry.isBufferGeometry) {
-                               // we assume non-indexed geometry
-                               if (geometry.index === null) {
-                                       const positionAttribute = geometry.attributes.position;
-                                       const lineDistances = [];
-
-                                       for (let i = 0, l = positionAttribute.count; i < l; i += 2) {
-                                               _start.fromBufferAttribute(positionAttribute, i);
-
-                                               _end.fromBufferAttribute(positionAttribute, i + 1);
-
-                                               lineDistances[i] = i === 0 ? 0 : lineDistances[i - 1];
-                                               lineDistances[i + 1] = lineDistances[i] + _start.distanceTo(_end);
-                                       }
-
-                                       geometry.setAttribute('lineDistance', new Float32BufferAttribute(lineDistances, 1));
-                               } else {
-                                       console.warn('THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.');
-                               }
-                       } else if (geometry.isGeometry) {
-                               console.error('THREE.LineSegments.computeLineDistances() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.');
-                       }
-
-                       return this;
-               }
-
-       }
-
-       LineSegments.prototype.isLineSegments = true;
-
-       class LineLoop extends Line {
-               constructor(geometry, material) {
-                       super(geometry, material);
-                       this.type = 'LineLoop';
-               }
-
-       }
-
-       LineLoop.prototype.isLineLoop = true;
-
-       /**
-        * parameters = {
-        *      color: <hex>,
-        *      opacity: <float>,
-        *      map: new THREE.Texture( <Image> ),
-        *      alphaMap: new THREE.Texture( <Image> ),
-        *
-        *      size: <float>,
-        *      sizeAttenuation: <bool>
-        *
-        * }
-        */
-
-       class PointsMaterial extends Material {
-               constructor(parameters) {
-                       super();
-                       this.type = 'PointsMaterial';
-                       this.color = new Color(0xffffff);
-                       this.map = null;
-                       this.alphaMap = null;
-                       this.size = 1;
-                       this.sizeAttenuation = true;
-                       this.setValues(parameters);
-               }
-
-               copy(source) {
-                       super.copy(source);
-                       this.color.copy(source.color);
-                       this.map = source.map;
-                       this.alphaMap = source.alphaMap;
-                       this.size = source.size;
-                       this.sizeAttenuation = source.sizeAttenuation;
-                       return this;
-               }
-
-       }
-
-       PointsMaterial.prototype.isPointsMaterial = true;
-
-       const _inverseMatrix = /*@__PURE__*/new Matrix4();
-
-       const _ray = /*@__PURE__*/new Ray();
-
-       const _sphere = /*@__PURE__*/new Sphere();
-
-       const _position$2 = /*@__PURE__*/new Vector3();
-
-       class Points extends Object3D {
-               constructor(geometry = new BufferGeometry(), material = new PointsMaterial()) {
-                       super();
-                       this.type = 'Points';
-                       this.geometry = geometry;
-                       this.material = material;
-                       this.updateMorphTargets();
-               }
-
-               copy(source) {
-                       super.copy(source);
-                       this.material = source.material;
-                       this.geometry = source.geometry;
-                       return this;
-               }
-
-               raycast(raycaster, intersects) {
-                       const geometry = this.geometry;
-                       const matrixWorld = this.matrixWorld;
-                       const threshold = raycaster.params.Points.threshold;
-                       const drawRange = geometry.drawRange; // Checking boundingSphere distance to ray
-
-                       if (geometry.boundingSphere === null) geometry.computeBoundingSphere();
-
-                       _sphere.copy(geometry.boundingSphere);
-
-                       _sphere.applyMatrix4(matrixWorld);
-
-                       _sphere.radius += threshold;
-                       if (raycaster.ray.intersectsSphere(_sphere) === false) return; //
-
-                       _inverseMatrix.copy(matrixWorld).invert();
-
-                       _ray.copy(raycaster.ray).applyMatrix4(_inverseMatrix);
-
-                       const localThreshold = threshold / ((this.scale.x + this.scale.y + this.scale.z) / 3);
-                       const localThresholdSq = localThreshold * localThreshold;
-
-                       if (geometry.isBufferGeometry) {
-                               const index = geometry.index;
-                               const attributes = geometry.attributes;
-                               const positionAttribute = attributes.position;
-
-                               if (index !== null) {
-                                       const start = Math.max(0, drawRange.start);
-                                       const end = Math.min(index.count, drawRange.start + drawRange.count);
-
-                                       for (let i = start, il = end; i < il; i++) {
-                                               const a = index.getX(i);
-
-                                               _position$2.fromBufferAttribute(positionAttribute, a);
-
-                                               testPoint(_position$2, a, localThresholdSq, matrixWorld, raycaster, intersects, this);
-                                       }
-                               } else {
-                                       const start = Math.max(0, drawRange.start);
-                                       const end = Math.min(positionAttribute.count, drawRange.start + drawRange.count);
-
-                                       for (let i = start, l = end; i < l; i++) {
-                                               _position$2.fromBufferAttribute(positionAttribute, i);
-
-                                               testPoint(_position$2, i, localThresholdSq, matrixWorld, raycaster, intersects, this);
-                                       }
-                               }
-                       } else {
-                               console.error('THREE.Points.raycast() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.');
-                       }
-               }
-
-               updateMorphTargets() {
-                       const geometry = this.geometry;
-
-                       if (geometry.isBufferGeometry) {
-                               const morphAttributes = geometry.morphAttributes;
-                               const keys = Object.keys(morphAttributes);
-
-                               if (keys.length > 0) {
-                                       const morphAttribute = morphAttributes[keys[0]];
-
-                                       if (morphAttribute !== undefined) {
-                                               this.morphTargetInfluences = [];
-                                               this.morphTargetDictionary = {};
-
-                                               for (let m = 0, ml = morphAttribute.length; m < ml; m++) {
-                                                       const name = morphAttribute[m].name || String(m);
-                                                       this.morphTargetInfluences.push(0);
-                                                       this.morphTargetDictionary[name] = m;
-                                               }
-                                       }
-                               }
-                       } else {
-                               const morphTargets = geometry.morphTargets;
-
-                               if (morphTargets !== undefined && morphTargets.length > 0) {
-                                       console.error('THREE.Points.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.');
-                               }
-                       }
-               }
-
-       }
-
-       Points.prototype.isPoints = true;
-
-       function testPoint(point, index, localThresholdSq, matrixWorld, raycaster, intersects, object) {
-               const rayPointDistanceSq = _ray.distanceSqToPoint(point);
-
-               if (rayPointDistanceSq < localThresholdSq) {
-                       const intersectPoint = new Vector3();
-
-                       _ray.closestPointToPoint(point, intersectPoint);
-
-                       intersectPoint.applyMatrix4(matrixWorld);
-                       const distance = raycaster.ray.origin.distanceTo(intersectPoint);
-                       if (distance < raycaster.near || distance > raycaster.far) return;
-                       intersects.push({
-                               distance: distance,
-                               distanceToRay: Math.sqrt(rayPointDistanceSq),
-                               point: intersectPoint,
-                               index: index,
-                               face: null,
-                               object: object
-                       });
-               }
-       }
-
-       class VideoTexture extends Texture {
-               constructor(video, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy) {
-                       super(video, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy);
-                       this.format = format !== undefined ? format : RGBFormat;
-                       this.minFilter = minFilter !== undefined ? minFilter : LinearFilter;
-                       this.magFilter = magFilter !== undefined ? magFilter : LinearFilter;
-                       this.generateMipmaps = false;
-                       const scope = this;
-
-                       function updateVideo() {
-                               scope.needsUpdate = true;
-                               video.requestVideoFrameCallback(updateVideo);
-                       }
-
-                       if ('requestVideoFrameCallback' in video) {
-                               video.requestVideoFrameCallback(updateVideo);
-                       }
-               }
-
-               clone() {
-                       return new this.constructor(this.image).copy(this);
-               }
-
-               update() {
-                       const video = this.image;
-                       const hasVideoFrameCallback = ('requestVideoFrameCallback' in video);
-
-                       if (hasVideoFrameCallback === false && video.readyState >= video.HAVE_CURRENT_DATA) {
-                               this.needsUpdate = true;
-                       }
-               }
-
-       }
-
-       VideoTexture.prototype.isVideoTexture = true;
-
-       class CompressedTexture extends Texture {
-               constructor(mipmaps, width, height, format, type, mapping, wrapS, wrapT, magFilter, minFilter, anisotropy, encoding) {
-                       super(null, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy, encoding);
-                       this.image = {
-                               width: width,
-                               height: height
-                       };
-                       this.mipmaps = mipmaps; // no flipping for cube textures
-                       // (also flipping doesn't work for compressed textures )
-
-                       this.flipY = false; // can't generate mipmaps for compressed textures
-                       // mips must be embedded in DDS files
-
-                       this.generateMipmaps = false;
-               }
-
-       }
-
-       CompressedTexture.prototype.isCompressedTexture = true;
-
-       class CanvasTexture extends Texture {
-               constructor(canvas, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy) {
-                       super(canvas, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy);
-                       this.needsUpdate = true;
-               }
-
-       }
-
-       CanvasTexture.prototype.isCanvasTexture = true;
-
-       class DepthTexture extends Texture {
-               constructor(width, height, type, mapping, wrapS, wrapT, magFilter, minFilter, anisotropy, format) {
-                       format = format !== undefined ? format : DepthFormat;
-
-                       if (format !== DepthFormat && format !== DepthStencilFormat) {
-                               throw new Error('DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat');
-                       }
-
-                       if (type === undefined && format === DepthFormat) type = UnsignedShortType;
-                       if (type === undefined && format === DepthStencilFormat) type = UnsignedInt248Type;
-                       super(null, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy);
-                       this.image = {
-                               width: width,
-                               height: height
-                       };
-                       this.magFilter = magFilter !== undefined ? magFilter : NearestFilter;
-                       this.minFilter = minFilter !== undefined ? minFilter : NearestFilter;
-                       this.flipY = false;
-                       this.generateMipmaps = false;
-               }
-
-       }
-
-       DepthTexture.prototype.isDepthTexture = true;
-
-       class CircleGeometry extends BufferGeometry {
-               constructor(radius = 1, segments = 8, thetaStart = 0, thetaLength = Math.PI * 2) {
-                       super();
-                       this.type = 'CircleGeometry';
-                       this.parameters = {
-                               radius: radius,
-                               segments: segments,
-                               thetaStart: thetaStart,
-                               thetaLength: thetaLength
-                       };
-                       segments = Math.max(3, segments); // buffers
-
-                       const indices = [];
-                       const vertices = [];
-                       const normals = [];
-                       const uvs = []; // helper variables
-
-                       const vertex = new Vector3();
-                       const uv = new Vector2(); // center point
-
-                       vertices.push(0, 0, 0);
-                       normals.push(0, 0, 1);
-                       uvs.push(0.5, 0.5);
-
-                       for (let s = 0, i = 3; s <= segments; s++, i += 3) {
-                               const segment = thetaStart + s / segments * thetaLength; // vertex
-
-                               vertex.x = radius * Math.cos(segment);
-                               vertex.y = radius * Math.sin(segment);
-                               vertices.push(vertex.x, vertex.y, vertex.z); // normal
-
-                               normals.push(0, 0, 1); // uvs
-
-                               uv.x = (vertices[i] / radius + 1) / 2;
-                               uv.y = (vertices[i + 1] / radius + 1) / 2;
-                               uvs.push(uv.x, uv.y);
-                       } // indices
-
-
-                       for (let i = 1; i <= segments; i++) {
-                               indices.push(i, i + 1, 0);
-                       } // build geometry
-
-
-                       this.setIndex(indices);
-                       this.setAttribute('position', new Float32BufferAttribute(vertices, 3));
-                       this.setAttribute('normal', new Float32BufferAttribute(normals, 3));
-                       this.setAttribute('uv', new Float32BufferAttribute(uvs, 2));
-               }
-
-               static fromJSON(data) {
-                       return new CircleGeometry(data.radius, data.segments, data.thetaStart, data.thetaLength);
-               }
-
-       }
-
-       class CylinderGeometry extends BufferGeometry {
-               constructor(radiusTop = 1, radiusBottom = 1, height = 1, radialSegments = 8, heightSegments = 1, openEnded = false, thetaStart = 0, thetaLength = Math.PI * 2) {
-                       super();
-                       this.type = 'CylinderGeometry';
-                       this.parameters = {
-                               radiusTop: radiusTop,
-                               radiusBottom: radiusBottom,
-                               height: height,
-                               radialSegments: radialSegments,
-                               heightSegments: heightSegments,
-                               openEnded: openEnded,
-                               thetaStart: thetaStart,
-                               thetaLength: thetaLength
-                       };
-                       const scope = this;
-                       radialSegments = Math.floor(radialSegments);
-                       heightSegments = Math.floor(heightSegments); // buffers
-
-                       const indices = [];
-                       const vertices = [];
-                       const normals = [];
-                       const uvs = []; // helper variables
-
-                       let index = 0;
-                       const indexArray = [];
-                       const halfHeight = height / 2;
-                       let groupStart = 0; // generate geometry
-
-                       generateTorso();
-
-                       if (openEnded === false) {
-                               if (radiusTop > 0) generateCap(true);
-                               if (radiusBottom > 0) generateCap(false);
-                       } // build geometry
-
-
-                       this.setIndex(indices);
-                       this.setAttribute('position', new Float32BufferAttribute(vertices, 3));
-                       this.setAttribute('normal', new Float32BufferAttribute(normals, 3));
-                       this.setAttribute('uv', new Float32BufferAttribute(uvs, 2));
-
-                       function generateTorso() {
-                               const normal = new Vector3();
-                               const vertex = new Vector3();
-                               let groupCount = 0; // this will be used to calculate the normal
-
-                               const slope = (radiusBottom - radiusTop) / height; // generate vertices, normals and uvs
-
-                               for (let y = 0; y <= heightSegments; y++) {
-                                       const indexRow = [];
-                                       const v = y / heightSegments; // calculate the radius of the current row
-
-                                       const radius = v * (radiusBottom - radiusTop) + radiusTop;
-
-                                       for (let x = 0; x <= radialSegments; x++) {
-                                               const u = x / radialSegments;
-                                               const theta = u * thetaLength + thetaStart;
-                                               const sinTheta = Math.sin(theta);
-                                               const cosTheta = Math.cos(theta); // vertex
-
-                                               vertex.x = radius * sinTheta;
-                                               vertex.y = -v * height + halfHeight;
-                                               vertex.z = radius * cosTheta;
-                                               vertices.push(vertex.x, vertex.y, vertex.z); // normal
-
-                                               normal.set(sinTheta, slope, cosTheta).normalize();
-                                               normals.push(normal.x, normal.y, normal.z); // uv
-
-                                               uvs.push(u, 1 - v); // save index of vertex in respective row
-
-                                               indexRow.push(index++);
-                                       } // now save vertices of the row in our index array
-
-
-                                       indexArray.push(indexRow);
-                               } // generate indices
-
-
-                               for (let x = 0; x < radialSegments; x++) {
-                                       for (let y = 0; y < heightSegments; y++) {
-                                               // we use the index array to access the correct indices
-                                               const a = indexArray[y][x];
-                                               const b = indexArray[y + 1][x];
-                                               const c = indexArray[y + 1][x + 1];
-                                               const d = indexArray[y][x + 1]; // faces
-
-                                               indices.push(a, b, d);
-                                               indices.push(b, c, d); // update group counter
-
-                                               groupCount += 6;
-                                       }
-                               } // add a group to the geometry. this will ensure multi material support
-
-
-                               scope.addGroup(groupStart, groupCount, 0); // calculate new start value for groups
-
-                               groupStart += groupCount;
-                       }
-
-                       function generateCap(top) {
-                               // save the index of the first center vertex
-                               const centerIndexStart = index;
-                               const uv = new Vector2();
-                               const vertex = new Vector3();
-                               let groupCount = 0;
-                               const radius = top === true ? radiusTop : radiusBottom;
-                               const sign = top === true ? 1 : -1; // first we generate the center vertex data of the cap.
-                               // because the geometry needs one set of uvs per face,
-                               // we must generate a center vertex per face/segment
-
-                               for (let x = 1; x <= radialSegments; x++) {
-                                       // vertex
-                                       vertices.push(0, halfHeight * sign, 0); // normal
-
-                                       normals.push(0, sign, 0); // uv
-
-                                       uvs.push(0.5, 0.5); // increase index
-
-                                       index++;
-                               } // save the index of the last center vertex
-
-
-                               const centerIndexEnd = index; // now we generate the surrounding vertices, normals and uvs
-
-                               for (let x = 0; x <= radialSegments; x++) {
-                                       const u = x / radialSegments;
-                                       const theta = u * thetaLength + thetaStart;
-                                       const cosTheta = Math.cos(theta);
-                                       const sinTheta = Math.sin(theta); // vertex
-
-                                       vertex.x = radius * sinTheta;
-                                       vertex.y = halfHeight * sign;
-                                       vertex.z = radius * cosTheta;
-                                       vertices.push(vertex.x, vertex.y, vertex.z); // normal
-
-                                       normals.push(0, sign, 0); // uv
-
-                                       uv.x = cosTheta * 0.5 + 0.5;
-                                       uv.y = sinTheta * 0.5 * sign + 0.5;
-                                       uvs.push(uv.x, uv.y); // increase index
-
-                                       index++;
-                               } // generate indices
-
-
-                               for (let x = 0; x < radialSegments; x++) {
-                                       const c = centerIndexStart + x;
-                                       const i = centerIndexEnd + x;
-
-                                       if (top === true) {
-                                               // face top
-                                               indices.push(i, i + 1, c);
-                                       } else {
-                                               // face bottom
-                                               indices.push(i + 1, i, c);
-                                       }
-
-                                       groupCount += 3;
-                               } // add a group to the geometry. this will ensure multi material support
-
-
-                               scope.addGroup(groupStart, groupCount, top === true ? 1 : 2); // calculate new start value for groups
-
-                               groupStart += groupCount;
-                       }
-               }
-
-               static fromJSON(data) {
-                       return new CylinderGeometry(data.radiusTop, data.radiusBottom, data.height, data.radialSegments, data.heightSegments, data.openEnded, data.thetaStart, data.thetaLength);
-               }
-
-       }
-
-       class ConeGeometry extends CylinderGeometry {
-               constructor(radius = 1, height = 1, radialSegments = 8, heightSegments = 1, openEnded = false, thetaStart = 0, thetaLength = Math.PI * 2) {
-                       super(0, radius, height, radialSegments, heightSegments, openEnded, thetaStart, thetaLength);
-                       this.type = 'ConeGeometry';
-                       this.parameters = {
-                               radius: radius,
-                               height: height,
-                               radialSegments: radialSegments,
-                               heightSegments: heightSegments,
-                               openEnded: openEnded,
-                               thetaStart: thetaStart,
-                               thetaLength: thetaLength
-                       };
-               }
-
-               static fromJSON(data) {
-                       return new ConeGeometry(data.radius, data.height, data.radialSegments, data.heightSegments, data.openEnded, data.thetaStart, data.thetaLength);
-               }
-
-       }
-
-       class PolyhedronGeometry extends BufferGeometry {
-               constructor(vertices, indices, radius = 1, detail = 0) {
-                       super();
-                       this.type = 'PolyhedronGeometry';
-                       this.parameters = {
-                               vertices: vertices,
-                               indices: indices,
-                               radius: radius,
-                               detail: detail
-                       }; // default buffer data
-
-                       const vertexBuffer = [];
-                       const uvBuffer = []; // the subdivision creates the vertex buffer data
-
-                       subdivide(detail); // all vertices should lie on a conceptual sphere with a given radius
-
-                       applyRadius(radius); // finally, create the uv data
-
-                       generateUVs(); // build non-indexed geometry
-
-                       this.setAttribute('position', new Float32BufferAttribute(vertexBuffer, 3));
-                       this.setAttribute('normal', new Float32BufferAttribute(vertexBuffer.slice(), 3));
-                       this.setAttribute('uv', new Float32BufferAttribute(uvBuffer, 2));
-
-                       if (detail === 0) {
-                               this.computeVertexNormals(); // flat normals
-                       } else {
-                               this.normalizeNormals(); // smooth normals
-                       } // helper functions
-
-
-                       function subdivide(detail) {
-                               const a = new Vector3();
-                               const b = new Vector3();
-                               const c = new Vector3(); // iterate over all faces and apply a subdivison with the given detail value
-
-                               for (let i = 0; i < indices.length; i += 3) {
-                                       // get the vertices of the face
-                                       getVertexByIndex(indices[i + 0], a);
-                                       getVertexByIndex(indices[i + 1], b);
-                                       getVertexByIndex(indices[i + 2], c); // perform subdivision
-
-                                       subdivideFace(a, b, c, detail);
-                               }
-                       }
-
-                       function subdivideFace(a, b, c, detail) {
-                               const cols = detail + 1; // we use this multidimensional array as a data structure for creating the subdivision
-
-                               const v = []; // construct all of the vertices for this subdivision
-
-                               for (let i = 0; i <= cols; i++) {
-                                       v[i] = [];
-                                       const aj = a.clone().lerp(c, i / cols);
-                                       const bj = b.clone().lerp(c, i / cols);
-                                       const rows = cols - i;
-
-                                       for (let j = 0; j <= rows; j++) {
-                                               if (j === 0 && i === cols) {
-                                                       v[i][j] = aj;
-                                               } else {
-                                                       v[i][j] = aj.clone().lerp(bj, j / rows);
-                                               }
-                                       }
-                               } // construct all of the faces
-
-
-                               for (let i = 0; i < cols; i++) {
-                                       for (let j = 0; j < 2 * (cols - i) - 1; j++) {
-                                               const k = Math.floor(j / 2);
-
-                                               if (j % 2 === 0) {
-                                                       pushVertex(v[i][k + 1]);
-                                                       pushVertex(v[i + 1][k]);
-                                                       pushVertex(v[i][k]);
-                                               } else {
-                                                       pushVertex(v[i][k + 1]);
-                                                       pushVertex(v[i + 1][k + 1]);
-                                                       pushVertex(v[i + 1][k]);
-                                               }
-                                       }
-                               }
-                       }
-
-                       function applyRadius(radius) {
-                               const vertex = new Vector3(); // iterate over the entire buffer and apply the radius to each vertex
-
-                               for (let i = 0; i < vertexBuffer.length; i += 3) {
-                                       vertex.x = vertexBuffer[i + 0];
-                                       vertex.y = vertexBuffer[i + 1];
-                                       vertex.z = vertexBuffer[i + 2];
-                                       vertex.normalize().multiplyScalar(radius);
-                                       vertexBuffer[i + 0] = vertex.x;
-                                       vertexBuffer[i + 1] = vertex.y;
-                                       vertexBuffer[i + 2] = vertex.z;
-                               }
-                       }
-
-                       function generateUVs() {
-                               const vertex = new Vector3();
-
-                               for (let i = 0; i < vertexBuffer.length; i += 3) {
-                                       vertex.x = vertexBuffer[i + 0];
-                                       vertex.y = vertexBuffer[i + 1];
-                                       vertex.z = vertexBuffer[i + 2];
-                                       const u = azimuth(vertex) / 2 / Math.PI + 0.5;
-                                       const v = inclination(vertex) / Math.PI + 0.5;
-                                       uvBuffer.push(u, 1 - v);
-                               }
-
-                               correctUVs();
-                               correctSeam();
-                       }
-
-                       function correctSeam() {
-                               // handle case when face straddles the seam, see #3269
-                               for (let i = 0; i < uvBuffer.length; i += 6) {
-                                       // uv data of a single face
-                                       const x0 = uvBuffer[i + 0];
-                                       const x1 = uvBuffer[i + 2];
-                                       const x2 = uvBuffer[i + 4];
-                                       const max = Math.max(x0, x1, x2);
-                                       const min = Math.min(x0, x1, x2); // 0.9 is somewhat arbitrary
-
-                                       if (max > 0.9 && min < 0.1) {
-                                               if (x0 < 0.2) uvBuffer[i + 0] += 1;
-                                               if (x1 < 0.2) uvBuffer[i + 2] += 1;
-                                               if (x2 < 0.2) uvBuffer[i + 4] += 1;
-                                       }
-                               }
-                       }
-
-                       function pushVertex(vertex) {
-                               vertexBuffer.push(vertex.x, vertex.y, vertex.z);
-                       }
-
-                       function getVertexByIndex(index, vertex) {
-                               const stride = index * 3;
-                               vertex.x = vertices[stride + 0];
-                               vertex.y = vertices[stride + 1];
-                               vertex.z = vertices[stride + 2];
-                       }
-
-                       function correctUVs() {
-                               const a = new Vector3();
-                               const b = new Vector3();
-                               const c = new Vector3();
-                               const centroid = new Vector3();
-                               const uvA = new Vector2();
-                               const uvB = new Vector2();
-                               const uvC = new Vector2();
-
-                               for (let i = 0, j = 0; i < vertexBuffer.length; i += 9, j += 6) {
-                                       a.set(vertexBuffer[i + 0], vertexBuffer[i + 1], vertexBuffer[i + 2]);
-                                       b.set(vertexBuffer[i + 3], vertexBuffer[i + 4], vertexBuffer[i + 5]);
-                                       c.set(vertexBuffer[i + 6], vertexBuffer[i + 7], vertexBuffer[i + 8]);
-                                       uvA.set(uvBuffer[j + 0], uvBuffer[j + 1]);
-                                       uvB.set(uvBuffer[j + 2], uvBuffer[j + 3]);
-                                       uvC.set(uvBuffer[j + 4], uvBuffer[j + 5]);
-                                       centroid.copy(a).add(b).add(c).divideScalar(3);
-                                       const azi = azimuth(centroid);
-                                       correctUV(uvA, j + 0, a, azi);
-                                       correctUV(uvB, j + 2, b, azi);
-                                       correctUV(uvC, j + 4, c, azi);
-                               }
-                       }
-
-                       function correctUV(uv, stride, vector, azimuth) {
-                               if (azimuth < 0 && uv.x === 1) {
-                                       uvBuffer[stride] = uv.x - 1;
-                               }
-
-                               if (vector.x === 0 && vector.z === 0) {
-                                       uvBuffer[stride] = azimuth / 2 / Math.PI + 0.5;
-                               }
-                       } // Angle around the Y axis, counter-clockwise when looking from above.
-
-
-                       function azimuth(vector) {
-                               return Math.atan2(vector.z, -vector.x);
-                       } // Angle above the XZ plane.
-
-
-                       function inclination(vector) {
-                               return Math.atan2(-vector.y, Math.sqrt(vector.x * vector.x + vector.z * vector.z));
-                       }
-               }
-
-               static fromJSON(data) {
-                       return new PolyhedronGeometry(data.vertices, data.indices, data.radius, data.details);
-               }
-
-       }
-
-       class DodecahedronGeometry extends PolyhedronGeometry {
-               constructor(radius = 1, detail = 0) {
-                       const t = (1 + Math.sqrt(5)) / 2;
-                       const r = 1 / t;
-                       const vertices = [// (±1, Â±1, Â±1)
-                       -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, Â±1/φ, Â±Ï†)
-                       0, -r, -t, 0, -r, t, 0, r, -t, 0, r, t, // (±1/φ, Â±Ï†, 0)
-                       -r, -t, 0, -r, t, 0, r, -t, 0, r, t, 0, // (±φ, 0, Â±1/φ)
-                       -t, 0, -r, t, 0, -r, -t, 0, r, t, 0, r];
-                       const indices = [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(vertices, indices, radius, detail);
-                       this.type = 'DodecahedronGeometry';
-                       this.parameters = {
-                               radius: radius,
-                               detail: detail
-                       };
-               }
-
-               static fromJSON(data) {
-                       return new DodecahedronGeometry(data.radius, data.detail);
-               }
-
-       }
-
-       const _v0 = new Vector3();
-
-       const _v1$1 = new Vector3();
-
-       const _normal = new Vector3();
-
-       const _triangle = new Triangle();
-
-       class EdgesGeometry extends BufferGeometry {
-               constructor(geometry, thresholdAngle) {
-                       super();
-                       this.type = 'EdgesGeometry';
-                       this.parameters = {
-                               thresholdAngle: thresholdAngle
-                       };
-                       thresholdAngle = thresholdAngle !== undefined ? thresholdAngle : 1;
-
-                       if (geometry.isGeometry === true) {
-                               console.error('THREE.EdgesGeometry no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.');
-                               return;
-                       }
-
-                       const precisionPoints = 4;
-                       const precision = Math.pow(10, precisionPoints);
-                       const thresholdDot = Math.cos(DEG2RAD * thresholdAngle);
-                       const indexAttr = geometry.getIndex();
-                       const positionAttr = geometry.getAttribute('position');
-                       const indexCount = indexAttr ? indexAttr.count : positionAttr.count;
-                       const indexArr = [0, 0, 0];
-                       const vertKeys = ['a', 'b', 'c'];
-                       const hashes = new Array(3);
-                       const edgeData = {};
-                       const vertices = [];
-
-                       for (let i = 0; i < indexCount; i += 3) {
-                               if (indexAttr) {
-                                       indexArr[0] = indexAttr.getX(i);
-                                       indexArr[1] = indexAttr.getX(i + 1);
-                                       indexArr[2] = indexAttr.getX(i + 2);
-                               } else {
-                                       indexArr[0] = i;
-                                       indexArr[1] = i + 1;
-                                       indexArr[2] = i + 2;
-                               }
-
-                               const {
-                                       a,
-                                       b,
-                                       c
-                               } = _triangle;
-                               a.fromBufferAttribute(positionAttr, indexArr[0]);
-                               b.fromBufferAttribute(positionAttr, indexArr[1]);
-                               c.fromBufferAttribute(positionAttr, indexArr[2]);
-
-                               _triangle.getNormal(_normal); // create hashes for the edge from the vertices
-
-
-                               hashes[0] = `${Math.round(a.x * precision)},${Math.round(a.y * precision)},${Math.round(a.z * precision)}`;
-                               hashes[1] = `${Math.round(b.x * precision)},${Math.round(b.y * precision)},${Math.round(b.z * precision)}`;
-                               hashes[2] = `${Math.round(c.x * precision)},${Math.round(c.y * precision)},${Math.round(c.z * precision)}`; // skip degenerate triangles
-
-                               if (hashes[0] === hashes[1] || hashes[1] === hashes[2] || hashes[2] === hashes[0]) {
-                                       continue;
-                               } // iterate over every edge
-
-
-                               for (let j = 0; j < 3; j++) {
-                                       // get the first and next vertex making up the edge
-                                       const jNext = (j + 1) % 3;
-                                       const vecHash0 = hashes[j];
-                                       const vecHash1 = hashes[jNext];
-                                       const v0 = _triangle[vertKeys[j]];
-                                       const v1 = _triangle[vertKeys[jNext]];
-                                       const hash = `${vecHash0}_${vecHash1}`;
-                                       const reverseHash = `${vecHash1}_${vecHash0}`;
-
-                                       if (reverseHash in edgeData && edgeData[reverseHash]) {
-                                               // if we found a sibling edge add it into the vertex array if
-                                               // it meets the angle threshold and delete the edge from the map.
-                                               if (_normal.dot(edgeData[reverseHash].normal) <= thresholdDot) {
-                                                       vertices.push(v0.x, v0.y, v0.z);
-                                                       vertices.push(v1.x, v1.y, v1.z);
-                                               }
-
-                                               edgeData[reverseHash] = null;
-                                       } else if (!(hash in edgeData)) {
-                                               // if we've already got an edge here then skip adding a new one
-                                               edgeData[hash] = {
-                                                       index0: indexArr[j],
-                                                       index1: indexArr[jNext],
-                                                       normal: _normal.clone()
-                                               };
-                                       }
-                               }
-                       } // iterate over all remaining, unmatched edges and add them to the vertex array
-
-
-                       for (const key in edgeData) {
-                               if (edgeData[key]) {
-                                       const {
-                                               index0,
-                                               index1
-                                       } = edgeData[key];
-
-                                       _v0.fromBufferAttribute(positionAttr, index0);
-
-                                       _v1$1.fromBufferAttribute(positionAttr, index1);
-
-                                       vertices.push(_v0.x, _v0.y, _v0.z);
-                                       vertices.push(_v1$1.x, _v1$1.y, _v1$1.z);
-                               }
-                       }
-
-                       this.setAttribute('position', new Float32BufferAttribute(vertices, 3));
-               }
-
-       }
-
-       /**
-        * Extensible curve object.
-        *
-        * Some common of curve methods:
-        * .getPoint( t, optionalTarget ), .getTangent( t, optionalTarget )
-        * .getPointAt( u, optionalTarget ), .getTangentAt( u, optionalTarget )
-        * .getPoints(), .getSpacedPoints()
-        * .getLength()
-        * .updateArcLengths()
-        *
-        * This following curves inherit from THREE.Curve:
-        *
-        * -- 2D curves --
-        * THREE.ArcCurve
-        * THREE.CubicBezierCurve
-        * THREE.EllipseCurve
-        * THREE.LineCurve
-        * THREE.QuadraticBezierCurve
-        * THREE.SplineCurve
-        *
-        * -- 3D curves --
-        * THREE.CatmullRomCurve3
-        * THREE.CubicBezierCurve3
-        * THREE.LineCurve3
-        * THREE.QuadraticBezierCurve3
-        *
-        * A series of curves can be represented as a THREE.CurvePath.
-        *
-        **/
-
-       class Curve {
-               constructor() {
-                       this.type = 'Curve';
-                       this.arcLengthDivisions = 200;
-               } // Virtual base class method to overwrite and implement in subclasses
-               //      - t [0 .. 1]
-
-
-               getPoint() {
-                       console.warn('THREE.Curve: .getPoint() not implemented.');
-                       return null;
-               } // Get point at relative position in curve according to arc length
-               // - u [0 .. 1]
-
-
-               getPointAt(u, optionalTarget) {
-                       const t = this.getUtoTmapping(u);
-                       return this.getPoint(t, optionalTarget);
-               } // Get sequence of points using getPoint( t )
-
-
-               getPoints(divisions = 5) {
-                       const points = [];
-
-                       for (let d = 0; d <= divisions; d++) {
-                               points.push(this.getPoint(d / divisions));
-                       }
-
-                       return points;
-               } // Get sequence of points using getPointAt( u )
-
-
-               getSpacedPoints(divisions = 5) {
-                       const points = [];
-
-                       for (let d = 0; d <= divisions; d++) {
-                               points.push(this.getPointAt(d / divisions));
-                       }
-
-                       return points;
-               } // Get total curve arc length
-
-
-               getLength() {
-                       const lengths = this.getLengths();
-                       return lengths[lengths.length - 1];
-               } // Get list of cumulative segment lengths
-
-
-               getLengths(divisions = this.arcLengthDivisions) {
-                       if (this.cacheArcLengths && this.cacheArcLengths.length === divisions + 1 && !this.needsUpdate) {
-                               return this.cacheArcLengths;
-                       }
-
-                       this.needsUpdate = false;
-                       const cache = [];
-                       let current,
-                                       last = this.getPoint(0);
-                       let sum = 0;
-                       cache.push(0);
-
-                       for (let p = 1; p <= divisions; p++) {
-                               current = this.getPoint(p / divisions);
-                               sum += current.distanceTo(last);
-                               cache.push(sum);
-                               last = current;
-                       }
-
-                       this.cacheArcLengths = cache;
-                       return cache; // { sums: cache, sum: sum }; Sum is in the last element.
-               }
-
-               updateArcLengths() {
-                       this.needsUpdate = true;
-                       this.getLengths();
-               } // Given u ( 0 .. 1 ), get a t to find p. This gives you points which are equidistant
-
-
-               getUtoTmapping(u, distance) {
-                       const arcLengths = this.getLengths();
-                       let i = 0;
-                       const il = arcLengths.length;
-                       let targetArcLength; // The targeted u distance value to get
-
-                       if (distance) {
-                               targetArcLength = distance;
-                       } else {
-                               targetArcLength = u * arcLengths[il - 1];
-                       } // binary search for the index with largest value smaller than target u distance
-
-
-                       let low = 0,
-                                       high = il - 1,
-                                       comparison;
-
-                       while (low <= high) {
-                               i = Math.floor(low + (high - low) / 2); // less likely to overflow, though probably not issue here, JS doesn't really have integers, all numbers are floats
-
-                               comparison = arcLengths[i] - targetArcLength;
-
-                               if (comparison < 0) {
-                                       low = i + 1;
-                               } else if (comparison > 0) {
-                                       high = i - 1;
-                               } else {
-                                       high = i;
-                                       break; // DONE
-                               }
-                       }
-
-                       i = high;
-
-                       if (arcLengths[i] === targetArcLength) {
-                               return i / (il - 1);
-                       } // we could get finer grain at lengths, or use simple interpolation between two points
-
-
-                       const lengthBefore = arcLengths[i];
-                       const lengthAfter = arcLengths[i + 1];
-                       const segmentLength = lengthAfter - lengthBefore; // determine where we are between the 'before' and 'after' points
-
-                       const segmentFraction = (targetArcLength - lengthBefore) / segmentLength; // add that fractional amount to t
-
-                       const t = (i + segmentFraction) / (il - 1);
-                       return t;
-               } // Returns a unit vector tangent at t
-               // In case any sub curve does not implement its tangent derivation,
-               // 2 points a small delta apart will be used to find its gradient
-               // which seems to give a reasonable approximation
-
-
-               getTangent(t, optionalTarget) {
-                       const delta = 0.0001;
-                       let t1 = t - delta;
-                       let t2 = t + delta; // Capping in case of danger
-
-                       if (t1 < 0) t1 = 0;
-                       if (t2 > 1) t2 = 1;
-                       const pt1 = this.getPoint(t1);
-                       const pt2 = this.getPoint(t2);
-                       const tangent = optionalTarget || (pt1.isVector2 ? new Vector2() : new Vector3());
-                       tangent.copy(pt2).sub(pt1).normalize();
-                       return tangent;
-               }
-
-               getTangentAt(u, optionalTarget) {
-                       const t = this.getUtoTmapping(u);
-                       return this.getTangent(t, optionalTarget);
-               }
-
-               computeFrenetFrames(segments, closed) {
-                       // see http://www.cs.indiana.edu/pub/techreports/TR425.pdf
-                       const normal = new Vector3();
-                       const tangents = [];
-                       const normals = [];
-                       const binormals = [];
-                       const vec = new Vector3();
-                       const mat = new Matrix4(); // compute the tangent vectors for each segment on the curve
-
-                       for (let i = 0; i <= segments; i++) {
-                               const u = i / segments;
-                               tangents[i] = this.getTangentAt(u, new Vector3());
-                               tangents[i].normalize();
-                       } // select an initial normal vector perpendicular to the first tangent vector,
-                       // and in the direction of the minimum tangent xyz component
-
-
-                       normals[0] = new Vector3();
-                       binormals[0] = new Vector3();
-                       let min = Number.MAX_VALUE;
-                       const tx = Math.abs(tangents[0].x);
-                       const ty = Math.abs(tangents[0].y);
-                       const tz = Math.abs(tangents[0].z);
-
-                       if (tx <= min) {
-                               min = tx;
-                               normal.set(1, 0, 0);
-                       }
-
-                       if (ty <= min) {
-                               min = ty;
-                               normal.set(0, 1, 0);
-                       }
-
-                       if (tz <= min) {
-                               normal.set(0, 0, 1);
-                       }
-
-                       vec.crossVectors(tangents[0], normal).normalize();
-                       normals[0].crossVectors(tangents[0], vec);
-                       binormals[0].crossVectors(tangents[0], normals[0]); // compute the slowly-varying normal and binormal vectors for each segment on the curve
-
-                       for (let i = 1; i <= segments; i++) {
-                               normals[i] = normals[i - 1].clone();
-                               binormals[i] = binormals[i - 1].clone();
-                               vec.crossVectors(tangents[i - 1], tangents[i]);
-
-                               if (vec.length() > Number.EPSILON) {
-                                       vec.normalize();
-                                       const theta = Math.acos(clamp(tangents[i - 1].dot(tangents[i]), -1, 1)); // clamp for floating pt errors
-
-                                       normals[i].applyMatrix4(mat.makeRotationAxis(vec, theta));
-                               }
-
-                               binormals[i].crossVectors(tangents[i], normals[i]);
-                       } // if the curve is closed, postprocess the vectors so the first and last normal vectors are the same
-
-
-                       if (closed === true) {
-                               let theta = Math.acos(clamp(normals[0].dot(normals[segments]), -1, 1));
-                               theta /= segments;
-
-                               if (tangents[0].dot(vec.crossVectors(normals[0], normals[segments])) > 0) {
-                                       theta = -theta;
-                               }
-
-                               for (let i = 1; i <= segments; i++) {
-                                       // twist a little...
-                                       normals[i].applyMatrix4(mat.makeRotationAxis(tangents[i], theta * i));
-                                       binormals[i].crossVectors(tangents[i], normals[i]);
-                               }
-                       }
-
-                       return {
-                               tangents: tangents,
-                               normals: normals,
-                               binormals: binormals
-                       };
-               }
-
-               clone() {
-                       return new this.constructor().copy(this);
-               }
-
-               copy(source) {
-                       this.arcLengthDivisions = source.arcLengthDivisions;
-                       return this;
-               }
-
-               toJSON() {
-                       const data = {
-                               metadata: {
-                                       version: 4.5,
-                                       type: 'Curve',
-                                       generator: 'Curve.toJSON'
-                               }
-                       };
-                       data.arcLengthDivisions = this.arcLengthDivisions;
-                       data.type = this.type;
-                       return data;
-               }
-
-               fromJSON(json) {
-                       this.arcLengthDivisions = json.arcLengthDivisions;
-                       return this;
-               }
-
-       }
-
-       class EllipseCurve extends Curve {
-               constructor(aX = 0, aY = 0, xRadius = 1, yRadius = 1, aStartAngle = 0, aEndAngle = Math.PI * 2, aClockwise = false, aRotation = 0) {
-                       super();
-                       this.type = 'EllipseCurve';
-                       this.aX = aX;
-                       this.aY = aY;
-                       this.xRadius = xRadius;
-                       this.yRadius = yRadius;
-                       this.aStartAngle = aStartAngle;
-                       this.aEndAngle = aEndAngle;
-                       this.aClockwise = aClockwise;
-                       this.aRotation = aRotation;
-               }
-
-               getPoint(t, optionalTarget) {
-                       const point = optionalTarget || new Vector2();
-                       const twoPi = Math.PI * 2;
-                       let deltaAngle = this.aEndAngle - this.aStartAngle;
-                       const samePoints = Math.abs(deltaAngle) < Number.EPSILON; // ensures that deltaAngle is 0 .. 2 PI
-
-                       while (deltaAngle < 0) deltaAngle += twoPi;
-
-                       while (deltaAngle > twoPi) deltaAngle -= twoPi;
-
-                       if (deltaAngle < Number.EPSILON) {
-                               if (samePoints) {
-                                       deltaAngle = 0;
-                               } else {
-                                       deltaAngle = twoPi;
-                               }
-                       }
-
-                       if (this.aClockwise === true && !samePoints) {
-                               if (deltaAngle === twoPi) {
-                                       deltaAngle = -twoPi;
-                               } else {
-                                       deltaAngle = deltaAngle - twoPi;
-                               }
-                       }
-
-                       const angle = this.aStartAngle + t * deltaAngle;
-                       let x = this.aX + this.xRadius * Math.cos(angle);
-                       let y = this.aY + this.yRadius * Math.sin(angle);
-
-                       if (this.aRotation !== 0) {
-                               const cos = Math.cos(this.aRotation);
-                               const sin = Math.sin(this.aRotation);
-                               const tx = x - this.aX;
-                               const ty = y - this.aY; // Rotate the point about the center of the ellipse.
-
-                               x = tx * cos - ty * sin + this.aX;
-                               y = tx * sin + ty * cos + this.aY;
-                       }
-
-                       return point.set(x, y);
-               }
-
-               copy(source) {
-                       super.copy(source);
-                       this.aX = source.aX;
-                       this.aY = source.aY;
-                       this.xRadius = source.xRadius;
-                       this.yRadius = source.yRadius;
-                       this.aStartAngle = source.aStartAngle;
-                       this.aEndAngle = source.aEndAngle;
-                       this.aClockwise = source.aClockwise;
-                       this.aRotation = source.aRotation;
-                       return this;
-               }
-
-               toJSON() {
-                       const data = super.toJSON();
-                       data.aX = this.aX;
-                       data.aY = this.aY;
-                       data.xRadius = this.xRadius;
-                       data.yRadius = this.yRadius;
-                       data.aStartAngle = this.aStartAngle;
-                       data.aEndAngle = this.aEndAngle;
-                       data.aClockwise = this.aClockwise;
-                       data.aRotation = this.aRotation;
-                       return data;
-               }
-
-               fromJSON(json) {
-                       super.fromJSON(json);
-                       this.aX = json.aX;
-                       this.aY = json.aY;
-                       this.xRadius = json.xRadius;
-                       this.yRadius = json.yRadius;
-                       this.aStartAngle = json.aStartAngle;
-                       this.aEndAngle = json.aEndAngle;
-                       this.aClockwise = json.aClockwise;
-                       this.aRotation = json.aRotation;
-                       return this;
-               }
-
-       }
-
-       EllipseCurve.prototype.isEllipseCurve = true;
-
-       class ArcCurve extends EllipseCurve {
-               constructor(aX, aY, aRadius, aStartAngle, aEndAngle, aClockwise) {
-                       super(aX, aY, aRadius, aRadius, aStartAngle, aEndAngle, aClockwise);
-                       this.type = 'ArcCurve';
-               }
-
-       }
-
-       ArcCurve.prototype.isArcCurve = true;
-
-       /**
-        * Centripetal CatmullRom Curve - which is useful for avoiding
-        * cusps and self-intersections in non-uniform catmull rom curves.
-        * http://www.cemyuksel.com/research/catmullrom_param/catmullrom.pdf
-        *
-        * curve.type accepts centripetal(default), chordal and catmullrom
-        * curve.tension is used for catmullrom which defaults to 0.5
-        */
-
-       /*
-       Based on an optimized c++ solution in
-        - http://stackoverflow.com/questions/9489736/catmull-rom-curve-with-no-cusps-and-no-self-intersections/
-        - http://ideone.com/NoEbVM
-
-       This CubicPoly class could be used for reusing some variables and calculations,
-       but for three.js curve use, it could be possible inlined and flatten into a single function call
-       which can be placed in CurveUtils.
-       */
-
-       function CubicPoly() {
-               let c0 = 0,
-                               c1 = 0,
-                               c2 = 0,
-                               c3 = 0;
-               /*
-                * Compute coefficients for a cubic polynomial
-                *       p(s) = c0 + c1*s + c2*s^2 + c3*s^3
-                * such that
-                *       p(0) = x0, p(1) = x1
-                *      and
-                *       p'(0) = t0, p'(1) = t1.
-                */
-
-               function init(x0, x1, t0, t1) {
-                       c0 = x0;
-                       c1 = t0;
-                       c2 = -3 * x0 + 3 * x1 - 2 * t0 - t1;
-                       c3 = 2 * x0 - 2 * x1 + t0 + t1;
-               }
-
-               return {
-                       initCatmullRom: function (x0, x1, x2, x3, tension) {
-                               init(x1, x2, tension * (x2 - x0), tension * (x3 - x1));
-                       },
-                       initNonuniformCatmullRom: function (x0, x1, x2, x3, dt0, dt1, dt2) {
-                               // compute tangents when parameterized in [t1,t2]
-                               let t1 = (x1 - x0) / dt0 - (x2 - x0) / (dt0 + dt1) + (x2 - x1) / dt1;
-                               let t2 = (x2 - x1) / dt1 - (x3 - x1) / (dt1 + dt2) + (x3 - x2) / dt2; // rescale tangents for parametrization in [0,1]
-
-                               t1 *= dt1;
-                               t2 *= dt1;
-                               init(x1, x2, t1, t2);
-                       },
-                       calc: function (t) {
-                               const t2 = t * t;
-                               const t3 = t2 * t;
-                               return c0 + c1 * t + c2 * t2 + c3 * t3;
-                       }
-               };
-       } //
-
-
-       const tmp = new Vector3();
-       const px = new CubicPoly(),
-                               py = new CubicPoly(),
-                               pz = new CubicPoly();
-
-       class CatmullRomCurve3 extends Curve {
-               constructor(points = [], closed = false, curveType = 'centripetal', tension = 0.5) {
-                       super();
-                       this.type = 'CatmullRomCurve3';
-                       this.points = points;
-                       this.closed = closed;
-                       this.curveType = curveType;
-                       this.tension = tension;
-               }
-
-               getPoint(t, optionalTarget = new Vector3()) {
-                       const point = optionalTarget;
-                       const points = this.points;
-                       const l = points.length;
-                       const p = (l - (this.closed ? 0 : 1)) * t;
-                       let intPoint = Math.floor(p);
-                       let weight = p - intPoint;
-
-                       if (this.closed) {
-                               intPoint += intPoint > 0 ? 0 : (Math.floor(Math.abs(intPoint) / l) + 1) * l;
-                       } else if (weight === 0 && intPoint === l - 1) {
-                               intPoint = l - 2;
-                               weight = 1;
-                       }
-
-                       let p0, p3; // 4 points (p1 & p2 defined below)
-
-                       if (this.closed || intPoint > 0) {
-                               p0 = points[(intPoint - 1) % l];
-                       } else {
-                               // extrapolate first point
-                               tmp.subVectors(points[0], points[1]).add(points[0]);
-                               p0 = tmp;
-                       }
-
-                       const p1 = points[intPoint % l];
-                       const p2 = points[(intPoint + 1) % l];
-
-                       if (this.closed || intPoint + 2 < l) {
-                               p3 = points[(intPoint + 2) % l];
-                       } else {
-                               // extrapolate last point
-                               tmp.subVectors(points[l - 1], points[l - 2]).add(points[l - 1]);
-                               p3 = tmp;
-                       }
-
-                       if (this.curveType === 'centripetal' || this.curveType === 'chordal') {
-                               // init Centripetal / Chordal Catmull-Rom
-                               const pow = this.curveType === 'chordal' ? 0.5 : 0.25;
-                               let dt0 = Math.pow(p0.distanceToSquared(p1), pow);
-                               let dt1 = Math.pow(p1.distanceToSquared(p2), pow);
-                               let dt2 = Math.pow(p2.distanceToSquared(p3), pow); // safety check for repeated points
-
-                               if (dt1 < 1e-4) dt1 = 1.0;
-                               if (dt0 < 1e-4) dt0 = dt1;
-                               if (dt2 < 1e-4) dt2 = dt1;
-                               px.initNonuniformCatmullRom(p0.x, p1.x, p2.x, p3.x, dt0, dt1, dt2);
-                               py.initNonuniformCatmullRom(p0.y, p1.y, p2.y, p3.y, dt0, dt1, dt2);
-                               pz.initNonuniformCatmullRom(p0.z, p1.z, p2.z, p3.z, dt0, dt1, dt2);
-                       } else if (this.curveType === 'catmullrom') {
-                               px.initCatmullRom(p0.x, p1.x, p2.x, p3.x, this.tension);
-                               py.initCatmullRom(p0.y, p1.y, p2.y, p3.y, this.tension);
-                               pz.initCatmullRom(p0.z, p1.z, p2.z, p3.z, this.tension);
-                       }
-
-                       point.set(px.calc(weight), py.calc(weight), pz.calc(weight));
-                       return point;
-               }
-
-               copy(source) {
-                       super.copy(source);
-                       this.points = [];
-
-                       for (let i = 0, l = source.points.length; i < l; i++) {
-                               const point = source.points[i];
-                               this.points.push(point.clone());
-                       }
-
-                       this.closed = source.closed;
-                       this.curveType = source.curveType;
-                       this.tension = source.tension;
-                       return this;
-               }
-
-               toJSON() {
-                       const data = super.toJSON();
-                       data.points = [];
-
-                       for (let i = 0, l = this.points.length; i < l; i++) {
-                               const point = this.points[i];
-                               data.points.push(point.toArray());
-                       }
-
-                       data.closed = this.closed;
-                       data.curveType = this.curveType;
-                       data.tension = this.tension;
-                       return data;
-               }
-
-               fromJSON(json) {
-                       super.fromJSON(json);
-                       this.points = [];
-
-                       for (let i = 0, l = json.points.length; i < l; i++) {
-                               const point = json.points[i];
-                               this.points.push(new Vector3().fromArray(point));
-                       }
-
-                       this.closed = json.closed;
-                       this.curveType = json.curveType;
-                       this.tension = json.tension;
-                       return this;
-               }
-
-       }
-
-       CatmullRomCurve3.prototype.isCatmullRomCurve3 = true;
-
-       /**
-        * Bezier Curves formulas obtained from
-        * http://en.wikipedia.org/wiki/Bézier_curve
-        */
-       function CatmullRom(t, p0, p1, p2, p3) {
-               const v0 = (p2 - p0) * 0.5;
-               const v1 = (p3 - p1) * 0.5;
-               const t2 = t * t;
-               const t3 = t * t2;
-               return (2 * p1 - 2 * p2 + v0 + v1) * t3 + (-3 * p1 + 3 * p2 - 2 * v0 - v1) * t2 + v0 * t + p1;
-       } //
-
-
-       function QuadraticBezierP0(t, p) {
-               const k = 1 - t;
-               return k * k * p;
-       }
-
-       function QuadraticBezierP1(t, p) {
-               return 2 * (1 - t) * t * p;
-       }
-
-       function QuadraticBezierP2(t, p) {
-               return t * t * p;
-       }
-
-       function QuadraticBezier(t, p0, p1, p2) {
-               return QuadraticBezierP0(t, p0) + QuadraticBezierP1(t, p1) + QuadraticBezierP2(t, p2);
-       } //
-
-
-       function CubicBezierP0(t, p) {
-               const k = 1 - t;
-               return k * k * k * p;
-       }
-
-       function CubicBezierP1(t, p) {
-               const k = 1 - t;
-               return 3 * k * k * t * p;
-       }
-
-       function CubicBezierP2(t, p) {
-               return 3 * (1 - t) * t * t * p;
-       }
-
-       function CubicBezierP3(t, p) {
-               return t * t * t * p;
-       }
-
-       function CubicBezier(t, p0, p1, p2, p3) {
-               return CubicBezierP0(t, p0) + CubicBezierP1(t, p1) + CubicBezierP2(t, p2) + CubicBezierP3(t, p3);
-       }
-
-       class CubicBezierCurve extends Curve {
-               constructor(v0 = new Vector2(), v1 = new Vector2(), v2 = new Vector2(), v3 = new Vector2()) {
-                       super();
-                       this.type = 'CubicBezierCurve';
-                       this.v0 = v0;
-                       this.v1 = v1;
-                       this.v2 = v2;
-                       this.v3 = v3;
-               }
-
-               getPoint(t, optionalTarget = new Vector2()) {
-                       const point = optionalTarget;
-                       const v0 = this.v0,
-                                               v1 = this.v1,
-                                               v2 = this.v2,
-                                               v3 = this.v3;
-                       point.set(CubicBezier(t, v0.x, v1.x, v2.x, v3.x), CubicBezier(t, v0.y, v1.y, v2.y, v3.y));
-                       return point;
-               }
-
-               copy(source) {
-                       super.copy(source);
-                       this.v0.copy(source.v0);
-                       this.v1.copy(source.v1);
-                       this.v2.copy(source.v2);
-                       this.v3.copy(source.v3);
-                       return this;
-               }
-
-               toJSON() {
-                       const data = super.toJSON();
-                       data.v0 = this.v0.toArray();
-                       data.v1 = this.v1.toArray();
-                       data.v2 = this.v2.toArray();
-                       data.v3 = this.v3.toArray();
-                       return data;
-               }
-
-               fromJSON(json) {
-                       super.fromJSON(json);
-                       this.v0.fromArray(json.v0);
-                       this.v1.fromArray(json.v1);
-                       this.v2.fromArray(json.v2);
-                       this.v3.fromArray(json.v3);
-                       return this;
-               }
-
-       }
-
-       CubicBezierCurve.prototype.isCubicBezierCurve = true;
-
-       class CubicBezierCurve3 extends Curve {
-               constructor(v0 = new Vector3(), v1 = new Vector3(), v2 = new Vector3(), v3 = new Vector3()) {
-                       super();
-                       this.type = 'CubicBezierCurve3';
-                       this.v0 = v0;
-                       this.v1 = v1;
-                       this.v2 = v2;
-                       this.v3 = v3;
-               }
-
-               getPoint(t, optionalTarget = new Vector3()) {
-                       const point = optionalTarget;
-                       const v0 = this.v0,
-                                               v1 = this.v1,
-                                               v2 = this.v2,
-                                               v3 = this.v3;
-                       point.set(CubicBezier(t, v0.x, v1.x, v2.x, v3.x), CubicBezier(t, v0.y, v1.y, v2.y, v3.y), CubicBezier(t, v0.z, v1.z, v2.z, v3.z));
-                       return point;
-               }
-
-               copy(source) {
-                       super.copy(source);
-                       this.v0.copy(source.v0);
-                       this.v1.copy(source.v1);
-                       this.v2.copy(source.v2);
-                       this.v3.copy(source.v3);
-                       return this;
-               }
-
-               toJSON() {
-                       const data = super.toJSON();
-                       data.v0 = this.v0.toArray();
-                       data.v1 = this.v1.toArray();
-                       data.v2 = this.v2.toArray();
-                       data.v3 = this.v3.toArray();
-                       return data;
-               }
-
-               fromJSON(json) {
-                       super.fromJSON(json);
-                       this.v0.fromArray(json.v0);
-                       this.v1.fromArray(json.v1);
-                       this.v2.fromArray(json.v2);
-                       this.v3.fromArray(json.v3);
-                       return this;
-               }
-
-       }
-
-       CubicBezierCurve3.prototype.isCubicBezierCurve3 = true;
-
-       class LineCurve extends Curve {
-               constructor(v1 = new Vector2(), v2 = new Vector2()) {
-                       super();
-                       this.type = 'LineCurve';
-                       this.v1 = v1;
-                       this.v2 = v2;
-               }
-
-               getPoint(t, optionalTarget = new Vector2()) {
-                       const point = optionalTarget;
-
-                       if (t === 1) {
-                               point.copy(this.v2);
-                       } else {
-                               point.copy(this.v2).sub(this.v1);
-                               point.multiplyScalar(t).add(this.v1);
-                       }
-
-                       return point;
-               } // Line curve is linear, so we can overwrite default getPointAt
-
-
-               getPointAt(u, optionalTarget) {
-                       return this.getPoint(u, optionalTarget);
-               }
-
-               getTangent(t, optionalTarget) {
-                       const tangent = optionalTarget || new Vector2();
-                       tangent.copy(this.v2).sub(this.v1).normalize();
-                       return tangent;
-               }
-
-               copy(source) {
-                       super.copy(source);
-                       this.v1.copy(source.v1);
-                       this.v2.copy(source.v2);
-                       return this;
-               }
-
-               toJSON() {
-                       const data = super.toJSON();
-                       data.v1 = this.v1.toArray();
-                       data.v2 = this.v2.toArray();
-                       return data;
-               }
-
-               fromJSON(json) {
-                       super.fromJSON(json);
-                       this.v1.fromArray(json.v1);
-                       this.v2.fromArray(json.v2);
-                       return this;
-               }
-
-       }
-
-       LineCurve.prototype.isLineCurve = true;
-
-       class LineCurve3 extends Curve {
-               constructor(v1 = new Vector3(), v2 = new Vector3()) {
-                       super();
-                       this.type = 'LineCurve3';
-                       this.isLineCurve3 = true;
-                       this.v1 = v1;
-                       this.v2 = v2;
-               }
-
-               getPoint(t, optionalTarget = new Vector3()) {
-                       const point = optionalTarget;
-
-                       if (t === 1) {
-                               point.copy(this.v2);
-                       } else {
-                               point.copy(this.v2).sub(this.v1);
-                               point.multiplyScalar(t).add(this.v1);
-                       }
-
-                       return point;
-               } // Line curve is linear, so we can overwrite default getPointAt
-
-
-               getPointAt(u, optionalTarget) {
-                       return this.getPoint(u, optionalTarget);
-               }
-
-               copy(source) {
-                       super.copy(source);
-                       this.v1.copy(source.v1);
-                       this.v2.copy(source.v2);
-                       return this;
-               }
-
-               toJSON() {
-                       const data = super.toJSON();
-                       data.v1 = this.v1.toArray();
-                       data.v2 = this.v2.toArray();
-                       return data;
-               }
-
-               fromJSON(json) {
-                       super.fromJSON(json);
-                       this.v1.fromArray(json.v1);
-                       this.v2.fromArray(json.v2);
-                       return this;
-               }
-
-       }
-
-       class QuadraticBezierCurve extends Curve {
-               constructor(v0 = new Vector2(), v1 = new Vector2(), v2 = new Vector2()) {
-                       super();
-                       this.type = 'QuadraticBezierCurve';
-                       this.v0 = v0;
-                       this.v1 = v1;
-                       this.v2 = v2;
-               }
-
-               getPoint(t, optionalTarget = new Vector2()) {
-                       const point = optionalTarget;
-                       const v0 = this.v0,
-                                               v1 = this.v1,
-                                               v2 = this.v2;
-                       point.set(QuadraticBezier(t, v0.x, v1.x, v2.x), QuadraticBezier(t, v0.y, v1.y, v2.y));
-                       return point;
-               }
-
-               copy(source) {
-                       super.copy(source);
-                       this.v0.copy(source.v0);
-                       this.v1.copy(source.v1);
-                       this.v2.copy(source.v2);
-                       return this;
-               }
-
-               toJSON() {
-                       const data = super.toJSON();
-                       data.v0 = this.v0.toArray();
-                       data.v1 = this.v1.toArray();
-                       data.v2 = this.v2.toArray();
-                       return data;
-               }
-
-               fromJSON(json) {
-                       super.fromJSON(json);
-                       this.v0.fromArray(json.v0);
-                       this.v1.fromArray(json.v1);
-                       this.v2.fromArray(json.v2);
-                       return this;
-               }
-
-       }
-
-       QuadraticBezierCurve.prototype.isQuadraticBezierCurve = true;
-
-       class QuadraticBezierCurve3 extends Curve {
-               constructor(v0 = new Vector3(), v1 = new Vector3(), v2 = new Vector3()) {
-                       super();
-                       this.type = 'QuadraticBezierCurve3';
-                       this.v0 = v0;
-                       this.v1 = v1;
-                       this.v2 = v2;
-               }
-
-               getPoint(t, optionalTarget = new Vector3()) {
-                       const point = optionalTarget;
-                       const v0 = this.v0,
-                                               v1 = this.v1,
-                                               v2 = this.v2;
-                       point.set(QuadraticBezier(t, v0.x, v1.x, v2.x), QuadraticBezier(t, v0.y, v1.y, v2.y), QuadraticBezier(t, v0.z, v1.z, v2.z));
-                       return point;
-               }
-
-               copy(source) {
-                       super.copy(source);
-                       this.v0.copy(source.v0);
-                       this.v1.copy(source.v1);
-                       this.v2.copy(source.v2);
-                       return this;
-               }
-
-               toJSON() {
-                       const data = super.toJSON();
-                       data.v0 = this.v0.toArray();
-                       data.v1 = this.v1.toArray();
-                       data.v2 = this.v2.toArray();
-                       return data;
-               }
-
-               fromJSON(json) {
-                       super.fromJSON(json);
-                       this.v0.fromArray(json.v0);
-                       this.v1.fromArray(json.v1);
-                       this.v2.fromArray(json.v2);
-                       return this;
-               }
-
-       }
-
-       QuadraticBezierCurve3.prototype.isQuadraticBezierCurve3 = true;
-
-       class SplineCurve extends Curve {
-               constructor(points = []) {
-                       super();
-                       this.type = 'SplineCurve';
-                       this.points = points;
-               }
-
-               getPoint(t, optionalTarget = new Vector2()) {
-                       const point = optionalTarget;
-                       const points = this.points;
-                       const p = (points.length - 1) * t;
-                       const intPoint = Math.floor(p);
-                       const weight = p - intPoint;
-                       const p0 = points[intPoint === 0 ? intPoint : intPoint - 1];
-                       const p1 = points[intPoint];
-                       const p2 = points[intPoint > points.length - 2 ? points.length - 1 : intPoint + 1];
-                       const p3 = points[intPoint > points.length - 3 ? points.length - 1 : intPoint + 2];
-                       point.set(CatmullRom(weight, p0.x, p1.x, p2.x, p3.x), CatmullRom(weight, p0.y, p1.y, p2.y, p3.y));
-                       return point;
-               }
-
-               copy(source) {
-                       super.copy(source);
-                       this.points = [];
-
-                       for (let i = 0, l = source.points.length; i < l; i++) {
-                               const point = source.points[i];
-                               this.points.push(point.clone());
-                       }
-
-                       return this;
-               }
-
-               toJSON() {
-                       const data = super.toJSON();
-                       data.points = [];
-
-                       for (let i = 0, l = this.points.length; i < l; i++) {
-                               const point = this.points[i];
-                               data.points.push(point.toArray());
-                       }
-
-                       return data;
-               }
-
-               fromJSON(json) {
-                       super.fromJSON(json);
-                       this.points = [];
-
-                       for (let i = 0, l = json.points.length; i < l; i++) {
-                               const point = json.points[i];
-                               this.points.push(new Vector2().fromArray(point));
-                       }
-
-                       return this;
-               }
-
-       }
-
-       SplineCurve.prototype.isSplineCurve = true;
-
-       var Curves = /*#__PURE__*/Object.freeze({
-               __proto__: null,
-               ArcCurve: ArcCurve,
-               CatmullRomCurve3: CatmullRomCurve3,
-               CubicBezierCurve: CubicBezierCurve,
-               CubicBezierCurve3: CubicBezierCurve3,
-               EllipseCurve: EllipseCurve,
-               LineCurve: LineCurve,
-               LineCurve3: LineCurve3,
-               QuadraticBezierCurve: QuadraticBezierCurve,
-               QuadraticBezierCurve3: QuadraticBezierCurve3,
-               SplineCurve: SplineCurve
-       });
-
-       /**
-        * Port from https://github.com/mapbox/earcut (v2.2.2)
-        */
-       const Earcut = {
-               triangulate: function (data, holeIndices, dim = 2) {
-                       const hasHoles = holeIndices && holeIndices.length;
-                       const outerLen = hasHoles ? holeIndices[0] * dim : data.length;
-                       let outerNode = linkedList(data, 0, outerLen, dim, true);
-                       const triangles = [];
-                       if (!outerNode || outerNode.next === outerNode.prev) return triangles;
-                       let minX, minY, maxX, maxY, x, y, invSize;
-                       if (hasHoles) outerNode = eliminateHoles(data, holeIndices, outerNode, dim); // if the shape is not too simple, we'll use z-order curve hash later; calculate polygon bbox
-
-                       if (data.length > 80 * dim) {
-                               minX = maxX = data[0];
-                               minY = maxY = data[1];
-
-                               for (let i = dim; i < outerLen; i += dim) {
-                                       x = data[i];
-                                       y = data[i + 1];
-                                       if (x < minX) minX = x;
-                                       if (y < minY) minY = y;
-                                       if (x > maxX) maxX = x;
-                                       if (y > maxY) maxY = y;
-                               } // minX, minY and invSize are later used to transform coords into integers for z-order calculation
-
-
-                               invSize = Math.max(maxX - minX, maxY - minY);
-                               invSize = invSize !== 0 ? 1 / invSize : 0;
-                       }
-
-                       earcutLinked(outerNode, triangles, dim, minX, minY, invSize);
-                       return triangles;
-               }
-       }; // create a circular doubly linked list from polygon points in the specified winding order
-
-       function linkedList(data, start, end, dim, clockwise) {
-               let i, last;
-
-               if (clockwise === signedArea(data, start, end, dim) > 0) {
-                       for (i = start; i < end; i += dim) last = insertNode(i, data[i], data[i + 1], last);
-               } else {
-                       for (i = end - dim; i >= start; i -= dim) last = insertNode(i, data[i], data[i + 1], last);
-               }
-
-               if (last && equals(last, last.next)) {
-                       removeNode(last);
-                       last = last.next;
-               }
-
-               return last;
-       } // eliminate colinear or duplicate points
-
-
-       function filterPoints(start, end) {
-               if (!start) return start;
-               if (!end) end = start;
-               let p = start,
-                               again;
-
-               do {
-                       again = false;
-
-                       if (!p.steiner && (equals(p, p.next) || area(p.prev, p, p.next) === 0)) {
-                               removeNode(p);
-                               p = end = p.prev;
-                               if (p === p.next) break;
-                               again = true;
-                       } else {
-                               p = p.next;
-                       }
-               } while (again || p !== end);
-
-               return end;
-       } // main ear slicing loop which triangulates a polygon (given as a linked list)
-
-
-       function earcutLinked(ear, triangles, dim, minX, minY, invSize, pass) {
-               if (!ear) return; // interlink polygon nodes in z-order
-
-               if (!pass && invSize) indexCurve(ear, minX, minY, invSize);
-               let stop = ear,
-                               prev,
-                               next; // iterate through ears, slicing them one by one
-
-               while (ear.prev !== ear.next) {
-                       prev = ear.prev;
-                       next = ear.next;
-
-                       if (invSize ? isEarHashed(ear, minX, minY, invSize) : isEar(ear)) {
-                               // cut off the triangle
-                               triangles.push(prev.i / dim);
-                               triangles.push(ear.i / dim);
-                               triangles.push(next.i / dim);
-                               removeNode(ear); // skipping the next vertex leads to less sliver triangles
-
-                               ear = next.next;
-                               stop = next.next;
-                               continue;
-                       }
-
-                       ear = next; // if we looped through the whole remaining polygon and can't find any more ears
-
-                       if (ear === stop) {
-                               // try filtering points and slicing again
-                               if (!pass) {
-                                       earcutLinked(filterPoints(ear), triangles, dim, minX, minY, invSize, 1); // if this didn't work, try curing all small self-intersections locally
-                               } else if (pass === 1) {
-                                       ear = cureLocalIntersections(filterPoints(ear), triangles, dim);
-                                       earcutLinked(ear, triangles, dim, minX, minY, invSize, 2); // as a last resort, try splitting the remaining polygon into two
-                               } else if (pass === 2) {
-                                       splitEarcut(ear, triangles, dim, minX, minY, invSize);
-                               }
-
-                               break;
-                       }
-               }
-       } // check whether a polygon node forms a valid ear with adjacent nodes
-
-
-       function isEar(ear) {
-               const a = ear.prev,
-                                       b = ear,
-                                       c = ear.next;
-               if (area(a, b, c) >= 0) return false; // reflex, can't be an ear
-               // now make sure we don't have other points inside the potential ear
-
-               let p = ear.next.next;
-
-               while (p !== ear.prev) {
-                       if (pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, p.x, p.y) && area(p.prev, p, p.next) >= 0) return false;
-                       p = p.next;
-               }
-
-               return true;
-       }
-
-       function isEarHashed(ear, minX, minY, invSize) {
-               const a = ear.prev,
-                                       b = ear,
-                                       c = ear.next;
-               if (area(a, b, c) >= 0) return false; // reflex, can't be an ear
-               // triangle bbox; min & max are calculated like this for speed
-
-               const minTX = a.x < b.x ? a.x < c.x ? a.x : c.x : b.x < c.x ? b.x : c.x,
-                                       minTY = a.y < b.y ? a.y < c.y ? a.y : c.y : b.y < c.y ? b.y : c.y,
-                                       maxTX = a.x > b.x ? a.x > c.x ? a.x : c.x : b.x > c.x ? b.x : c.x,
-                                       maxTY = a.y > b.y ? a.y > c.y ? a.y : c.y : b.y > c.y ? b.y : c.y; // z-order range for the current triangle bbox;
-
-               const minZ = zOrder(minTX, minTY, minX, minY, invSize),
-                                       maxZ = zOrder(maxTX, maxTY, minX, minY, invSize);
-               let p = ear.prevZ,
-                               n = ear.nextZ; // look for points inside the triangle in both directions
-
-               while (p && p.z >= minZ && n && n.z <= maxZ) {
-                       if (p !== ear.prev && p !== ear.next && pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, p.x, p.y) && area(p.prev, p, p.next) >= 0) return false;
-                       p = p.prevZ;
-                       if (n !== ear.prev && n !== ear.next && pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, n.x, n.y) && area(n.prev, n, n.next) >= 0) return false;
-                       n = n.nextZ;
-               } // look for remaining points in decreasing z-order
-
-
-               while (p && p.z >= minZ) {
-                       if (p !== ear.prev && p !== ear.next && pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, p.x, p.y) && area(p.prev, p, p.next) >= 0) return false;
-                       p = p.prevZ;
-               } // look for remaining points in increasing z-order
-
-
-               while (n && n.z <= maxZ) {
-                       if (n !== ear.prev && n !== ear.next && pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, n.x, n.y) && area(n.prev, n, n.next) >= 0) return false;
-                       n = n.nextZ;
-               }
-
-               return true;
-       } // go through all polygon nodes and cure small local self-intersections
-
-
-       function cureLocalIntersections(start, triangles, dim) {
-               let p = start;
-
-               do {
-                       const a = p.prev,
-                                               b = p.next.next;
-
-                       if (!equals(a, b) && intersects(a, p, p.next, b) && locallyInside(a, b) && locallyInside(b, a)) {
-                               triangles.push(a.i / dim);
-                               triangles.push(p.i / dim);
-                               triangles.push(b.i / dim); // remove two nodes involved
-
-                               removeNode(p);
-                               removeNode(p.next);
-                               p = start = b;
-                       }
-
-                       p = p.next;
-               } while (p !== start);
-
-               return filterPoints(p);
-       } // try splitting polygon into two and triangulate them independently
-
-
-       function splitEarcut(start, triangles, dim, minX, minY, invSize) {
-               // look for a valid diagonal that divides the polygon into two
-               let a = start;
-
-               do {
-                       let b = a.next.next;
-
-                       while (b !== a.prev) {
-                               if (a.i !== b.i && isValidDiagonal(a, b)) {
-                                       // split the polygon in two by the diagonal
-                                       let c = splitPolygon(a, b); // filter colinear points around the cuts
-
-                                       a = filterPoints(a, a.next);
-                                       c = filterPoints(c, c.next); // run earcut on each half
-
-                                       earcutLinked(a, triangles, dim, minX, minY, invSize);
-                                       earcutLinked(c, triangles, dim, minX, minY, invSize);
-                                       return;
-                               }
-
-                               b = b.next;
-                       }
-
-                       a = a.next;
-               } while (a !== start);
-       } // link every hole into the outer loop, producing a single-ring polygon without holes
-
-
-       function eliminateHoles(data, holeIndices, outerNode, dim) {
-               const queue = [];
-               let i, len, start, end, list;
-
-               for (i = 0, len = holeIndices.length; i < len; i++) {
-                       start = holeIndices[i] * dim;
-                       end = i < len - 1 ? holeIndices[i + 1] * dim : data.length;
-                       list = linkedList(data, start, end, dim, false);
-                       if (list === list.next) list.steiner = true;
-                       queue.push(getLeftmost(list));
-               }
-
-               queue.sort(compareX); // process holes from left to right
-
-               for (i = 0; i < queue.length; i++) {
-                       eliminateHole(queue[i], outerNode);
-                       outerNode = filterPoints(outerNode, outerNode.next);
-               }
-
-               return outerNode;
-       }
-
-       function compareX(a, b) {
-               return a.x - b.x;
-       } // find a bridge between vertices that connects hole with an outer ring and and link it
-
-
-       function eliminateHole(hole, outerNode) {
-               outerNode = findHoleBridge(hole, outerNode);
-
-               if (outerNode) {
-                       const b = splitPolygon(outerNode, hole); // filter collinear points around the cuts
-
-                       filterPoints(outerNode, outerNode.next);
-                       filterPoints(b, b.next);
-               }
-       } // David Eberly's algorithm for finding a bridge between hole and outer polygon
-
-
-       function findHoleBridge(hole, outerNode) {
-               let p = outerNode;
-               const hx = hole.x;
-               const hy = hole.y;
-               let qx = -Infinity,
-                               m; // find a segment intersected by a ray from the hole's leftmost point to the left;
-               // segment's endpoint with lesser x will be potential connection point
-
-               do {
-                       if (hy <= p.y && hy >= p.next.y && p.next.y !== p.y) {
-                               const x = p.x + (hy - p.y) * (p.next.x - p.x) / (p.next.y - p.y);
-
-                               if (x <= hx && x > qx) {
-                                       qx = x;
-
-                                       if (x === hx) {
-                                               if (hy === p.y) return p;
-                                               if (hy === p.next.y) return p.next;
-                                       }
-
-                                       m = p.x < p.next.x ? p : p.next;
-                               }
-                       }
-
-                       p = p.next;
-               } while (p !== outerNode);
-
-               if (!m) return null;
-               if (hx === qx) return m; // hole touches outer segment; pick leftmost endpoint
-               // look for points inside the triangle of hole point, segment intersection and endpoint;
-               // if there are no points found, we have a valid connection;
-               // otherwise choose the point of the minimum angle with the ray as connection point
-
-               const stop = m,
-                                       mx = m.x,
-                                       my = m.y;
-               let tanMin = Infinity,
-                               tan;
-               p = m;
-
-               do {
-                       if (hx >= p.x && p.x >= mx && hx !== p.x && pointInTriangle(hy < my ? hx : qx, hy, mx, my, hy < my ? qx : hx, hy, p.x, p.y)) {
-                               tan = Math.abs(hy - p.y) / (hx - p.x); // tangential
-
-                               if (locallyInside(p, hole) && (tan < tanMin || tan === tanMin && (p.x > m.x || p.x === m.x && sectorContainsSector(m, p)))) {
-                                       m = p;
-                                       tanMin = tan;
-                               }
-                       }
-
-                       p = p.next;
-               } while (p !== stop);
-
-               return m;
-       } // whether sector in vertex m contains sector in vertex p in the same coordinates
-
-
-       function sectorContainsSector(m, p) {
-               return area(m.prev, m, p.prev) < 0 && area(p.next, m, m.next) < 0;
-       } // interlink polygon nodes in z-order
-
-
-       function indexCurve(start, minX, minY, invSize) {
-               let p = start;
-
-               do {
-                       if (p.z === null) p.z = zOrder(p.x, p.y, minX, minY, invSize);
-                       p.prevZ = p.prev;
-                       p.nextZ = p.next;
-                       p = p.next;
-               } while (p !== start);
-
-               p.prevZ.nextZ = null;
-               p.prevZ = null;
-               sortLinked(p);
-       } // Simon Tatham's linked list merge sort algorithm
-       // http://www.chiark.greenend.org.uk/~sgtatham/algorithms/listsort.html
-
-
-       function sortLinked(list) {
-               let i,
-                               p,
-                               q,
-                               e,
-                               tail,
-                               numMerges,
-                               pSize,
-                               qSize,
-                               inSize = 1;
-
-               do {
-                       p = list;
-                       list = null;
-                       tail = null;
-                       numMerges = 0;
-
-                       while (p) {
-                               numMerges++;
-                               q = p;
-                               pSize = 0;
-
-                               for (i = 0; i < inSize; i++) {
-                                       pSize++;
-                                       q = q.nextZ;
-                                       if (!q) break;
-                               }
-
-                               qSize = inSize;
-
-                               while (pSize > 0 || qSize > 0 && q) {
-                                       if (pSize !== 0 && (qSize === 0 || !q || p.z <= q.z)) {
-                                               e = p;
-                                               p = p.nextZ;
-                                               pSize--;
-                                       } else {
-                                               e = q;
-                                               q = q.nextZ;
-                                               qSize--;
-                                       }
-
-                                       if (tail) tail.nextZ = e;else list = e;
-                                       e.prevZ = tail;
-                                       tail = e;
-                               }
-
-                               p = q;
-                       }
-
-                       tail.nextZ = null;
-                       inSize *= 2;
-               } while (numMerges > 1);
-
-               return list;
-       } // z-order of a point given coords and inverse of the longer side of data bbox
-
-
-       function zOrder(x, y, minX, minY, invSize) {
-               // coords are transformed into non-negative 15-bit integer range
-               x = 32767 * (x - minX) * invSize;
-               y = 32767 * (y - minY) * invSize;
-               x = (x | x << 8) & 0x00FF00FF;
-               x = (x | x << 4) & 0x0F0F0F0F;
-               x = (x | x << 2) & 0x33333333;
-               x = (x | x << 1) & 0x55555555;
-               y = (y | y << 8) & 0x00FF00FF;
-               y = (y | y << 4) & 0x0F0F0F0F;
-               y = (y | y << 2) & 0x33333333;
-               y = (y | y << 1) & 0x55555555;
-               return x | y << 1;
-       } // find the leftmost node of a polygon ring
-
-
-       function getLeftmost(start) {
-               let p = start,
-                               leftmost = start;
-
-               do {
-                       if (p.x < leftmost.x || p.x === leftmost.x && p.y < leftmost.y) leftmost = p;
-                       p = p.next;
-               } while (p !== start);
-
-               return leftmost;
-       } // check if a point lies within a convex triangle
-
-
-       function pointInTriangle(ax, ay, bx, by, cx, cy, px, py) {
-               return (cx - px) * (ay - py) - (ax - px) * (cy - py) >= 0 && (ax - px) * (by - py) - (bx - px) * (ay - py) >= 0 && (bx - px) * (cy - py) - (cx - px) * (by - py) >= 0;
-       } // check if a diagonal between two polygon nodes is valid (lies in polygon interior)
-
-
-       function isValidDiagonal(a, b) {
-               return a.next.i !== b.i && a.prev.i !== b.i && !intersectsPolygon(a, b) && (locallyInside(a, b) && locallyInside(b, a) && middleInside(a, b) && (area(a.prev, a, b.prev) || area(a, b.prev, b)) || // does not create opposite-facing sectors
-               equals(a, b) && area(a.prev, a, a.next) > 0 && area(b.prev, b, b.next) > 0); // special zero-length case
-       } // signed area of a triangle
-
-
-       function area(p, q, r) {
-               return (q.y - p.y) * (r.x - q.x) - (q.x - p.x) * (r.y - q.y);
-       } // check if two points are equal
-
-
-       function equals(p1, p2) {
-               return p1.x === p2.x && p1.y === p2.y;
-       } // check if two segments intersect
-
-
-       function intersects(p1, q1, p2, q2) {
-               const o1 = sign(area(p1, q1, p2));
-               const o2 = sign(area(p1, q1, q2));
-               const o3 = sign(area(p2, q2, p1));
-               const o4 = sign(area(p2, q2, q1));
-               if (o1 !== o2 && o3 !== o4) return true; // general case
-
-               if (o1 === 0 && onSegment(p1, p2, q1)) return true; // p1, q1 and p2 are collinear and p2 lies on p1q1
-
-               if (o2 === 0 && onSegment(p1, q2, q1)) return true; // p1, q1 and q2 are collinear and q2 lies on p1q1
-
-               if (o3 === 0 && onSegment(p2, p1, q2)) return true; // p2, q2 and p1 are collinear and p1 lies on p2q2
-
-               if (o4 === 0 && onSegment(p2, q1, q2)) return true; // p2, q2 and q1 are collinear and q1 lies on p2q2
-
-               return false;
-       } // for collinear points p, q, r, check if point q lies on segment pr
-
-
-       function onSegment(p, q, r) {
-               return q.x <= Math.max(p.x, r.x) && q.x >= Math.min(p.x, r.x) && q.y <= Math.max(p.y, r.y) && q.y >= Math.min(p.y, r.y);
-       }
-
-       function sign(num) {
-               return num > 0 ? 1 : num < 0 ? -1 : 0;
-       } // check if a polygon diagonal intersects any polygon segments
-
-
-       function intersectsPolygon(a, b) {
-               let p = a;
-
-               do {
-                       if (p.i !== a.i && p.next.i !== a.i && p.i !== b.i && p.next.i !== b.i && intersects(p, p.next, a, b)) return true;
-                       p = p.next;
-               } while (p !== a);
-
-               return false;
-       } // check if a polygon diagonal is locally inside the polygon
-
-
-       function locallyInside(a, b) {
-               return area(a.prev, a, a.next) < 0 ? area(a, b, a.next) >= 0 && area(a, a.prev, b) >= 0 : area(a, b, a.prev) < 0 || area(a, a.next, b) < 0;
-       } // check if the middle point of a polygon diagonal is inside the polygon
-
-
-       function middleInside(a, b) {
-               let p = a,
-                               inside = false;
-               const px = (a.x + b.x) / 2,
-                                       py = (a.y + b.y) / 2;
-
-               do {
-                       if (p.y > py !== p.next.y > py && p.next.y !== p.y && px < (p.next.x - p.x) * (py - p.y) / (p.next.y - p.y) + p.x) inside = !inside;
-                       p = p.next;
-               } while (p !== a);
-
-               return inside;
-       } // link two polygon vertices with a bridge; if the vertices belong to the same ring, it splits polygon into two;
-       // if one belongs to the outer ring and another to a hole, it merges it into a single ring
-
-
-       function splitPolygon(a, b) {
-               const a2 = new Node(a.i, a.x, a.y),
-                                       b2 = new Node(b.i, b.x, b.y),
-                                       an = a.next,
-                                       bp = b.prev;
-               a.next = b;
-               b.prev = a;
-               a2.next = an;
-               an.prev = a2;
-               b2.next = a2;
-               a2.prev = b2;
-               bp.next = b2;
-               b2.prev = bp;
-               return b2;
-       } // create a node and optionally link it with previous one (in a circular doubly linked list)
-
-
-       function insertNode(i, x, y, last) {
-               const p = new Node(i, x, y);
-
-               if (!last) {
-                       p.prev = p;
-                       p.next = p;
-               } else {
-                       p.next = last.next;
-                       p.prev = last;
-                       last.next.prev = p;
-                       last.next = p;
-               }
-
-               return p;
-       }
-
-       function removeNode(p) {
-               p.next.prev = p.prev;
-               p.prev.next = p.next;
-               if (p.prevZ) p.prevZ.nextZ = p.nextZ;
-               if (p.nextZ) p.nextZ.prevZ = p.prevZ;
-       }
-
-       function Node(i, x, y) {
-               // vertex index in coordinates array
-               this.i = i; // vertex coordinates
-
-               this.x = x;
-               this.y = y; // previous and next vertex nodes in a polygon ring
-
-               this.prev = null;
-               this.next = null; // z-order curve value
-
-               this.z = null; // previous and next nodes in z-order
-
-               this.prevZ = null;
-               this.nextZ = null; // indicates whether this is a steiner point
-
-               this.steiner = false;
-       }
-
-       function signedArea(data, start, end, dim) {
-               let sum = 0;
-
-               for (let i = start, j = end - dim; i < end; i += dim) {
-                       sum += (data[j] - data[i]) * (data[i + 1] + data[j + 1]);
-                       j = i;
-               }
-
-               return sum;
-       }
-
-       class ShapeUtils {
-               // calculate area of the contour polygon
-               static area(contour) {
-                       const n = contour.length;
-                       let a = 0.0;
-
-                       for (let p = n - 1, q = 0; q < n; p = q++) {
-                               a += contour[p].x * contour[q].y - contour[q].x * contour[p].y;
-                       }
-
-                       return a * 0.5;
-               }
-
-               static isClockWise(pts) {
-                       return ShapeUtils.area(pts) < 0;
-               }
-
-               static triangulateShape(contour, holes) {
-                       const vertices = []; // flat array of vertices like [ x0,y0, x1,y1, x2,y2, ... ]
-
-                       const holeIndices = []; // array of hole indices
-
-                       const faces = []; // final array of vertex indices like [ [ a,b,d ], [ b,c,d ] ]
-
-                       removeDupEndPts(contour);
-                       addContour(vertices, contour); //
-
-                       let holeIndex = contour.length;
-                       holes.forEach(removeDupEndPts);
-
-                       for (let i = 0; i < holes.length; i++) {
-                               holeIndices.push(holeIndex);
-                               holeIndex += holes[i].length;
-                               addContour(vertices, holes[i]);
-                       } //
-
-
-                       const triangles = Earcut.triangulate(vertices, holeIndices); //
-
-                       for (let i = 0; i < triangles.length; i += 3) {
-                               faces.push(triangles.slice(i, i + 3));
-                       }
-
-                       return faces;
-               }
-
-       }
-
-       function removeDupEndPts(points) {
-               const l = points.length;
-
-               if (l > 2 && points[l - 1].equals(points[0])) {
-                       points.pop();
-               }
-       }
-
-       function addContour(vertices, contour) {
-               for (let i = 0; i < contour.length; i++) {
-                       vertices.push(contour[i].x);
-                       vertices.push(contour[i].y);
-               }
-       }
-
-       /**
-        * Creates extruded geometry from a path shape.
-        *
-        * parameters = {
-        *
-        *      curveSegments: <int>, // number of points on the curves
-        *      steps: <int>, // number of points for z-side extrusions / used for subdividing segments of extrude spline too
-        *      depth: <float>, // Depth to extrude the shape
-        *
-        *      bevelEnabled: <bool>, // turn on bevel
-        *      bevelThickness: <float>, // how deep into the original shape bevel goes
-        *      bevelSize: <float>, // how far from shape outline (including bevelOffset) is bevel
-        *      bevelOffset: <float>, // how far from shape outline does bevel start
-        *      bevelSegments: <int>, // number of bevel layers
-        *
-        *      extrudePath: <THREE.Curve> // curve to extrude shape along
-        *
-        *      UVGenerator: <Object> // object that provides UV generator functions
-        *
-        * }
-        */
-
-       class ExtrudeGeometry extends BufferGeometry {
-               constructor(shapes, options) {
-                       super();
-                       this.type = 'ExtrudeGeometry';
-                       this.parameters = {
-                               shapes: shapes,
-                               options: options
-                       };
-                       shapes = Array.isArray(shapes) ? shapes : [shapes];
-                       const scope = this;
-                       const verticesArray = [];
-                       const uvArray = [];
-
-                       for (let i = 0, l = shapes.length; i < l; i++) {
-                               const shape = shapes[i];
-                               addShape(shape);
-                       } // build geometry
-
-
-                       this.setAttribute('position', new Float32BufferAttribute(verticesArray, 3));
-                       this.setAttribute('uv', new Float32BufferAttribute(uvArray, 2));
-                       this.computeVertexNormals(); // functions
-
-                       function addShape(shape) {
-                               const placeholder = []; // options
-
-                               const curveSegments = options.curveSegments !== undefined ? options.curveSegments : 12;
-                               const steps = options.steps !== undefined ? options.steps : 1;
-                               let depth = options.depth !== undefined ? options.depth : 100;
-                               let bevelEnabled = options.bevelEnabled !== undefined ? options.bevelEnabled : true;
-                               let bevelThickness = options.bevelThickness !== undefined ? options.bevelThickness : 6;
-                               let bevelSize = options.bevelSize !== undefined ? options.bevelSize : bevelThickness - 2;
-                               let bevelOffset = options.bevelOffset !== undefined ? options.bevelOffset : 0;
-                               let bevelSegments = options.bevelSegments !== undefined ? options.bevelSegments : 3;
-                               const extrudePath = options.extrudePath;
-                               const uvgen = options.UVGenerator !== undefined ? options.UVGenerator : WorldUVGenerator; // deprecated options
-
-                               if (options.amount !== undefined) {
-                                       console.warn('THREE.ExtrudeBufferGeometry: amount has been renamed to depth.');
-                                       depth = options.amount;
-                               } //
-
-
-                               let extrudePts,
-                                               extrudeByPath = false;
-                               let splineTube, binormal, normal, position2;
-
-                               if (extrudePath) {
-                                       extrudePts = extrudePath.getSpacedPoints(steps);
-                                       extrudeByPath = true;
-                                       bevelEnabled = false; // bevels not supported for path extrusion
-                                       // SETUP TNB variables
-                                       // TODO1 - have a .isClosed in spline?
-
-                                       splineTube = extrudePath.computeFrenetFrames(steps, false); // console.log(splineTube, 'splineTube', splineTube.normals.length, 'steps', steps, 'extrudePts', extrudePts.length);
-
-                                       binormal = new Vector3();
-                                       normal = new Vector3();
-                                       position2 = new Vector3();
-                               } // Safeguards if bevels are not enabled
-
-
-                               if (!bevelEnabled) {
-                                       bevelSegments = 0;
-                                       bevelThickness = 0;
-                                       bevelSize = 0;
-                                       bevelOffset = 0;
-                               } // Variables initialization
-
-
-                               const shapePoints = shape.extractPoints(curveSegments);
-                               let vertices = shapePoints.shape;
-                               const holes = shapePoints.holes;
-                               const reverse = !ShapeUtils.isClockWise(vertices);
-
-                               if (reverse) {
-                                       vertices = vertices.reverse(); // Maybe we should also check if holes are in the opposite direction, just to be safe ...
-
-                                       for (let h = 0, hl = holes.length; h < hl; h++) {
-                                               const ahole = holes[h];
-
-                                               if (ShapeUtils.isClockWise(ahole)) {
-                                                       holes[h] = ahole.reverse();
-                                               }
-                                       }
-                               }
-
-                               const faces = ShapeUtils.triangulateShape(vertices, holes);
-                               /* Vertices */
-
-                               const contour = vertices; // vertices has all points but contour has only points of circumference
-
-                               for (let h = 0, hl = holes.length; h < hl; h++) {
-                                       const ahole = holes[h];
-                                       vertices = vertices.concat(ahole);
-                               }
-
-                               function scalePt2(pt, vec, size) {
-                                       if (!vec) console.error('THREE.ExtrudeGeometry: vec does not exist');
-                                       return vec.clone().multiplyScalar(size).add(pt);
-                               }
-
-                               const vlen = vertices.length,
-                                                       flen = faces.length; // Find directions for point movement
-
-                               function getBevelVec(inPt, inPrev, inNext) {
-                                       // computes for inPt the corresponding point inPt' on a new contour
-                                       //       shifted by 1 unit (length of normalized vector) to the left
-                                       // if we walk along contour clockwise, this new contour is outside the old one
-                                       //
-                                       // inPt' is the intersection of the two lines parallel to the two
-                                       //      adjacent edges of inPt at a distance of 1 unit on the left side.
-                                       let v_trans_x, v_trans_y, shrink_by; // resulting translation vector for inPt
-                                       // good reading for geometry algorithms (here: line-line intersection)
-                                       // http://geomalgorithms.com/a05-_intersect-1.html
-
-                                       const v_prev_x = inPt.x - inPrev.x,
-                                                               v_prev_y = inPt.y - inPrev.y;
-                                       const v_next_x = inNext.x - inPt.x,
-                                                               v_next_y = inNext.y - inPt.y;
-                                       const v_prev_lensq = v_prev_x * v_prev_x + v_prev_y * v_prev_y; // check for collinear edges
-
-                                       const collinear0 = v_prev_x * v_next_y - v_prev_y * v_next_x;
-
-                                       if (Math.abs(collinear0) > Number.EPSILON) {
-                                               // not collinear
-                                               // length of vectors for normalizing
-                                               const v_prev_len = Math.sqrt(v_prev_lensq);
-                                               const v_next_len = Math.sqrt(v_next_x * v_next_x + v_next_y * v_next_y); // shift adjacent points by unit vectors to the left
-
-                                               const ptPrevShift_x = inPrev.x - v_prev_y / v_prev_len;
-                                               const ptPrevShift_y = inPrev.y + v_prev_x / v_prev_len;
-                                               const ptNextShift_x = inNext.x - v_next_y / v_next_len;
-                                               const ptNextShift_y = inNext.y + v_next_x / v_next_len; // scaling factor for v_prev to intersection point
-
-                                               const sf = ((ptNextShift_x - ptPrevShift_x) * v_next_y - (ptNextShift_y - ptPrevShift_y) * v_next_x) / (v_prev_x * v_next_y - v_prev_y * v_next_x); // vector from inPt to intersection point
-
-                                               v_trans_x = ptPrevShift_x + v_prev_x * sf - inPt.x;
-                                               v_trans_y = ptPrevShift_y + v_prev_y * sf - inPt.y; // Don't normalize!, otherwise sharp corners become ugly
-                                               //      but prevent crazy spikes
-
-                                               const v_trans_lensq = v_trans_x * v_trans_x + v_trans_y * v_trans_y;
-
-                                               if (v_trans_lensq <= 2) {
-                                                       return new Vector2(v_trans_x, v_trans_y);
-                                               } else {
-                                                       shrink_by = Math.sqrt(v_trans_lensq / 2);
-                                               }
-                                       } else {
-                                               // handle special case of collinear edges
-                                               let direction_eq = false; // assumes: opposite
-
-                                               if (v_prev_x > Number.EPSILON) {
-                                                       if (v_next_x > Number.EPSILON) {
-                                                               direction_eq = true;
-                                                       }
-                                               } else {
-                                                       if (v_prev_x < -Number.EPSILON) {
-                                                               if (v_next_x < -Number.EPSILON) {
-                                                                       direction_eq = true;
-                                                               }
-                                                       } else {
-                                                               if (Math.sign(v_prev_y) === Math.sign(v_next_y)) {
-                                                                       direction_eq = true;
-                                                               }
-                                                       }
-                                               }
-
-                                               if (direction_eq) {
-                                                       // console.log("Warning: lines are a straight sequence");
-                                                       v_trans_x = -v_prev_y;
-                                                       v_trans_y = v_prev_x;
-                                                       shrink_by = Math.sqrt(v_prev_lensq);
-                                               } else {
-                                                       // console.log("Warning: lines are a straight spike");
-                                                       v_trans_x = v_prev_x;
-                                                       v_trans_y = v_prev_y;
-                                                       shrink_by = Math.sqrt(v_prev_lensq / 2);
-                                               }
-                                       }
-
-                                       return new Vector2(v_trans_x / shrink_by, v_trans_y / shrink_by);
-                               }
-
-                               const contourMovements = [];
-
-                               for (let i = 0, il = contour.length, j = il - 1, k = i + 1; i < il; i++, j++, k++) {
-                                       if (j === il) j = 0;
-                                       if (k === il) k = 0; // (j)---(i)---(k)
-                                       // console.log('i,j,k', i, j , k)
-
-                                       contourMovements[i] = getBevelVec(contour[i], contour[j], contour[k]);
-                               }
-
-                               const holesMovements = [];
-                               let oneHoleMovements,
-                                               verticesMovements = contourMovements.concat();
-
-                               for (let h = 0, hl = holes.length; h < hl; h++) {
-                                       const ahole = holes[h];
-                                       oneHoleMovements = [];
-
-                                       for (let i = 0, il = ahole.length, j = il - 1, k = i + 1; i < il; i++, j++, k++) {
-                                               if (j === il) j = 0;
-                                               if (k === il) k = 0; // (j)---(i)---(k)
-
-                                               oneHoleMovements[i] = getBevelVec(ahole[i], ahole[j], ahole[k]);
-                                       }
-
-                                       holesMovements.push(oneHoleMovements);
-                                       verticesMovements = verticesMovements.concat(oneHoleMovements);
-                               } // Loop bevelSegments, 1 for the front, 1 for the back
-
-
-                               for (let b = 0; b < bevelSegments; b++) {
-                                       //for ( b = bevelSegments; b > 0; b -- ) {
-                                       const t = b / bevelSegments;
-                                       const z = bevelThickness * Math.cos(t * Math.PI / 2);
-                                       const bs = bevelSize * Math.sin(t * Math.PI / 2) + bevelOffset; // contract shape
-
-                                       for (let i = 0, il = contour.length; i < il; i++) {
-                                               const vert = scalePt2(contour[i], contourMovements[i], bs);
-                                               v(vert.x, vert.y, -z);
-                                       } // expand holes
-
-
-                                       for (let h = 0, hl = holes.length; h < hl; h++) {
-                                               const ahole = holes[h];
-                                               oneHoleMovements = holesMovements[h];
-
-                                               for (let i = 0, il = ahole.length; i < il; i++) {
-                                                       const vert = scalePt2(ahole[i], oneHoleMovements[i], bs);
-                                                       v(vert.x, vert.y, -z);
-                                               }
-                                       }
-                               }
-
-                               const bs = bevelSize + bevelOffset; // Back facing vertices
-
-                               for (let i = 0; i < vlen; i++) {
-                                       const vert = bevelEnabled ? scalePt2(vertices[i], verticesMovements[i], bs) : vertices[i];
-
-                                       if (!extrudeByPath) {
-                                               v(vert.x, vert.y, 0);
-                                       } else {
-                                               // v( vert.x, vert.y + extrudePts[ 0 ].y, extrudePts[ 0 ].x );
-                                               normal.copy(splineTube.normals[0]).multiplyScalar(vert.x);
-                                               binormal.copy(splineTube.binormals[0]).multiplyScalar(vert.y);
-                                               position2.copy(extrudePts[0]).add(normal).add(binormal);
-                                               v(position2.x, position2.y, position2.z);
-                                       }
-                               } // Add stepped vertices...
-                               // Including front facing vertices
-
-
-                               for (let s = 1; s <= steps; s++) {
-                                       for (let i = 0; i < vlen; i++) {
-                                               const vert = bevelEnabled ? scalePt2(vertices[i], verticesMovements[i], bs) : vertices[i];
-
-                                               if (!extrudeByPath) {
-                                                       v(vert.x, vert.y, depth / steps * s);
-                                               } else {
-                                                       // v( vert.x, vert.y + extrudePts[ s - 1 ].y, extrudePts[ s - 1 ].x );
-                                                       normal.copy(splineTube.normals[s]).multiplyScalar(vert.x);
-                                                       binormal.copy(splineTube.binormals[s]).multiplyScalar(vert.y);
-                                                       position2.copy(extrudePts[s]).add(normal).add(binormal);
-                                                       v(position2.x, position2.y, position2.z);
-                                               }
-                                       }
-                               } // Add bevel segments planes
-                               //for ( b = 1; b <= bevelSegments; b ++ ) {
-
-
-                               for (let b = bevelSegments - 1; b >= 0; b--) {
-                                       const t = b / bevelSegments;
-                                       const z = bevelThickness * Math.cos(t * Math.PI / 2);
-                                       const bs = bevelSize * Math.sin(t * Math.PI / 2) + bevelOffset; // contract shape
-
-                                       for (let i = 0, il = contour.length; i < il; i++) {
-                                               const vert = scalePt2(contour[i], contourMovements[i], bs);
-                                               v(vert.x, vert.y, depth + z);
-                                       } // expand holes
-
-
-                                       for (let h = 0, hl = holes.length; h < hl; h++) {
-                                               const ahole = holes[h];
-                                               oneHoleMovements = holesMovements[h];
-
-                                               for (let i = 0, il = ahole.length; i < il; i++) {
-                                                       const vert = scalePt2(ahole[i], oneHoleMovements[i], bs);
-
-                                                       if (!extrudeByPath) {
-                                                               v(vert.x, vert.y, depth + z);
-                                                       } else {
-                                                               v(vert.x, vert.y + extrudePts[steps - 1].y, extrudePts[steps - 1].x + z);
-                                                       }
-                                               }
-                                       }
-                               }
-                               /* Faces */
-                               // Top and bottom faces
-
-
-                               buildLidFaces(); // Sides faces
-
-                               buildSideFaces(); ///// Internal functions
-
-                               function buildLidFaces() {
-                                       const start = verticesArray.length / 3;
-
-                                       if (bevelEnabled) {
-                                               let layer = 0; // steps + 1
-
-                                               let offset = vlen * layer; // Bottom faces
-
-                                               for (let i = 0; i < flen; i++) {
-                                                       const face = faces[i];
-                                                       f3(face[2] + offset, face[1] + offset, face[0] + offset);
-                                               }
-
-                                               layer = steps + bevelSegments * 2;
-                                               offset = vlen * layer; // Top faces
-
-                                               for (let i = 0; i < flen; i++) {
-                                                       const face = faces[i];
-                                                       f3(face[0] + offset, face[1] + offset, face[2] + offset);
-                                               }
-                                       } else {
-                                               // Bottom faces
-                                               for (let i = 0; i < flen; i++) {
-                                                       const face = faces[i];
-                                                       f3(face[2], face[1], face[0]);
-                                               } // Top faces
-
-
-                                               for (let i = 0; i < flen; i++) {
-                                                       const face = faces[i];
-                                                       f3(face[0] + vlen * steps, face[1] + vlen * steps, face[2] + vlen * steps);
-                                               }
-                                       }
-
-                                       scope.addGroup(start, verticesArray.length / 3 - start, 0);
-                               } // Create faces for the z-sides of the shape
-
-
-                               function buildSideFaces() {
-                                       const start = verticesArray.length / 3;
-                                       let layeroffset = 0;
-                                       sidewalls(contour, layeroffset);
-                                       layeroffset += contour.length;
-
-                                       for (let h = 0, hl = holes.length; h < hl; h++) {
-                                               const ahole = holes[h];
-                                               sidewalls(ahole, layeroffset); //, true
-
-                                               layeroffset += ahole.length;
-                                       }
-
-                                       scope.addGroup(start, verticesArray.length / 3 - start, 1);
-                               }
-
-                               function sidewalls(contour, layeroffset) {
-                                       let i = contour.length;
-
-                                       while (--i >= 0) {
-                                               const j = i;
-                                               let k = i - 1;
-                                               if (k < 0) k = contour.length - 1; //console.log('b', i,j, i-1, k,vertices.length);
-
-                                               for (let s = 0, sl = steps + bevelSegments * 2; s < sl; s++) {
-                                                       const slen1 = vlen * s;
-                                                       const slen2 = vlen * (s + 1);
-                                                       const a = layeroffset + j + slen1,
-                                                                               b = layeroffset + k + slen1,
-                                                                               c = layeroffset + k + slen2,
-                                                                               d = layeroffset + j + slen2;
-                                                       f4(a, b, c, d);
-                                               }
-                                       }
-                               }
-
-                               function v(x, y, z) {
-                                       placeholder.push(x);
-                                       placeholder.push(y);
-                                       placeholder.push(z);
-                               }
-
-                               function f3(a, b, c) {
-                                       addVertex(a);
-                                       addVertex(b);
-                                       addVertex(c);
-                                       const nextIndex = verticesArray.length / 3;
-                                       const uvs = uvgen.generateTopUV(scope, verticesArray, nextIndex - 3, nextIndex - 2, nextIndex - 1);
-                                       addUV(uvs[0]);
-                                       addUV(uvs[1]);
-                                       addUV(uvs[2]);
-                               }
-
-                               function f4(a, b, c, d) {
-                                       addVertex(a);
-                                       addVertex(b);
-                                       addVertex(d);
-                                       addVertex(b);
-                                       addVertex(c);
-                                       addVertex(d);
-                                       const nextIndex = verticesArray.length / 3;
-                                       const uvs = uvgen.generateSideWallUV(scope, verticesArray, nextIndex - 6, nextIndex - 3, nextIndex - 2, nextIndex - 1);
-                                       addUV(uvs[0]);
-                                       addUV(uvs[1]);
-                                       addUV(uvs[3]);
-                                       addUV(uvs[1]);
-                                       addUV(uvs[2]);
-                                       addUV(uvs[3]);
-                               }
-
-                               function addVertex(index) {
-                                       verticesArray.push(placeholder[index * 3 + 0]);
-                                       verticesArray.push(placeholder[index * 3 + 1]);
-                                       verticesArray.push(placeholder[index * 3 + 2]);
-                               }
-
-                               function addUV(vector2) {
-                                       uvArray.push(vector2.x);
-                                       uvArray.push(vector2.y);
-                               }
-                       }
-               }
-
-               toJSON() {
-                       const data = super.toJSON();
-                       const shapes = this.parameters.shapes;
-                       const options = this.parameters.options;
-                       return toJSON$1(shapes, options, data);
-               }
-
-               static fromJSON(data, shapes) {
-                       const geometryShapes = [];
-
-                       for (let j = 0, jl = data.shapes.length; j < jl; j++) {
-                               const shape = shapes[data.shapes[j]];
-                               geometryShapes.push(shape);
-                       }
-
-                       const extrudePath = data.options.extrudePath;
-
-                       if (extrudePath !== undefined) {
-                               data.options.extrudePath = new Curves[extrudePath.type]().fromJSON(extrudePath);
-                       }
-
-                       return new ExtrudeGeometry(geometryShapes, data.options);
-               }
-
-       }
-
-       const WorldUVGenerator = {
-               generateTopUV: function (geometry, vertices, indexA, indexB, indexC) {
-                       const a_x = vertices[indexA * 3];
-                       const a_y = vertices[indexA * 3 + 1];
-                       const b_x = vertices[indexB * 3];
-                       const b_y = vertices[indexB * 3 + 1];
-                       const c_x = vertices[indexC * 3];
-                       const c_y = vertices[indexC * 3 + 1];
-                       return [new Vector2(a_x, a_y), new Vector2(b_x, b_y), new Vector2(c_x, c_y)];
-               },
-               generateSideWallUV: function (geometry, vertices, indexA, indexB, indexC, indexD) {
-                       const a_x = vertices[indexA * 3];
-                       const a_y = vertices[indexA * 3 + 1];
-                       const a_z = vertices[indexA * 3 + 2];
-                       const b_x = vertices[indexB * 3];
-                       const b_y = vertices[indexB * 3 + 1];
-                       const b_z = vertices[indexB * 3 + 2];
-                       const c_x = vertices[indexC * 3];
-                       const c_y = vertices[indexC * 3 + 1];
-                       const c_z = vertices[indexC * 3 + 2];
-                       const d_x = vertices[indexD * 3];
-                       const d_y = vertices[indexD * 3 + 1];
-                       const d_z = vertices[indexD * 3 + 2];
-
-                       if (Math.abs(a_y - b_y) < Math.abs(a_x - b_x)) {
-                               return [new Vector2(a_x, 1 - a_z), new Vector2(b_x, 1 - b_z), new Vector2(c_x, 1 - c_z), new Vector2(d_x, 1 - d_z)];
-                       } else {
-                               return [new Vector2(a_y, 1 - a_z), new Vector2(b_y, 1 - b_z), new Vector2(c_y, 1 - c_z), new Vector2(d_y, 1 - d_z)];
-                       }
-               }
-       };
-
-       function toJSON$1(shapes, options, data) {
-               data.shapes = [];
-
-               if (Array.isArray(shapes)) {
-                       for (let i = 0, l = shapes.length; i < l; i++) {
-                               const shape = shapes[i];
-                               data.shapes.push(shape.uuid);
-                       }
-               } else {
-                       data.shapes.push(shapes.uuid);
-               }
-
-               if (options.extrudePath !== undefined) data.options.extrudePath = options.extrudePath.toJSON();
-               return data;
-       }
-
-       class IcosahedronGeometry extends PolyhedronGeometry {
-               constructor(radius = 1, detail = 0) {
-                       const t = (1 + Math.sqrt(5)) / 2;
-                       const vertices = [-1, t, 0, 1, t, 0, -1, -t, 0, 1, -t, 0, 0, -1, t, 0, 1, t, 0, -1, -t, 0, 1, -t, t, 0, -1, t, 0, 1, -t, 0, -1, -t, 0, 1];
-                       const indices = [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(vertices, indices, radius, detail);
-                       this.type = 'IcosahedronGeometry';
-                       this.parameters = {
-                               radius: radius,
-                               detail: detail
-                       };
-               }
-
-               static fromJSON(data) {
-                       return new IcosahedronGeometry(data.radius, data.detail);
-               }
-
-       }
-
-       class LatheGeometry extends BufferGeometry {
-               constructor(points, segments = 12, phiStart = 0, phiLength = Math.PI * 2) {
-                       super();
-                       this.type = 'LatheGeometry';
-                       this.parameters = {
-                               points: points,
-                               segments: segments,
-                               phiStart: phiStart,
-                               phiLength: phiLength
-                       };
-                       segments = Math.floor(segments); // clamp phiLength so it's in range of [ 0, 2PI ]
-
-                       phiLength = clamp(phiLength, 0, Math.PI * 2); // buffers
-
-                       const indices = [];
-                       const vertices = [];
-                       const uvs = []; // helper variables
-
-                       const inverseSegments = 1.0 / segments;
-                       const vertex = new Vector3();
-                       const uv = new Vector2(); // generate vertices and uvs
-
-                       for (let i = 0; i <= segments; i++) {
-                               const phi = phiStart + i * inverseSegments * phiLength;
-                               const sin = Math.sin(phi);
-                               const cos = Math.cos(phi);
-
-                               for (let j = 0; j <= points.length - 1; j++) {
-                                       // vertex
-                                       vertex.x = points[j].x * sin;
-                                       vertex.y = points[j].y;
-                                       vertex.z = points[j].x * cos;
-                                       vertices.push(vertex.x, vertex.y, vertex.z); // uv
-
-                                       uv.x = i / segments;
-                                       uv.y = j / (points.length - 1);
-                                       uvs.push(uv.x, uv.y);
-                               }
-                       } // indices
-
-
-                       for (let i = 0; i < segments; i++) {
-                               for (let j = 0; j < points.length - 1; j++) {
-                                       const base = j + i * points.length;
-                                       const a = base;
-                                       const b = base + points.length;
-                                       const c = base + points.length + 1;
-                                       const d = base + 1; // faces
-
-                                       indices.push(a, b, d);
-                                       indices.push(b, c, d);
-                               }
-                       } // build geometry
-
-
-                       this.setIndex(indices);
-                       this.setAttribute('position', new Float32BufferAttribute(vertices, 3));
-                       this.setAttribute('uv', new Float32BufferAttribute(uvs, 2)); // generate normals
-
-                       this.computeVertexNormals(); // if the geometry is closed, we need to average the normals along the seam.
-                       // because the corresponding vertices are identical (but still have different UVs).
-
-                       if (phiLength === Math.PI * 2) {
-                               const normals = this.attributes.normal.array;
-                               const n1 = new Vector3();
-                               const n2 = new Vector3();
-                               const n = new Vector3(); // this is the buffer offset for the last line of vertices
-
-                               const base = segments * points.length * 3;
-
-                               for (let i = 0, j = 0; i < points.length; i++, j += 3) {
-                                       // select the normal of the vertex in the first line
-                                       n1.x = normals[j + 0];
-                                       n1.y = normals[j + 1];
-                                       n1.z = normals[j + 2]; // select the normal of the vertex in the last line
-
-                                       n2.x = normals[base + j + 0];
-                                       n2.y = normals[base + j + 1];
-                                       n2.z = normals[base + j + 2]; // average normals
-
-                                       n.addVectors(n1, n2).normalize(); // assign the new values to both normals
-
-                                       normals[j + 0] = normals[base + j + 0] = n.x;
-                                       normals[j + 1] = normals[base + j + 1] = n.y;
-                                       normals[j + 2] = normals[base + j + 2] = n.z;
-                               }
-                       }
-               }
-
-               static fromJSON(data) {
-                       return new LatheGeometry(data.points, data.segments, data.phiStart, data.phiLength);
-               }
-
-       }
-
-       class OctahedronGeometry extends PolyhedronGeometry {
-               constructor(radius = 1, detail = 0) {
-                       const vertices = [1, 0, 0, -1, 0, 0, 0, 1, 0, 0, -1, 0, 0, 0, 1, 0, 0, -1];
-                       const indices = [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(vertices, indices, radius, detail);
-                       this.type = 'OctahedronGeometry';
-                       this.parameters = {
-                               radius: radius,
-                               detail: detail
-                       };
-               }
-
-               static fromJSON(data) {
-                       return new OctahedronGeometry(data.radius, data.detail);
-               }
-
-       }
-
-       /**
-        * Parametric Surfaces Geometry
-        * based on the brilliant article by @prideout https://prideout.net/blog/old/blog/index.html@p=44.html
-        */
-
-       class ParametricGeometry extends BufferGeometry {
-               constructor(func, slices, stacks) {
-                       super();
-                       this.type = 'ParametricGeometry';
-                       this.parameters = {
-                               func: func,
-                               slices: slices,
-                               stacks: stacks
-                       }; // buffers
-
-                       const indices = [];
-                       const vertices = [];
-                       const normals = [];
-                       const uvs = [];
-                       const EPS = 0.00001;
-                       const normal = new Vector3();
-                       const p0 = new Vector3(),
-                                               p1 = new Vector3();
-                       const pu = new Vector3(),
-                                               pv = new Vector3();
-
-                       if (func.length < 3) {
-                               console.error('THREE.ParametricGeometry: Function must now modify a Vector3 as third parameter.');
-                       } // generate vertices, normals and uvs
-
-
-                       const sliceCount = slices + 1;
-
-                       for (let i = 0; i <= stacks; i++) {
-                               const v = i / stacks;
-
-                               for (let j = 0; j <= slices; j++) {
-                                       const u = j / slices; // vertex
-
-                                       func(u, v, p0);
-                                       vertices.push(p0.x, p0.y, p0.z); // normal
-                                       // approximate tangent vectors via finite differences
-
-                                       if (u - EPS >= 0) {
-                                               func(u - EPS, v, p1);
-                                               pu.subVectors(p0, p1);
-                                       } else {
-                                               func(u + EPS, v, p1);
-                                               pu.subVectors(p1, p0);
-                                       }
-
-                                       if (v - EPS >= 0) {
-                                               func(u, v - EPS, p1);
-                                               pv.subVectors(p0, p1);
-                                       } else {
-                                               func(u, v + EPS, p1);
-                                               pv.subVectors(p1, p0);
-                                       } // cross product of tangent vectors returns surface normal
-
-
-                                       normal.crossVectors(pu, pv).normalize();
-                                       normals.push(normal.x, normal.y, normal.z); // uv
-
-                                       uvs.push(u, v);
-                               }
-                       } // generate indices
-
-
-                       for (let i = 0; i < stacks; i++) {
-                               for (let j = 0; j < slices; j++) {
-                                       const a = i * sliceCount + j;
-                                       const b = i * sliceCount + j + 1;
-                                       const c = (i + 1) * sliceCount + j + 1;
-                                       const d = (i + 1) * sliceCount + j; // faces one and two
-
-                                       indices.push(a, b, d);
-                                       indices.push(b, c, d);
-                               }
-                       } // build geometry
-
-
-                       this.setIndex(indices);
-                       this.setAttribute('position', new Float32BufferAttribute(vertices, 3));
-                       this.setAttribute('normal', new Float32BufferAttribute(normals, 3));
-                       this.setAttribute('uv', new Float32BufferAttribute(uvs, 2));
-               }
-
-       }
-
-       class RingGeometry extends BufferGeometry {
-               constructor(innerRadius = 0.5, outerRadius = 1, thetaSegments = 8, phiSegments = 1, thetaStart = 0, thetaLength = Math.PI * 2) {
-                       super();
-                       this.type = 'RingGeometry';
-                       this.parameters = {
-                               innerRadius: innerRadius,
-                               outerRadius: outerRadius,
-                               thetaSegments: thetaSegments,
-                               phiSegments: phiSegments,
-                               thetaStart: thetaStart,
-                               thetaLength: thetaLength
-                       };
-                       thetaSegments = Math.max(3, thetaSegments);
-                       phiSegments = Math.max(1, phiSegments); // buffers
-
-                       const indices = [];
-                       const vertices = [];
-                       const normals = [];
-                       const uvs = []; // some helper variables
-
-                       let radius = innerRadius;
-                       const radiusStep = (outerRadius - innerRadius) / phiSegments;
-                       const vertex = new Vector3();
-                       const uv = new Vector2(); // generate vertices, normals and uvs
-
-                       for (let j = 0; j <= phiSegments; j++) {
-                               for (let i = 0; i <= thetaSegments; i++) {
-                                       // values are generate from the inside of the ring to the outside
-                                       const segment = thetaStart + i / thetaSegments * thetaLength; // vertex
-
-                                       vertex.x = radius * Math.cos(segment);
-                                       vertex.y = radius * Math.sin(segment);
-                                       vertices.push(vertex.x, vertex.y, vertex.z); // normal
-
-                                       normals.push(0, 0, 1); // uv
-
-                                       uv.x = (vertex.x / outerRadius + 1) / 2;
-                                       uv.y = (vertex.y / outerRadius + 1) / 2;
-                                       uvs.push(uv.x, uv.y);
-                               } // increase the radius for next row of vertices
-
-
-                               radius += radiusStep;
-                       } // indices
-
-
-                       for (let j = 0; j < phiSegments; j++) {
-                               const thetaSegmentLevel = j * (thetaSegments + 1);
-
-                               for (let i = 0; i < thetaSegments; i++) {
-                                       const segment = i + thetaSegmentLevel;
-                                       const a = segment;
-                                       const b = segment + thetaSegments + 1;
-                                       const c = segment + thetaSegments + 2;
-                                       const d = segment + 1; // faces
-
-                                       indices.push(a, b, d);
-                                       indices.push(b, c, d);
-                               }
-                       } // build geometry
-
-
-                       this.setIndex(indices);
-                       this.setAttribute('position', new Float32BufferAttribute(vertices, 3));
-                       this.setAttribute('normal', new Float32BufferAttribute(normals, 3));
-                       this.setAttribute('uv', new Float32BufferAttribute(uvs, 2));
-               }
-
-               static fromJSON(data) {
-                       return new RingGeometry(data.innerRadius, data.outerRadius, data.thetaSegments, data.phiSegments, data.thetaStart, data.thetaLength);
-               }
-
-       }
-
-       class ShapeGeometry extends BufferGeometry {
-               constructor(shapes, curveSegments = 12) {
-                       super();
-                       this.type = 'ShapeGeometry';
-                       this.parameters = {
-                               shapes: shapes,
-                               curveSegments: curveSegments
-                       }; // buffers
-
-                       const indices = [];
-                       const vertices = [];
-                       const normals = [];
-                       const uvs = []; // helper variables
-
-                       let groupStart = 0;
-                       let groupCount = 0; // allow single and array values for "shapes" parameter
-
-                       if (Array.isArray(shapes) === false) {
-                               addShape(shapes);
-                       } else {
-                               for (let i = 0; i < shapes.length; i++) {
-                                       addShape(shapes[i]);
-                                       this.addGroup(groupStart, groupCount, i); // enables MultiMaterial support
-
-                                       groupStart += groupCount;
-                                       groupCount = 0;
-                               }
-                       } // build geometry
-
-
-                       this.setIndex(indices);
-                       this.setAttribute('position', new Float32BufferAttribute(vertices, 3));
-                       this.setAttribute('normal', new Float32BufferAttribute(normals, 3));
-                       this.setAttribute('uv', new Float32BufferAttribute(uvs, 2)); // helper functions
-
-                       function addShape(shape) {
-                               const indexOffset = vertices.length / 3;
-                               const points = shape.extractPoints(curveSegments);
-                               let shapeVertices = points.shape;
-                               const shapeHoles = points.holes; // check direction of vertices
-
-                               if (ShapeUtils.isClockWise(shapeVertices) === false) {
-                                       shapeVertices = shapeVertices.reverse();
-                               }
-
-                               for (let i = 0, l = shapeHoles.length; i < l; i++) {
-                                       const shapeHole = shapeHoles[i];
-
-                                       if (ShapeUtils.isClockWise(shapeHole) === true) {
-                                               shapeHoles[i] = shapeHole.reverse();
-                                       }
-                               }
-
-                               const faces = ShapeUtils.triangulateShape(shapeVertices, shapeHoles); // join vertices of inner and outer paths to a single array
-
-                               for (let i = 0, l = shapeHoles.length; i < l; i++) {
-                                       const shapeHole = shapeHoles[i];
-                                       shapeVertices = shapeVertices.concat(shapeHole);
-                               } // vertices, normals, uvs
-
-
-                               for (let i = 0, l = shapeVertices.length; i < l; i++) {
-                                       const vertex = shapeVertices[i];
-                                       vertices.push(vertex.x, vertex.y, 0);
-                                       normals.push(0, 0, 1);
-                                       uvs.push(vertex.x, vertex.y); // world uvs
-                               } // incides
-
-
-                               for (let i = 0, l = faces.length; i < l; i++) {
-                                       const face = faces[i];
-                                       const a = face[0] + indexOffset;
-                                       const b = face[1] + indexOffset;
-                                       const c = face[2] + indexOffset;
-                                       indices.push(a, b, c);
-                                       groupCount += 3;
-                               }
-                       }
-               }
-
-               toJSON() {
-                       const data = super.toJSON();
-                       const shapes = this.parameters.shapes;
-                       return toJSON(shapes, data);
-               }
-
-               static fromJSON(data, shapes) {
-                       const geometryShapes = [];
-
-                       for (let j = 0, jl = data.shapes.length; j < jl; j++) {
-                               const shape = shapes[data.shapes[j]];
-                               geometryShapes.push(shape);
-                       }
-
-                       return new ShapeGeometry(geometryShapes, data.curveSegments);
-               }
-
-       }
-
-       function toJSON(shapes, data) {
-               data.shapes = [];
-
-               if (Array.isArray(shapes)) {
-                       for (let i = 0, l = shapes.length; i < l; i++) {
-                               const shape = shapes[i];
-                               data.shapes.push(shape.uuid);
-                       }
-               } else {
-                       data.shapes.push(shapes.uuid);
-               }
-
-               return data;
-       }
-
-       class SphereGeometry extends BufferGeometry {
-               constructor(radius = 1, widthSegments = 32, heightSegments = 16, phiStart = 0, phiLength = Math.PI * 2, thetaStart = 0, thetaLength = Math.PI) {
-                       super();
-                       this.type = 'SphereGeometry';
-                       this.parameters = {
-                               radius: radius,
-                               widthSegments: widthSegments,
-                               heightSegments: heightSegments,
-                               phiStart: phiStart,
-                               phiLength: phiLength,
-                               thetaStart: thetaStart,
-                               thetaLength: thetaLength
-                       };
-                       widthSegments = Math.max(3, Math.floor(widthSegments));
-                       heightSegments = Math.max(2, Math.floor(heightSegments));
-                       const thetaEnd = Math.min(thetaStart + thetaLength, Math.PI);
-                       let index = 0;
-                       const grid = [];
-                       const vertex = new Vector3();
-                       const normal = new Vector3(); // buffers
-
-                       const indices = [];
-                       const vertices = [];
-                       const normals = [];
-                       const uvs = []; // generate vertices, normals and uvs
-
-                       for (let iy = 0; iy <= heightSegments; iy++) {
-                               const verticesRow = [];
-                               const v = iy / heightSegments; // special case for the poles
-
-                               let uOffset = 0;
-
-                               if (iy == 0 && thetaStart == 0) {
-                                       uOffset = 0.5 / widthSegments;
-                               } else if (iy == heightSegments && thetaEnd == Math.PI) {
-                                       uOffset = -0.5 / widthSegments;
-                               }
-
-                               for (let ix = 0; ix <= widthSegments; ix++) {
-                                       const u = ix / widthSegments; // vertex
-
-                                       vertex.x = -radius * Math.cos(phiStart + u * phiLength) * Math.sin(thetaStart + v * thetaLength);
-                                       vertex.y = radius * Math.cos(thetaStart + v * thetaLength);
-                                       vertex.z = radius * Math.sin(phiStart + u * phiLength) * Math.sin(thetaStart + v * thetaLength);
-                                       vertices.push(vertex.x, vertex.y, vertex.z); // normal
-
-                                       normal.copy(vertex).normalize();
-                                       normals.push(normal.x, normal.y, normal.z); // uv
-
-                                       uvs.push(u + uOffset, 1 - v);
-                                       verticesRow.push(index++);
-                               }
-
-                               grid.push(verticesRow);
-                       } // indices
-
-
-                       for (let iy = 0; iy < heightSegments; iy++) {
-                               for (let ix = 0; ix < widthSegments; ix++) {
-                                       const a = grid[iy][ix + 1];
-                                       const b = grid[iy][ix];
-                                       const c = grid[iy + 1][ix];
-                                       const d = grid[iy + 1][ix + 1];
-                                       if (iy !== 0 || thetaStart > 0) indices.push(a, b, d);
-                                       if (iy !== heightSegments - 1 || thetaEnd < Math.PI) indices.push(b, c, d);
-                               }
-                       } // build geometry
-
-
-                       this.setIndex(indices);
-                       this.setAttribute('position', new Float32BufferAttribute(vertices, 3));
-                       this.setAttribute('normal', new Float32BufferAttribute(normals, 3));
-                       this.setAttribute('uv', new Float32BufferAttribute(uvs, 2));
-               }
-
-               static fromJSON(data) {
-                       return new SphereGeometry(data.radius, data.widthSegments, data.heightSegments, data.phiStart, data.phiLength, data.thetaStart, data.thetaLength);
-               }
-
-       }
-
-       class TetrahedronGeometry extends PolyhedronGeometry {
-               constructor(radius = 1, detail = 0) {
-                       const vertices = [1, 1, 1, -1, -1, 1, -1, 1, -1, 1, -1, -1];
-                       const indices = [2, 1, 0, 0, 3, 2, 1, 3, 0, 2, 3, 1];
-                       super(vertices, indices, radius, detail);
-                       this.type = 'TetrahedronGeometry';
-                       this.parameters = {
-                               radius: radius,
-                               detail: detail
-                       };
-               }
-
-               static fromJSON(data) {
-                       return new TetrahedronGeometry(data.radius, data.detail);
-               }
-
-       }
-
-       /**
-        * Text = 3D Text
-        *
-        * parameters = {
-        *      font: <THREE.Font>, // font
-        *
-        *      size: <float>, // size of the text
-        *      height: <float>, // thickness to extrude text
-        *      curveSegments: <int>, // number of points on the curves
-        *
-        *      bevelEnabled: <bool>, // turn on bevel
-        *      bevelThickness: <float>, // how deep into text bevel goes
-        *      bevelSize: <float>, // how far from text outline (including bevelOffset) is bevel
-        *      bevelOffset: <float> // how far from text outline does bevel start
-        * }
-        */
-
-       class TextGeometry extends ExtrudeGeometry {
-               constructor(text, parameters = {}) {
-                       const font = parameters.font;
-
-                       if (!(font && font.isFont)) {
-                               console.error('THREE.TextGeometry: font parameter is not an instance of THREE.Font.');
-                               return new BufferGeometry();
-                       }
-
-                       const shapes = font.generateShapes(text, parameters.size); // translate parameters to ExtrudeGeometry API
-
-                       parameters.depth = parameters.height !== undefined ? parameters.height : 50; // defaults
-
-                       if (parameters.bevelThickness === undefined) parameters.bevelThickness = 10;
-                       if (parameters.bevelSize === undefined) parameters.bevelSize = 8;
-                       if (parameters.bevelEnabled === undefined) parameters.bevelEnabled = false;
-                       super(shapes, parameters);
-                       this.type = 'TextGeometry';
-               }
-
-       }
-
-       class TorusGeometry extends BufferGeometry {
-               constructor(radius = 1, tube = 0.4, radialSegments = 8, tubularSegments = 6, arc = Math.PI * 2) {
-                       super();
-                       this.type = 'TorusGeometry';
-                       this.parameters = {
-                               radius: radius,
-                               tube: tube,
-                               radialSegments: radialSegments,
-                               tubularSegments: tubularSegments,
-                               arc: arc
-                       };
-                       radialSegments = Math.floor(radialSegments);
-                       tubularSegments = Math.floor(tubularSegments); // buffers
-
-                       const indices = [];
-                       const vertices = [];
-                       const normals = [];
-                       const uvs = []; // helper variables
-
-                       const center = new Vector3();
-                       const vertex = new Vector3();
-                       const normal = new Vector3(); // generate vertices, normals and uvs
-
-                       for (let j = 0; j <= radialSegments; j++) {
-                               for (let i = 0; i <= tubularSegments; i++) {
-                                       const u = i / tubularSegments * arc;
-                                       const v = j / radialSegments * Math.PI * 2; // vertex
-
-                                       vertex.x = (radius + tube * Math.cos(v)) * Math.cos(u);
-                                       vertex.y = (radius + tube * Math.cos(v)) * Math.sin(u);
-                                       vertex.z = tube * Math.sin(v);
-                                       vertices.push(vertex.x, vertex.y, vertex.z); // normal
-
-                                       center.x = radius * Math.cos(u);
-                                       center.y = radius * Math.sin(u);
-                                       normal.subVectors(vertex, center).normalize();
-                                       normals.push(normal.x, normal.y, normal.z); // uv
-
-                                       uvs.push(i / tubularSegments);
-                                       uvs.push(j / radialSegments);
-                               }
-                       } // generate indices
-
-
-                       for (let j = 1; j <= radialSegments; j++) {
-                               for (let i = 1; i <= tubularSegments; i++) {
-                                       // indices
-                                       const a = (tubularSegments + 1) * j + i - 1;
-                                       const b = (tubularSegments + 1) * (j - 1) + i - 1;
-                                       const c = (tubularSegments + 1) * (j - 1) + i;
-                                       const d = (tubularSegments + 1) * j + i; // faces
-
-                                       indices.push(a, b, d);
-                                       indices.push(b, c, d);
-                               }
-                       } // build geometry
-
-
-                       this.setIndex(indices);
-                       this.setAttribute('position', new Float32BufferAttribute(vertices, 3));
-                       this.setAttribute('normal', new Float32BufferAttribute(normals, 3));
-                       this.setAttribute('uv', new Float32BufferAttribute(uvs, 2));
-               }
-
-               static fromJSON(data) {
-                       return new TorusGeometry(data.radius, data.tube, data.radialSegments, data.tubularSegments, data.arc);
-               }
-
-       }
-
-       class TorusKnotGeometry extends BufferGeometry {
-               constructor(radius = 1, tube = 0.4, tubularSegments = 64, radialSegments = 8, p = 2, q = 3) {
-                       super();
-                       this.type = 'TorusKnotGeometry';
-                       this.parameters = {
-                               radius: radius,
-                               tube: tube,
-                               tubularSegments: tubularSegments,
-                               radialSegments: radialSegments,
-                               p: p,
-                               q: q
-                       };
-                       tubularSegments = Math.floor(tubularSegments);
-                       radialSegments = Math.floor(radialSegments); // buffers
-
-                       const indices = [];
-                       const vertices = [];
-                       const normals = [];
-                       const uvs = []; // helper variables
-
-                       const vertex = new Vector3();
-                       const normal = new Vector3();
-                       const P1 = new Vector3();
-                       const P2 = new Vector3();
-                       const B = new Vector3();
-                       const T = new Vector3();
-                       const N = new Vector3(); // generate vertices, normals and uvs
-
-                       for (let i = 0; i <= tubularSegments; ++i) {
-                               // the radian "u" is used to calculate the position on the torus curve of the current tubular segement
-                               const u = i / tubularSegments * p * Math.PI * 2; // now we calculate two points. P1 is our current position on the curve, P2 is a little farther ahead.
-                               // these points are used to create a special "coordinate space", which is necessary to calculate the correct vertex positions
-
-                               calculatePositionOnCurve(u, p, q, radius, P1);
-                               calculatePositionOnCurve(u + 0.01, p, q, radius, P2); // calculate orthonormal basis
-
-                               T.subVectors(P2, P1);
-                               N.addVectors(P2, P1);
-                               B.crossVectors(T, N);
-                               N.crossVectors(B, T); // normalize B, N. T can be ignored, we don't use it
-
-                               B.normalize();
-                               N.normalize();
-
-                               for (let j = 0; j <= radialSegments; ++j) {
-                                       // now calculate the vertices. they are nothing more than an extrusion of the torus curve.
-                                       // because we extrude a shape in the xy-plane, there is no need to calculate a z-value.
-                                       const v = j / radialSegments * Math.PI * 2;
-                                       const cx = -tube * Math.cos(v);
-                                       const cy = tube * Math.sin(v); // now calculate the final vertex position.
-                                       // first we orient the extrusion with our basis vectos, then we add it to the current position on the curve
-
-                                       vertex.x = P1.x + (cx * N.x + cy * B.x);
-                                       vertex.y = P1.y + (cx * N.y + cy * B.y);
-                                       vertex.z = P1.z + (cx * N.z + cy * B.z);
-                                       vertices.push(vertex.x, vertex.y, vertex.z); // normal (P1 is always the center/origin of the extrusion, thus we can use it to calculate the normal)
-
-                                       normal.subVectors(vertex, P1).normalize();
-                                       normals.push(normal.x, normal.y, normal.z); // uv
-
-                                       uvs.push(i / tubularSegments);
-                                       uvs.push(j / radialSegments);
-                               }
-                       } // generate indices
-
-
-                       for (let j = 1; j <= tubularSegments; j++) {
-                               for (let i = 1; i <= radialSegments; i++) {
-                                       // indices
-                                       const a = (radialSegments + 1) * (j - 1) + (i - 1);
-                                       const b = (radialSegments + 1) * j + (i - 1);
-                                       const c = (radialSegments + 1) * j + i;
-                                       const d = (radialSegments + 1) * (j - 1) + i; // faces
-
-                                       indices.push(a, b, d);
-                                       indices.push(b, c, d);
-                               }
-                       } // build geometry
-
-
-                       this.setIndex(indices);
-                       this.setAttribute('position', new Float32BufferAttribute(vertices, 3));
-                       this.setAttribute('normal', new Float32BufferAttribute(normals, 3));
-                       this.setAttribute('uv', new Float32BufferAttribute(uvs, 2)); // this function calculates the current position on the torus curve
-
-                       function calculatePositionOnCurve(u, p, q, radius, position) {
-                               const cu = Math.cos(u);
-                               const su = Math.sin(u);
-                               const quOverP = q / p * u;
-                               const cs = Math.cos(quOverP);
-                               position.x = radius * (2 + cs) * 0.5 * cu;
-                               position.y = radius * (2 + cs) * su * 0.5;
-                               position.z = radius * Math.sin(quOverP) * 0.5;
-                       }
-               }
-
-               static fromJSON(data) {
-                       return new TorusKnotGeometry(data.radius, data.tube, data.tubularSegments, data.radialSegments, data.p, data.q);
-               }
-
-       }
-
-       class TubeGeometry extends BufferGeometry {
-               constructor(path, tubularSegments = 64, radius = 1, radialSegments = 8, closed = false) {
-                       super();
-                       this.type = 'TubeGeometry';
-                       this.parameters = {
-                               path: path,
-                               tubularSegments: tubularSegments,
-                               radius: radius,
-                               radialSegments: radialSegments,
-                               closed: closed
-                       };
-                       const frames = path.computeFrenetFrames(tubularSegments, closed); // expose internals
-
-                       this.tangents = frames.tangents;
-                       this.normals = frames.normals;
-                       this.binormals = frames.binormals; // helper variables
-
-                       const vertex = new Vector3();
-                       const normal = new Vector3();
-                       const uv = new Vector2();
-                       let P = new Vector3(); // buffer
-
-                       const vertices = [];
-                       const normals = [];
-                       const uvs = [];
-                       const indices = []; // create buffer data
-
-                       generateBufferData(); // build geometry
-
-                       this.setIndex(indices);
-                       this.setAttribute('position', new Float32BufferAttribute(vertices, 3));
-                       this.setAttribute('normal', new Float32BufferAttribute(normals, 3));
-                       this.setAttribute('uv', new Float32BufferAttribute(uvs, 2)); // functions
-
-                       function generateBufferData() {
-                               for (let i = 0; i < tubularSegments; i++) {
-                                       generateSegment(i);
-                               } // if the geometry is not closed, generate the last row of vertices and normals
-                               // at the regular position on the given path
-                               //
-                               // if the geometry is closed, duplicate the first row of vertices and normals (uvs will differ)
-
-
-                               generateSegment(closed === false ? tubularSegments : 0); // uvs are generated in a separate function.
-                               // this makes it easy compute correct values for closed geometries
-
-                               generateUVs(); // finally create faces
-
-                               generateIndices();
-                       }
-
-                       function generateSegment(i) {
-                               // we use getPointAt to sample evenly distributed points from the given path
-                               P = path.getPointAt(i / tubularSegments, P); // retrieve corresponding normal and binormal
-
-                               const N = frames.normals[i];
-                               const B = frames.binormals[i]; // generate normals and vertices for the current segment
-
-                               for (let j = 0; j <= radialSegments; j++) {
-                                       const v = j / radialSegments * Math.PI * 2;
-                                       const sin = Math.sin(v);
-                                       const cos = -Math.cos(v); // normal
-
-                                       normal.x = cos * N.x + sin * B.x;
-                                       normal.y = cos * N.y + sin * B.y;
-                                       normal.z = cos * N.z + sin * B.z;
-                                       normal.normalize();
-                                       normals.push(normal.x, normal.y, normal.z); // vertex
-
-                                       vertex.x = P.x + radius * normal.x;
-                                       vertex.y = P.y + radius * normal.y;
-                                       vertex.z = P.z + radius * normal.z;
-                                       vertices.push(vertex.x, vertex.y, vertex.z);
-                               }
-                       }
-
-                       function generateIndices() {
-                               for (let j = 1; j <= tubularSegments; j++) {
-                                       for (let i = 1; i <= radialSegments; i++) {
-                                               const a = (radialSegments + 1) * (j - 1) + (i - 1);
-                                               const b = (radialSegments + 1) * j + (i - 1);
-                                               const c = (radialSegments + 1) * j + i;
-                                               const d = (radialSegments + 1) * (j - 1) + i; // faces
-
-                                               indices.push(a, b, d);
-                                               indices.push(b, c, d);
-                                       }
-                               }
-                       }
-
-                       function generateUVs() {
-                               for (let i = 0; i <= tubularSegments; i++) {
-                                       for (let j = 0; j <= radialSegments; j++) {
-                                               uv.x = i / tubularSegments;
-                                               uv.y = j / radialSegments;
-                                               uvs.push(uv.x, uv.y);
-                                       }
-                               }
-                       }
-               }
-
-               toJSON() {
-                       const data = super.toJSON();
-                       data.path = this.parameters.path.toJSON();
-                       return data;
-               }
-
-               static fromJSON(data) {
-                       // This only works for built-in curves (e.g. CatmullRomCurve3).
-                       // User defined curves or instances of CurvePath will not be deserialized.
-                       return new TubeGeometry(new Curves[data.path.type]().fromJSON(data.path), data.tubularSegments, data.radius, data.radialSegments, data.closed);
-               }
-
-       }
-
-       class WireframeGeometry extends BufferGeometry {
-               constructor(geometry) {
-                       super();
-                       this.type = 'WireframeGeometry';
-
-                       if (geometry.isGeometry === true) {
-                               console.error('THREE.WireframeGeometry no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.');
-                               return;
-                       } // buffer
-
-
-                       const vertices = [];
-                       const edges = new Set(); // helper variables
-
-                       const start = new Vector3();
-                       const end = new Vector3();
-
-                       if (geometry.index !== null) {
-                               // indexed BufferGeometry
-                               const position = geometry.attributes.position;
-                               const indices = geometry.index;
-                               let groups = geometry.groups;
-
-                               if (groups.length === 0) {
-                                       groups = [{
-                                               start: 0,
-                                               count: indices.count,
-                                               materialIndex: 0
-                                       }];
-                               } // create a data structure that contains all eges without duplicates
-
-
-                               for (let o = 0, ol = groups.length; o < ol; ++o) {
-                                       const group = groups[o];
-                                       const groupStart = group.start;
-                                       const groupCount = group.count;
-
-                                       for (let i = groupStart, l = groupStart + groupCount; i < l; i += 3) {
-                                               for (let j = 0; j < 3; j++) {
-                                                       const index1 = indices.getX(i + j);
-                                                       const index2 = indices.getX(i + (j + 1) % 3);
-                                                       start.fromBufferAttribute(position, index1);
-                                                       end.fromBufferAttribute(position, index2);
-
-                                                       if (isUniqueEdge(start, end, edges) === true) {
-                                                               vertices.push(start.x, start.y, start.z);
-                                                               vertices.push(end.x, end.y, end.z);
-                                                       }
-                                               }
-                                       }
-                               }
-                       } else {
-                               // non-indexed BufferGeometry
-                               const position = geometry.attributes.position;
-
-                               for (let i = 0, l = position.count / 3; i < l; i++) {
-                                       for (let j = 0; j < 3; j++) {
-                                               // three edges per triangle, an edge is represented as (index1, index2)
-                                               // e.g. the first triangle has the following edges: (0,1),(1,2),(2,0)
-                                               const index1 = 3 * i + j;
-                                               const index2 = 3 * i + (j + 1) % 3;
-                                               start.fromBufferAttribute(position, index1);
-                                               end.fromBufferAttribute(position, index2);
-
-                                               if (isUniqueEdge(start, end, edges) === true) {
-                                                       vertices.push(start.x, start.y, start.z);
-                                                       vertices.push(end.x, end.y, end.z);
-                                               }
-                                       }
-                               }
-                       } // build geometry
-
-
-                       this.setAttribute('position', new Float32BufferAttribute(vertices, 3));
-               }
-
-       }
-
-       function isUniqueEdge(start, end, edges) {
-               const hash1 = `${start.x},${start.y},${start.z}-${end.x},${end.y},${end.z}`;
-               const hash2 = `${end.x},${end.y},${end.z}-${start.x},${start.y},${start.z}`; // coincident edge
-
-               if (edges.has(hash1) === true || edges.has(hash2) === true) {
-                       return false;
-               } else {
-                       edges.add(hash1, hash2);
-                       return true;
-               }
-       }
-
-       var Geometries = /*#__PURE__*/Object.freeze({
-               __proto__: null,
-               BoxGeometry: BoxGeometry,
-               BoxBufferGeometry: BoxGeometry,
-               CircleGeometry: CircleGeometry,
-               CircleBufferGeometry: CircleGeometry,
-               ConeGeometry: ConeGeometry,
-               ConeBufferGeometry: ConeGeometry,
-               CylinderGeometry: CylinderGeometry,
-               CylinderBufferGeometry: CylinderGeometry,
-               DodecahedronGeometry: DodecahedronGeometry,
-               DodecahedronBufferGeometry: DodecahedronGeometry,
-               EdgesGeometry: EdgesGeometry,
-               ExtrudeGeometry: ExtrudeGeometry,
-               ExtrudeBufferGeometry: ExtrudeGeometry,
-               IcosahedronGeometry: IcosahedronGeometry,
-               IcosahedronBufferGeometry: IcosahedronGeometry,
-               LatheGeometry: LatheGeometry,
-               LatheBufferGeometry: LatheGeometry,
-               OctahedronGeometry: OctahedronGeometry,
-               OctahedronBufferGeometry: OctahedronGeometry,
-               ParametricGeometry: ParametricGeometry,
-               ParametricBufferGeometry: ParametricGeometry,
-               PlaneGeometry: PlaneGeometry,
-               PlaneBufferGeometry: PlaneGeometry,
-               PolyhedronGeometry: PolyhedronGeometry,
-               PolyhedronBufferGeometry: PolyhedronGeometry,
-               RingGeometry: RingGeometry,
-               RingBufferGeometry: RingGeometry,
-               ShapeGeometry: ShapeGeometry,
-               ShapeBufferGeometry: ShapeGeometry,
-               SphereGeometry: SphereGeometry,
-               SphereBufferGeometry: SphereGeometry,
-               TetrahedronGeometry: TetrahedronGeometry,
-               TetrahedronBufferGeometry: TetrahedronGeometry,
-               TextGeometry: TextGeometry,
-               TextBufferGeometry: TextGeometry,
-               TorusGeometry: TorusGeometry,
-               TorusBufferGeometry: TorusGeometry,
-               TorusKnotGeometry: TorusKnotGeometry,
-               TorusKnotBufferGeometry: TorusKnotGeometry,
-               TubeGeometry: TubeGeometry,
-               TubeBufferGeometry: TubeGeometry,
-               WireframeGeometry: WireframeGeometry
-       });
-
-       /**
-        * parameters = {
-        *      color: <THREE.Color>
-        * }
-        */
-
-       class ShadowMaterial extends Material {
-               constructor(parameters) {
-                       super();
-                       this.type = 'ShadowMaterial';
-                       this.color = new Color(0x000000);
-                       this.transparent = true;
-                       this.setValues(parameters);
-               }
-
-               copy(source) {
-                       super.copy(source);
-                       this.color.copy(source.color);
-                       return this;
-               }
-
-       }
-
-       ShadowMaterial.prototype.isShadowMaterial = true;
-
-       /**
-        * parameters = {
-        *      color: <hex>,
-        *      roughness: <float>,
-        *      metalness: <float>,
-        *      opacity: <float>,
-        *
-        *      map: new THREE.Texture( <Image> ),
-        *
-        *      lightMap: new THREE.Texture( <Image> ),
-        *      lightMapIntensity: <float>
-        *
-        *      aoMap: new THREE.Texture( <Image> ),
-        *      aoMapIntensity: <float>
-        *
-        *      emissive: <hex>,
-        *      emissiveIntensity: <float>
-        *      emissiveMap: new THREE.Texture( <Image> ),
-        *
-        *      bumpMap: new THREE.Texture( <Image> ),
-        *      bumpScale: <float>,
-        *
-        *      normalMap: new THREE.Texture( <Image> ),
-        *      normalMapType: THREE.TangentSpaceNormalMap,
-        *      normalScale: <Vector2>,
-        *
-        *      displacementMap: new THREE.Texture( <Image> ),
-        *      displacementScale: <float>,
-        *      displacementBias: <float>,
-        *
-        *      roughnessMap: new THREE.Texture( <Image> ),
-        *
-        *      metalnessMap: new THREE.Texture( <Image> ),
-        *
-        *      alphaMap: new THREE.Texture( <Image> ),
-        *
-        *      envMap: new THREE.CubeTexture( [posx, negx, posy, negy, posz, negz] ),
-        *      envMapIntensity: <float>
-        *
-        *      refractionRatio: <float>,
-        *
-        *      wireframe: <boolean>,
-        *      wireframeLinewidth: <float>,
-        *
-        *      flatShading: <bool>
-        * }
-        */
-
-       class MeshStandardMaterial extends Material {
-               constructor(parameters) {
-                       super();
-                       this.defines = {
-                               'STANDARD': ''
-                       };
-                       this.type = 'MeshStandardMaterial';
-                       this.color = new Color(0xffffff); // diffuse
-
-                       this.roughness = 1.0;
-                       this.metalness = 0.0;
-                       this.map = null;
-                       this.lightMap = null;
-                       this.lightMapIntensity = 1.0;
-                       this.aoMap = null;
-                       this.aoMapIntensity = 1.0;
-                       this.emissive = new Color(0x000000);
-                       this.emissiveIntensity = 1.0;
-                       this.emissiveMap = null;
-                       this.bumpMap = null;
-                       this.bumpScale = 1;
-                       this.normalMap = null;
-                       this.normalMapType = TangentSpaceNormalMap;
-                       this.normalScale = new Vector2(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.0;
-                       this.refractionRatio = 0.98;
-                       this.wireframe = false;
-                       this.wireframeLinewidth = 1;
-                       this.wireframeLinecap = 'round';
-                       this.wireframeLinejoin = 'round';
-                       this.flatShading = false;
-                       this.setValues(parameters);
-               }
-
-               copy(source) {
-                       super.copy(source);
-                       this.defines = {
-                               'STANDARD': ''
-                       };
-                       this.color.copy(source.color);
-                       this.roughness = source.roughness;
-                       this.metalness = source.metalness;
-                       this.map = source.map;
-                       this.lightMap = source.lightMap;
-                       this.lightMapIntensity = source.lightMapIntensity;
-                       this.aoMap = source.aoMap;
-                       this.aoMapIntensity = source.aoMapIntensity;
-                       this.emissive.copy(source.emissive);
-                       this.emissiveMap = source.emissiveMap;
-                       this.emissiveIntensity = source.emissiveIntensity;
-                       this.bumpMap = source.bumpMap;
-                       this.bumpScale = source.bumpScale;
-                       this.normalMap = source.normalMap;
-                       this.normalMapType = source.normalMapType;
-                       this.normalScale.copy(source.normalScale);
-                       this.displacementMap = source.displacementMap;
-                       this.displacementScale = source.displacementScale;
-                       this.displacementBias = source.displacementBias;
-                       this.roughnessMap = source.roughnessMap;
-                       this.metalnessMap = source.metalnessMap;
-                       this.alphaMap = source.alphaMap;
-                       this.envMap = source.envMap;
-                       this.envMapIntensity = source.envMapIntensity;
-                       this.refractionRatio = source.refractionRatio;
-                       this.wireframe = source.wireframe;
-                       this.wireframeLinewidth = source.wireframeLinewidth;
-                       this.wireframeLinecap = source.wireframeLinecap;
-                       this.wireframeLinejoin = source.wireframeLinejoin;
-                       this.flatShading = source.flatShading;
-                       return this;
-               }
-
-       }
-
-       MeshStandardMaterial.prototype.isMeshStandardMaterial = true;
-
-       /**
-        * parameters = {
-        *      clearcoat: <float>,
-        *      clearcoatMap: new THREE.Texture( <Image> ),
-        *      clearcoatRoughness: <float>,
-        *      clearcoatRoughnessMap: new THREE.Texture( <Image> ),
-        *      clearcoatNormalScale: <Vector2>,
-        *      clearcoatNormalMap: new THREE.Texture( <Image> ),
-        *
-        *      ior: <float>,
-        *      reflectivity: <float>,
-        *
-        *      sheenTint: <Color>,
-        *
-        *      transmission: <float>,
-        *      transmissionMap: new THREE.Texture( <Image> ),
-        *
-        *      thickness: <float>,
-        *      thicknessMap: new THREE.Texture( <Image> ),
-        *      attenuationDistance: <float>,
-        *      attenuationTint: <Color>,
-        *
-        *      specularIntensity: <float>,
-        *      specularIntensityhMap: new THREE.Texture( <Image> ),
-        *      specularTint: <Color>,
-        *      specularTintMap: new THREE.Texture( <Image> )
-        * }
-        */
-
-       class MeshPhysicalMaterial extends MeshStandardMaterial {
-               constructor(parameters) {
-                       super();
-                       this.defines = {
-                               'STANDARD': '',
-                               'PHYSICAL': ''
-                       };
-                       this.type = 'MeshPhysicalMaterial';
-                       this.clearcoatMap = null;
-                       this.clearcoatRoughness = 0.0;
-                       this.clearcoatRoughnessMap = null;
-                       this.clearcoatNormalScale = new Vector2(1, 1);
-                       this.clearcoatNormalMap = null;
-                       this.ior = 1.5;
-                       Object.defineProperty(this, 'reflectivity', {
-                               get: function () {
-                                       return clamp(2.5 * (this.ior - 1) / (this.ior + 1), 0, 1);
-                               },
-                               set: function (reflectivity) {
-                                       this.ior = (1 + 0.4 * reflectivity) / (1 - 0.4 * reflectivity);
-                               }
-                       });
-                       this.sheenTint = new Color(0x000000);
-                       this.transmission = 0.0;
-                       this.transmissionMap = null;
-                       this.thickness = 0.01;
-                       this.thicknessMap = null;
-                       this.attenuationDistance = 0.0;
-                       this.attenuationTint = new Color(1, 1, 1);
-                       this.specularIntensity = 1.0;
-                       this.specularIntensityMap = null;
-                       this.specularTint = new Color(1, 1, 1);
-                       this.specularTintMap = null;
-                       this._clearcoat = 0;
-                       this._transmission = 0;
-                       this.setValues(parameters);
-               }
-
-               get clearcoat() {
-                       return this._clearcoat;
-               }
-
-               set clearcoat(value) {
-                       if (this._clearcoat > 0 !== value > 0) {
-                               this.version++;
-                       }
-
-                       this._clearcoat = value;
-               }
-
-               get transmission() {
-                       return this._transmission;
-               }
-
-               set transmission(value) {
-                       if (this._transmission > 0 !== value > 0) {
-                               this.version++;
-                       }
-
-                       this._transmission = value;
-               }
-
-               copy(source) {
-                       super.copy(source);
-                       this.defines = {
-                               'STANDARD': '',
-                               'PHYSICAL': ''
-                       };
-                       this.clearcoat = source.clearcoat;
-                       this.clearcoatMap = source.clearcoatMap;
-                       this.clearcoatRoughness = source.clearcoatRoughness;
-                       this.clearcoatRoughnessMap = source.clearcoatRoughnessMap;
-                       this.clearcoatNormalMap = source.clearcoatNormalMap;
-                       this.clearcoatNormalScale.copy(source.clearcoatNormalScale);
-                       this.ior = source.ior;
-                       this.sheenTint.copy(source.sheenTint);
-                       this.transmission = source.transmission;
-                       this.transmissionMap = source.transmissionMap;
-                       this.thickness = source.thickness;
-                       this.thicknessMap = source.thicknessMap;
-                       this.attenuationDistance = source.attenuationDistance;
-                       this.attenuationTint.copy(source.attenuationTint);
-                       this.specularIntensity = source.specularIntensity;
-                       this.specularIntensityMap = source.specularIntensityMap;
-                       this.specularTint.copy(source.specularTint);
-                       this.specularTintMap = source.specularTintMap;
-                       return this;
-               }
-
-       }
-
-       MeshPhysicalMaterial.prototype.isMeshPhysicalMaterial = true;
-
-       /**
-        * parameters = {
-        *      color: <hex>,
-        *      specular: <hex>,
-        *      shininess: <float>,
-        *      opacity: <float>,
-        *
-        *      map: new THREE.Texture( <Image> ),
-        *
-        *      lightMap: new THREE.Texture( <Image> ),
-        *      lightMapIntensity: <float>
-        *
-        *      aoMap: new THREE.Texture( <Image> ),
-        *      aoMapIntensity: <float>
-        *
-        *      emissive: <hex>,
-        *      emissiveIntensity: <float>
-        *      emissiveMap: new THREE.Texture( <Image> ),
-        *
-        *      bumpMap: new THREE.Texture( <Image> ),
-        *      bumpScale: <float>,
-        *
-        *      normalMap: new THREE.Texture( <Image> ),
-        *      normalMapType: THREE.TangentSpaceNormalMap,
-        *      normalScale: <Vector2>,
-        *
-        *      displacementMap: new THREE.Texture( <Image> ),
-        *      displacementScale: <float>,
-        *      displacementBias: <float>,
-        *
-        *      specularMap: new THREE.Texture( <Image> ),
-        *
-        *      alphaMap: new THREE.Texture( <Image> ),
-        *
-        *      envMap: new THREE.CubeTexture( [posx, negx, posy, negy, posz, negz] ),
-        *      combine: THREE.MultiplyOperation,
-        *      reflectivity: <float>,
-        *      refractionRatio: <float>,
-        *
-        *      wireframe: <boolean>,
-        *      wireframeLinewidth: <float>,
-        *
-        *      flatShading: <bool>
-        * }
-        */
-
-       class MeshPhongMaterial extends Material {
-               constructor(parameters) {
-                       super();
-                       this.type = 'MeshPhongMaterial';
-                       this.color = new Color(0xffffff); // diffuse
-
-                       this.specular = new Color(0x111111);
-                       this.shininess = 30;
-                       this.map = null;
-                       this.lightMap = null;
-                       this.lightMapIntensity = 1.0;
-                       this.aoMap = null;
-                       this.aoMapIntensity = 1.0;
-                       this.emissive = new Color(0x000000);
-                       this.emissiveIntensity = 1.0;
-                       this.emissiveMap = null;
-                       this.bumpMap = null;
-                       this.bumpScale = 1;
-                       this.normalMap = null;
-                       this.normalMapType = TangentSpaceNormalMap;
-                       this.normalScale = new Vector2(1, 1);
-                       this.displacementMap = null;
-                       this.displacementScale = 1;
-                       this.displacementBias = 0;
-                       this.specularMap = null;
-                       this.alphaMap = null;
-                       this.envMap = null;
-                       this.combine = MultiplyOperation;
-                       this.reflectivity = 1;
-                       this.refractionRatio = 0.98;
-                       this.wireframe = false;
-                       this.wireframeLinewidth = 1;
-                       this.wireframeLinecap = 'round';
-                       this.wireframeLinejoin = 'round';
-                       this.flatShading = false;
-                       this.setValues(parameters);
-               }
-
-               copy(source) {
-                       super.copy(source);
-                       this.color.copy(source.color);
-                       this.specular.copy(source.specular);
-                       this.shininess = source.shininess;
-                       this.map = source.map;
-                       this.lightMap = source.lightMap;
-                       this.lightMapIntensity = source.lightMapIntensity;
-                       this.aoMap = source.aoMap;
-                       this.aoMapIntensity = source.aoMapIntensity;
-                       this.emissive.copy(source.emissive);
-                       this.emissiveMap = source.emissiveMap;
-                       this.emissiveIntensity = source.emissiveIntensity;
-                       this.bumpMap = source.bumpMap;
-                       this.bumpScale = source.bumpScale;
-                       this.normalMap = source.normalMap;
-                       this.normalMapType = source.normalMapType;
-                       this.normalScale.copy(source.normalScale);
-                       this.displacementMap = source.displacementMap;
-                       this.displacementScale = source.displacementScale;
-                       this.displacementBias = source.displacementBias;
-                       this.specularMap = source.specularMap;
-                       this.alphaMap = source.alphaMap;
-                       this.envMap = source.envMap;
-                       this.combine = source.combine;
-                       this.reflectivity = source.reflectivity;
-                       this.refractionRatio = source.refractionRatio;
-                       this.wireframe = source.wireframe;
-                       this.wireframeLinewidth = source.wireframeLinewidth;
-                       this.wireframeLinecap = source.wireframeLinecap;
-                       this.wireframeLinejoin = source.wireframeLinejoin;
-                       this.flatShading = source.flatShading;
-                       return this;
-               }
-
-       }
-
-       MeshPhongMaterial.prototype.isMeshPhongMaterial = true;
-
-       /**
-        * parameters = {
-        *      color: <hex>,
-        *
-        *      map: new THREE.Texture( <Image> ),
-        *      gradientMap: new THREE.Texture( <Image> ),
-        *
-        *      lightMap: new THREE.Texture( <Image> ),
-        *      lightMapIntensity: <float>
-        *
-        *      aoMap: new THREE.Texture( <Image> ),
-        *      aoMapIntensity: <float>
-        *
-        *      emissive: <hex>,
-        *      emissiveIntensity: <float>
-        *      emissiveMap: new THREE.Texture( <Image> ),
-        *
-        *      bumpMap: new THREE.Texture( <Image> ),
-        *      bumpScale: <float>,
-        *
-        *      normalMap: new THREE.Texture( <Image> ),
-        *      normalMapType: THREE.TangentSpaceNormalMap,
-        *      normalScale: <Vector2>,
-        *
-        *      displacementMap: new THREE.Texture( <Image> ),
-        *      displacementScale: <float>,
-        *      displacementBias: <float>,
-        *
-        *      alphaMap: new THREE.Texture( <Image> ),
-        *
-        *      wireframe: <boolean>,
-        *      wireframeLinewidth: <float>,
-        *
-        * }
-        */
-
-       class MeshToonMaterial extends Material {
-               constructor(parameters) {
-                       super();
-                       this.defines = {
-                               'TOON': ''
-                       };
-                       this.type = 'MeshToonMaterial';
-                       this.color = new Color(0xffffff);
-                       this.map = null;
-                       this.gradientMap = null;
-                       this.lightMap = null;
-                       this.lightMapIntensity = 1.0;
-                       this.aoMap = null;
-                       this.aoMapIntensity = 1.0;
-                       this.emissive = new Color(0x000000);
-                       this.emissiveIntensity = 1.0;
-                       this.emissiveMap = null;
-                       this.bumpMap = null;
-                       this.bumpScale = 1;
-                       this.normalMap = null;
-                       this.normalMapType = TangentSpaceNormalMap;
-                       this.normalScale = new Vector2(1, 1);
-                       this.displacementMap = null;
-                       this.displacementScale = 1;
-                       this.displacementBias = 0;
-                       this.alphaMap = null;
-                       this.wireframe = false;
-                       this.wireframeLinewidth = 1;
-                       this.wireframeLinecap = 'round';
-                       this.wireframeLinejoin = 'round';
-                       this.setValues(parameters);
-               }
-
-               copy(source) {
-                       super.copy(source);
-                       this.color.copy(source.color);
-                       this.map = source.map;
-                       this.gradientMap = source.gradientMap;
-                       this.lightMap = source.lightMap;
-                       this.lightMapIntensity = source.lightMapIntensity;
-                       this.aoMap = source.aoMap;
-                       this.aoMapIntensity = source.aoMapIntensity;
-                       this.emissive.copy(source.emissive);
-                       this.emissiveMap = source.emissiveMap;
-                       this.emissiveIntensity = source.emissiveIntensity;
-                       this.bumpMap = source.bumpMap;
-                       this.bumpScale = source.bumpScale;
-                       this.normalMap = source.normalMap;
-                       this.normalMapType = source.normalMapType;
-                       this.normalScale.copy(source.normalScale);
-                       this.displacementMap = source.displacementMap;
-                       this.displacementScale = source.displacementScale;
-                       this.displacementBias = source.displacementBias;
-                       this.alphaMap = source.alphaMap;
-                       this.wireframe = source.wireframe;
-                       this.wireframeLinewidth = source.wireframeLinewidth;
-                       this.wireframeLinecap = source.wireframeLinecap;
-                       this.wireframeLinejoin = source.wireframeLinejoin;
-                       return this;
-               }
-
-       }
-
-       MeshToonMaterial.prototype.isMeshToonMaterial = true;
-
-       /**
-        * parameters = {
-        *      opacity: <float>,
-        *
-        *      bumpMap: new THREE.Texture( <Image> ),
-        *      bumpScale: <float>,
-        *
-        *      normalMap: new THREE.Texture( <Image> ),
-        *      normalMapType: THREE.TangentSpaceNormalMap,
-        *      normalScale: <Vector2>,
-        *
-        *      displacementMap: new THREE.Texture( <Image> ),
-        *      displacementScale: <float>,
-        *      displacementBias: <float>,
-        *
-        *      wireframe: <boolean>,
-        *      wireframeLinewidth: <float>
-        *
-        *      flatShading: <bool>
-        * }
-        */
-
-       class MeshNormalMaterial extends Material {
-               constructor(parameters) {
-                       super();
-                       this.type = 'MeshNormalMaterial';
-                       this.bumpMap = null;
-                       this.bumpScale = 1;
-                       this.normalMap = null;
-                       this.normalMapType = TangentSpaceNormalMap;
-                       this.normalScale = new Vector2(1, 1);
-                       this.displacementMap = null;
-                       this.displacementScale = 1;
-                       this.displacementBias = 0;
-                       this.wireframe = false;
-                       this.wireframeLinewidth = 1;
-                       this.fog = false;
-                       this.flatShading = false;
-                       this.setValues(parameters);
-               }
-
-               copy(source) {
-                       super.copy(source);
-                       this.bumpMap = source.bumpMap;
-                       this.bumpScale = source.bumpScale;
-                       this.normalMap = source.normalMap;
-                       this.normalMapType = source.normalMapType;
-                       this.normalScale.copy(source.normalScale);
-                       this.displacementMap = source.displacementMap;
-                       this.displacementScale = source.displacementScale;
-                       this.displacementBias = source.displacementBias;
-                       this.wireframe = source.wireframe;
-                       this.wireframeLinewidth = source.wireframeLinewidth;
-                       this.flatShading = source.flatShading;
-                       return this;
-               }
-
-       }
-
-       MeshNormalMaterial.prototype.isMeshNormalMaterial = true;
-
-       /**
-        * parameters = {
-        *      color: <hex>,
-        *      opacity: <float>,
-        *
-        *      map: new THREE.Texture( <Image> ),
-        *
-        *      lightMap: new THREE.Texture( <Image> ),
-        *      lightMapIntensity: <float>
-        *
-        *      aoMap: new THREE.Texture( <Image> ),
-        *      aoMapIntensity: <float>
-        *
-        *      emissive: <hex>,
-        *      emissiveIntensity: <float>
-        *      emissiveMap: new THREE.Texture( <Image> ),
-        *
-        *      specularMap: new THREE.Texture( <Image> ),
-        *
-        *      alphaMap: new THREE.Texture( <Image> ),
-        *
-        *      envMap: new THREE.CubeTexture( [posx, negx, posy, negy, posz, negz] ),
-        *      combine: THREE.Multiply,
-        *      reflectivity: <float>,
-        *      refractionRatio: <float>,
-        *
-        *      wireframe: <boolean>,
-        *      wireframeLinewidth: <float>,
-        *
-        * }
-        */
-
-       class MeshLambertMaterial extends Material {
-               constructor(parameters) {
-                       super();
-                       this.type = 'MeshLambertMaterial';
-                       this.color = new Color(0xffffff); // diffuse
-
-                       this.map = null;
-                       this.lightMap = null;
-                       this.lightMapIntensity = 1.0;
-                       this.aoMap = null;
-                       this.aoMapIntensity = 1.0;
-                       this.emissive = new Color(0x000000);
-                       this.emissiveIntensity = 1.0;
-                       this.emissiveMap = null;
-                       this.specularMap = null;
-                       this.alphaMap = null;
-                       this.envMap = null;
-                       this.combine = MultiplyOperation;
-                       this.reflectivity = 1;
-                       this.refractionRatio = 0.98;
-                       this.wireframe = false;
-                       this.wireframeLinewidth = 1;
-                       this.wireframeLinecap = 'round';
-                       this.wireframeLinejoin = 'round';
-                       this.setValues(parameters);
-               }
-
-               copy(source) {
-                       super.copy(source);
-                       this.color.copy(source.color);
-                       this.map = source.map;
-                       this.lightMap = source.lightMap;
-                       this.lightMapIntensity = source.lightMapIntensity;
-                       this.aoMap = source.aoMap;
-                       this.aoMapIntensity = source.aoMapIntensity;
-                       this.emissive.copy(source.emissive);
-                       this.emissiveMap = source.emissiveMap;
-                       this.emissiveIntensity = source.emissiveIntensity;
-                       this.specularMap = source.specularMap;
-                       this.alphaMap = source.alphaMap;
-                       this.envMap = source.envMap;
-                       this.combine = source.combine;
-                       this.reflectivity = source.reflectivity;
-                       this.refractionRatio = source.refractionRatio;
-                       this.wireframe = source.wireframe;
-                       this.wireframeLinewidth = source.wireframeLinewidth;
-                       this.wireframeLinecap = source.wireframeLinecap;
-                       this.wireframeLinejoin = source.wireframeLinejoin;
-                       return this;
-               }
-
-       }
-
-       MeshLambertMaterial.prototype.isMeshLambertMaterial = true;
-
-       /**
-        * parameters = {
-        *      color: <hex>,
-        *      opacity: <float>,
-        *
-        *      matcap: new THREE.Texture( <Image> ),
-        *
-        *      map: new THREE.Texture( <Image> ),
-        *
-        *      bumpMap: new THREE.Texture( <Image> ),
-        *      bumpScale: <float>,
-        *
-        *      normalMap: new THREE.Texture( <Image> ),
-        *      normalMapType: THREE.TangentSpaceNormalMap,
-        *      normalScale: <Vector2>,
-        *
-        *      displacementMap: new THREE.Texture( <Image> ),
-        *      displacementScale: <float>,
-        *      displacementBias: <float>,
-        *
-        *      alphaMap: new THREE.Texture( <Image> ),
-        *
-        *      flatShading: <bool>
-        * }
-        */
-
-       class MeshMatcapMaterial extends Material {
-               constructor(parameters) {
-                       super();
-                       this.defines = {
-                               'MATCAP': ''
-                       };
-                       this.type = 'MeshMatcapMaterial';
-                       this.color = new Color(0xffffff); // diffuse
-
-                       this.matcap = null;
-                       this.map = null;
-                       this.bumpMap = null;
-                       this.bumpScale = 1;
-                       this.normalMap = null;
-                       this.normalMapType = TangentSpaceNormalMap;
-                       this.normalScale = new Vector2(1, 1);
-                       this.displacementMap = null;
-                       this.displacementScale = 1;
-                       this.displacementBias = 0;
-                       this.alphaMap = null;
-                       this.flatShading = false;
-                       this.setValues(parameters);
-               }
-
-               copy(source) {
-                       super.copy(source);
-                       this.defines = {
-                               'MATCAP': ''
-                       };
-                       this.color.copy(source.color);
-                       this.matcap = source.matcap;
-                       this.map = source.map;
-                       this.bumpMap = source.bumpMap;
-                       this.bumpScale = source.bumpScale;
-                       this.normalMap = source.normalMap;
-                       this.normalMapType = source.normalMapType;
-                       this.normalScale.copy(source.normalScale);
-                       this.displacementMap = source.displacementMap;
-                       this.displacementScale = source.displacementScale;
-                       this.displacementBias = source.displacementBias;
-                       this.alphaMap = source.alphaMap;
-                       this.flatShading = source.flatShading;
-                       return this;
-               }
-
-       }
-
-       MeshMatcapMaterial.prototype.isMeshMatcapMaterial = true;
-
-       /**
-        * parameters = {
-        *      color: <hex>,
-        *      opacity: <float>,
-        *
-        *      linewidth: <float>,
-        *
-        *      scale: <float>,
-        *      dashSize: <float>,
-        *      gapSize: <float>
-        * }
-        */
-
-       class LineDashedMaterial extends LineBasicMaterial {
-               constructor(parameters) {
-                       super();
-                       this.type = 'LineDashedMaterial';
-                       this.scale = 1;
-                       this.dashSize = 3;
-                       this.gapSize = 1;
-                       this.setValues(parameters);
-               }
-
-               copy(source) {
-                       super.copy(source);
-                       this.scale = source.scale;
-                       this.dashSize = source.dashSize;
-                       this.gapSize = source.gapSize;
-                       return this;
-               }
-
-       }
-
-       LineDashedMaterial.prototype.isLineDashedMaterial = true;
-
-       var Materials = /*#__PURE__*/Object.freeze({
-               __proto__: null,
-               ShadowMaterial: ShadowMaterial,
-               SpriteMaterial: SpriteMaterial,
-               RawShaderMaterial: RawShaderMaterial,
-               ShaderMaterial: ShaderMaterial,
-               PointsMaterial: PointsMaterial,
-               MeshPhysicalMaterial: MeshPhysicalMaterial,
-               MeshStandardMaterial: MeshStandardMaterial,
-               MeshPhongMaterial: MeshPhongMaterial,
-               MeshToonMaterial: MeshToonMaterial,
-               MeshNormalMaterial: MeshNormalMaterial,
-               MeshLambertMaterial: MeshLambertMaterial,
-               MeshDepthMaterial: MeshDepthMaterial,
-               MeshDistanceMaterial: MeshDistanceMaterial,
-               MeshBasicMaterial: MeshBasicMaterial,
-               MeshMatcapMaterial: MeshMatcapMaterial,
-               LineDashedMaterial: LineDashedMaterial,
-               LineBasicMaterial: LineBasicMaterial,
-               Material: Material
-       });
-
-       const AnimationUtils = {
-               // same as Array.prototype.slice, but also works on typed arrays
-               arraySlice: function (array, from, to) {
-                       if (AnimationUtils.isTypedArray(array)) {
-                               // in ios9 array.subarray(from, undefined) will return empty array
-                               // but array.subarray(from) or array.subarray(from, len) is correct
-                               return new array.constructor(array.subarray(from, to !== undefined ? to : array.length));
-                       }
-
-                       return array.slice(from, to);
-               },
-               // converts an array to a specific type
-               convertArray: function (array, type, forceClone) {
-                       if (!array || // let 'undefined' and 'null' pass
-                       !forceClone && array.constructor === type) return array;
-
-                       if (typeof type.BYTES_PER_ELEMENT === 'number') {
-                               return new type(array); // create typed array
-                       }
-
-                       return Array.prototype.slice.call(array); // create Array
-               },
-               isTypedArray: function (object) {
-                       return ArrayBuffer.isView(object) && !(object instanceof DataView);
-               },
-               // returns an array by which times and values can be sorted
-               getKeyframeOrder: function (times) {
-                       function compareTime(i, j) {
-                               return times[i] - times[j];
-                       }
-
-                       const n = times.length;
-                       const result = new Array(n);
-
-                       for (let i = 0; i !== n; ++i) result[i] = i;
-
-                       result.sort(compareTime);
-                       return result;
-               },
-               // uses the array previously returned by 'getKeyframeOrder' to sort data
-               sortedArray: function (values, stride, order) {
-                       const nValues = values.length;
-                       const result = new values.constructor(nValues);
-
-                       for (let i = 0, dstOffset = 0; dstOffset !== nValues; ++i) {
-                               const srcOffset = order[i] * stride;
-
-                               for (let j = 0; j !== stride; ++j) {
-                                       result[dstOffset++] = values[srcOffset + j];
-                               }
-                       }
-
-                       return result;
-               },
-               // function for parsing AOS keyframe formats
-               flattenJSON: function (jsonKeys, times, values, valuePropertyName) {
-                       let i = 1,
-                                       key = jsonKeys[0];
-
-                       while (key !== undefined && key[valuePropertyName] === undefined) {
-                               key = jsonKeys[i++];
-                       }
-
-                       if (key === undefined) return; // no data
-
-                       let value = key[valuePropertyName];
-                       if (value === undefined) return; // no data
-
-                       if (Array.isArray(value)) {
-                               do {
-                                       value = key[valuePropertyName];
-
-                                       if (value !== undefined) {
-                                               times.push(key.time);
-                                               values.push.apply(values, value); // push all elements
-                                       }
-
-                                       key = jsonKeys[i++];
-                               } while (key !== undefined);
-                       } else if (value.toArray !== undefined) {
-                               // ...assume THREE.Math-ish
-                               do {
-                                       value = key[valuePropertyName];
-
-                                       if (value !== undefined) {
-                                               times.push(key.time);
-                                               value.toArray(values, values.length);
-                                       }
-
-                                       key = jsonKeys[i++];
-                               } while (key !== undefined);
-                       } else {
-                               // otherwise push as-is
-                               do {
-                                       value = key[valuePropertyName];
-
-                                       if (value !== undefined) {
-                                               times.push(key.time);
-                                               values.push(value);
-                                       }
-
-                                       key = jsonKeys[i++];
-                               } while (key !== undefined);
-                       }
-               },
-               subclip: function (sourceClip, name, startFrame, endFrame, fps = 30) {
-                       const clip = sourceClip.clone();
-                       clip.name = name;
-                       const tracks = [];
-
-                       for (let i = 0; i < clip.tracks.length; ++i) {
-                               const track = clip.tracks[i];
-                               const valueSize = track.getValueSize();
-                               const times = [];
-                               const values = [];
-
-                               for (let j = 0; j < track.times.length; ++j) {
-                                       const frame = track.times[j] * fps;
-                                       if (frame < startFrame || frame >= endFrame) continue;
-                                       times.push(track.times[j]);
-
-                                       for (let k = 0; k < valueSize; ++k) {
-                                               values.push(track.values[j * valueSize + k]);
-                                       }
-                               }
-
-                               if (times.length === 0) continue;
-                               track.times = AnimationUtils.convertArray(times, track.times.constructor);
-                               track.values = AnimationUtils.convertArray(values, track.values.constructor);
-                               tracks.push(track);
-                       }
-
-                       clip.tracks = tracks; // find minimum .times value across all tracks in the trimmed clip
-
-                       let minStartTime = Infinity;
-
-                       for (let i = 0; i < clip.tracks.length; ++i) {
-                               if (minStartTime > clip.tracks[i].times[0]) {
-                                       minStartTime = clip.tracks[i].times[0];
-                               }
-                       } // shift all tracks such that clip begins at t=0
-
-
-                       for (let i = 0; i < clip.tracks.length; ++i) {
-                               clip.tracks[i].shift(-1 * minStartTime);
-                       }
-
-                       clip.resetDuration();
-                       return clip;
-               },
-               makeClipAdditive: function (targetClip, referenceFrame = 0, referenceClip = targetClip, fps = 30) {
-                       if (fps <= 0) fps = 30;
-                       const numTracks = referenceClip.tracks.length;
-                       const referenceTime = referenceFrame / fps; // Make each track's values relative to the values at the reference frame
-
-                       for (let i = 0; i < numTracks; ++i) {
-                               const referenceTrack = referenceClip.tracks[i];
-                               const referenceTrackType = referenceTrack.ValueTypeName; // Skip this track if it's non-numeric
-
-                               if (referenceTrackType === 'bool' || referenceTrackType === 'string') continue; // Find the track in the target clip whose name and type matches the reference track
-
-                               const targetTrack = targetClip.tracks.find(function (track) {
-                                       return track.name === referenceTrack.name && track.ValueTypeName === referenceTrackType;
-                               });
-                               if (targetTrack === undefined) continue;
-                               let referenceOffset = 0;
-                               const referenceValueSize = referenceTrack.getValueSize();
-
-                               if (referenceTrack.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline) {
-                                       referenceOffset = referenceValueSize / 3;
-                               }
-
-                               let targetOffset = 0;
-                               const targetValueSize = targetTrack.getValueSize();
-
-                               if (targetTrack.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline) {
-                                       targetOffset = targetValueSize / 3;
-                               }
-
-                               const lastIndex = referenceTrack.times.length - 1;
-                               let referenceValue; // Find the value to subtract out of the track
-
-                               if (referenceTime <= referenceTrack.times[0]) {
-                                       // Reference frame is earlier than the first keyframe, so just use the first keyframe
-                                       const startIndex = referenceOffset;
-                                       const endIndex = referenceValueSize - referenceOffset;
-                                       referenceValue = AnimationUtils.arraySlice(referenceTrack.values, startIndex, endIndex);
-                               } else if (referenceTime >= referenceTrack.times[lastIndex]) {
-                                       // Reference frame is after the last keyframe, so just use the last keyframe
-                                       const startIndex = lastIndex * referenceValueSize + referenceOffset;
-                                       const endIndex = startIndex + referenceValueSize - referenceOffset;
-                                       referenceValue = AnimationUtils.arraySlice(referenceTrack.values, startIndex, endIndex);
-                               } else {
-                                       // Interpolate to the reference value
-                                       const interpolant = referenceTrack.createInterpolant();
-                                       const startIndex = referenceOffset;
-                                       const endIndex = referenceValueSize - referenceOffset;
-                                       interpolant.evaluate(referenceTime);
-                                       referenceValue = AnimationUtils.arraySlice(interpolant.resultBuffer, startIndex, endIndex);
-                               } // Conjugate the quaternion
-
-
-                               if (referenceTrackType === 'quaternion') {
-                                       const referenceQuat = new Quaternion().fromArray(referenceValue).normalize().conjugate();
-                                       referenceQuat.toArray(referenceValue);
-                               } // Subtract the reference value from all of the track values
-
-
-                               const numTimes = targetTrack.times.length;
-
-                               for (let j = 0; j < numTimes; ++j) {
-                                       const valueStart = j * targetValueSize + targetOffset;
-
-                                       if (referenceTrackType === 'quaternion') {
-                                               // Multiply the conjugate for quaternion track types
-                                               Quaternion.multiplyQuaternionsFlat(targetTrack.values, valueStart, referenceValue, 0, targetTrack.values, valueStart);
-                                       } else {
-                                               const valueEnd = targetValueSize - targetOffset * 2; // Subtract each value for all other numeric track types
-
-                                               for (let k = 0; k < valueEnd; ++k) {
-                                                       targetTrack.values[valueStart + k] -= referenceValue[k];
-                                               }
-                                       }
-                               }
-                       }
-
-                       targetClip.blendMode = AdditiveAnimationBlendMode;
-                       return targetClip;
-               }
-       };
-
-       /**
-        * Abstract base class of interpolants over parametric samples.
-        *
-        * The parameter domain is one dimensional, typically the time or a path
-        * along a curve defined by the data.
-        *
-        * The sample values can have any dimensionality and derived classes may
-        * apply special interpretations to the data.
-        *
-        * This class provides the interval seek in a Template Method, deferring
-        * the actual interpolation to derived classes.
-        *
-        * Time complexity is O(1) for linear access crossing at most two points
-        * and O(log N) for random access, where N is the number of positions.
-        *
-        * References:
-        *
-        *              http://www.oodesign.com/template-method-pattern.html
-        *
-        */
-       class Interpolant {
-               constructor(parameterPositions, sampleValues, sampleSize, resultBuffer) {
-                       this.parameterPositions = parameterPositions;
-                       this._cachedIndex = 0;
-                       this.resultBuffer = resultBuffer !== undefined ? resultBuffer : new sampleValues.constructor(sampleSize);
-                       this.sampleValues = sampleValues;
-                       this.valueSize = sampleSize;
-                       this.settings = null;
-                       this.DefaultSettings_ = {};
-               }
-
-               evaluate(t) {
-                       const pp = this.parameterPositions;
-                       let i1 = this._cachedIndex,
-                                       t1 = pp[i1],
-                                       t0 = pp[i1 - 1];
-
-                       validate_interval: {
-                               seek: {
-                                       let right;
-
-                                       linear_scan: {
-                                               //- See http://jsperf.com/comparison-to-undefined/3
-                                               //- slower code:
-                                               //-
-                                               //-                             if ( t >= t1 || t1 === undefined ) {
-                                               forward_scan: if (!(t < t1)) {
-                                                       for (let giveUpAt = i1 + 2;;) {
-                                                               if (t1 === undefined) {
-                                                                       if (t < t0) break forward_scan; // after end
-
-                                                                       i1 = pp.length;
-                                                                       this._cachedIndex = i1;
-                                                                       return this.afterEnd_(i1 - 1, t, t0);
-                                                               }
-
-                                                               if (i1 === giveUpAt) break; // this loop
-
-                                                               t0 = t1;
-                                                               t1 = pp[++i1];
-
-                                                               if (t < t1) {
-                                                                       // we have arrived at the sought interval
-                                                                       break seek;
-                                                               }
-                                                       } // prepare binary search on the right side of the index
-
-
-                                                       right = pp.length;
-                                                       break linear_scan;
-                                               } //- slower code:
-                                               //-                                     if ( t < t0 || t0 === undefined ) {
-
-
-                                               if (!(t >= t0)) {
-                                                       // looping?
-                                                       const t1global = pp[1];
-
-                                                       if (t < t1global) {
-                                                               i1 = 2; // + 1, using the scan for the details
-
-                                                               t0 = t1global;
-                                                       } // linear reverse scan
-
-
-                                                       for (let giveUpAt = i1 - 2;;) {
-                                                               if (t0 === undefined) {
-                                                                       // before start
-                                                                       this._cachedIndex = 0;
-                                                                       return this.beforeStart_(0, t, t1);
-                                                               }
-
-                                                               if (i1 === giveUpAt) break; // this loop
-
-                                                               t1 = t0;
-                                                               t0 = pp[--i1 - 1];
-
-                                                               if (t >= t0) {
-                                                                       // we have arrived at the sought interval
-                                                                       break seek;
-                                                               }
-                                                       } // prepare binary search on the left side of the index
-
-
-                                                       right = i1;
-                                                       i1 = 0;
-                                                       break linear_scan;
-                                               } // the interval is valid
-
-
-                                               break validate_interval;
-                                       } // linear scan
-                                       // binary search
-
-
-                                       while (i1 < right) {
-                                               const mid = i1 + right >>> 1;
-
-                                               if (t < pp[mid]) {
-                                                       right = mid;
-                                               } else {
-                                                       i1 = mid + 1;
-                                               }
-                                       }
-
-                                       t1 = pp[i1];
-                                       t0 = pp[i1 - 1]; // check boundary cases, again
-
-                                       if (t0 === undefined) {
-                                               this._cachedIndex = 0;
-                                               return this.beforeStart_(0, t, t1);
-                                       }
-
-                                       if (t1 === undefined) {
-                                               i1 = pp.length;
-                                               this._cachedIndex = i1;
-                                               return this.afterEnd_(i1 - 1, t0, t);
-                                       }
-                               } // seek
-
-
-                               this._cachedIndex = i1;
-                               this.intervalChanged_(i1, t0, t1);
-                       } // validate_interval
-
-
-                       return this.interpolate_(i1, t0, t, t1);
-               }
-
-               getSettings_() {
-                       return this.settings || this.DefaultSettings_;
-               }
-
-               copySampleValue_(index) {
-                       // copies a sample value to the result buffer
-                       const result = this.resultBuffer,
-                                               values = this.sampleValues,
-                                               stride = this.valueSize,
-                                               offset = index * stride;
-
-                       for (let i = 0; i !== stride; ++i) {
-                               result[i] = values[offset + i];
-                       }
-
-                       return result;
-               } // Template methods for derived classes:
-
-
-               interpolate_() {
-                       throw new Error('call to abstract method'); // implementations shall return this.resultBuffer
-               }
-
-               intervalChanged_() {// empty
-               }
-
-       } // ALIAS DEFINITIONS
-
-
-       Interpolant.prototype.beforeStart_ = Interpolant.prototype.copySampleValue_;
-       Interpolant.prototype.afterEnd_ = Interpolant.prototype.copySampleValue_;
-
-       /**
-        * Fast and simple cubic spline interpolant.
-        *
-        * It was derived from a Hermitian construction setting the first derivative
-        * at each sample position to the linear slope between neighboring positions
-        * over their parameter interval.
-        */
-
-       class CubicInterpolant extends Interpolant {
-               constructor(parameterPositions, sampleValues, sampleSize, resultBuffer) {
-                       super(parameterPositions, sampleValues, sampleSize, resultBuffer);
-                       this._weightPrev = -0;
-                       this._offsetPrev = -0;
-                       this._weightNext = -0;
-                       this._offsetNext = -0;
-                       this.DefaultSettings_ = {
-                               endingStart: ZeroCurvatureEnding,
-                               endingEnd: ZeroCurvatureEnding
-                       };
-               }
-
-               intervalChanged_(i1, t0, t1) {
-                       const pp = this.parameterPositions;
-                       let iPrev = i1 - 2,
-                                       iNext = i1 + 1,
-                                       tPrev = pp[iPrev],
-                                       tNext = pp[iNext];
-
-                       if (tPrev === undefined) {
-                               switch (this.getSettings_().endingStart) {
-                                       case ZeroSlopeEnding:
-                                               // f'(t0) = 0
-                                               iPrev = i1;
-                                               tPrev = 2 * t0 - t1;
-                                               break;
-
-                                       case WrapAroundEnding:
-                                               // use the other end of the curve
-                                               iPrev = pp.length - 2;
-                                               tPrev = t0 + pp[iPrev] - pp[iPrev + 1];
-                                               break;
-
-                                       default:
-                                               // ZeroCurvatureEnding
-                                               // f''(t0) = 0 a.k.a. Natural Spline
-                                               iPrev = i1;
-                                               tPrev = t1;
-                               }
-                       }
-
-                       if (tNext === undefined) {
-                               switch (this.getSettings_().endingEnd) {
-                                       case ZeroSlopeEnding:
-                                               // f'(tN) = 0
-                                               iNext = i1;
-                                               tNext = 2 * t1 - t0;
-                                               break;
-
-                                       case WrapAroundEnding:
-                                               // use the other end of the curve
-                                               iNext = 1;
-                                               tNext = t1 + pp[1] - pp[0];
-                                               break;
-
-                                       default:
-                                               // ZeroCurvatureEnding
-                                               // f''(tN) = 0, a.k.a. Natural Spline
-                                               iNext = i1 - 1;
-                                               tNext = t0;
-                               }
-                       }
-
-                       const halfDt = (t1 - t0) * 0.5,
-                                               stride = this.valueSize;
-                       this._weightPrev = halfDt / (t0 - tPrev);
-                       this._weightNext = halfDt / (tNext - t1);
-                       this._offsetPrev = iPrev * stride;
-                       this._offsetNext = iNext * stride;
-               }
-
-               interpolate_(i1, t0, t, t1) {
-                       const result = this.resultBuffer,
-                                               values = this.sampleValues,
-                                               stride = this.valueSize,
-                                               o1 = i1 * stride,
-                                               o0 = o1 - stride,
-                                               oP = this._offsetPrev,
-                                               oN = this._offsetNext,
-                                               wP = this._weightPrev,
-                                               wN = this._weightNext,
-                                               p = (t - t0) / (t1 - t0),
-                                               pp = p * p,
-                                               ppp = pp * p; // evaluate polynomials
-
-                       const sP = -wP * ppp + 2 * wP * pp - wP * p;
-                       const s0 = (1 + wP) * ppp + (-1.5 - 2 * wP) * pp + (-0.5 + wP) * p + 1;
-                       const s1 = (-1 - wN) * ppp + (1.5 + wN) * pp + 0.5 * p;
-                       const sN = wN * ppp - wN * pp; // combine data linearly
-
-                       for (let i = 0; i !== stride; ++i) {
-                               result[i] = sP * values[oP + i] + s0 * values[o0 + i] + s1 * values[o1 + i] + sN * values[oN + i];
-                       }
-
-                       return result;
-               }
-
-       }
-
-       class LinearInterpolant extends Interpolant {
-               constructor(parameterPositions, sampleValues, sampleSize, resultBuffer) {
-                       super(parameterPositions, sampleValues, sampleSize, resultBuffer);
-               }
-
-               interpolate_(i1, t0, t, t1) {
-                       const result = this.resultBuffer,
-                                               values = this.sampleValues,
-                                               stride = this.valueSize,
-                                               offset1 = i1 * stride,
-                                               offset0 = offset1 - stride,
-                                               weight1 = (t - t0) / (t1 - t0),
-                                               weight0 = 1 - weight1;
-
-                       for (let i = 0; i !== stride; ++i) {
-                               result[i] = values[offset0 + i] * weight0 + values[offset1 + i] * weight1;
-                       }
-
-                       return result;
-               }
-
-       }
-
-       /**
-        *
-        * Interpolant that evaluates to the sample value at the position preceeding
-        * the parameter.
-        */
-
-       class DiscreteInterpolant extends Interpolant {
-               constructor(parameterPositions, sampleValues, sampleSize, resultBuffer) {
-                       super(parameterPositions, sampleValues, sampleSize, resultBuffer);
-               }
-
-               interpolate_(i1
-               /*, t0, t, t1 */
-               ) {
-                       return this.copySampleValue_(i1 - 1);
-               }
-
-       }
-
-       class KeyframeTrack {
-               constructor(name, times, values, interpolation) {
-                       if (name === undefined) throw new Error('THREE.KeyframeTrack: track name is undefined');
-                       if (times === undefined || times.length === 0) throw new Error('THREE.KeyframeTrack: no keyframes in track named ' + name);
-                       this.name = name;
-                       this.times = AnimationUtils.convertArray(times, this.TimeBufferType);
-                       this.values = AnimationUtils.convertArray(values, this.ValueBufferType);
-                       this.setInterpolation(interpolation || this.DefaultInterpolation);
-               } // Serialization (in static context, because of constructor invocation
-               // and automatic invocation of .toJSON):
-
-
-               static toJSON(track) {
-                       const trackType = track.constructor;
-                       let json; // derived classes can define a static toJSON method
-
-                       if (trackType.toJSON !== this.toJSON) {
-                               json = trackType.toJSON(track);
-                       } else {
-                               // by default, we assume the data can be serialized as-is
-                               json = {
-                                       'name': track.name,
-                                       'times': AnimationUtils.convertArray(track.times, Array),
-                                       'values': AnimationUtils.convertArray(track.values, Array)
-                               };
-                               const interpolation = track.getInterpolation();
-
-                               if (interpolation !== track.DefaultInterpolation) {
-                                       json.interpolation = interpolation;
-                               }
-                       }
-
-                       json.type = track.ValueTypeName; // mandatory
-
-                       return json;
-               }
-
-               InterpolantFactoryMethodDiscrete(result) {
-                       return new DiscreteInterpolant(this.times, this.values, this.getValueSize(), result);
-               }
-
-               InterpolantFactoryMethodLinear(result) {
-                       return new LinearInterpolant(this.times, this.values, this.getValueSize(), result);
-               }
-
-               InterpolantFactoryMethodSmooth(result) {
-                       return new CubicInterpolant(this.times, this.values, this.getValueSize(), result);
-               }
-
-               setInterpolation(interpolation) {
-                       let factoryMethod;
-
-                       switch (interpolation) {
-                               case InterpolateDiscrete:
-                                       factoryMethod = this.InterpolantFactoryMethodDiscrete;
-                                       break;
-
-                               case InterpolateLinear:
-                                       factoryMethod = this.InterpolantFactoryMethodLinear;
-                                       break;
-
-                               case InterpolateSmooth:
-                                       factoryMethod = this.InterpolantFactoryMethodSmooth;
-                                       break;
-                       }
-
-                       if (factoryMethod === undefined) {
-                               const message = 'unsupported interpolation for ' + this.ValueTypeName + ' keyframe track named ' + this.name;
-
-                               if (this.createInterpolant === undefined) {
-                                       // fall back to default, unless the default itself is messed up
-                                       if (interpolation !== this.DefaultInterpolation) {
-                                               this.setInterpolation(this.DefaultInterpolation);
-                                       } else {
-                                               throw new Error(message); // fatal, in this case
-                                       }
-                               }
-
-                               console.warn('THREE.KeyframeTrack:', message);
-                               return this;
-                       }
-
-                       this.createInterpolant = factoryMethod;
-                       return this;
-               }
-
-               getInterpolation() {
-                       switch (this.createInterpolant) {
-                               case this.InterpolantFactoryMethodDiscrete:
-                                       return InterpolateDiscrete;
-
-                               case this.InterpolantFactoryMethodLinear:
-                                       return InterpolateLinear;
-
-                               case this.InterpolantFactoryMethodSmooth:
-                                       return InterpolateSmooth;
-                       }
-               }
-
-               getValueSize() {
-                       return this.values.length / this.times.length;
-               } // move all keyframes either forwards or backwards in time
-
-
-               shift(timeOffset) {
-                       if (timeOffset !== 0.0) {
-                               const times = this.times;
-
-                               for (let i = 0, n = times.length; i !== n; ++i) {
-                                       times[i] += timeOffset;
-                               }
-                       }
-
-                       return this;
-               } // scale all keyframe times by a factor (useful for frame <-> seconds conversions)
-
-
-               scale(timeScale) {
-                       if (timeScale !== 1.0) {
-                               const times = this.times;
-
-                               for (let i = 0, n = times.length; i !== n; ++i) {
-                                       times[i] *= timeScale;
-                               }
-                       }
-
-                       return this;
-               } // removes keyframes before and after animation without changing any values within the range [startTime, endTime].
-               // IMPORTANT: We do not shift around keys to the start of the track time, because for interpolated keys this will change their values
-
-
-               trim(startTime, endTime) {
-                       const times = this.times,
-                                               nKeys = times.length;
-                       let from = 0,
-                                       to = nKeys - 1;
-
-                       while (from !== nKeys && times[from] < startTime) {
-                               ++from;
-                       }
-
-                       while (to !== -1 && times[to] > endTime) {
-                               --to;
-                       }
-
-                       ++to; // inclusive -> exclusive bound
-
-                       if (from !== 0 || to !== nKeys) {
-                               // empty tracks are forbidden, so keep at least one keyframe
-                               if (from >= to) {
-                                       to = Math.max(to, 1);
-                                       from = to - 1;
-                               }
-
-                               const stride = this.getValueSize();
-                               this.times = AnimationUtils.arraySlice(times, from, to);
-                               this.values = AnimationUtils.arraySlice(this.values, from * stride, to * stride);
-                       }
-
-                       return this;
-               } // ensure we do not get a GarbageInGarbageOut situation, make sure tracks are at least minimally viable
-
-
-               validate() {
-                       let valid = true;
-                       const valueSize = this.getValueSize();
-
-                       if (valueSize - Math.floor(valueSize) !== 0) {
-                               console.error('THREE.KeyframeTrack: Invalid value size in track.', this);
-                               valid = false;
-                       }
-
-                       const times = this.times,
-                                               values = this.values,
-                                               nKeys = times.length;
-
-                       if (nKeys === 0) {
-                               console.error('THREE.KeyframeTrack: Track is empty.', this);
-                               valid = false;
-                       }
-
-                       let prevTime = null;
-
-                       for (let i = 0; i !== nKeys; i++) {
-                               const currTime = times[i];
-
-                               if (typeof currTime === 'number' && isNaN(currTime)) {
-                                       console.error('THREE.KeyframeTrack: Time is not a valid number.', this, i, currTime);
-                                       valid = false;
-                                       break;
-                               }
-
-                               if (prevTime !== null && prevTime > currTime) {
-                                       console.error('THREE.KeyframeTrack: Out of order keys.', this, i, currTime, prevTime);
-                                       valid = false;
-                                       break;
-                               }
-
-                               prevTime = currTime;
-                       }
-
-                       if (values !== undefined) {
-                               if (AnimationUtils.isTypedArray(values)) {
-                                       for (let i = 0, n = values.length; i !== n; ++i) {
-                                               const value = values[i];
-
-                                               if (isNaN(value)) {
-                                                       console.error('THREE.KeyframeTrack: Value is not a valid number.', this, i, value);
-                                                       valid = false;
-                                                       break;
-                                               }
-                                       }
-                               }
-                       }
-
-                       return valid;
-               } // removes equivalent sequential keys as common in morph target sequences
-               // (0,0,0,0,1,1,1,0,0,0,0,0,0,0) --> (0,0,1,1,0,0)
-
-
-               optimize() {
-                       // times or values may be shared with other tracks, so overwriting is unsafe
-                       const times = AnimationUtils.arraySlice(this.times),
-                                               values = AnimationUtils.arraySlice(this.values),
-                                               stride = this.getValueSize(),
-                                               smoothInterpolation = this.getInterpolation() === InterpolateSmooth,
-                                               lastIndex = times.length - 1;
-                       let writeIndex = 1;
-
-                       for (let i = 1; i < lastIndex; ++i) {
-                               let keep = false;
-                               const time = times[i];
-                               const timeNext = times[i + 1]; // remove adjacent keyframes scheduled at the same time
-
-                               if (time !== timeNext && (i !== 1 || time !== times[0])) {
-                                       if (!smoothInterpolation) {
-                                               // remove unnecessary keyframes same as their neighbors
-                                               const offset = i * stride,
-                                                                       offsetP = offset - stride,
-                                                                       offsetN = offset + stride;
-
-                                               for (let j = 0; j !== stride; ++j) {
-                                                       const value = values[offset + j];
-
-                                                       if (value !== values[offsetP + j] || value !== values[offsetN + j]) {
-                                                               keep = true;
-                                                               break;
-                                                       }
-                                               }
-                                       } else {
-                                               keep = true;
-                                       }
-                               } // in-place compaction
-
-
-                               if (keep) {
-                                       if (i !== writeIndex) {
-                                               times[writeIndex] = times[i];
-                                               const readOffset = i * stride,
-                                                                       writeOffset = writeIndex * stride;
-
-                                               for (let j = 0; j !== stride; ++j) {
-                                                       values[writeOffset + j] = values[readOffset + j];
-                                               }
-                                       }
-
-                                       ++writeIndex;
-                               }
-                       } // flush last keyframe (compaction looks ahead)
-
-
-                       if (lastIndex > 0) {
-                               times[writeIndex] = times[lastIndex];
-
-                               for (let readOffset = lastIndex * stride, writeOffset = writeIndex * stride, j = 0; j !== stride; ++j) {
-                                       values[writeOffset + j] = values[readOffset + j];
-                               }
-
-                               ++writeIndex;
-                       }
-
-                       if (writeIndex !== times.length) {
-                               this.times = AnimationUtils.arraySlice(times, 0, writeIndex);
-                               this.values = AnimationUtils.arraySlice(values, 0, writeIndex * stride);
-                       } else {
-                               this.times = times;
-                               this.values = values;
-                       }
-
-                       return this;
-               }
-
-               clone() {
-                       const times = AnimationUtils.arraySlice(this.times, 0);
-                       const values = AnimationUtils.arraySlice(this.values, 0);
-                       const TypedKeyframeTrack = this.constructor;
-                       const track = new TypedKeyframeTrack(this.name, times, values); // Interpolant argument to constructor is not saved, so copy the factory method directly.
-
-                       track.createInterpolant = this.createInterpolant;
-                       return track;
-               }
-
-       }
-
-       KeyframeTrack.prototype.TimeBufferType = Float32Array;
-       KeyframeTrack.prototype.ValueBufferType = Float32Array;
-       KeyframeTrack.prototype.DefaultInterpolation = InterpolateLinear;
-
-       /**
-        * A Track of Boolean keyframe values.
-        */
-
-       class BooleanKeyframeTrack extends KeyframeTrack {}
-
-       BooleanKeyframeTrack.prototype.ValueTypeName = 'bool';
-       BooleanKeyframeTrack.prototype.ValueBufferType = Array;
-       BooleanKeyframeTrack.prototype.DefaultInterpolation = InterpolateDiscrete;
-       BooleanKeyframeTrack.prototype.InterpolantFactoryMethodLinear = undefined;
-       BooleanKeyframeTrack.prototype.InterpolantFactoryMethodSmooth = undefined; // Note: Actually this track could have a optimized / compressed
-
-       /**
-        * A Track of keyframe values that represent color.
-        */
-
-       class ColorKeyframeTrack extends KeyframeTrack {}
-
-       ColorKeyframeTrack.prototype.ValueTypeName = 'color'; // ValueBufferType is inherited
-
-       /**
-        * A Track of numeric keyframe values.
-        */
-
-       class NumberKeyframeTrack extends KeyframeTrack {}
-
-       NumberKeyframeTrack.prototype.ValueTypeName = 'number'; // ValueBufferType is inherited
-
-       /**
-        * Spherical linear unit quaternion interpolant.
-        */
-
-       class QuaternionLinearInterpolant extends Interpolant {
-               constructor(parameterPositions, sampleValues, sampleSize, resultBuffer) {
-                       super(parameterPositions, sampleValues, sampleSize, resultBuffer);
-               }
-
-               interpolate_(i1, t0, t, t1) {
-                       const result = this.resultBuffer,
-                                               values = this.sampleValues,
-                                               stride = this.valueSize,
-                                               alpha = (t - t0) / (t1 - t0);
-                       let offset = i1 * stride;
-
-                       for (let end = offset + stride; offset !== end; offset += 4) {
-                               Quaternion.slerpFlat(result, 0, values, offset - stride, values, offset, alpha);
-                       }
-
-                       return result;
-               }
-
-       }
-
-       /**
-        * A Track of quaternion keyframe values.
-        */
-
-       class QuaternionKeyframeTrack extends KeyframeTrack {
-               InterpolantFactoryMethodLinear(result) {
-                       return new QuaternionLinearInterpolant(this.times, this.values, this.getValueSize(), result);
-               }
-
-       }
-
-       QuaternionKeyframeTrack.prototype.ValueTypeName = 'quaternion'; // ValueBufferType is inherited
-
-       QuaternionKeyframeTrack.prototype.DefaultInterpolation = InterpolateLinear;
-       QuaternionKeyframeTrack.prototype.InterpolantFactoryMethodSmooth = undefined;
-
-       /**
-        * A Track that interpolates Strings
-        */
-
-       class StringKeyframeTrack extends KeyframeTrack {}
-
-       StringKeyframeTrack.prototype.ValueTypeName = 'string';
-       StringKeyframeTrack.prototype.ValueBufferType = Array;
-       StringKeyframeTrack.prototype.DefaultInterpolation = InterpolateDiscrete;
-       StringKeyframeTrack.prototype.InterpolantFactoryMethodLinear = undefined;
-       StringKeyframeTrack.prototype.InterpolantFactoryMethodSmooth = undefined;
-
-       /**
-        * A Track of vectored keyframe values.
-        */
-
-       class VectorKeyframeTrack extends KeyframeTrack {}
-
-       VectorKeyframeTrack.prototype.ValueTypeName = 'vector'; // ValueBufferType is inherited
-
-       class AnimationClip {
-               constructor(name, duration = -1, tracks, blendMode = NormalAnimationBlendMode) {
-                       this.name = name;
-                       this.tracks = tracks;
-                       this.duration = duration;
-                       this.blendMode = blendMode;
-                       this.uuid = generateUUID(); // this means it should figure out its duration by scanning the tracks
-
-                       if (this.duration < 0) {
-                               this.resetDuration();
-                       }
-               }
-
-               static parse(json) {
-                       const tracks = [],
-                                               jsonTracks = json.tracks,
-                                               frameTime = 1.0 / (json.fps || 1.0);
-
-                       for (let i = 0, n = jsonTracks.length; i !== n; ++i) {
-                               tracks.push(parseKeyframeTrack(jsonTracks[i]).scale(frameTime));
-                       }
-
-                       const clip = new this(json.name, json.duration, tracks, json.blendMode);
-                       clip.uuid = json.uuid;
-                       return clip;
-               }
-
-               static toJSON(clip) {
-                       const tracks = [],
-                                               clipTracks = clip.tracks;
-                       const json = {
-                               'name': clip.name,
-                               'duration': clip.duration,
-                               'tracks': tracks,
-                               'uuid': clip.uuid,
-                               'blendMode': clip.blendMode
-                       };
-
-                       for (let i = 0, n = clipTracks.length; i !== n; ++i) {
-                               tracks.push(KeyframeTrack.toJSON(clipTracks[i]));
-                       }
-
-                       return json;
-               }
-
-               static CreateFromMorphTargetSequence(name, morphTargetSequence, fps, noLoop) {
-                       const numMorphTargets = morphTargetSequence.length;
-                       const tracks = [];
-
-                       for (let i = 0; i < numMorphTargets; i++) {
-                               let times = [];
-                               let values = [];
-                               times.push((i + numMorphTargets - 1) % numMorphTargets, i, (i + 1) % numMorphTargets);
-                               values.push(0, 1, 0);
-                               const order = AnimationUtils.getKeyframeOrder(times);
-                               times = AnimationUtils.sortedArray(times, 1, order);
-                               values = AnimationUtils.sortedArray(values, 1, order); // if there is a key at the first frame, duplicate it as the
-                               // last frame as well for perfect loop.
-
-                               if (!noLoop && times[0] === 0) {
-                                       times.push(numMorphTargets);
-                                       values.push(values[0]);
-                               }
-
-                               tracks.push(new NumberKeyframeTrack('.morphTargetInfluences[' + morphTargetSequence[i].name + ']', times, values).scale(1.0 / fps));
-                       }
-
-                       return new this(name, -1, tracks);
-               }
-
-               static findByName(objectOrClipArray, name) {
-                       let clipArray = objectOrClipArray;
-
-                       if (!Array.isArray(objectOrClipArray)) {
-                               const o = objectOrClipArray;
-                               clipArray = o.geometry && o.geometry.animations || o.animations;
-                       }
-
-                       for (let i = 0; i < clipArray.length; i++) {
-                               if (clipArray[i].name === name) {
-                                       return clipArray[i];
-                               }
-                       }
-
-                       return null;
-               }
-
-               static CreateClipsFromMorphTargetSequences(morphTargets, fps, noLoop) {
-                       const animationToMorphTargets = {}; // tested with https://regex101.com/ on trick sequences
-                       // such flamingo_flyA_003, flamingo_run1_003, crdeath0059
-
-                       const pattern = /^([\w-]*?)([\d]+)$/; // sort morph target names into animation groups based
-                       // patterns like Walk_001, Walk_002, Run_001, Run_002
-
-                       for (let i = 0, il = morphTargets.length; i < il; i++) {
-                               const morphTarget = morphTargets[i];
-                               const parts = morphTarget.name.match(pattern);
-
-                               if (parts && parts.length > 1) {
-                                       const name = parts[1];
-                                       let animationMorphTargets = animationToMorphTargets[name];
-
-                                       if (!animationMorphTargets) {
-                                               animationToMorphTargets[name] = animationMorphTargets = [];
-                                       }
-
-                                       animationMorphTargets.push(morphTarget);
-                               }
-                       }
-
-                       const clips = [];
-
-                       for (const name in animationToMorphTargets) {
-                               clips.push(this.CreateFromMorphTargetSequence(name, animationToMorphTargets[name], fps, noLoop));
-                       }
-
-                       return clips;
-               } // parse the animation.hierarchy format
-
-
-               static parseAnimation(animation, bones) {
-                       if (!animation) {
-                               console.error('THREE.AnimationClip: No animation in JSONLoader data.');
-                               return null;
-                       }
-
-                       const addNonemptyTrack = function (trackType, trackName, animationKeys, propertyName, destTracks) {
-                               // only return track if there are actually keys.
-                               if (animationKeys.length !== 0) {
-                                       const times = [];
-                                       const values = [];
-                                       AnimationUtils.flattenJSON(animationKeys, times, values, propertyName); // empty keys are filtered out, so check again
-
-                                       if (times.length !== 0) {
-                                               destTracks.push(new trackType(trackName, times, values));
-                                       }
-                               }
-                       };
-
-                       const tracks = [];
-                       const clipName = animation.name || 'default';
-                       const fps = animation.fps || 30;
-                       const blendMode = animation.blendMode; // automatic length determination in AnimationClip.
-
-                       let duration = animation.length || -1;
-                       const hierarchyTracks = animation.hierarchy || [];
-
-                       for (let h = 0; h < hierarchyTracks.length; h++) {
-                               const animationKeys = hierarchyTracks[h].keys; // skip empty tracks
-
-                               if (!animationKeys || animationKeys.length === 0) continue; // process morph targets
-
-                               if (animationKeys[0].morphTargets) {
-                                       // figure out all morph targets used in this track
-                                       const morphTargetNames = {};
-                                       let k;
-
-                                       for (k = 0; k < animationKeys.length; k++) {
-                                               if (animationKeys[k].morphTargets) {
-                                                       for (let m = 0; m < animationKeys[k].morphTargets.length; m++) {
-                                                               morphTargetNames[animationKeys[k].morphTargets[m]] = -1;
-                                                       }
-                                               }
-                                       } // create a track for each morph target with all zero
-                                       // morphTargetInfluences except for the keys in which
-                                       // the morphTarget is named.
-
-
-                                       for (const morphTargetName in morphTargetNames) {
-                                               const times = [];
-                                               const values = [];
-
-                                               for (let m = 0; m !== animationKeys[k].morphTargets.length; ++m) {
-                                                       const animationKey = animationKeys[k];
-                                                       times.push(animationKey.time);
-                                                       values.push(animationKey.morphTarget === morphTargetName ? 1 : 0);
-                                               }
-
-                                               tracks.push(new NumberKeyframeTrack('.morphTargetInfluence[' + morphTargetName + ']', times, values));
-                                       }
-
-                                       duration = morphTargetNames.length * (fps || 1.0);
-                               } else {
-                                       // ...assume skeletal animation
-                                       const boneName = '.bones[' + bones[h].name + ']';
-                                       addNonemptyTrack(VectorKeyframeTrack, boneName + '.position', animationKeys, 'pos', tracks);
-                                       addNonemptyTrack(QuaternionKeyframeTrack, boneName + '.quaternion', animationKeys, 'rot', tracks);
-                                       addNonemptyTrack(VectorKeyframeTrack, boneName + '.scale', animationKeys, 'scl', tracks);
-                               }
-                       }
-
-                       if (tracks.length === 0) {
-                               return null;
-                       }
-
-                       const clip = new this(clipName, duration, tracks, blendMode);
-                       return clip;
-               }
-
-               resetDuration() {
-                       const tracks = this.tracks;
-                       let duration = 0;
-
-                       for (let i = 0, n = tracks.length; i !== n; ++i) {
-                               const track = this.tracks[i];
-                               duration = Math.max(duration, track.times[track.times.length - 1]);
-                       }
-
-                       this.duration = duration;
-                       return this;
-               }
-
-               trim() {
-                       for (let i = 0; i < this.tracks.length; i++) {
-                               this.tracks[i].trim(0, this.duration);
-                       }
-
-                       return this;
-               }
-
-               validate() {
-                       let valid = true;
-
-                       for (let i = 0; i < this.tracks.length; i++) {
-                               valid = valid && this.tracks[i].validate();
-                       }
-
-                       return valid;
-               }
-
-               optimize() {
-                       for (let i = 0; i < this.tracks.length; i++) {
-                               this.tracks[i].optimize();
-                       }
-
-                       return this;
-               }
-
-               clone() {
-                       const tracks = [];
-
-                       for (let i = 0; i < this.tracks.length; i++) {
-                               tracks.push(this.tracks[i].clone());
-                       }
-
-                       return new this.constructor(this.name, this.duration, tracks, this.blendMode);
-               }
-
-               toJSON() {
-                       return this.constructor.toJSON(this);
-               }
-
-       }
-
-       function getTrackTypeForValueTypeName(typeName) {
-               switch (typeName.toLowerCase()) {
-                       case 'scalar':
-                       case 'double':
-                       case 'float':
-                       case 'number':
-                       case 'integer':
-                               return NumberKeyframeTrack;
-
-                       case 'vector':
-                       case 'vector2':
-                       case 'vector3':
-                       case 'vector4':
-                               return VectorKeyframeTrack;
-
-                       case 'color':
-                               return ColorKeyframeTrack;
-
-                       case 'quaternion':
-                               return QuaternionKeyframeTrack;
-
-                       case 'bool':
-                       case 'boolean':
-                               return BooleanKeyframeTrack;
-
-                       case 'string':
-                               return StringKeyframeTrack;
-               }
-
-               throw new Error('THREE.KeyframeTrack: Unsupported typeName: ' + typeName);
-       }
-
-       function parseKeyframeTrack(json) {
-               if (json.type === undefined) {
-                       throw new Error('THREE.KeyframeTrack: track type undefined, can not parse');
-               }
-
-               const trackType = getTrackTypeForValueTypeName(json.type);
-
-               if (json.times === undefined) {
-                       const times = [],
-                                               values = [];
-                       AnimationUtils.flattenJSON(json.keys, times, values, 'value');
-                       json.times = times;
-                       json.values = values;
-               } // derived classes can define a static parse method
-
-
-               if (trackType.parse !== undefined) {
-                       return trackType.parse(json);
-               } else {
-                       // by default, we assume a constructor compatible with the base
-                       return new trackType(json.name, json.times, json.values, json.interpolation);
-               }
-       }
-
-       const Cache = {
-               enabled: false,
-               files: {},
-               add: function (key, file) {
-                       if (this.enabled === false) return; // console.log( 'THREE.Cache', 'Adding key:', key );
-
-                       this.files[key] = file;
-               },
-               get: function (key) {
-                       if (this.enabled === false) return; // console.log( 'THREE.Cache', 'Checking key:', key );
-
-                       return this.files[key];
-               },
-               remove: function (key) {
-                       delete this.files[key];
-               },
-               clear: function () {
-                       this.files = {};
-               }
-       };
-
-       class LoadingManager {
-               constructor(onLoad, onProgress, onError) {
-                       const scope = this;
-                       let isLoading = false;
-                       let itemsLoaded = 0;
-                       let itemsTotal = 0;
-                       let urlModifier = undefined;
-                       const handlers = []; // Refer to #5689 for the reason why we don't set .onStart
-                       // in the constructor
-
-                       this.onStart = undefined;
-                       this.onLoad = onLoad;
-                       this.onProgress = onProgress;
-                       this.onError = onError;
-
-                       this.itemStart = function (url) {
-                               itemsTotal++;
-
-                               if (isLoading === false) {
-                                       if (scope.onStart !== undefined) {
-                                               scope.onStart(url, itemsLoaded, itemsTotal);
-                                       }
-                               }
-
-                               isLoading = true;
-                       };
-
-                       this.itemEnd = function (url) {
-                               itemsLoaded++;
-
-                               if (scope.onProgress !== undefined) {
-                                       scope.onProgress(url, itemsLoaded, itemsTotal);
-                               }
-
-                               if (itemsLoaded === itemsTotal) {
-                                       isLoading = false;
-
-                                       if (scope.onLoad !== undefined) {
-                                               scope.onLoad();
-                                       }
-                               }
-                       };
-
-                       this.itemError = function (url) {
-                               if (scope.onError !== undefined) {
-                                       scope.onError(url);
-                               }
-                       };
-
-                       this.resolveURL = function (url) {
-                               if (urlModifier) {
-                                       return urlModifier(url);
-                               }
-
-                               return url;
-                       };
-
-                       this.setURLModifier = function (transform) {
-                               urlModifier = transform;
-                               return this;
-                       };
-
-                       this.addHandler = function (regex, loader) {
-                               handlers.push(regex, loader);
-                               return this;
-                       };
-
-                       this.removeHandler = function (regex) {
-                               const index = handlers.indexOf(regex);
-
-                               if (index !== -1) {
-                                       handlers.splice(index, 2);
-                               }
-
-                               return this;
-                       };
-
-                       this.getHandler = function (file) {
-                               for (let i = 0, l = handlers.length; i < l; i += 2) {
-                                       const regex = handlers[i];
-                                       const loader = handlers[i + 1];
-                                       if (regex.global) regex.lastIndex = 0; // see #17920
-
-                                       if (regex.test(file)) {
-                                               return loader;
-                                       }
-                               }
-
-                               return null;
-                       };
-               }
-
-       }
-
-       const DefaultLoadingManager = new LoadingManager();
-
-       class Loader {
-               constructor(manager) {
-                       this.manager = manager !== undefined ? manager : DefaultLoadingManager;
-                       this.crossOrigin = 'anonymous';
-                       this.withCredentials = false;
-                       this.path = '';
-                       this.resourcePath = '';
-                       this.requestHeader = {};
-               }
-
-               load() {}
-
-               loadAsync(url, onProgress) {
-                       const scope = this;
-                       return new Promise(function (resolve, reject) {
-                               scope.load(url, resolve, onProgress, reject);
-                       });
-               }
-
-               parse() {}
-
-               setCrossOrigin(crossOrigin) {
-                       this.crossOrigin = crossOrigin;
-                       return this;
-               }
-
-               setWithCredentials(value) {
-                       this.withCredentials = value;
-                       return this;
-               }
-
-               setPath(path) {
-                       this.path = path;
-                       return this;
-               }
-
-               setResourcePath(resourcePath) {
-                       this.resourcePath = resourcePath;
-                       return this;
-               }
-
-               setRequestHeader(requestHeader) {
-                       this.requestHeader = requestHeader;
-                       return this;
-               }
-
-       }
-
-       const loading = {};
-
-       class FileLoader extends Loader {
-               constructor(manager) {
-                       super(manager);
-               }
-
-               load(url, onLoad, onProgress, onError) {
-                       if (url === undefined) url = '';
-                       if (this.path !== undefined) url = this.path + url;
-                       url = this.manager.resolveURL(url);
-                       const scope = this;
-                       const cached = Cache.get(url);
-
-                       if (cached !== undefined) {
-                               scope.manager.itemStart(url);
-                               setTimeout(function () {
-                                       if (onLoad) onLoad(cached);
-                                       scope.manager.itemEnd(url);
-                               }, 0);
-                               return cached;
-                       } // Check if request is duplicate
-
-
-                       if (loading[url] !== undefined) {
-                               loading[url].push({
-                                       onLoad: onLoad,
-                                       onProgress: onProgress,
-                                       onError: onError
-                               });
-                               return;
-                       } // Check for data: URI
-
-
-                       const dataUriRegex = /^data:(.*?)(;base64)?,(.*)$/;
-                       const dataUriRegexResult = url.match(dataUriRegex);
-                       let request; // Safari can not handle Data URIs through XMLHttpRequest so process manually
-
-                       if (dataUriRegexResult) {
-                               const mimeType = dataUriRegexResult[1];
-                               const isBase64 = !!dataUriRegexResult[2];
-                               let data = dataUriRegexResult[3];
-                               data = decodeURIComponent(data);
-                               if (isBase64) data = atob(data);
-
-                               try {
-                                       let response;
-                                       const responseType = (this.responseType || '').toLowerCase();
-
-                                       switch (responseType) {
-                                               case 'arraybuffer':
-                                               case 'blob':
-                                                       const view = new Uint8Array(data.length);
-
-                                                       for (let i = 0; i < data.length; i++) {
-                                                               view[i] = data.charCodeAt(i);
-                                                       }
-
-                                                       if (responseType === 'blob') {
-                                                               response = new Blob([view.buffer], {
-                                                                       type: mimeType
-                                                               });
-                                                       } else {
-                                                               response = view.buffer;
-                                                       }
-
-                                                       break;
-
-                                               case 'document':
-                                                       const parser = new DOMParser();
-                                                       response = parser.parseFromString(data, mimeType);
-                                                       break;
-
-                                               case 'json':
-                                                       response = JSON.parse(data);
-                                                       break;
-
-                                               default:
-                                                       // 'text' or other
-                                                       response = data;
-                                                       break;
-                                       } // Wait for next browser tick like standard XMLHttpRequest event dispatching does
-
-
-                                       setTimeout(function () {
-                                               if (onLoad) onLoad(response);
-                                               scope.manager.itemEnd(url);
-                                       }, 0);
-                               } catch (error) {
-                                       // Wait for next browser tick like standard XMLHttpRequest event dispatching does
-                                       setTimeout(function () {
-                                               if (onError) onError(error);
-                                               scope.manager.itemError(url);
-                                               scope.manager.itemEnd(url);
-                                       }, 0);
-                               }
-                       } else {
-                               // Initialise array for duplicate requests
-                               loading[url] = [];
-                               loading[url].push({
-                                       onLoad: onLoad,
-                                       onProgress: onProgress,
-                                       onError: onError
-                               });
-                               request = new XMLHttpRequest();
-                               request.open('GET', url, true);
-                               request.addEventListener('load', function (event) {
-                                       const response = this.response;
-                                       const callbacks = loading[url];
-                                       delete loading[url];
-
-                                       if (this.status === 200 || this.status === 0) {
-                                               // Some browsers return HTTP Status 0 when using non-http protocol
-                                               // e.g. 'file://' or 'data://'. Handle as success.
-                                               if (this.status === 0) console.warn('THREE.FileLoader: HTTP Status 0 received.'); // Add to cache only on HTTP success, so that we do not cache
-                                               // error response bodies as proper responses to requests.
-
-                                               Cache.add(url, response);
-
-                                               for (let i = 0, il = callbacks.length; i < il; i++) {
-                                                       const callback = callbacks[i];
-                                                       if (callback.onLoad) callback.onLoad(response);
-                                               }
-
-                                               scope.manager.itemEnd(url);
-                                       } else {
-                                               for (let i = 0, il = callbacks.length; i < il; i++) {
-                                                       const callback = callbacks[i];
-                                                       if (callback.onError) callback.onError(event);
-                                               }
-
-                                               scope.manager.itemError(url);
-                                               scope.manager.itemEnd(url);
-                                       }
-                               }, false);
-                               request.addEventListener('progress', function (event) {
-                                       const callbacks = loading[url];
-
-                                       for (let i = 0, il = callbacks.length; i < il; i++) {
-                                               const callback = callbacks[i];
-                                               if (callback.onProgress) callback.onProgress(event);
-                                       }
-                               }, false);
-                               request.addEventListener('error', function (event) {
-                                       const callbacks = loading[url];
-                                       delete loading[url];
-
-                                       for (let i = 0, il = callbacks.length; i < il; i++) {
-                                               const callback = callbacks[i];
-                                               if (callback.onError) callback.onError(event);
-                                       }
-
-                                       scope.manager.itemError(url);
-                                       scope.manager.itemEnd(url);
-                               }, false);
-                               request.addEventListener('abort', function (event) {
-                                       const callbacks = loading[url];
-                                       delete loading[url];
-
-                                       for (let i = 0, il = callbacks.length; i < il; i++) {
-                                               const callback = callbacks[i];
-                                               if (callback.onError) callback.onError(event);
-                                       }
-
-                                       scope.manager.itemError(url);
-                                       scope.manager.itemEnd(url);
-                               }, false);
-                               if (this.responseType !== undefined) request.responseType = this.responseType;
-                               if (this.withCredentials !== undefined) request.withCredentials = this.withCredentials;
-                               if (request.overrideMimeType) request.overrideMimeType(this.mimeType !== undefined ? this.mimeType : 'text/plain');
-
-                               for (const header in this.requestHeader) {
-                                       request.setRequestHeader(header, this.requestHeader[header]);
-                               }
-
-                               request.send(null);
-                       }
-
-                       scope.manager.itemStart(url);
-                       return request;
-               }
-
-               setResponseType(value) {
-                       this.responseType = value;
-                       return this;
-               }
-
-               setMimeType(value) {
-                       this.mimeType = value;
-                       return this;
-               }
-
-       }
-
-       class AnimationLoader extends Loader {
-               constructor(manager) {
-                       super(manager);
-               }
-
-               load(url, onLoad, onProgress, onError) {
-                       const scope = this;
-                       const loader = new FileLoader(this.manager);
-                       loader.setPath(this.path);
-                       loader.setRequestHeader(this.requestHeader);
-                       loader.setWithCredentials(this.withCredentials);
-                       loader.load(url, function (text) {
-                               try {
-                                       onLoad(scope.parse(JSON.parse(text)));
-                               } catch (e) {
-                                       if (onError) {
-                                               onError(e);
-                                       } else {
-                                               console.error(e);
-                                       }
-
-                                       scope.manager.itemError(url);
-                               }
-                       }, onProgress, onError);
-               }
-
-               parse(json) {
-                       const animations = [];
-
-                       for (let i = 0; i < json.length; i++) {
-                               const clip = AnimationClip.parse(json[i]);
-                               animations.push(clip);
-                       }
-
-                       return animations;
-               }
-
-       }
-
-       /**
-        * Abstract Base class to block based textures loader (dds, pvr, ...)
-        *
-        * Sub classes have to implement the parse() method which will be used in load().
-        */
-
-       class CompressedTextureLoader extends Loader {
-               constructor(manager) {
-                       super(manager);
-               }
-
-               load(url, onLoad, onProgress, onError) {
-                       const scope = this;
-                       const images = [];
-                       const texture = new CompressedTexture();
-                       const loader = new FileLoader(this.manager);
-                       loader.setPath(this.path);
-                       loader.setResponseType('arraybuffer');
-                       loader.setRequestHeader(this.requestHeader);
-                       loader.setWithCredentials(scope.withCredentials);
-                       let loaded = 0;
-
-                       function loadTexture(i) {
-                               loader.load(url[i], function (buffer) {
-                                       const texDatas = scope.parse(buffer, true);
-                                       images[i] = {
-                                               width: texDatas.width,
-                                               height: texDatas.height,
-                                               format: texDatas.format,
-                                               mipmaps: texDatas.mipmaps
-                                       };
-                                       loaded += 1;
-
-                                       if (loaded === 6) {
-                                               if (texDatas.mipmapCount === 1) texture.minFilter = LinearFilter;
-                                               texture.image = images;
-                                               texture.format = texDatas.format;
-                                               texture.needsUpdate = true;
-                                               if (onLoad) onLoad(texture);
-                                       }
-                               }, onProgress, onError);
-                       }
-
-                       if (Array.isArray(url)) {
-                               for (let i = 0, il = url.length; i < il; ++i) {
-                                       loadTexture(i);
-                               }
-                       } else {
-                               // compressed cubemap texture stored in a single DDS file
-                               loader.load(url, function (buffer) {
-                                       const texDatas = scope.parse(buffer, true);
-
-                                       if (texDatas.isCubemap) {
-                                               const faces = texDatas.mipmaps.length / texDatas.mipmapCount;
-
-                                               for (let f = 0; f < faces; f++) {
-                                                       images[f] = {
-                                                               mipmaps: []
-                                                       };
-
-                                                       for (let i = 0; i < texDatas.mipmapCount; i++) {
-                                                               images[f].mipmaps.push(texDatas.mipmaps[f * texDatas.mipmapCount + i]);
-                                                               images[f].format = texDatas.format;
-                                                               images[f].width = texDatas.width;
-                                                               images[f].height = texDatas.height;
-                                                       }
-                                               }
-
-                                               texture.image = images;
-                                       } else {
-                                               texture.image.width = texDatas.width;
-                                               texture.image.height = texDatas.height;
-                                               texture.mipmaps = texDatas.mipmaps;
-                                       }
-
-                                       if (texDatas.mipmapCount === 1) {
-                                               texture.minFilter = LinearFilter;
-                                       }
-
-                                       texture.format = texDatas.format;
-                                       texture.needsUpdate = true;
-                                       if (onLoad) onLoad(texture);
-                               }, onProgress, onError);
-                       }
-
-                       return texture;
-               }
-
-       }
-
-       class ImageLoader extends Loader {
-               constructor(manager) {
-                       super(manager);
-               }
-
-               load(url, onLoad, onProgress, onError) {
-                       if (this.path !== undefined) url = this.path + url;
-                       url = this.manager.resolveURL(url);
-                       const scope = this;
-                       const cached = Cache.get(url);
-
-                       if (cached !== undefined) {
-                               scope.manager.itemStart(url);
-                               setTimeout(function () {
-                                       if (onLoad) onLoad(cached);
-                                       scope.manager.itemEnd(url);
-                               }, 0);
-                               return cached;
-                       }
-
-                       const image = document.createElementNS('http://www.w3.org/1999/xhtml', 'img');
-
-                       function onImageLoad() {
-                               image.removeEventListener('load', onImageLoad, false);
-                               image.removeEventListener('error', onImageError, false);
-                               Cache.add(url, this);
-                               if (onLoad) onLoad(this);
-                               scope.manager.itemEnd(url);
-                       }
-
-                       function onImageError(event) {
-                               image.removeEventListener('load', onImageLoad, false);
-                               image.removeEventListener('error', onImageError, false);
-                               if (onError) onError(event);
-                               scope.manager.itemError(url);
-                               scope.manager.itemEnd(url);
-                       }
-
-                       image.addEventListener('load', onImageLoad, false);
-                       image.addEventListener('error', onImageError, false);
-
-                       if (url.substr(0, 5) !== 'data:') {
-                               if (this.crossOrigin !== undefined) image.crossOrigin = this.crossOrigin;
-                       }
-
-                       scope.manager.itemStart(url);
-                       image.src = url;
-                       return image;
-               }
-
-       }
-
-       class CubeTextureLoader extends Loader {
-               constructor(manager) {
-                       super(manager);
-               }
-
-               load(urls, onLoad, onProgress, onError) {
-                       const texture = new CubeTexture();
-                       const loader = new ImageLoader(this.manager);
-                       loader.setCrossOrigin(this.crossOrigin);
-                       loader.setPath(this.path);
-                       let loaded = 0;
-
-                       function loadTexture(i) {
-                               loader.load(urls[i], function (image) {
-                                       texture.images[i] = image;
-                                       loaded++;
-
-                                       if (loaded === 6) {
-                                               texture.needsUpdate = true;
-                                               if (onLoad) onLoad(texture);
-                                       }
-                               }, undefined, onError);
-                       }
-
-                       for (let i = 0; i < urls.length; ++i) {
-                               loadTexture(i);
-                       }
-
-                       return texture;
-               }
-
-       }
-
-       /**
-        * Abstract Base class to load generic binary textures formats (rgbe, hdr, ...)
-        *
-        * Sub classes have to implement the parse() method which will be used in load().
-        */
-
-       class DataTextureLoader extends Loader {
-               constructor(manager) {
-                       super(manager);
-               }
-
-               load(url, onLoad, onProgress, onError) {
-                       const scope = this;
-                       const texture = new DataTexture();
-                       const loader = new FileLoader(this.manager);
-                       loader.setResponseType('arraybuffer');
-                       loader.setRequestHeader(this.requestHeader);
-                       loader.setPath(this.path);
-                       loader.setWithCredentials(scope.withCredentials);
-                       loader.load(url, function (buffer) {
-                               const texData = scope.parse(buffer);
-                               if (!texData) return;
-
-                               if (texData.image !== undefined) {
-                                       texture.image = texData.image;
-                               } else if (texData.data !== undefined) {
-                                       texture.image.width = texData.width;
-                                       texture.image.height = texData.height;
-                                       texture.image.data = texData.data;
-                               }
-
-                               texture.wrapS = texData.wrapS !== undefined ? texData.wrapS : ClampToEdgeWrapping;
-                               texture.wrapT = texData.wrapT !== undefined ? texData.wrapT : ClampToEdgeWrapping;
-                               texture.magFilter = texData.magFilter !== undefined ? texData.magFilter : LinearFilter;
-                               texture.minFilter = texData.minFilter !== undefined ? texData.minFilter : LinearFilter;
-                               texture.anisotropy = texData.anisotropy !== undefined ? texData.anisotropy : 1;
-
-                               if (texData.encoding !== undefined) {
-                                       texture.encoding = texData.encoding;
-                               }
-
-                               if (texData.flipY !== undefined) {
-                                       texture.flipY = texData.flipY;
-                               }
-
-                               if (texData.format !== undefined) {
-                                       texture.format = texData.format;
-                               }
-
-                               if (texData.type !== undefined) {
-                                       texture.type = texData.type;
-                               }
-
-                               if (texData.mipmaps !== undefined) {
-                                       texture.mipmaps = texData.mipmaps;
-                                       texture.minFilter = LinearMipmapLinearFilter; // presumably...
-                               }
-
-                               if (texData.mipmapCount === 1) {
-                                       texture.minFilter = LinearFilter;
-                               }
-
-                               if (texData.generateMipmaps !== undefined) {
-                                       texture.generateMipmaps = texData.generateMipmaps;
-                               }
-
-                               texture.needsUpdate = true;
-                               if (onLoad) onLoad(texture, texData);
-                       }, onProgress, onError);
-                       return texture;
-               }
-
-       }
-
-       class TextureLoader extends Loader {
-               constructor(manager) {
-                       super(manager);
-               }
-
-               load(url, onLoad, onProgress, onError) {
-                       const texture = new Texture();
-                       const loader = new ImageLoader(this.manager);
-                       loader.setCrossOrigin(this.crossOrigin);
-                       loader.setPath(this.path);
-                       loader.load(url, function (image) {
-                               texture.image = image; // JPEGs can't have an alpha channel, so memory can be saved by storing them as RGB.
-
-                               const isJPEG = url.search(/\.jpe?g($|\?)/i) > 0 || url.search(/^data\:image\/jpeg/) === 0;
-                               texture.format = isJPEG ? RGBFormat : RGBAFormat;
-                               texture.needsUpdate = true;
-
-                               if (onLoad !== undefined) {
-                                       onLoad(texture);
-                               }
-                       }, onProgress, onError);
-                       return texture;
-               }
-
-       }
-
-       /**************************************************************
-        *      Curved Path - a curve path is simply a array of connected
-        *      curves, but retains the api of a curve
-        **************************************************************/
-
-       class CurvePath extends Curve {
-               constructor() {
-                       super();
-                       this.type = 'CurvePath';
-                       this.curves = [];
-                       this.autoClose = false; // Automatically closes the path
-               }
-
-               add(curve) {
-                       this.curves.push(curve);
-               }
-
-               closePath() {
-                       // Add a line curve if start and end of lines are not connected
-                       const startPoint = this.curves[0].getPoint(0);
-                       const endPoint = this.curves[this.curves.length - 1].getPoint(1);
-
-                       if (!startPoint.equals(endPoint)) {
-                               this.curves.push(new LineCurve(endPoint, startPoint));
-                       }
-               } // To get accurate point with reference to
-               // entire path distance at time t,
-               // following has to be done:
-               // 1. Length of each sub path have to be known
-               // 2. Locate and identify type of curve
-               // 3. Get t for the curve
-               // 4. Return curve.getPointAt(t')
-
-
-               getPoint(t) {
-                       const d = t * this.getLength();
-                       const curveLengths = this.getCurveLengths();
-                       let i = 0; // To think about boundaries points.
-
-                       while (i < curveLengths.length) {
-                               if (curveLengths[i] >= d) {
-                                       const diff = curveLengths[i] - d;
-                                       const curve = this.curves[i];
-                                       const segmentLength = curve.getLength();
-                                       const u = segmentLength === 0 ? 0 : 1 - diff / segmentLength;
-                                       return curve.getPointAt(u);
-                               }
-
-                               i++;
-                       }
-
-                       return null; // loop where sum != 0, sum > d , sum+1 <d
-               } // We cannot use the default THREE.Curve getPoint() with getLength() because in
-               // THREE.Curve, getLength() depends on getPoint() but in THREE.CurvePath
-               // getPoint() depends on getLength
-
-
-               getLength() {
-                       const lens = this.getCurveLengths();
-                       return lens[lens.length - 1];
-               } // cacheLengths must be recalculated.
-
-
-               updateArcLengths() {
-                       this.needsUpdate = true;
-                       this.cacheLengths = null;
-                       this.getCurveLengths();
-               } // Compute lengths and cache them
-               // We cannot overwrite getLengths() because UtoT mapping uses it.
-
-
-               getCurveLengths() {
-                       // We use cache values if curves and cache array are same length
-                       if (this.cacheLengths && this.cacheLengths.length === this.curves.length) {
-                               return this.cacheLengths;
-                       } // Get length of sub-curve
-                       // Push sums into cached array
-
-
-                       const lengths = [];
-                       let sums = 0;
-
-                       for (let i = 0, l = this.curves.length; i < l; i++) {
-                               sums += this.curves[i].getLength();
-                               lengths.push(sums);
-                       }
-
-                       this.cacheLengths = lengths;
-                       return lengths;
-               }
-
-               getSpacedPoints(divisions = 40) {
-                       const points = [];
-
-                       for (let i = 0; i <= divisions; i++) {
-                               points.push(this.getPoint(i / divisions));
-                       }
-
-                       if (this.autoClose) {
-                               points.push(points[0]);
-                       }
-
-                       return points;
-               }
-
-               getPoints(divisions = 12) {
-                       const points = [];
-                       let last;
-
-                       for (let i = 0, curves = this.curves; i < curves.length; i++) {
-                               const curve = curves[i];
-                               const resolution = curve && curve.isEllipseCurve ? divisions * 2 : curve && (curve.isLineCurve || curve.isLineCurve3) ? 1 : curve && curve.isSplineCurve ? divisions * curve.points.length : divisions;
-                               const pts = curve.getPoints(resolution);
-
-                               for (let j = 0; j < pts.length; j++) {
-                                       const point = pts[j];
-                                       if (last && last.equals(point)) continue; // ensures no consecutive points are duplicates
-
-                                       points.push(point);
-                                       last = point;
-                               }
-                       }
-
-                       if (this.autoClose && points.length > 1 && !points[points.length - 1].equals(points[0])) {
-                               points.push(points[0]);
-                       }
-
-                       return points;
-               }
-
-               copy(source) {
-                       super.copy(source);
-                       this.curves = [];
-
-                       for (let i = 0, l = source.curves.length; i < l; i++) {
-                               const curve = source.curves[i];
-                               this.curves.push(curve.clone());
-                       }
-
-                       this.autoClose = source.autoClose;
-                       return this;
-               }
-
-               toJSON() {
-                       const data = super.toJSON();
-                       data.autoClose = this.autoClose;
-                       data.curves = [];
-
-                       for (let i = 0, l = this.curves.length; i < l; i++) {
-                               const curve = this.curves[i];
-                               data.curves.push(curve.toJSON());
-                       }
-
-                       return data;
-               }
-
-               fromJSON(json) {
-                       super.fromJSON(json);
-                       this.autoClose = json.autoClose;
-                       this.curves = [];
-
-                       for (let i = 0, l = json.curves.length; i < l; i++) {
-                               const curve = json.curves[i];
-                               this.curves.push(new Curves[curve.type]().fromJSON(curve));
-                       }
-
-                       return this;
-               }
-
-       }
-
-       class Path extends CurvePath {
-               constructor(points) {
-                       super();
-                       this.type = 'Path';
-                       this.currentPoint = new Vector2();
-
-                       if (points) {
-                               this.setFromPoints(points);
-                       }
-               }
-
-               setFromPoints(points) {
-                       this.moveTo(points[0].x, points[0].y);
-
-                       for (let i = 1, l = points.length; i < l; i++) {
-                               this.lineTo(points[i].x, points[i].y);
-                       }
-
-                       return this;
-               }
-
-               moveTo(x, y) {
-                       this.currentPoint.set(x, y); // TODO consider referencing vectors instead of copying?
-
-                       return this;
-               }
-
-               lineTo(x, y) {
-                       const curve = new LineCurve(this.currentPoint.clone(), new Vector2(x, y));
-                       this.curves.push(curve);
-                       this.currentPoint.set(x, y);
-                       return this;
-               }
-
-               quadraticCurveTo(aCPx, aCPy, aX, aY) {
-                       const curve = new QuadraticBezierCurve(this.currentPoint.clone(), new Vector2(aCPx, aCPy), new Vector2(aX, aY));
-                       this.curves.push(curve);
-                       this.currentPoint.set(aX, aY);
-                       return this;
-               }
-
-               bezierCurveTo(aCP1x, aCP1y, aCP2x, aCP2y, aX, aY) {
-                       const curve = new CubicBezierCurve(this.currentPoint.clone(), new Vector2(aCP1x, aCP1y), new Vector2(aCP2x, aCP2y), new Vector2(aX, aY));
-                       this.curves.push(curve);
-                       this.currentPoint.set(aX, aY);
-                       return this;
-               }
-
-               splineThru(pts
-               /*Array of Vector*/
-               ) {
-                       const npts = [this.currentPoint.clone()].concat(pts);
-                       const curve = new SplineCurve(npts);
-                       this.curves.push(curve);
-                       this.currentPoint.copy(pts[pts.length - 1]);
-                       return this;
-               }
-
-               arc(aX, aY, aRadius, aStartAngle, aEndAngle, aClockwise) {
-                       const x0 = this.currentPoint.x;
-                       const y0 = this.currentPoint.y;
-                       this.absarc(aX + x0, aY + y0, aRadius, aStartAngle, aEndAngle, aClockwise);
-                       return this;
-               }
-
-               absarc(aX, aY, aRadius, aStartAngle, aEndAngle, aClockwise) {
-                       this.absellipse(aX, aY, aRadius, aRadius, aStartAngle, aEndAngle, aClockwise);
-                       return this;
-               }
-
-               ellipse(aX, aY, xRadius, yRadius, aStartAngle, aEndAngle, aClockwise, aRotation) {
-                       const x0 = this.currentPoint.x;
-                       const y0 = this.currentPoint.y;
-                       this.absellipse(aX + x0, aY + y0, xRadius, yRadius, aStartAngle, aEndAngle, aClockwise, aRotation);
-                       return this;
-               }
-
-               absellipse(aX, aY, xRadius, yRadius, aStartAngle, aEndAngle, aClockwise, aRotation) {
-                       const curve = new EllipseCurve(aX, aY, xRadius, yRadius, aStartAngle, aEndAngle, aClockwise, aRotation);
-
-                       if (this.curves.length > 0) {
-                               // if a previous curve is present, attempt to join
-                               const firstPoint = curve.getPoint(0);
-
-                               if (!firstPoint.equals(this.currentPoint)) {
-                                       this.lineTo(firstPoint.x, firstPoint.y);
-                               }
-                       }
-
-                       this.curves.push(curve);
-                       const lastPoint = curve.getPoint(1);
-                       this.currentPoint.copy(lastPoint);
-                       return this;
-               }
-
-               copy(source) {
-                       super.copy(source);
-                       this.currentPoint.copy(source.currentPoint);
-                       return this;
-               }
-
-               toJSON() {
-                       const data = super.toJSON();
-                       data.currentPoint = this.currentPoint.toArray();
-                       return data;
-               }
-
-               fromJSON(json) {
-                       super.fromJSON(json);
-                       this.currentPoint.fromArray(json.currentPoint);
-                       return this;
-               }
-
-       }
-
-       class Shape extends Path {
-               constructor(points) {
-                       super(points);
-                       this.uuid = generateUUID();
-                       this.type = 'Shape';
-                       this.holes = [];
-               }
-
-               getPointsHoles(divisions) {
-                       const holesPts = [];
-
-                       for (let i = 0, l = this.holes.length; i < l; i++) {
-                               holesPts[i] = this.holes[i].getPoints(divisions);
-                       }
-
-                       return holesPts;
-               } // get points of shape and holes (keypoints based on segments parameter)
-
-
-               extractPoints(divisions) {
-                       return {
-                               shape: this.getPoints(divisions),
-                               holes: this.getPointsHoles(divisions)
-                       };
-               }
-
-               copy(source) {
-                       super.copy(source);
-                       this.holes = [];
-
-                       for (let i = 0, l = source.holes.length; i < l; i++) {
-                               const hole = source.holes[i];
-                               this.holes.push(hole.clone());
-                       }
-
-                       return this;
-               }
-
-               toJSON() {
-                       const data = super.toJSON();
-                       data.uuid = this.uuid;
-                       data.holes = [];
-
-                       for (let i = 0, l = this.holes.length; i < l; i++) {
-                               const hole = this.holes[i];
-                               data.holes.push(hole.toJSON());
-                       }
-
-                       return data;
-               }
-
-               fromJSON(json) {
-                       super.fromJSON(json);
-                       this.uuid = json.uuid;
-                       this.holes = [];
-
-                       for (let i = 0, l = json.holes.length; i < l; i++) {
-                               const hole = json.holes[i];
-                               this.holes.push(new Path().fromJSON(hole));
-                       }
-
-                       return this;
-               }
-
-       }
-
-       class Light extends Object3D {
-               constructor(color, intensity = 1) {
-                       super();
-                       this.type = 'Light';
-                       this.color = new Color(color);
-                       this.intensity = intensity;
-               }
-
-               dispose() {// Empty here in base class; some subclasses override.
-               }
-
-               copy(source) {
-                       super.copy(source);
-                       this.color.copy(source.color);
-                       this.intensity = source.intensity;
-                       return this;
-               }
-
-               toJSON(meta) {
-                       const data = super.toJSON(meta);
-                       data.object.color = this.color.getHex();
-                       data.object.intensity = this.intensity;
-                       if (this.groundColor !== undefined) data.object.groundColor = this.groundColor.getHex();
-                       if (this.distance !== undefined) data.object.distance = this.distance;
-                       if (this.angle !== undefined) data.object.angle = this.angle;
-                       if (this.decay !== undefined) data.object.decay = this.decay;
-                       if (this.penumbra !== undefined) data.object.penumbra = this.penumbra;
-                       if (this.shadow !== undefined) data.object.shadow = this.shadow.toJSON();
-                       return data;
-               }
-
-       }
-
-       Light.prototype.isLight = true;
-
-       class HemisphereLight extends Light {
-               constructor(skyColor, groundColor, intensity) {
-                       super(skyColor, intensity);
-                       this.type = 'HemisphereLight';
-                       this.position.copy(Object3D.DefaultUp);
-                       this.updateMatrix();
-                       this.groundColor = new Color(groundColor);
-               }
-
-               copy(source) {
-                       Light.prototype.copy.call(this, source);
-                       this.groundColor.copy(source.groundColor);
-                       return this;
-               }
-
-       }
-
-       HemisphereLight.prototype.isHemisphereLight = true;
-
-       const _projScreenMatrix$1 = /*@__PURE__*/new Matrix4();
-
-       const _lightPositionWorld$1 = /*@__PURE__*/new Vector3();
-
-       const _lookTarget$1 = /*@__PURE__*/new Vector3();
-
-       class LightShadow {
-               constructor(camera) {
-                       this.camera = camera;
-                       this.bias = 0;
-                       this.normalBias = 0;
-                       this.radius = 1;
-                       this.blurSamples = 8;
-                       this.mapSize = new Vector2(512, 512);
-                       this.map = null;
-                       this.mapPass = null;
-                       this.matrix = new Matrix4();
-                       this.autoUpdate = true;
-                       this.needsUpdate = false;
-                       this._frustum = new Frustum();
-                       this._frameExtents = new Vector2(1, 1);
-                       this._viewportCount = 1;
-                       this._viewports = [new Vector4(0, 0, 1, 1)];
-               }
-
-               getViewportCount() {
-                       return this._viewportCount;
-               }
-
-               getFrustum() {
-                       return this._frustum;
-               }
-
-               updateMatrices(light) {
-                       const shadowCamera = this.camera;
-                       const shadowMatrix = this.matrix;
-
-                       _lightPositionWorld$1.setFromMatrixPosition(light.matrixWorld);
-
-                       shadowCamera.position.copy(_lightPositionWorld$1);
-
-                       _lookTarget$1.setFromMatrixPosition(light.target.matrixWorld);
-
-                       shadowCamera.lookAt(_lookTarget$1);
-                       shadowCamera.updateMatrixWorld();
-
-                       _projScreenMatrix$1.multiplyMatrices(shadowCamera.projectionMatrix, shadowCamera.matrixWorldInverse);
-
-                       this._frustum.setFromProjectionMatrix(_projScreenMatrix$1);
-
-                       shadowMatrix.set(0.5, 0.0, 0.0, 0.5, 0.0, 0.5, 0.0, 0.5, 0.0, 0.0, 0.5, 0.5, 0.0, 0.0, 0.0, 1.0);
-                       shadowMatrix.multiply(shadowCamera.projectionMatrix);
-                       shadowMatrix.multiply(shadowCamera.matrixWorldInverse);
-               }
-
-               getViewport(viewportIndex) {
-                       return this._viewports[viewportIndex];
-               }
-
-               getFrameExtents() {
-                       return this._frameExtents;
-               }
-
-               dispose() {
-                       if (this.map) {
-                               this.map.dispose();
-                       }
-
-                       if (this.mapPass) {
-                               this.mapPass.dispose();
-                       }
-               }
-
-               copy(source) {
-                       this.camera = source.camera.clone();
-                       this.bias = source.bias;
-                       this.radius = source.radius;
-                       this.mapSize.copy(source.mapSize);
-                       return this;
-               }
-
-               clone() {
-                       return new this.constructor().copy(this);
-               }
-
-               toJSON() {
-                       const object = {};
-                       if (this.bias !== 0) object.bias = this.bias;
-                       if (this.normalBias !== 0) object.normalBias = this.normalBias;
-                       if (this.radius !== 1) object.radius = this.radius;
-                       if (this.mapSize.x !== 512 || this.mapSize.y !== 512) object.mapSize = this.mapSize.toArray();
-                       object.camera = this.camera.toJSON(false).object;
-                       delete object.camera.matrix;
-                       return object;
-               }
-
-       }
-
-       class SpotLightShadow extends LightShadow {
-               constructor() {
-                       super(new PerspectiveCamera(50, 1, 0.5, 500));
-                       this.focus = 1;
-               }
-
-               updateMatrices(light) {
-                       const camera = this.camera;
-                       const fov = RAD2DEG * 2 * light.angle * this.focus;
-                       const aspect = this.mapSize.width / this.mapSize.height;
-                       const far = light.distance || camera.far;
-
-                       if (fov !== camera.fov || aspect !== camera.aspect || far !== camera.far) {
-                               camera.fov = fov;
-                               camera.aspect = aspect;
-                               camera.far = far;
-                               camera.updateProjectionMatrix();
-                       }
-
-                       super.updateMatrices(light);
-               }
-
-               copy(source) {
-                       super.copy(source);
-                       this.focus = source.focus;
-                       return this;
-               }
-
-       }
-
-       SpotLightShadow.prototype.isSpotLightShadow = true;
-
-       class SpotLight extends Light {
-               constructor(color, intensity, distance = 0, angle = Math.PI / 3, penumbra = 0, decay = 1) {
-                       super(color, intensity);
-                       this.type = 'SpotLight';
-                       this.position.copy(Object3D.DefaultUp);
-                       this.updateMatrix();
-                       this.target = new Object3D();
-                       this.distance = distance;
-                       this.angle = angle;
-                       this.penumbra = penumbra;
-                       this.decay = decay; // for physically correct lights, should be 2.
-
-                       this.shadow = new SpotLightShadow();
-               }
-
-               get power() {
-                       // compute the light's luminous power (in lumens) from its intensity (in candela)
-                       // by convention for a spotlight, luminous power (lm) = Ï€ * luminous intensity (cd)
-                       return this.intensity * Math.PI;
-               }
-
-               set power(power) {
-                       // set the light's intensity (in candela) from the desired luminous power (in lumens)
-                       this.intensity = power / Math.PI;
-               }
-
-               dispose() {
-                       this.shadow.dispose();
-               }
-
-               copy(source) {
-                       super.copy(source);
-                       this.distance = source.distance;
-                       this.angle = source.angle;
-                       this.penumbra = source.penumbra;
-                       this.decay = source.decay;
-                       this.target = source.target.clone();
-                       this.shadow = source.shadow.clone();
-                       return this;
-               }
-
-       }
-
-       SpotLight.prototype.isSpotLight = true;
-
-       const _projScreenMatrix = /*@__PURE__*/new Matrix4();
-
-       const _lightPositionWorld = /*@__PURE__*/new Vector3();
-
-       const _lookTarget = /*@__PURE__*/new Vector3();
-
-       class PointLightShadow extends LightShadow {
-               constructor() {
-                       super(new PerspectiveCamera(90, 1, 0.5, 500));
-                       this._frameExtents = new Vector2(4, 2);
-                       this._viewportCount = 6;
-                       this._viewports = [// These viewports map a cube-map onto a 2D texture with the
-                       // following orientation:
-                       //
-                       //      xzXZ
-                       //       y Y
-                       //
-                       // X - Positive x direction
-                       // x - Negative x direction
-                       // Y - Positive y direction
-                       // y - Negative y direction
-                       // Z - Positive z direction
-                       // z - Negative z direction
-                       // positive X
-                       new Vector4(2, 1, 1, 1), // negative X
-                       new Vector4(0, 1, 1, 1), // positive Z
-                       new Vector4(3, 1, 1, 1), // negative Z
-                       new Vector4(1, 1, 1, 1), // positive Y
-                       new Vector4(3, 0, 1, 1), // negative Y
-                       new Vector4(1, 0, 1, 1)];
-                       this._cubeDirections = [new Vector3(1, 0, 0), new Vector3(-1, 0, 0), new Vector3(0, 0, 1), new Vector3(0, 0, -1), new Vector3(0, 1, 0), new Vector3(0, -1, 0)];
-                       this._cubeUps = [new Vector3(0, 1, 0), new Vector3(0, 1, 0), new Vector3(0, 1, 0), new Vector3(0, 1, 0), new Vector3(0, 0, 1), new Vector3(0, 0, -1)];
-               }
-
-               updateMatrices(light, viewportIndex = 0) {
-                       const camera = this.camera;
-                       const shadowMatrix = this.matrix;
-                       const far = light.distance || camera.far;
-
-                       if (far !== camera.far) {
-                               camera.far = far;
-                               camera.updateProjectionMatrix();
-                       }
-
-                       _lightPositionWorld.setFromMatrixPosition(light.matrixWorld);
-
-                       camera.position.copy(_lightPositionWorld);
-
-                       _lookTarget.copy(camera.position);
-
-                       _lookTarget.add(this._cubeDirections[viewportIndex]);
-
-                       camera.up.copy(this._cubeUps[viewportIndex]);
-                       camera.lookAt(_lookTarget);
-                       camera.updateMatrixWorld();
-                       shadowMatrix.makeTranslation(-_lightPositionWorld.x, -_lightPositionWorld.y, -_lightPositionWorld.z);
-
-                       _projScreenMatrix.multiplyMatrices(camera.projectionMatrix, camera.matrixWorldInverse);
-
-                       this._frustum.setFromProjectionMatrix(_projScreenMatrix);
-               }
-
-       }
-
-       PointLightShadow.prototype.isPointLightShadow = true;
-
-       class PointLight extends Light {
-               constructor(color, intensity, distance = 0, decay = 1) {
-                       super(color, intensity);
-                       this.type = 'PointLight';
-                       this.distance = distance;
-                       this.decay = decay; // for physically correct lights, should be 2.
-
-                       this.shadow = new PointLightShadow();
-               }
-
-               get power() {
-                       // compute the light's luminous power (in lumens) from its intensity (in candela)
-                       // for an isotropic light source, luminous power (lm) = 4 Ï€ luminous intensity (cd)
-                       return this.intensity * 4 * Math.PI;
-               }
-
-               set power(power) {
-                       // set the light's intensity (in candela) from the desired luminous power (in lumens)
-                       this.intensity = power / (4 * Math.PI);
-               }
-
-               dispose() {
-                       this.shadow.dispose();
-               }
-
-               copy(source) {
-                       super.copy(source);
-                       this.distance = source.distance;
-                       this.decay = source.decay;
-                       this.shadow = source.shadow.clone();
-                       return this;
-               }
-
-       }
-
-       PointLight.prototype.isPointLight = true;
-
-       class DirectionalLightShadow extends LightShadow {
-               constructor() {
-                       super(new OrthographicCamera(-5, 5, 5, -5, 0.5, 500));
-               }
-
-       }
-
-       DirectionalLightShadow.prototype.isDirectionalLightShadow = true;
-
-       class DirectionalLight extends Light {
-               constructor(color, intensity) {
-                       super(color, intensity);
-                       this.type = 'DirectionalLight';
-                       this.position.copy(Object3D.DefaultUp);
-                       this.updateMatrix();
-                       this.target = new Object3D();
-                       this.shadow = new DirectionalLightShadow();
-               }
-
-               dispose() {
-                       this.shadow.dispose();
-               }
-
-               copy(source) {
-                       super.copy(source);
-                       this.target = source.target.clone();
-                       this.shadow = source.shadow.clone();
-                       return this;
-               }
-
-       }
-
-       DirectionalLight.prototype.isDirectionalLight = true;
-
-       class AmbientLight extends Light {
-               constructor(color, intensity) {
-                       super(color, intensity);
-                       this.type = 'AmbientLight';
-               }
-
-       }
-
-       AmbientLight.prototype.isAmbientLight = true;
-
-       class RectAreaLight extends Light {
-               constructor(color, intensity, width = 10, height = 10) {
-                       super(color, intensity);
-                       this.type = 'RectAreaLight';
-                       this.width = width;
-                       this.height = height;
-               }
-
-               get power() {
-                       // compute the light's luminous power (in lumens) from its intensity (in nits)
-                       return this.intensity * this.width * this.height * Math.PI;
-               }
-
-               set power(power) {
-                       // set the light's intensity (in nits) from the desired luminous power (in lumens)
-                       this.intensity = power / (this.width * this.height * Math.PI);
-               }
-
-               copy(source) {
-                       super.copy(source);
-                       this.width = source.width;
-                       this.height = source.height;
-                       return this;
-               }
-
-               toJSON(meta) {
-                       const data = super.toJSON(meta);
-                       data.object.width = this.width;
-                       data.object.height = this.height;
-                       return data;
-               }
-
-       }
-
-       RectAreaLight.prototype.isRectAreaLight = true;
-
-       /**
-        * Primary reference:
-        *       https://graphics.stanford.edu/papers/envmap/envmap.pdf
-        *
-        * Secondary reference:
-        *       https://www.ppsloan.org/publications/StupidSH36.pdf
-        */
-       // 3-band SH defined by 9 coefficients
-
-       class SphericalHarmonics3 {
-               constructor() {
-                       this.coefficients = [];
-
-                       for (let i = 0; i < 9; i++) {
-                               this.coefficients.push(new Vector3());
-                       }
-               }
-
-               set(coefficients) {
-                       for (let i = 0; i < 9; i++) {
-                               this.coefficients[i].copy(coefficients[i]);
-                       }
-
-                       return this;
-               }
-
-               zero() {
-                       for (let i = 0; i < 9; i++) {
-                               this.coefficients[i].set(0, 0, 0);
-                       }
-
-                       return this;
-               } // get the radiance in the direction of the normal
-               // target is a Vector3
-
-
-               getAt(normal, target) {
-                       // normal is assumed to be unit length
-                       const x = normal.x,
-                                               y = normal.y,
-                                               z = normal.z;
-                       const coeff = this.coefficients; // band 0
-
-                       target.copy(coeff[0]).multiplyScalar(0.282095); // band 1
-
-                       target.addScaledVector(coeff[1], 0.488603 * y);
-                       target.addScaledVector(coeff[2], 0.488603 * z);
-                       target.addScaledVector(coeff[3], 0.488603 * x); // band 2
-
-                       target.addScaledVector(coeff[4], 1.092548 * (x * y));
-                       target.addScaledVector(coeff[5], 1.092548 * (y * z));
-                       target.addScaledVector(coeff[6], 0.315392 * (3.0 * z * z - 1.0));
-                       target.addScaledVector(coeff[7], 1.092548 * (x * z));
-                       target.addScaledVector(coeff[8], 0.546274 * (x * x - y * y));
-                       return target;
-               } // get the irradiance (radiance convolved with cosine lobe) in the direction of the normal
-               // target is a Vector3
-               // https://graphics.stanford.edu/papers/envmap/envmap.pdf
-
-
-               getIrradianceAt(normal, target) {
-                       // normal is assumed to be unit length
-                       const x = normal.x,
-                                               y = normal.y,
-                                               z = normal.z;
-                       const coeff = this.coefficients; // band 0
-
-                       target.copy(coeff[0]).multiplyScalar(0.886227); // Ï€ * 0.282095
-                       // band 1
-
-                       target.addScaledVector(coeff[1], 2.0 * 0.511664 * y); // ( 2 * Ï€ / 3 ) * 0.488603
-
-                       target.addScaledVector(coeff[2], 2.0 * 0.511664 * z);
-                       target.addScaledVector(coeff[3], 2.0 * 0.511664 * x); // band 2
-
-                       target.addScaledVector(coeff[4], 2.0 * 0.429043 * x * y); // ( Ï€ / 4 ) * 1.092548
-
-                       target.addScaledVector(coeff[5], 2.0 * 0.429043 * y * z);
-                       target.addScaledVector(coeff[6], 0.743125 * z * z - 0.247708); // ( Ï€ / 4 ) * 0.315392 * 3
-
-                       target.addScaledVector(coeff[7], 2.0 * 0.429043 * x * z);
-                       target.addScaledVector(coeff[8], 0.429043 * (x * x - y * y)); // ( Ï€ / 4 ) * 0.546274
-
-                       return target;
-               }
-
-               add(sh) {
-                       for (let i = 0; i < 9; i++) {
-                               this.coefficients[i].add(sh.coefficients[i]);
-                       }
-
-                       return this;
-               }
-
-               addScaledSH(sh, s) {
-                       for (let i = 0; i < 9; i++) {
-                               this.coefficients[i].addScaledVector(sh.coefficients[i], s);
-                       }
-
-                       return this;
-               }
-
-               scale(s) {
-                       for (let i = 0; i < 9; i++) {
-                               this.coefficients[i].multiplyScalar(s);
-                       }
-
-                       return this;
-               }
-
-               lerp(sh, alpha) {
-                       for (let i = 0; i < 9; i++) {
-                               this.coefficients[i].lerp(sh.coefficients[i], alpha);
-                       }
-
-                       return this;
-               }
-
-               equals(sh) {
-                       for (let i = 0; i < 9; i++) {
-                               if (!this.coefficients[i].equals(sh.coefficients[i])) {
-                                       return false;
-                               }
-                       }
-
-                       return true;
-               }
-
-               copy(sh) {
-                       return this.set(sh.coefficients);
-               }
-
-               clone() {
-                       return new this.constructor().copy(this);
-               }
-
-               fromArray(array, offset = 0) {
-                       const coefficients = this.coefficients;
-
-                       for (let i = 0; i < 9; i++) {
-                               coefficients[i].fromArray(array, offset + i * 3);
-                       }
-
-                       return this;
-               }
-
-               toArray(array = [], offset = 0) {
-                       const coefficients = this.coefficients;
-
-                       for (let i = 0; i < 9; i++) {
-                               coefficients[i].toArray(array, offset + i * 3);
-                       }
-
-                       return array;
-               } // evaluate the basis functions
-               // shBasis is an Array[ 9 ]
-
-
-               static getBasisAt(normal, shBasis) {
-                       // normal is assumed to be unit length
-                       const x = normal.x,
-                                               y = normal.y,
-                                               z = normal.z; // band 0
-
-                       shBasis[0] = 0.282095; // band 1
-
-                       shBasis[1] = 0.488603 * y;
-                       shBasis[2] = 0.488603 * z;
-                       shBasis[3] = 0.488603 * x; // band 2
-
-                       shBasis[4] = 1.092548 * x * y;
-                       shBasis[5] = 1.092548 * y * z;
-                       shBasis[6] = 0.315392 * (3 * z * z - 1);
-                       shBasis[7] = 1.092548 * x * z;
-                       shBasis[8] = 0.546274 * (x * x - y * y);
-               }
-
-       }
-
-       SphericalHarmonics3.prototype.isSphericalHarmonics3 = true;
-
-       class LightProbe extends Light {
-               constructor(sh = new SphericalHarmonics3(), intensity = 1) {
-                       super(undefined, intensity);
-                       this.sh = sh;
-               }
-
-               copy(source) {
-                       super.copy(source);
-                       this.sh.copy(source.sh);
-                       return this;
-               }
-
-               fromJSON(json) {
-                       this.intensity = json.intensity; // TODO: Move this bit to Light.fromJSON();
-
-                       this.sh.fromArray(json.sh);
-                       return this;
-               }
-
-               toJSON(meta) {
-                       const data = super.toJSON(meta);
-                       data.object.sh = this.sh.toArray();
-                       return data;
-               }
-
-       }
-
-       LightProbe.prototype.isLightProbe = true;
-
-       class MaterialLoader extends Loader {
-               constructor(manager) {
-                       super(manager);
-                       this.textures = {};
-               }
-
-               load(url, onLoad, onProgress, onError) {
-                       const scope = this;
-                       const loader = new FileLoader(scope.manager);
-                       loader.setPath(scope.path);
-                       loader.setRequestHeader(scope.requestHeader);
-                       loader.setWithCredentials(scope.withCredentials);
-                       loader.load(url, function (text) {
-                               try {
-                                       onLoad(scope.parse(JSON.parse(text)));
-                               } catch (e) {
-                                       if (onError) {
-                                               onError(e);
-                                       } else {
-                                               console.error(e);
-                                       }
-
-                                       scope.manager.itemError(url);
-                               }
-                       }, onProgress, onError);
-               }
-
-               parse(json) {
-                       const textures = this.textures;
-
-                       function getTexture(name) {
-                               if (textures[name] === undefined) {
-                                       console.warn('THREE.MaterialLoader: Undefined texture', name);
-                               }
-
-                               return textures[name];
-                       }
-
-                       const material = new Materials[json.type]();
-                       if (json.uuid !== undefined) material.uuid = json.uuid;
-                       if (json.name !== undefined) material.name = json.name;
-                       if (json.color !== undefined && material.color !== undefined) material.color.setHex(json.color);
-                       if (json.roughness !== undefined) material.roughness = json.roughness;
-                       if (json.metalness !== undefined) material.metalness = json.metalness;
-                       if (json.sheenTint !== undefined) material.sheenTint = new Color().setHex(json.sheenTint);
-                       if (json.emissive !== undefined && material.emissive !== undefined) material.emissive.setHex(json.emissive);
-                       if (json.specular !== undefined && material.specular !== undefined) material.specular.setHex(json.specular);
-                       if (json.specularIntensity !== undefined) material.specularIntensity = json.specularIntensity;
-                       if (json.specularTint !== undefined && material.specularTint !== undefined) material.specularTint.setHex(json.specularTint);
-                       if (json.shininess !== undefined) material.shininess = json.shininess;
-                       if (json.clearcoat !== undefined) material.clearcoat = json.clearcoat;
-                       if (json.clearcoatRoughness !== undefined) material.clearcoatRoughness = json.clearcoatRoughness;
-                       if (json.transmission !== undefined) material.transmission = json.transmission;
-                       if (json.thickness !== undefined) material.thickness = json.thickness;
-                       if (json.attenuationDistance !== undefined) material.attenuationDistance = json.attenuationDistance;
-                       if (json.attenuationTint !== undefined && material.attenuationTint !== undefined) material.attenuationTint.setHex(json.attenuationTint);
-                       if (json.fog !== undefined) material.fog = json.fog;
-                       if (json.flatShading !== undefined) material.flatShading = json.flatShading;
-                       if (json.blending !== undefined) material.blending = json.blending;
-                       if (json.combine !== undefined) material.combine = json.combine;
-                       if (json.side !== undefined) material.side = json.side;
-                       if (json.shadowSide !== undefined) material.shadowSide = json.shadowSide;
-                       if (json.opacity !== undefined) material.opacity = json.opacity;
-                       if (json.format !== undefined) material.format = json.format;
-                       if (json.transparent !== undefined) material.transparent = json.transparent;
-                       if (json.alphaTest !== undefined) material.alphaTest = json.alphaTest;
-                       if (json.depthTest !== undefined) material.depthTest = json.depthTest;
-                       if (json.depthWrite !== undefined) material.depthWrite = json.depthWrite;
-                       if (json.colorWrite !== undefined) material.colorWrite = json.colorWrite;
-                       if (json.stencilWrite !== undefined) material.stencilWrite = json.stencilWrite;
-                       if (json.stencilWriteMask !== undefined) material.stencilWriteMask = json.stencilWriteMask;
-                       if (json.stencilFunc !== undefined) material.stencilFunc = json.stencilFunc;
-                       if (json.stencilRef !== undefined) material.stencilRef = json.stencilRef;
-                       if (json.stencilFuncMask !== undefined) material.stencilFuncMask = json.stencilFuncMask;
-                       if (json.stencilFail !== undefined) material.stencilFail = json.stencilFail;
-                       if (json.stencilZFail !== undefined) material.stencilZFail = json.stencilZFail;
-                       if (json.stencilZPass !== undefined) material.stencilZPass = json.stencilZPass;
-                       if (json.wireframe !== undefined) material.wireframe = json.wireframe;
-                       if (json.wireframeLinewidth !== undefined) material.wireframeLinewidth = json.wireframeLinewidth;
-                       if (json.wireframeLinecap !== undefined) material.wireframeLinecap = json.wireframeLinecap;
-                       if (json.wireframeLinejoin !== undefined) material.wireframeLinejoin = json.wireframeLinejoin;
-                       if (json.rotation !== undefined) material.rotation = json.rotation;
-                       if (json.linewidth !== 1) material.linewidth = json.linewidth;
-                       if (json.dashSize !== undefined) material.dashSize = json.dashSize;
-                       if (json.gapSize !== undefined) material.gapSize = json.gapSize;
-                       if (json.scale !== undefined) material.scale = json.scale;
-                       if (json.polygonOffset !== undefined) material.polygonOffset = json.polygonOffset;
-                       if (json.polygonOffsetFactor !== undefined) material.polygonOffsetFactor = json.polygonOffsetFactor;
-                       if (json.polygonOffsetUnits !== undefined) material.polygonOffsetUnits = json.polygonOffsetUnits;
-                       if (json.dithering !== undefined) material.dithering = json.dithering;
-                       if (json.alphaToCoverage !== undefined) material.alphaToCoverage = json.alphaToCoverage;
-                       if (json.premultipliedAlpha !== undefined) material.premultipliedAlpha = json.premultipliedAlpha;
-                       if (json.visible !== undefined) material.visible = json.visible;
-                       if (json.toneMapped !== undefined) material.toneMapped = json.toneMapped;
-                       if (json.userData !== undefined) material.userData = json.userData;
-
-                       if (json.vertexColors !== undefined) {
-                               if (typeof json.vertexColors === 'number') {
-                                       material.vertexColors = json.vertexColors > 0 ? true : false;
-                               } else {
-                                       material.vertexColors = json.vertexColors;
-                               }
-                       } // Shader Material
-
-
-                       if (json.uniforms !== undefined) {
-                               for (const name in json.uniforms) {
-                                       const uniform = json.uniforms[name];
-                                       material.uniforms[name] = {};
-
-                                       switch (uniform.type) {
-                                               case 't':
-                                                       material.uniforms[name].value = getTexture(uniform.value);
-                                                       break;
-
-                                               case 'c':
-                                                       material.uniforms[name].value = new Color().setHex(uniform.value);
-                                                       break;
-
-                                               case 'v2':
-                                                       material.uniforms[name].value = new Vector2().fromArray(uniform.value);
-                                                       break;
-
-                                               case 'v3':
-                                                       material.uniforms[name].value = new Vector3().fromArray(uniform.value);
-                                                       break;
-
-                                               case 'v4':
-                                                       material.uniforms[name].value = new Vector4().fromArray(uniform.value);
-                                                       break;
-
-                                               case 'm3':
-                                                       material.uniforms[name].value = new Matrix3().fromArray(uniform.value);
-                                                       break;
-
-                                               case 'm4':
-                                                       material.uniforms[name].value = new Matrix4().fromArray(uniform.value);
-                                                       break;
-
-                                               default:
-                                                       material.uniforms[name].value = uniform.value;
-                                       }
-                               }
-                       }
-
-                       if (json.defines !== undefined) material.defines = json.defines;
-                       if (json.vertexShader !== undefined) material.vertexShader = json.vertexShader;
-                       if (json.fragmentShader !== undefined) material.fragmentShader = json.fragmentShader;
-
-                       if (json.extensions !== undefined) {
-                               for (const key in json.extensions) {
-                                       material.extensions[key] = json.extensions[key];
-                               }
-                       } // Deprecated
-
-
-                       if (json.shading !== undefined) material.flatShading = json.shading === 1; // THREE.FlatShading
-                       // for PointsMaterial
-
-                       if (json.size !== undefined) material.size = json.size;
-                       if (json.sizeAttenuation !== undefined) material.sizeAttenuation = json.sizeAttenuation; // maps
-
-                       if (json.map !== undefined) material.map = getTexture(json.map);
-                       if (json.matcap !== undefined) material.matcap = getTexture(json.matcap);
-                       if (json.alphaMap !== undefined) material.alphaMap = getTexture(json.alphaMap);
-                       if (json.bumpMap !== undefined) material.bumpMap = getTexture(json.bumpMap);
-                       if (json.bumpScale !== undefined) material.bumpScale = json.bumpScale;
-                       if (json.normalMap !== undefined) material.normalMap = getTexture(json.normalMap);
-                       if (json.normalMapType !== undefined) material.normalMapType = json.normalMapType;
-
-                       if (json.normalScale !== undefined) {
-                               let normalScale = json.normalScale;
-
-                               if (Array.isArray(normalScale) === false) {
-                                       // Blender exporter used to export a scalar. See #7459
-                                       normalScale = [normalScale, normalScale];
-                               }
-
-                               material.normalScale = new Vector2().fromArray(normalScale);
-                       }
-
-                       if (json.displacementMap !== undefined) material.displacementMap = getTexture(json.displacementMap);
-                       if (json.displacementScale !== undefined) material.displacementScale = json.displacementScale;
-                       if (json.displacementBias !== undefined) material.displacementBias = json.displacementBias;
-                       if (json.roughnessMap !== undefined) material.roughnessMap = getTexture(json.roughnessMap);
-                       if (json.metalnessMap !== undefined) material.metalnessMap = getTexture(json.metalnessMap);
-                       if (json.emissiveMap !== undefined) material.emissiveMap = getTexture(json.emissiveMap);
-                       if (json.emissiveIntensity !== undefined) material.emissiveIntensity = json.emissiveIntensity;
-                       if (json.specularMap !== undefined) material.specularMap = getTexture(json.specularMap);
-                       if (json.specularIntensityMap !== undefined) material.specularIntensityMap = getTexture(json.specularIntensityMap);
-                       if (json.specularTintMap !== undefined) material.specularTintMap = getTexture(json.specularTintMap);
-                       if (json.envMap !== undefined) material.envMap = getTexture(json.envMap);
-                       if (json.envMapIntensity !== undefined) material.envMapIntensity = json.envMapIntensity;
-                       if (json.reflectivity !== undefined) material.reflectivity = json.reflectivity;
-                       if (json.refractionRatio !== undefined) material.refractionRatio = json.refractionRatio;
-                       if (json.lightMap !== undefined) material.lightMap = getTexture(json.lightMap);
-                       if (json.lightMapIntensity !== undefined) material.lightMapIntensity = json.lightMapIntensity;
-                       if (json.aoMap !== undefined) material.aoMap = getTexture(json.aoMap);
-                       if (json.aoMapIntensity !== undefined) material.aoMapIntensity = json.aoMapIntensity;
-                       if (json.gradientMap !== undefined) material.gradientMap = getTexture(json.gradientMap);
-                       if (json.clearcoatMap !== undefined) material.clearcoatMap = getTexture(json.clearcoatMap);
-                       if (json.clearcoatRoughnessMap !== undefined) material.clearcoatRoughnessMap = getTexture(json.clearcoatRoughnessMap);
-                       if (json.clearcoatNormalMap !== undefined) material.clearcoatNormalMap = getTexture(json.clearcoatNormalMap);
-                       if (json.clearcoatNormalScale !== undefined) material.clearcoatNormalScale = new Vector2().fromArray(json.clearcoatNormalScale);
-                       if (json.transmissionMap !== undefined) material.transmissionMap = getTexture(json.transmissionMap);
-                       if (json.thicknessMap !== undefined) material.thicknessMap = getTexture(json.thicknessMap);
-                       return material;
-               }
-
-               setTextures(value) {
-                       this.textures = value;
-                       return this;
-               }
-
-       }
-
-       class LoaderUtils {
-               static decodeText(array) {
-                       if (typeof TextDecoder !== 'undefined') {
-                               return new TextDecoder().decode(array);
-                       } // Avoid the String.fromCharCode.apply(null, array) shortcut, which
-                       // throws a "maximum call stack size exceeded" error for large arrays.
-
-
-                       let s = '';
-
-                       for (let i = 0, il = array.length; i < il; i++) {
-                               // Implicitly assumes little-endian.
-                               s += String.fromCharCode(array[i]);
-                       }
-
-                       try {
-                               // merges multi-byte utf-8 characters.
-                               return decodeURIComponent(escape(s));
-                       } catch (e) {
-                               // see #16358
-                               return s;
-                       }
-               }
-
-               static extractUrlBase(url) {
-                       const index = url.lastIndexOf('/');
-                       if (index === -1) return './';
-                       return url.substr(0, index + 1);
-               }
-
-       }
-
-       class InstancedBufferGeometry extends BufferGeometry {
-               constructor() {
-                       super();
-                       this.type = 'InstancedBufferGeometry';
-                       this.instanceCount = Infinity;
-               }
-
-               copy(source) {
-                       super.copy(source);
-                       this.instanceCount = source.instanceCount;
-                       return this;
-               }
-
-               clone() {
-                       return new this.constructor().copy(this);
-               }
-
-               toJSON() {
-                       const data = super.toJSON(this);
-                       data.instanceCount = this.instanceCount;
-                       data.isInstancedBufferGeometry = true;
-                       return data;
-               }
-
-       }
-
-       InstancedBufferGeometry.prototype.isInstancedBufferGeometry = true;
-
-       class BufferGeometryLoader extends Loader {
-               constructor(manager) {
-                       super(manager);
-               }
-
-               load(url, onLoad, onProgress, onError) {
-                       const scope = this;
-                       const loader = new FileLoader(scope.manager);
-                       loader.setPath(scope.path);
-                       loader.setRequestHeader(scope.requestHeader);
-                       loader.setWithCredentials(scope.withCredentials);
-                       loader.load(url, function (text) {
-                               try {
-                                       onLoad(scope.parse(JSON.parse(text)));
-                               } catch (e) {
-                                       if (onError) {
-                                               onError(e);
-                                       } else {
-                                               console.error(e);
-                                       }
-
-                                       scope.manager.itemError(url);
-                               }
-                       }, onProgress, onError);
-               }
-
-               parse(json) {
-                       const interleavedBufferMap = {};
-                       const arrayBufferMap = {};
-
-                       function getInterleavedBuffer(json, uuid) {
-                               if (interleavedBufferMap[uuid] !== undefined) return interleavedBufferMap[uuid];
-                               const interleavedBuffers = json.interleavedBuffers;
-                               const interleavedBuffer = interleavedBuffers[uuid];
-                               const buffer = getArrayBuffer(json, interleavedBuffer.buffer);
-                               const array = getTypedArray(interleavedBuffer.type, buffer);
-                               const ib = new InterleavedBuffer(array, interleavedBuffer.stride);
-                               ib.uuid = interleavedBuffer.uuid;
-                               interleavedBufferMap[uuid] = ib;
-                               return ib;
-                       }
-
-                       function getArrayBuffer(json, uuid) {
-                               if (arrayBufferMap[uuid] !== undefined) return arrayBufferMap[uuid];
-                               const arrayBuffers = json.arrayBuffers;
-                               const arrayBuffer = arrayBuffers[uuid];
-                               const ab = new Uint32Array(arrayBuffer).buffer;
-                               arrayBufferMap[uuid] = ab;
-                               return ab;
-                       }
-
-                       const geometry = json.isInstancedBufferGeometry ? new InstancedBufferGeometry() : new BufferGeometry();
-                       const index = json.data.index;
-
-                       if (index !== undefined) {
-                               const typedArray = getTypedArray(index.type, index.array);
-                               geometry.setIndex(new BufferAttribute(typedArray, 1));
-                       }
-
-                       const attributes = json.data.attributes;
-
-                       for (const key in attributes) {
-                               const attribute = attributes[key];
-                               let bufferAttribute;
-
-                               if (attribute.isInterleavedBufferAttribute) {
-                                       const interleavedBuffer = getInterleavedBuffer(json.data, attribute.data);
-                                       bufferAttribute = new InterleavedBufferAttribute(interleavedBuffer, attribute.itemSize, attribute.offset, attribute.normalized);
-                               } else {
-                                       const typedArray = getTypedArray(attribute.type, attribute.array);
-                                       const bufferAttributeConstr = attribute.isInstancedBufferAttribute ? InstancedBufferAttribute : BufferAttribute;
-                                       bufferAttribute = new bufferAttributeConstr(typedArray, attribute.itemSize, attribute.normalized);
-                               }
-
-                               if (attribute.name !== undefined) bufferAttribute.name = attribute.name;
-                               if (attribute.usage !== undefined) bufferAttribute.setUsage(attribute.usage);
-
-                               if (attribute.updateRange !== undefined) {
-                                       bufferAttribute.updateRange.offset = attribute.updateRange.offset;
-                                       bufferAttribute.updateRange.count = attribute.updateRange.count;
-                               }
-
-                               geometry.setAttribute(key, bufferAttribute);
-                       }
-
-                       const morphAttributes = json.data.morphAttributes;
-
-                       if (morphAttributes) {
-                               for (const key in morphAttributes) {
-                                       const attributeArray = morphAttributes[key];
-                                       const array = [];
-
-                                       for (let i = 0, il = attributeArray.length; i < il; i++) {
-                                               const attribute = attributeArray[i];
-                                               let bufferAttribute;
-
-                                               if (attribute.isInterleavedBufferAttribute) {
-                                                       const interleavedBuffer = getInterleavedBuffer(json.data, attribute.data);
-                                                       bufferAttribute = new InterleavedBufferAttribute(interleavedBuffer, attribute.itemSize, attribute.offset, attribute.normalized);
-                                               } else {
-                                                       const typedArray = getTypedArray(attribute.type, attribute.array);
-                                                       bufferAttribute = new BufferAttribute(typedArray, attribute.itemSize, attribute.normalized);
-                                               }
-
-                                               if (attribute.name !== undefined) bufferAttribute.name = attribute.name;
-                                               array.push(bufferAttribute);
-                                       }
-
-                                       geometry.morphAttributes[key] = array;
-                               }
-                       }
-
-                       const morphTargetsRelative = json.data.morphTargetsRelative;
-
-                       if (morphTargetsRelative) {
-                               geometry.morphTargetsRelative = true;
-                       }
-
-                       const groups = json.data.groups || json.data.drawcalls || json.data.offsets;
-
-                       if (groups !== undefined) {
-                               for (let i = 0, n = groups.length; i !== n; ++i) {
-                                       const group = groups[i];
-                                       geometry.addGroup(group.start, group.count, group.materialIndex);
-                               }
-                       }
-
-                       const boundingSphere = json.data.boundingSphere;
-
-                       if (boundingSphere !== undefined) {
-                               const center = new Vector3();
-
-                               if (boundingSphere.center !== undefined) {
-                                       center.fromArray(boundingSphere.center);
-                               }
-
-                               geometry.boundingSphere = new Sphere(center, boundingSphere.radius);
-                       }
-
-                       if (json.name) geometry.name = json.name;
-                       if (json.userData) geometry.userData = json.userData;
-                       return geometry;
-               }
-
-       }
-
-       class ObjectLoader extends Loader {
-               constructor(manager) {
-                       super(manager);
-               }
-
-               load(url, onLoad, onProgress, onError) {
-                       const scope = this;
-                       const path = this.path === '' ? LoaderUtils.extractUrlBase(url) : this.path;
-                       this.resourcePath = this.resourcePath || path;
-                       const loader = new FileLoader(this.manager);
-                       loader.setPath(this.path);
-                       loader.setRequestHeader(this.requestHeader);
-                       loader.setWithCredentials(this.withCredentials);
-                       loader.load(url, function (text) {
-                               let json = null;
-
-                               try {
-                                       json = JSON.parse(text);
-                               } catch (error) {
-                                       if (onError !== undefined) onError(error);
-                                       console.error('THREE:ObjectLoader: Can\'t parse ' + url + '.', error.message);
-                                       return;
-                               }
-
-                               const metadata = json.metadata;
-
-                               if (metadata === undefined || metadata.type === undefined || metadata.type.toLowerCase() === 'geometry') {
-                                       console.error('THREE.ObjectLoader: Can\'t load ' + url);
-                                       return;
-                               }
-
-                               scope.parse(json, onLoad);
-                       }, onProgress, onError);
-               }
-
-               async loadAsync(url, onProgress) {
-                       const scope = this;
-                       const path = this.path === '' ? LoaderUtils.extractUrlBase(url) : this.path;
-                       this.resourcePath = this.resourcePath || path;
-                       const loader = new FileLoader(this.manager);
-                       loader.setPath(this.path);
-                       loader.setRequestHeader(this.requestHeader);
-                       loader.setWithCredentials(this.withCredentials);
-                       const text = await loader.loadAsync(url, onProgress);
-                       const json = JSON.parse(text);
-                       const metadata = json.metadata;
-
-                       if (metadata === undefined || metadata.type === undefined || metadata.type.toLowerCase() === 'geometry') {
-                               throw new Error('THREE.ObjectLoader: Can\'t load ' + url);
-                       }
-
-                       return await scope.parseAsync(json);
-               }
-
-               parse(json, onLoad) {
-                       const animations = this.parseAnimations(json.animations);
-                       const shapes = this.parseShapes(json.shapes);
-                       const geometries = this.parseGeometries(json.geometries, shapes);
-                       const images = this.parseImages(json.images, function () {
-                               if (onLoad !== undefined) onLoad(object);
-                       });
-                       const textures = this.parseTextures(json.textures, images);
-                       const materials = this.parseMaterials(json.materials, textures);
-                       const object = this.parseObject(json.object, geometries, materials, textures, animations);
-                       const skeletons = this.parseSkeletons(json.skeletons, object);
-                       this.bindSkeletons(object, skeletons); //
-
-                       if (onLoad !== undefined) {
-                               let hasImages = false;
-
-                               for (const uuid in images) {
-                                       if (images[uuid] instanceof HTMLImageElement) {
-                                               hasImages = true;
-                                               break;
-                                       }
-                               }
-
-                               if (hasImages === false) onLoad(object);
-                       }
-
-                       return object;
-               }
-
-               async parseAsync(json) {
-                       const animations = this.parseAnimations(json.animations);
-                       const shapes = this.parseShapes(json.shapes);
-                       const geometries = this.parseGeometries(json.geometries, shapes);
-                       const images = await this.parseImagesAsync(json.images);
-                       const textures = this.parseTextures(json.textures, images);
-                       const materials = this.parseMaterials(json.materials, textures);
-                       const object = this.parseObject(json.object, geometries, materials, textures, animations);
-                       const skeletons = this.parseSkeletons(json.skeletons, object);
-                       this.bindSkeletons(object, skeletons);
-                       return object;
-               }
-
-               parseShapes(json) {
-                       const shapes = {};
-
-                       if (json !== undefined) {
-                               for (let i = 0, l = json.length; i < l; i++) {
-                                       const shape = new Shape().fromJSON(json[i]);
-                                       shapes[shape.uuid] = shape;
-                               }
-                       }
-
-                       return shapes;
-               }
-
-               parseSkeletons(json, object) {
-                       const skeletons = {};
-                       const bones = {}; // generate bone lookup table
-
-                       object.traverse(function (child) {
-                               if (child.isBone) bones[child.uuid] = child;
-                       }); // create skeletons
-
-                       if (json !== undefined) {
-                               for (let i = 0, l = json.length; i < l; i++) {
-                                       const skeleton = new Skeleton().fromJSON(json[i], bones);
-                                       skeletons[skeleton.uuid] = skeleton;
-                               }
-                       }
-
-                       return skeletons;
-               }
-
-               parseGeometries(json, shapes) {
-                       const geometries = {};
-
-                       if (json !== undefined) {
-                               const bufferGeometryLoader = new BufferGeometryLoader();
-
-                               for (let i = 0, l = json.length; i < l; i++) {
-                                       let geometry;
-                                       const data = json[i];
-
-                                       switch (data.type) {
-                                               case 'BufferGeometry':
-                                               case 'InstancedBufferGeometry':
-                                                       geometry = bufferGeometryLoader.parse(data);
-                                                       break;
-
-                                               case 'Geometry':
-                                                       console.error('THREE.ObjectLoader: The legacy Geometry type is no longer supported.');
-                                                       break;
-
-                                               default:
-                                                       if (data.type in Geometries) {
-                                                               geometry = Geometries[data.type].fromJSON(data, shapes);
-                                                       } else {
-                                                               console.warn(`THREE.ObjectLoader: Unsupported geometry type "${data.type}"`);
-                                                       }
-
-                                       }
-
-                                       geometry.uuid = data.uuid;
-                                       if (data.name !== undefined) geometry.name = data.name;
-                                       if (geometry.isBufferGeometry === true && data.userData !== undefined) geometry.userData = data.userData;
-                                       geometries[data.uuid] = geometry;
-                               }
-                       }
-
-                       return geometries;
-               }
-
-               parseMaterials(json, textures) {
-                       const cache = {}; // MultiMaterial
-
-                       const materials = {};
-
-                       if (json !== undefined) {
-                               const loader = new MaterialLoader();
-                               loader.setTextures(textures);
-
-                               for (let i = 0, l = json.length; i < l; i++) {
-                                       const data = json[i];
-
-                                       if (data.type === 'MultiMaterial') {
-                                               // Deprecated
-                                               const array = [];
-
-                                               for (let j = 0; j < data.materials.length; j++) {
-                                                       const material = data.materials[j];
-
-                                                       if (cache[material.uuid] === undefined) {
-                                                               cache[material.uuid] = loader.parse(material);
-                                                       }
-
-                                                       array.push(cache[material.uuid]);
-                                               }
-
-                                               materials[data.uuid] = array;
-                                       } else {
-                                               if (cache[data.uuid] === undefined) {
-                                                       cache[data.uuid] = loader.parse(data);
-                                               }
-
-                                               materials[data.uuid] = cache[data.uuid];
-                                       }
-                               }
-                       }
-
-                       return materials;
-               }
-
-               parseAnimations(json) {
-                       const animations = {};
-
-                       if (json !== undefined) {
-                               for (let i = 0; i < json.length; i++) {
-                                       const data = json[i];
-                                       const clip = AnimationClip.parse(data);
-                                       animations[clip.uuid] = clip;
-                               }
-                       }
-
-                       return animations;
-               }
-
-               parseImages(json, onLoad) {
-                       const scope = this;
-                       const images = {};
-                       let loader;
-
-                       function loadImage(url) {
-                               scope.manager.itemStart(url);
-                               return loader.load(url, function () {
-                                       scope.manager.itemEnd(url);
-                               }, undefined, function () {
-                                       scope.manager.itemError(url);
-                                       scope.manager.itemEnd(url);
-                               });
-                       }
-
-                       function deserializeImage(image) {
-                               if (typeof image === 'string') {
-                                       const url = image;
-                                       const path = /^(\/\/)|([a-z]+:(\/\/)?)/i.test(url) ? url : scope.resourcePath + url;
-                                       return loadImage(path);
-                               } else {
-                                       if (image.data) {
-                                               return {
-                                                       data: getTypedArray(image.type, image.data),
-                                                       width: image.width,
-                                                       height: image.height
-                                               };
-                                       } else {
-                                               return null;
-                                       }
-                               }
-                       }
-
-                       if (json !== undefined && json.length > 0) {
-                               const manager = new LoadingManager(onLoad);
-                               loader = new ImageLoader(manager);
-                               loader.setCrossOrigin(this.crossOrigin);
-
-                               for (let i = 0, il = json.length; i < il; i++) {
-                                       const image = json[i];
-                                       const url = image.url;
-
-                                       if (Array.isArray(url)) {
-                                               // load array of images e.g CubeTexture
-                                               images[image.uuid] = [];
-
-                                               for (let j = 0, jl = url.length; j < jl; j++) {
-                                                       const currentUrl = url[j];
-                                                       const deserializedImage = deserializeImage(currentUrl);
-
-                                                       if (deserializedImage !== null) {
-                                                               if (deserializedImage instanceof HTMLImageElement) {
-                                                                       images[image.uuid].push(deserializedImage);
-                                                               } else {
-                                                                       // special case: handle array of data textures for cube textures
-                                                                       images[image.uuid].push(new DataTexture(deserializedImage.data, deserializedImage.width, deserializedImage.height));
-                                                               }
-                                                       }
-                                               }
-                                       } else {
-                                               // load single image
-                                               const deserializedImage = deserializeImage(image.url);
-
-                                               if (deserializedImage !== null) {
-                                                       images[image.uuid] = deserializedImage;
-                                               }
-                                       }
-                               }
-                       }
-
-                       return images;
-               }
-
-               async parseImagesAsync(json) {
-                       const scope = this;
-                       const images = {};
-                       let loader;
-
-                       async function deserializeImage(image) {
-                               if (typeof image === 'string') {
-                                       const url = image;
-                                       const path = /^(\/\/)|([a-z]+:(\/\/)?)/i.test(url) ? url : scope.resourcePath + url;
-                                       return await loader.loadAsync(path);
-                               } else {
-                                       if (image.data) {
-                                               return {
-                                                       data: getTypedArray(image.type, image.data),
-                                                       width: image.width,
-                                                       height: image.height
-                                               };
-                                       } else {
-                                               return null;
-                                       }
-                               }
-                       }
-
-                       if (json !== undefined && json.length > 0) {
-                               loader = new ImageLoader(this.manager);
-                               loader.setCrossOrigin(this.crossOrigin);
-
-                               for (let i = 0, il = json.length; i < il; i++) {
-                                       const image = json[i];
-                                       const url = image.url;
-
-                                       if (Array.isArray(url)) {
-                                               // load array of images e.g CubeTexture
-                                               images[image.uuid] = [];
-
-                                               for (let j = 0, jl = url.length; j < jl; j++) {
-                                                       const currentUrl = url[j];
-                                                       const deserializedImage = await deserializeImage(currentUrl);
-
-                                                       if (deserializedImage !== null) {
-                                                               if (deserializedImage instanceof HTMLImageElement) {
-                                                                       images[image.uuid].push(deserializedImage);
-                                                               } else {
-                                                                       // special case: handle array of data textures for cube textures
-                                                                       images[image.uuid].push(new DataTexture(deserializedImage.data, deserializedImage.width, deserializedImage.height));
-                                                               }
-                                                       }
-                                               }
-                                       } else {
-                                               // load single image
-                                               const deserializedImage = await deserializeImage(image.url);
-
-                                               if (deserializedImage !== null) {
-                                                       images[image.uuid] = deserializedImage;
-                                               }
-                                       }
-                               }
-                       }
-
-                       return images;
-               }
-
-               parseTextures(json, images) {
-                       function parseConstant(value, type) {
-                               if (typeof value === 'number') return value;
-                               console.warn('THREE.ObjectLoader.parseTexture: Constant should be in numeric form.', value);
-                               return type[value];
-                       }
-
-                       const textures = {};
-
-                       if (json !== undefined) {
-                               for (let i = 0, l = json.length; i < l; i++) {
-                                       const data = json[i];
-
-                                       if (data.image === undefined) {
-                                               console.warn('THREE.ObjectLoader: No "image" specified for', data.uuid);
-                                       }
-
-                                       if (images[data.image] === undefined) {
-                                               console.warn('THREE.ObjectLoader: Undefined image', data.image);
-                                       }
-
-                                       let texture;
-                                       const image = images[data.image];
-
-                                       if (Array.isArray(image)) {
-                                               texture = new CubeTexture(image);
-                                               if (image.length === 6) texture.needsUpdate = true;
-                                       } else {
-                                               if (image && image.data) {
-                                                       texture = new DataTexture(image.data, image.width, image.height);
-                                               } else {
-                                                       texture = new Texture(image);
-                                               }
-
-                                               if (image) texture.needsUpdate = true; // textures can have undefined image data
-                                       }
-
-                                       texture.uuid = data.uuid;
-                                       if (data.name !== undefined) texture.name = data.name;
-                                       if (data.mapping !== undefined) texture.mapping = parseConstant(data.mapping, TEXTURE_MAPPING);
-                                       if (data.offset !== undefined) texture.offset.fromArray(data.offset);
-                                       if (data.repeat !== undefined) texture.repeat.fromArray(data.repeat);
-                                       if (data.center !== undefined) texture.center.fromArray(data.center);
-                                       if (data.rotation !== undefined) texture.rotation = data.rotation;
-
-                                       if (data.wrap !== undefined) {
-                                               texture.wrapS = parseConstant(data.wrap[0], TEXTURE_WRAPPING);
-                                               texture.wrapT = parseConstant(data.wrap[1], TEXTURE_WRAPPING);
-                                       }
-
-                                       if (data.format !== undefined) texture.format = data.format;
-                                       if (data.type !== undefined) texture.type = data.type;
-                                       if (data.encoding !== undefined) texture.encoding = data.encoding;
-                                       if (data.minFilter !== undefined) texture.minFilter = parseConstant(data.minFilter, TEXTURE_FILTER);
-                                       if (data.magFilter !== undefined) texture.magFilter = parseConstant(data.magFilter, TEXTURE_FILTER);
-                                       if (data.anisotropy !== undefined) texture.anisotropy = data.anisotropy;
-                                       if (data.flipY !== undefined) texture.flipY = data.flipY;
-                                       if (data.premultiplyAlpha !== undefined) texture.premultiplyAlpha = data.premultiplyAlpha;
-                                       if (data.unpackAlignment !== undefined) texture.unpackAlignment = data.unpackAlignment;
-                                       textures[data.uuid] = texture;
-                               }
-                       }
-
-                       return textures;
-               }
-
-               parseObject(data, geometries, materials, textures, animations) {
-                       let object;
-
-                       function getGeometry(name) {
-                               if (geometries[name] === undefined) {
-                                       console.warn('THREE.ObjectLoader: Undefined geometry', name);
-                               }
-
-                               return geometries[name];
-                       }
-
-                       function getMaterial(name) {
-                               if (name === undefined) return undefined;
-
-                               if (Array.isArray(name)) {
-                                       const array = [];
-
-                                       for (let i = 0, l = name.length; i < l; i++) {
-                                               const uuid = name[i];
-
-                                               if (materials[uuid] === undefined) {
-                                                       console.warn('THREE.ObjectLoader: Undefined material', uuid);
-                                               }
-
-                                               array.push(materials[uuid]);
-                                       }
-
-                                       return array;
-                               }
-
-                               if (materials[name] === undefined) {
-                                       console.warn('THREE.ObjectLoader: Undefined material', name);
-                               }
-
-                               return materials[name];
-                       }
-
-                       function getTexture(uuid) {
-                               if (textures[uuid] === undefined) {
-                                       console.warn('THREE.ObjectLoader: Undefined texture', uuid);
-                               }
-
-                               return textures[uuid];
-                       }
-
-                       let geometry, material;
-
-                       switch (data.type) {
-                               case 'Scene':
-                                       object = new Scene();
-
-                                       if (data.background !== undefined) {
-                                               if (Number.isInteger(data.background)) {
-                                                       object.background = new Color(data.background);
-                                               } else {
-                                                       object.background = getTexture(data.background);
-                                               }
-                                       }
-
-                                       if (data.environment !== undefined) {
-                                               object.environment = getTexture(data.environment);
-                                       }
-
-                                       if (data.fog !== undefined) {
-                                               if (data.fog.type === 'Fog') {
-                                                       object.fog = new Fog(data.fog.color, data.fog.near, data.fog.far);
-                                               } else if (data.fog.type === 'FogExp2') {
-                                                       object.fog = new FogExp2(data.fog.color, data.fog.density);
-                                               }
-                                       }
-
-                                       break;
-
-                               case 'PerspectiveCamera':
-                                       object = new PerspectiveCamera(data.fov, data.aspect, data.near, data.far);
-                                       if (data.focus !== undefined) object.focus = data.focus;
-                                       if (data.zoom !== undefined) object.zoom = data.zoom;
-                                       if (data.filmGauge !== undefined) object.filmGauge = data.filmGauge;
-                                       if (data.filmOffset !== undefined) object.filmOffset = data.filmOffset;
-                                       if (data.view !== undefined) object.view = Object.assign({}, data.view);
-                                       break;
-
-                               case 'OrthographicCamera':
-                                       object = new OrthographicCamera(data.left, data.right, data.top, data.bottom, data.near, data.far);
-                                       if (data.zoom !== undefined) object.zoom = data.zoom;
-                                       if (data.view !== undefined) object.view = Object.assign({}, data.view);
-                                       break;
-
-                               case 'AmbientLight':
-                                       object = new AmbientLight(data.color, data.intensity);
-                                       break;
-
-                               case 'DirectionalLight':
-                                       object = new DirectionalLight(data.color, data.intensity);
-                                       break;
-
-                               case 'PointLight':
-                                       object = new PointLight(data.color, data.intensity, data.distance, data.decay);
-                                       break;
-
-                               case 'RectAreaLight':
-                                       object = new RectAreaLight(data.color, data.intensity, data.width, data.height);
-                                       break;
-
-                               case 'SpotLight':
-                                       object = new SpotLight(data.color, data.intensity, data.distance, data.angle, data.penumbra, data.decay);
-                                       break;
-
-                               case 'HemisphereLight':
-                                       object = new HemisphereLight(data.color, data.groundColor, data.intensity);
-                                       break;
-
-                               case 'LightProbe':
-                                       object = new LightProbe().fromJSON(data);
-                                       break;
-
-                               case 'SkinnedMesh':
-                                       geometry = getGeometry(data.geometry);
-                                       material = getMaterial(data.material);
-                                       object = new SkinnedMesh(geometry, material);
-                                       if (data.bindMode !== undefined) object.bindMode = data.bindMode;
-                                       if (data.bindMatrix !== undefined) object.bindMatrix.fromArray(data.bindMatrix);
-                                       if (data.skeleton !== undefined) object.skeleton = data.skeleton;
-                                       break;
-
-                               case 'Mesh':
-                                       geometry = getGeometry(data.geometry);
-                                       material = getMaterial(data.material);
-                                       object = new Mesh(geometry, material);
-                                       break;
-
-                               case 'InstancedMesh':
-                                       geometry = getGeometry(data.geometry);
-                                       material = getMaterial(data.material);
-                                       const count = data.count;
-                                       const instanceMatrix = data.instanceMatrix;
-                                       const instanceColor = data.instanceColor;
-                                       object = new InstancedMesh(geometry, material, count);
-                                       object.instanceMatrix = new InstancedBufferAttribute(new Float32Array(instanceMatrix.array), 16);
-                                       if (instanceColor !== undefined) object.instanceColor = new InstancedBufferAttribute(new Float32Array(instanceColor.array), instanceColor.itemSize);
-                                       break;
-
-                               case 'LOD':
-                                       object = new LOD();
-                                       break;
-
-                               case 'Line':
-                                       object = new Line(getGeometry(data.geometry), getMaterial(data.material));
-                                       break;
-
-                               case 'LineLoop':
-                                       object = new LineLoop(getGeometry(data.geometry), getMaterial(data.material));
-                                       break;
-
-                               case 'LineSegments':
-                                       object = new LineSegments(getGeometry(data.geometry), getMaterial(data.material));
-                                       break;
-
-                               case 'PointCloud':
-                               case 'Points':
-                                       object = new Points(getGeometry(data.geometry), getMaterial(data.material));
-                                       break;
-
-                               case 'Sprite':
-                                       object = new Sprite(getMaterial(data.material));
-                                       break;
-
-                               case 'Group':
-                                       object = new Group();
-                                       break;
-
-                               case 'Bone':
-                                       object = new Bone();
-                                       break;
-
-                               default:
-                                       object = new Object3D();
-                       }
-
-                       object.uuid = data.uuid;
-                       if (data.name !== undefined) object.name = data.name;
-
-                       if (data.matrix !== undefined) {
-                               object.matrix.fromArray(data.matrix);
-                               if (data.matrixAutoUpdate !== undefined) object.matrixAutoUpdate = data.matrixAutoUpdate;
-                               if (object.matrixAutoUpdate) object.matrix.decompose(object.position, object.quaternion, object.scale);
-                       } else {
-                               if (data.position !== undefined) object.position.fromArray(data.position);
-                               if (data.rotation !== undefined) object.rotation.fromArray(data.rotation);
-                               if (data.quaternion !== undefined) object.quaternion.fromArray(data.quaternion);
-                               if (data.scale !== undefined) object.scale.fromArray(data.scale);
-                       }
-
-                       if (data.castShadow !== undefined) object.castShadow = data.castShadow;
-                       if (data.receiveShadow !== undefined) object.receiveShadow = data.receiveShadow;
-
-                       if (data.shadow) {
-                               if (data.shadow.bias !== undefined) object.shadow.bias = data.shadow.bias;
-                               if (data.shadow.normalBias !== undefined) object.shadow.normalBias = data.shadow.normalBias;
-                               if (data.shadow.radius !== undefined) object.shadow.radius = data.shadow.radius;
-                               if (data.shadow.mapSize !== undefined) object.shadow.mapSize.fromArray(data.shadow.mapSize);
-                               if (data.shadow.camera !== undefined) object.shadow.camera = this.parseObject(data.shadow.camera);
-                       }
-
-                       if (data.visible !== undefined) object.visible = data.visible;
-                       if (data.frustumCulled !== undefined) object.frustumCulled = data.frustumCulled;
-                       if (data.renderOrder !== undefined) object.renderOrder = data.renderOrder;
-                       if (data.userData !== undefined) object.userData = data.userData;
-                       if (data.layers !== undefined) object.layers.mask = data.layers;
-
-                       if (data.children !== undefined) {
-                               const children = data.children;
-
-                               for (let i = 0; i < children.length; i++) {
-                                       object.add(this.parseObject(children[i], geometries, materials, textures, animations));
-                               }
-                       }
-
-                       if (data.animations !== undefined) {
-                               const objectAnimations = data.animations;
-
-                               for (let i = 0; i < objectAnimations.length; i++) {
-                                       const uuid = objectAnimations[i];
-                                       object.animations.push(animations[uuid]);
-                               }
-                       }
-
-                       if (data.type === 'LOD') {
-                               if (data.autoUpdate !== undefined) object.autoUpdate = data.autoUpdate;
-                               const levels = data.levels;
-
-                               for (let l = 0; l < levels.length; l++) {
-                                       const level = levels[l];
-                                       const child = object.getObjectByProperty('uuid', level.object);
-
-                                       if (child !== undefined) {
-                                               object.addLevel(child, level.distance);
-                                       }
-                               }
-                       }
-
-                       return object;
-               }
-
-               bindSkeletons(object, skeletons) {
-                       if (Object.keys(skeletons).length === 0) return;
-                       object.traverse(function (child) {
-                               if (child.isSkinnedMesh === true && child.skeleton !== undefined) {
-                                       const skeleton = skeletons[child.skeleton];
-
-                                       if (skeleton === undefined) {
-                                               console.warn('THREE.ObjectLoader: No skeleton found with UUID:', child.skeleton);
-                                       } else {
-                                               child.bind(skeleton, child.bindMatrix);
-                                       }
-                               }
-                       });
-               }
-               /* DEPRECATED */
-
-
-               setTexturePath(value) {
-                       console.warn('THREE.ObjectLoader: .setTexturePath() has been renamed to .setResourcePath().');
-                       return this.setResourcePath(value);
-               }
-
-       }
-
-       const TEXTURE_MAPPING = {
-               UVMapping: UVMapping,
-               CubeReflectionMapping: CubeReflectionMapping,
-               CubeRefractionMapping: CubeRefractionMapping,
-               EquirectangularReflectionMapping: EquirectangularReflectionMapping,
-               EquirectangularRefractionMapping: EquirectangularRefractionMapping,
-               CubeUVReflectionMapping: CubeUVReflectionMapping,
-               CubeUVRefractionMapping: CubeUVRefractionMapping
-       };
-       const TEXTURE_WRAPPING = {
-               RepeatWrapping: RepeatWrapping,
-               ClampToEdgeWrapping: ClampToEdgeWrapping,
-               MirroredRepeatWrapping: MirroredRepeatWrapping
-       };
-       const TEXTURE_FILTER = {
-               NearestFilter: NearestFilter,
-               NearestMipmapNearestFilter: NearestMipmapNearestFilter,
-               NearestMipmapLinearFilter: NearestMipmapLinearFilter,
-               LinearFilter: LinearFilter,
-               LinearMipmapNearestFilter: LinearMipmapNearestFilter,
-               LinearMipmapLinearFilter: LinearMipmapLinearFilter
-       };
-
-       class ImageBitmapLoader extends Loader {
-               constructor(manager) {
-                       super(manager);
-
-                       if (typeof createImageBitmap === 'undefined') {
-                               console.warn('THREE.ImageBitmapLoader: createImageBitmap() not supported.');
-                       }
-
-                       if (typeof fetch === 'undefined') {
-                               console.warn('THREE.ImageBitmapLoader: fetch() not supported.');
-                       }
-
-                       this.options = {
-                               premultiplyAlpha: 'none'
-                       };
-               }
-
-               setOptions(options) {
-                       this.options = options;
-                       return this;
-               }
-
-               load(url, onLoad, onProgress, onError) {
-                       if (url === undefined) url = '';
-                       if (this.path !== undefined) url = this.path + url;
-                       url = this.manager.resolveURL(url);
-                       const scope = this;
-                       const cached = Cache.get(url);
-
-                       if (cached !== undefined) {
-                               scope.manager.itemStart(url);
-                               setTimeout(function () {
-                                       if (onLoad) onLoad(cached);
-                                       scope.manager.itemEnd(url);
-                               }, 0);
-                               return cached;
-                       }
-
-                       const fetchOptions = {};
-                       fetchOptions.credentials = this.crossOrigin === 'anonymous' ? 'same-origin' : 'include';
-                       fetchOptions.headers = this.requestHeader;
-                       fetch(url, fetchOptions).then(function (res) {
-                               return res.blob();
-                       }).then(function (blob) {
-                               return createImageBitmap(blob, Object.assign(scope.options, {
-                                       colorSpaceConversion: 'none'
-                               }));
-                       }).then(function (imageBitmap) {
-                               Cache.add(url, imageBitmap);
-                               if (onLoad) onLoad(imageBitmap);
-                               scope.manager.itemEnd(url);
-                       }).catch(function (e) {
-                               if (onError) onError(e);
-                               scope.manager.itemError(url);
-                               scope.manager.itemEnd(url);
-                       });
-                       scope.manager.itemStart(url);
-               }
-
-       }
-
-       ImageBitmapLoader.prototype.isImageBitmapLoader = true;
-
-       class ShapePath {
-               constructor() {
-                       this.type = 'ShapePath';
-                       this.color = new Color();
-                       this.subPaths = [];
-                       this.currentPath = null;
-               }
-
-               moveTo(x, y) {
-                       this.currentPath = new Path();
-                       this.subPaths.push(this.currentPath);
-                       this.currentPath.moveTo(x, y);
-                       return this;
-               }
-
-               lineTo(x, y) {
-                       this.currentPath.lineTo(x, y);
-                       return this;
-               }
-
-               quadraticCurveTo(aCPx, aCPy, aX, aY) {
-                       this.currentPath.quadraticCurveTo(aCPx, aCPy, aX, aY);
-                       return this;
-               }
-
-               bezierCurveTo(aCP1x, aCP1y, aCP2x, aCP2y, aX, aY) {
-                       this.currentPath.bezierCurveTo(aCP1x, aCP1y, aCP2x, aCP2y, aX, aY);
-                       return this;
-               }
-
-               splineThru(pts) {
-                       this.currentPath.splineThru(pts);
-                       return this;
-               }
-
-               toShapes(isCCW, noHoles) {
-                       function toShapesNoHoles(inSubpaths) {
-                               const shapes = [];
-
-                               for (let i = 0, l = inSubpaths.length; i < l; i++) {
-                                       const tmpPath = inSubpaths[i];
-                                       const tmpShape = new Shape();
-                                       tmpShape.curves = tmpPath.curves;
-                                       shapes.push(tmpShape);
-                               }
-
-                               return shapes;
-                       }
-
-                       function isPointInsidePolygon(inPt, inPolygon) {
-                               const polyLen = inPolygon.length; // inPt on polygon contour => immediate success               or
-                               // toggling of inside/outside at every single! intersection point of an edge
-                               //      with the horizontal line through inPt, left of inPt
-                               //      not counting lowerY endpoints of edges and whole edges on that line
-
-                               let inside = false;
-
-                               for (let p = polyLen - 1, q = 0; q < polyLen; p = q++) {
-                                       let edgeLowPt = inPolygon[p];
-                                       let edgeHighPt = inPolygon[q];
-                                       let edgeDx = edgeHighPt.x - edgeLowPt.x;
-                                       let edgeDy = edgeHighPt.y - edgeLowPt.y;
-
-                                       if (Math.abs(edgeDy) > Number.EPSILON) {
-                                               // not parallel
-                                               if (edgeDy < 0) {
-                                                       edgeLowPt = inPolygon[q];
-                                                       edgeDx = -edgeDx;
-                                                       edgeHighPt = inPolygon[p];
-                                                       edgeDy = -edgeDy;
-                                               }
-
-                                               if (inPt.y < edgeLowPt.y || inPt.y > edgeHighPt.y) continue;
-
-                                               if (inPt.y === edgeLowPt.y) {
-                                                       if (inPt.x === edgeLowPt.x) return true; // inPt is on contour ?
-                                                       // continue;                            // no intersection or edgeLowPt => doesn't count !!!
-                                               } else {
-                                                       const perpEdge = edgeDy * (inPt.x - edgeLowPt.x) - edgeDx * (inPt.y - edgeLowPt.y);
-                                                       if (perpEdge === 0) return true; // inPt is on contour ?
-
-                                                       if (perpEdge < 0) continue;
-                                                       inside = !inside; // true intersection left of inPt
-                                               }
-                                       } else {
-                                               // parallel or collinear
-                                               if (inPt.y !== edgeLowPt.y) continue; // parallel
-                                               // edge lies on the same horizontal line as inPt
-
-                                               if (edgeHighPt.x <= inPt.x && inPt.x <= edgeLowPt.x || edgeLowPt.x <= inPt.x && inPt.x <= edgeHighPt.x) return true; // inPt: Point on contour !
-                                               // continue;
-                                       }
-                               }
-
-                               return inside;
-                       }
-
-                       const isClockWise = ShapeUtils.isClockWise;
-                       const subPaths = this.subPaths;
-                       if (subPaths.length === 0) return [];
-                       if (noHoles === true) return toShapesNoHoles(subPaths);
-                       let solid, tmpPath, tmpShape;
-                       const shapes = [];
-
-                       if (subPaths.length === 1) {
-                               tmpPath = subPaths[0];
-                               tmpShape = new Shape();
-                               tmpShape.curves = tmpPath.curves;
-                               shapes.push(tmpShape);
-                               return shapes;
-                       }
-
-                       let holesFirst = !isClockWise(subPaths[0].getPoints());
-                       holesFirst = isCCW ? !holesFirst : holesFirst; // console.log("Holes first", holesFirst);
-
-                       const betterShapeHoles = [];
-                       const newShapes = [];
-                       let newShapeHoles = [];
-                       let mainIdx = 0;
-                       let tmpPoints;
-                       newShapes[mainIdx] = undefined;
-                       newShapeHoles[mainIdx] = [];
-
-                       for (let i = 0, l = subPaths.length; i < l; i++) {
-                               tmpPath = subPaths[i];
-                               tmpPoints = tmpPath.getPoints();
-                               solid = isClockWise(tmpPoints);
-                               solid = isCCW ? !solid : solid;
-
-                               if (solid) {
-                                       if (!holesFirst && newShapes[mainIdx]) mainIdx++;
-                                       newShapes[mainIdx] = {
-                                               s: new Shape(),
-                                               p: tmpPoints
-                                       };
-                                       newShapes[mainIdx].s.curves = tmpPath.curves;
-                                       if (holesFirst) mainIdx++;
-                                       newShapeHoles[mainIdx] = []; //console.log('cw', i);
-                               } else {
-                                       newShapeHoles[mainIdx].push({
-                                               h: tmpPath,
-                                               p: tmpPoints[0]
-                                       }); //console.log('ccw', i);
-                               }
-                       } // only Holes? -> probably all Shapes with wrong orientation
-
-
-                       if (!newShapes[0]) return toShapesNoHoles(subPaths);
-
-                       if (newShapes.length > 1) {
-                               let ambiguous = false;
-                               const toChange = [];
-
-                               for (let sIdx = 0, sLen = newShapes.length; sIdx < sLen; sIdx++) {
-                                       betterShapeHoles[sIdx] = [];
-                               }
-
-                               for (let sIdx = 0, sLen = newShapes.length; sIdx < sLen; sIdx++) {
-                                       const sho = newShapeHoles[sIdx];
-
-                                       for (let hIdx = 0; hIdx < sho.length; hIdx++) {
-                                               const ho = sho[hIdx];
-                                               let hole_unassigned = true;
-
-                                               for (let s2Idx = 0; s2Idx < newShapes.length; s2Idx++) {
-                                                       if (isPointInsidePolygon(ho.p, newShapes[s2Idx].p)) {
-                                                               if (sIdx !== s2Idx) toChange.push({
-                                                                       froms: sIdx,
-                                                                       tos: s2Idx,
-                                                                       hole: hIdx
-                                                               });
-
-                                                               if (hole_unassigned) {
-                                                                       hole_unassigned = false;
-                                                                       betterShapeHoles[s2Idx].push(ho);
-                                                               } else {
-                                                                       ambiguous = true;
-                                                               }
-                                                       }
-                                               }
-
-                                               if (hole_unassigned) {
-                                                       betterShapeHoles[sIdx].push(ho);
-                                               }
-                                       }
-                               } // console.log("ambiguous: ", ambiguous);
-
-
-                               if (toChange.length > 0) {
-                                       // console.log("to change: ", toChange);
-                                       if (!ambiguous) newShapeHoles = betterShapeHoles;
-                               }
-                       }
-
-                       let tmpHoles;
-
-                       for (let i = 0, il = newShapes.length; i < il; i++) {
-                               tmpShape = newShapes[i].s;
-                               shapes.push(tmpShape);
-                               tmpHoles = newShapeHoles[i];
-
-                               for (let j = 0, jl = tmpHoles.length; j < jl; j++) {
-                                       tmpShape.holes.push(tmpHoles[j].h);
-                               }
-                       } //console.log("shape", shapes);
-
-
-                       return shapes;
-               }
-
-       }
-
-       class Font {
-               constructor(data) {
-                       this.type = 'Font';
-                       this.data = data;
-               }
-
-               generateShapes(text, size = 100) {
-                       const shapes = [];
-                       const paths = createPaths(text, size, this.data);
-
-                       for (let p = 0, pl = paths.length; p < pl; p++) {
-                               Array.prototype.push.apply(shapes, paths[p].toShapes());
-                       }
-
-                       return shapes;
-               }
-
-       }
-
-       function createPaths(text, size, data) {
-               const chars = Array.from(text);
-               const scale = size / data.resolution;
-               const line_height = (data.boundingBox.yMax - data.boundingBox.yMin + data.underlineThickness) * scale;
-               const paths = [];
-               let offsetX = 0,
-                               offsetY = 0;
-
-               for (let i = 0; i < chars.length; i++) {
-                       const char = chars[i];
-
-                       if (char === '\n') {
-                               offsetX = 0;
-                               offsetY -= line_height;
-                       } else {
-                               const ret = createPath(char, scale, offsetX, offsetY, data);
-                               offsetX += ret.offsetX;
-                               paths.push(ret.path);
-                       }
-               }
-
-               return paths;
-       }
-
-       function createPath(char, scale, offsetX, offsetY, data) {
-               const glyph = data.glyphs[char] || data.glyphs['?'];
-
-               if (!glyph) {
-                       console.error('THREE.Font: character "' + char + '" does not exists in font family ' + data.familyName + '.');
-                       return;
-               }
-
-               const path = new ShapePath();
-               let x, y, cpx, cpy, cpx1, cpy1, cpx2, cpy2;
-
-               if (glyph.o) {
-                       const outline = glyph._cachedOutline || (glyph._cachedOutline = glyph.o.split(' '));
-
-                       for (let i = 0, l = outline.length; i < l;) {
-                               const action = outline[i++];
-
-                               switch (action) {
-                                       case 'm':
-                                               // moveTo
-                                               x = outline[i++] * scale + offsetX;
-                                               y = outline[i++] * scale + offsetY;
-                                               path.moveTo(x, y);
-                                               break;
-
-                                       case 'l':
-                                               // lineTo
-                                               x = outline[i++] * scale + offsetX;
-                                               y = outline[i++] * scale + offsetY;
-                                               path.lineTo(x, y);
-                                               break;
-
-                                       case 'q':
-                                               // quadraticCurveTo
-                                               cpx = outline[i++] * scale + offsetX;
-                                               cpy = outline[i++] * scale + offsetY;
-                                               cpx1 = outline[i++] * scale + offsetX;
-                                               cpy1 = outline[i++] * scale + offsetY;
-                                               path.quadraticCurveTo(cpx1, cpy1, cpx, cpy);
-                                               break;
-
-                                       case 'b':
-                                               // bezierCurveTo
-                                               cpx = outline[i++] * scale + offsetX;
-                                               cpy = outline[i++] * scale + offsetY;
-                                               cpx1 = outline[i++] * scale + offsetX;
-                                               cpy1 = outline[i++] * scale + offsetY;
-                                               cpx2 = outline[i++] * scale + offsetX;
-                                               cpy2 = outline[i++] * scale + offsetY;
-                                               path.bezierCurveTo(cpx1, cpy1, cpx2, cpy2, cpx, cpy);
-                                               break;
-                               }
-                       }
-               }
-
-               return {
-                       offsetX: glyph.ha * scale,
-                       path: path
-               };
-       }
-
-       Font.prototype.isFont = true;
-
-       class FontLoader extends Loader {
-               constructor(manager) {
-                       super(manager);
-               }
-
-               load(url, onLoad, onProgress, onError) {
-                       const scope = this;
-                       const loader = new FileLoader(this.manager);
-                       loader.setPath(this.path);
-                       loader.setRequestHeader(this.requestHeader);
-                       loader.setWithCredentials(scope.withCredentials);
-                       loader.load(url, function (text) {
-                               let json;
-
-                               try {
-                                       json = JSON.parse(text);
-                               } catch (e) {
-                                       console.warn('THREE.FontLoader: typeface.js support is being deprecated. Use typeface.json instead.');
-                                       json = JSON.parse(text.substring(65, text.length - 2));
-                               }
-
-                               const font = scope.parse(json);
-                               if (onLoad) onLoad(font);
-                       }, onProgress, onError);
-               }
-
-               parse(json) {
-                       return new Font(json);
-               }
-
-       }
-
-       let _context;
-
-       const AudioContext = {
-               getContext: function () {
-                       if (_context === undefined) {
-                               _context = new (window.AudioContext || window.webkitAudioContext)();
-                       }
-
-                       return _context;
-               },
-               setContext: function (value) {
-                       _context = value;
-               }
-       };
-
-       class AudioLoader extends Loader {
-               constructor(manager) {
-                       super(manager);
-               }
-
-               load(url, onLoad, onProgress, onError) {
-                       const scope = this;
-                       const loader = new FileLoader(this.manager);
-                       loader.setResponseType('arraybuffer');
-                       loader.setPath(this.path);
-                       loader.setRequestHeader(this.requestHeader);
-                       loader.setWithCredentials(this.withCredentials);
-                       loader.load(url, function (buffer) {
-                               try {
-                                       // Create a copy of the buffer. The `decodeAudioData` method
-                                       // detaches the buffer when complete, preventing reuse.
-                                       const bufferCopy = buffer.slice(0);
-                                       const context = AudioContext.getContext();
-                                       context.decodeAudioData(bufferCopy, function (audioBuffer) {
-                                               onLoad(audioBuffer);
-                                       });
-                               } catch (e) {
-                                       if (onError) {
-                                               onError(e);
-                                       } else {
-                                               console.error(e);
-                                       }
-
-                                       scope.manager.itemError(url);
-                               }
-                       }, onProgress, onError);
-               }
-
-       }
-
-       class HemisphereLightProbe extends LightProbe {
-               constructor(skyColor, groundColor, intensity = 1) {
-                       super(undefined, intensity);
-                       const color1 = new Color().set(skyColor);
-                       const color2 = new Color().set(groundColor);
-                       const sky = new Vector3(color1.r, color1.g, color1.b);
-                       const ground = new Vector3(color2.r, color2.g, color2.b); // without extra factor of PI in the shader, should = 1 / Math.sqrt( Math.PI );
-
-                       const c0 = Math.sqrt(Math.PI);
-                       const c1 = c0 * Math.sqrt(0.75);
-                       this.sh.coefficients[0].copy(sky).add(ground).multiplyScalar(c0);
-                       this.sh.coefficients[1].copy(sky).sub(ground).multiplyScalar(c1);
-               }
-
-       }
-
-       HemisphereLightProbe.prototype.isHemisphereLightProbe = true;
-
-       class AmbientLightProbe extends LightProbe {
-               constructor(color, intensity = 1) {
-                       super(undefined, intensity);
-                       const color1 = new Color().set(color); // without extra factor of PI in the shader, would be 2 / Math.sqrt( Math.PI );
-
-                       this.sh.coefficients[0].set(color1.r, color1.g, color1.b).multiplyScalar(2 * Math.sqrt(Math.PI));
-               }
-
-       }
-
-       AmbientLightProbe.prototype.isAmbientLightProbe = true;
-
-       const _eyeRight = /*@__PURE__*/new Matrix4();
-
-       const _eyeLeft = /*@__PURE__*/new Matrix4();
-
-       class StereoCamera {
-               constructor() {
-                       this.type = 'StereoCamera';
-                       this.aspect = 1;
-                       this.eyeSep = 0.064;
-                       this.cameraL = new PerspectiveCamera();
-                       this.cameraL.layers.enable(1);
-                       this.cameraL.matrixAutoUpdate = false;
-                       this.cameraR = new PerspectiveCamera();
-                       this.cameraR.layers.enable(2);
-                       this.cameraR.matrixAutoUpdate = false;
-                       this._cache = {
-                               focus: null,
-                               fov: null,
-                               aspect: null,
-                               near: null,
-                               far: null,
-                               zoom: null,
-                               eyeSep: null
-                       };
-               }
-
-               update(camera) {
-                       const cache = this._cache;
-                       const needsUpdate = cache.focus !== camera.focus || cache.fov !== camera.fov || cache.aspect !== camera.aspect * this.aspect || cache.near !== camera.near || cache.far !== camera.far || cache.zoom !== camera.zoom || cache.eyeSep !== this.eyeSep;
-
-                       if (needsUpdate) {
-                               cache.focus = camera.focus;
-                               cache.fov = camera.fov;
-                               cache.aspect = camera.aspect * this.aspect;
-                               cache.near = camera.near;
-                               cache.far = camera.far;
-                               cache.zoom = camera.zoom;
-                               cache.eyeSep = this.eyeSep; // Off-axis stereoscopic effect based on
-                               // http://paulbourke.net/stereographics/stereorender/
-
-                               const projectionMatrix = camera.projectionMatrix.clone();
-                               const eyeSepHalf = cache.eyeSep / 2;
-                               const eyeSepOnProjection = eyeSepHalf * cache.near / cache.focus;
-                               const ymax = cache.near * Math.tan(DEG2RAD * cache.fov * 0.5) / cache.zoom;
-                               let xmin, xmax; // translate xOffset
-
-                               _eyeLeft.elements[12] = -eyeSepHalf;
-                               _eyeRight.elements[12] = eyeSepHalf; // for left eye
-
-                               xmin = -ymax * cache.aspect + eyeSepOnProjection;
-                               xmax = ymax * cache.aspect + eyeSepOnProjection;
-                               projectionMatrix.elements[0] = 2 * cache.near / (xmax - xmin);
-                               projectionMatrix.elements[8] = (xmax + xmin) / (xmax - xmin);
-                               this.cameraL.projectionMatrix.copy(projectionMatrix); // for right eye
-
-                               xmin = -ymax * cache.aspect - eyeSepOnProjection;
-                               xmax = ymax * cache.aspect - eyeSepOnProjection;
-                               projectionMatrix.elements[0] = 2 * cache.near / (xmax - xmin);
-                               projectionMatrix.elements[8] = (xmax + xmin) / (xmax - xmin);
-                               this.cameraR.projectionMatrix.copy(projectionMatrix);
-                       }
-
-                       this.cameraL.matrixWorld.copy(camera.matrixWorld).multiply(_eyeLeft);
-                       this.cameraR.matrixWorld.copy(camera.matrixWorld).multiply(_eyeRight);
-               }
-
-       }
-
-       class Clock {
-               constructor(autoStart = true) {
-                       this.autoStart = autoStart;
-                       this.startTime = 0;
-                       this.oldTime = 0;
-                       this.elapsedTime = 0;
-                       this.running = false;
-               }
-
-               start() {
-                       this.startTime = now();
-                       this.oldTime = this.startTime;
-                       this.elapsedTime = 0;
-                       this.running = true;
-               }
-
-               stop() {
-                       this.getElapsedTime();
-                       this.running = false;
-                       this.autoStart = false;
-               }
-
-               getElapsedTime() {
-                       this.getDelta();
-                       return this.elapsedTime;
-               }
-
-               getDelta() {
-                       let diff = 0;
-
-                       if (this.autoStart && !this.running) {
-                               this.start();
-                               return 0;
-                       }
-
-                       if (this.running) {
-                               const newTime = now();
-                               diff = (newTime - this.oldTime) / 1000;
-                               this.oldTime = newTime;
-                               this.elapsedTime += diff;
-                       }
-
-                       return diff;
-               }
-
-       }
-
-       function now() {
-               return (typeof performance === 'undefined' ? Date : performance).now(); // see #10732
-       }
-
-       const _position$1 = /*@__PURE__*/new Vector3();
-
-       const _quaternion$1 = /*@__PURE__*/new Quaternion();
-
-       const _scale$1 = /*@__PURE__*/new Vector3();
-
-       const _orientation$1 = /*@__PURE__*/new Vector3();
-
-       class AudioListener extends Object3D {
-               constructor() {
-                       super();
-                       this.type = 'AudioListener';
-                       this.context = AudioContext.getContext();
-                       this.gain = this.context.createGain();
-                       this.gain.connect(this.context.destination);
-                       this.filter = null;
-                       this.timeDelta = 0; // private
-
-                       this._clock = new Clock();
-               }
-
-               getInput() {
-                       return this.gain;
-               }
-
-               removeFilter() {
-                       if (this.filter !== null) {
-                               this.gain.disconnect(this.filter);
-                               this.filter.disconnect(this.context.destination);
-                               this.gain.connect(this.context.destination);
-                               this.filter = null;
-                       }
-
-                       return this;
-               }
-
-               getFilter() {
-                       return this.filter;
-               }
-
-               setFilter(value) {
-                       if (this.filter !== null) {
-                               this.gain.disconnect(this.filter);
-                               this.filter.disconnect(this.context.destination);
-                       } else {
-                               this.gain.disconnect(this.context.destination);
-                       }
-
-                       this.filter = value;
-                       this.gain.connect(this.filter);
-                       this.filter.connect(this.context.destination);
-                       return this;
-               }
-
-               getMasterVolume() {
-                       return this.gain.gain.value;
-               }
-
-               setMasterVolume(value) {
-                       this.gain.gain.setTargetAtTime(value, this.context.currentTime, 0.01);
-                       return this;
-               }
-
-               updateMatrixWorld(force) {
-                       super.updateMatrixWorld(force);
-                       const listener = this.context.listener;
-                       const up = this.up;
-                       this.timeDelta = this._clock.getDelta();
-                       this.matrixWorld.decompose(_position$1, _quaternion$1, _scale$1);
-
-                       _orientation$1.set(0, 0, -1).applyQuaternion(_quaternion$1);
-
-                       if (listener.positionX) {
-                               // code path for Chrome (see #14393)
-                               const endTime = this.context.currentTime + this.timeDelta;
-                               listener.positionX.linearRampToValueAtTime(_position$1.x, endTime);
-                               listener.positionY.linearRampToValueAtTime(_position$1.y, endTime);
-                               listener.positionZ.linearRampToValueAtTime(_position$1.z, endTime);
-                               listener.forwardX.linearRampToValueAtTime(_orientation$1.x, endTime);
-                               listener.forwardY.linearRampToValueAtTime(_orientation$1.y, endTime);
-                               listener.forwardZ.linearRampToValueAtTime(_orientation$1.z, endTime);
-                               listener.upX.linearRampToValueAtTime(up.x, endTime);
-                               listener.upY.linearRampToValueAtTime(up.y, endTime);
-                               listener.upZ.linearRampToValueAtTime(up.z, endTime);
-                       } else {
-                               listener.setPosition(_position$1.x, _position$1.y, _position$1.z);
-                               listener.setOrientation(_orientation$1.x, _orientation$1.y, _orientation$1.z, up.x, up.y, up.z);
-                       }
-               }
-
-       }
-
-       class Audio extends Object3D {
-               constructor(listener) {
-                       super();
-                       this.type = 'Audio';
-                       this.listener = listener;
-                       this.context = listener.context;
-                       this.gain = this.context.createGain();
-                       this.gain.connect(listener.getInput());
-                       this.autoplay = false;
-                       this.buffer = null;
-                       this.detune = 0;
-                       this.loop = false;
-                       this.loopStart = 0;
-                       this.loopEnd = 0;
-                       this.offset = 0;
-                       this.duration = undefined;
-                       this.playbackRate = 1;
-                       this.isPlaying = false;
-                       this.hasPlaybackControl = true;
-                       this.source = null;
-                       this.sourceType = 'empty';
-                       this._startedAt = 0;
-                       this._progress = 0;
-                       this._connected = false;
-                       this.filters = [];
-               }
-
-               getOutput() {
-                       return this.gain;
-               }
-
-               setNodeSource(audioNode) {
-                       this.hasPlaybackControl = false;
-                       this.sourceType = 'audioNode';
-                       this.source = audioNode;
-                       this.connect();
-                       return this;
-               }
-
-               setMediaElementSource(mediaElement) {
-                       this.hasPlaybackControl = false;
-                       this.sourceType = 'mediaNode';
-                       this.source = this.context.createMediaElementSource(mediaElement);
-                       this.connect();
-                       return this;
-               }
-
-               setMediaStreamSource(mediaStream) {
-                       this.hasPlaybackControl = false;
-                       this.sourceType = 'mediaStreamNode';
-                       this.source = this.context.createMediaStreamSource(mediaStream);
-                       this.connect();
-                       return this;
-               }
-
-               setBuffer(audioBuffer) {
-                       this.buffer = audioBuffer;
-                       this.sourceType = 'buffer';
-                       if (this.autoplay) this.play();
-                       return this;
-               }
-
-               play(delay = 0) {
-                       if (this.isPlaying === true) {
-                               console.warn('THREE.Audio: Audio is already playing.');
-                               return;
-                       }
-
-                       if (this.hasPlaybackControl === false) {
-                               console.warn('THREE.Audio: this Audio has no playback control.');
-                               return;
-                       }
-
-                       this._startedAt = this.context.currentTime + delay;
-                       const source = this.context.createBufferSource();
-                       source.buffer = this.buffer;
-                       source.loop = this.loop;
-                       source.loopStart = this.loopStart;
-                       source.loopEnd = this.loopEnd;
-                       source.onended = this.onEnded.bind(this);
-                       source.start(this._startedAt, this._progress + this.offset, this.duration);
-                       this.isPlaying = true;
-                       this.source = source;
-                       this.setDetune(this.detune);
-                       this.setPlaybackRate(this.playbackRate);
-                       return this.connect();
-               }
-
-               pause() {
-                       if (this.hasPlaybackControl === false) {
-                               console.warn('THREE.Audio: this Audio has no playback control.');
-                               return;
-                       }
-
-                       if (this.isPlaying === true) {
-                               // update current progress
-                               this._progress += Math.max(this.context.currentTime - this._startedAt, 0) * this.playbackRate;
-
-                               if (this.loop === true) {
-                                       // ensure _progress does not exceed duration with looped audios
-                                       this._progress = this._progress % (this.duration || this.buffer.duration);
-                               }
-
-                               this.source.stop();
-                               this.source.onended = null;
-                               this.isPlaying = false;
-                       }
-
-                       return this;
-               }
-
-               stop() {
-                       if (this.hasPlaybackControl === false) {
-                               console.warn('THREE.Audio: this Audio has no playback control.');
-                               return;
-                       }
-
-                       this._progress = 0;
-                       this.source.stop();
-                       this.source.onended = null;
-                       this.isPlaying = false;
-                       return this;
-               }
-
-               connect() {
-                       if (this.filters.length > 0) {
-                               this.source.connect(this.filters[0]);
-
-                               for (let i = 1, l = this.filters.length; i < l; i++) {
-                                       this.filters[i - 1].connect(this.filters[i]);
-                               }
-
-                               this.filters[this.filters.length - 1].connect(this.getOutput());
-                       } else {
-                               this.source.connect(this.getOutput());
-                       }
-
-                       this._connected = true;
-                       return this;
-               }
-
-               disconnect() {
-                       if (this.filters.length > 0) {
-                               this.source.disconnect(this.filters[0]);
-
-                               for (let i = 1, l = this.filters.length; i < l; i++) {
-                                       this.filters[i - 1].disconnect(this.filters[i]);
-                               }
-
-                               this.filters[this.filters.length - 1].disconnect(this.getOutput());
-                       } else {
-                               this.source.disconnect(this.getOutput());
-                       }
-
-                       this._connected = false;
-                       return this;
-               }
-
-               getFilters() {
-                       return this.filters;
-               }
-
-               setFilters(value) {
-                       if (!value) value = [];
-
-                       if (this._connected === true) {
-                               this.disconnect();
-                               this.filters = value.slice();
-                               this.connect();
-                       } else {
-                               this.filters = value.slice();
-                       }
-
-                       return this;
-               }
-
-               setDetune(value) {
-                       this.detune = value;
-                       if (this.source.detune === undefined) return; // only set detune when available
-
-                       if (this.isPlaying === true) {
-                               this.source.detune.setTargetAtTime(this.detune, this.context.currentTime, 0.01);
-                       }
-
-                       return this;
-               }
-
-               getDetune() {
-                       return this.detune;
-               }
-
-               getFilter() {
-                       return this.getFilters()[0];
-               }
-
-               setFilter(filter) {
-                       return this.setFilters(filter ? [filter] : []);
-               }
-
-               setPlaybackRate(value) {
-                       if (this.hasPlaybackControl === false) {
-                               console.warn('THREE.Audio: this Audio has no playback control.');
-                               return;
-                       }
-
-                       this.playbackRate = value;
-
-                       if (this.isPlaying === true) {
-                               this.source.playbackRate.setTargetAtTime(this.playbackRate, this.context.currentTime, 0.01);
-                       }
-
-                       return this;
-               }
-
-               getPlaybackRate() {
-                       return this.playbackRate;
-               }
-
-               onEnded() {
-                       this.isPlaying = false;
-               }
-
-               getLoop() {
-                       if (this.hasPlaybackControl === false) {
-                               console.warn('THREE.Audio: this Audio has no playback control.');
-                               return false;
-                       }
-
-                       return this.loop;
-               }
-
-               setLoop(value) {
-                       if (this.hasPlaybackControl === false) {
-                               console.warn('THREE.Audio: this Audio has no playback control.');
-                               return;
-                       }
-
-                       this.loop = value;
-
-                       if (this.isPlaying === true) {
-                               this.source.loop = this.loop;
-                       }
-
-                       return this;
-               }
-
-               setLoopStart(value) {
-                       this.loopStart = value;
-                       return this;
-               }
-
-               setLoopEnd(value) {
-                       this.loopEnd = value;
-                       return this;
-               }
-
-               getVolume() {
-                       return this.gain.gain.value;
-               }
-
-               setVolume(value) {
-                       this.gain.gain.setTargetAtTime(value, this.context.currentTime, 0.01);
-                       return this;
-               }
-
-       }
-
-       const _position = /*@__PURE__*/new Vector3();
-
-       const _quaternion = /*@__PURE__*/new Quaternion();
-
-       const _scale = /*@__PURE__*/new Vector3();
-
-       const _orientation = /*@__PURE__*/new Vector3();
-
-       class PositionalAudio extends Audio {
-               constructor(listener) {
-                       super(listener);
-                       this.panner = this.context.createPanner();
-                       this.panner.panningModel = 'HRTF';
-                       this.panner.connect(this.gain);
-               }
-
-               getOutput() {
-                       return this.panner;
-               }
-
-               getRefDistance() {
-                       return this.panner.refDistance;
-               }
-
-               setRefDistance(value) {
-                       this.panner.refDistance = value;
-                       return this;
-               }
-
-               getRolloffFactor() {
-                       return this.panner.rolloffFactor;
-               }
-
-               setRolloffFactor(value) {
-                       this.panner.rolloffFactor = value;
-                       return this;
-               }
-
-               getDistanceModel() {
-                       return this.panner.distanceModel;
-               }
-
-               setDistanceModel(value) {
-                       this.panner.distanceModel = value;
-                       return this;
-               }
-
-               getMaxDistance() {
-                       return this.panner.maxDistance;
-               }
-
-               setMaxDistance(value) {
-                       this.panner.maxDistance = value;
-                       return this;
-               }
-
-               setDirectionalCone(coneInnerAngle, coneOuterAngle, coneOuterGain) {
-                       this.panner.coneInnerAngle = coneInnerAngle;
-                       this.panner.coneOuterAngle = coneOuterAngle;
-                       this.panner.coneOuterGain = coneOuterGain;
-                       return this;
-               }
-
-               updateMatrixWorld(force) {
-                       super.updateMatrixWorld(force);
-                       if (this.hasPlaybackControl === true && this.isPlaying === false) return;
-                       this.matrixWorld.decompose(_position, _quaternion, _scale);
-
-                       _orientation.set(0, 0, 1).applyQuaternion(_quaternion);
-
-                       const panner = this.panner;
-
-                       if (panner.positionX) {
-                               // code path for Chrome and Firefox (see #14393)
-                               const endTime = this.context.currentTime + this.listener.timeDelta;
-                               panner.positionX.linearRampToValueAtTime(_position.x, endTime);
-                               panner.positionY.linearRampToValueAtTime(_position.y, endTime);
-                               panner.positionZ.linearRampToValueAtTime(_position.z, endTime);
-                               panner.orientationX.linearRampToValueAtTime(_orientation.x, endTime);
-                               panner.orientationY.linearRampToValueAtTime(_orientation.y, endTime);
-                               panner.orientationZ.linearRampToValueAtTime(_orientation.z, endTime);
-                       } else {
-                               panner.setPosition(_position.x, _position.y, _position.z);
-                               panner.setOrientation(_orientation.x, _orientation.y, _orientation.z);
-                       }
-               }
-
-       }
-
-       class AudioAnalyser {
-               constructor(audio, fftSize = 2048) {
-                       this.analyser = audio.context.createAnalyser();
-                       this.analyser.fftSize = fftSize;
-                       this.data = new Uint8Array(this.analyser.frequencyBinCount);
-                       audio.getOutput().connect(this.analyser);
-               }
-
-               getFrequencyData() {
-                       this.analyser.getByteFrequencyData(this.data);
-                       return this.data;
-               }
-
-               getAverageFrequency() {
-                       let value = 0;
-                       const data = this.getFrequencyData();
-
-                       for (let i = 0; i < data.length; i++) {
-                               value += data[i];
-                       }
-
-                       return value / data.length;
-               }
-
-       }
-
-       class PropertyMixer {
-               constructor(binding, typeName, valueSize) {
-                       this.binding = binding;
-                       this.valueSize = valueSize;
-                       let mixFunction, mixFunctionAdditive, setIdentity; // buffer layout: [ incoming | accu0 | accu1 | orig | addAccu | (optional work) ]
-                       //
-                       // interpolators can use .buffer as their .result
-                       // the data then goes to 'incoming'
-                       //
-                       // 'accu0' and 'accu1' are used frame-interleaved for
-                       // the cumulative result and are compared to detect
-                       // changes
-                       //
-                       // 'orig' stores the original state of the property
-                       //
-                       // 'add' is used for additive cumulative results
-                       //
-                       // 'work' is optional and is only present for quaternion types. It is used
-                       // to store intermediate quaternion multiplication results
-
-                       switch (typeName) {
-                               case 'quaternion':
-                                       mixFunction = this._slerp;
-                                       mixFunctionAdditive = this._slerpAdditive;
-                                       setIdentity = this._setAdditiveIdentityQuaternion;
-                                       this.buffer = new Float64Array(valueSize * 6);
-                                       this._workIndex = 5;
-                                       break;
-
-                               case 'string':
-                               case 'bool':
-                                       mixFunction = this._select; // Use the regular mix function and for additive on these types,
-                                       // additive is not relevant for non-numeric types
-
-                                       mixFunctionAdditive = this._select;
-                                       setIdentity = this._setAdditiveIdentityOther;
-                                       this.buffer = new Array(valueSize * 5);
-                                       break;
-
-                               default:
-                                       mixFunction = this._lerp;
-                                       mixFunctionAdditive = this._lerpAdditive;
-                                       setIdentity = this._setAdditiveIdentityNumeric;
-                                       this.buffer = new Float64Array(valueSize * 5);
-                       }
-
-                       this._mixBufferRegion = mixFunction;
-                       this._mixBufferRegionAdditive = mixFunctionAdditive;
-                       this._setIdentity = setIdentity;
-                       this._origIndex = 3;
-                       this._addIndex = 4;
-                       this.cumulativeWeight = 0;
-                       this.cumulativeWeightAdditive = 0;
-                       this.useCount = 0;
-                       this.referenceCount = 0;
-               } // accumulate data in the 'incoming' region into 'accu<i>'
-
-
-               accumulate(accuIndex, weight) {
-                       // note: happily accumulating nothing when weight = 0, the caller knows
-                       // the weight and shouldn't have made the call in the first place
-                       const buffer = this.buffer,
-                                               stride = this.valueSize,
-                                               offset = accuIndex * stride + stride;
-                       let currentWeight = this.cumulativeWeight;
-
-                       if (currentWeight === 0) {
-                               // accuN := incoming * weight
-                               for (let i = 0; i !== stride; ++i) {
-                                       buffer[offset + i] = buffer[i];
-                               }
-
-                               currentWeight = weight;
-                       } else {
-                               // accuN := accuN + incoming * weight
-                               currentWeight += weight;
-                               const mix = weight / currentWeight;
-
-                               this._mixBufferRegion(buffer, offset, 0, mix, stride);
-                       }
-
-                       this.cumulativeWeight = currentWeight;
-               } // accumulate data in the 'incoming' region into 'add'
-
-
-               accumulateAdditive(weight) {
-                       const buffer = this.buffer,
-                                               stride = this.valueSize,
-                                               offset = stride * this._addIndex;
-
-                       if (this.cumulativeWeightAdditive === 0) {
-                               // add = identity
-                               this._setIdentity();
-                       } // add := add + incoming * weight
-
-
-                       this._mixBufferRegionAdditive(buffer, offset, 0, weight, stride);
-
-                       this.cumulativeWeightAdditive += weight;
-               } // apply the state of 'accu<i>' to the binding when accus differ
-
-
-               apply(accuIndex) {
-                       const stride = this.valueSize,
-                                               buffer = this.buffer,
-                                               offset = accuIndex * stride + stride,
-                                               weight = this.cumulativeWeight,
-                                               weightAdditive = this.cumulativeWeightAdditive,
-                                               binding = this.binding;
-                       this.cumulativeWeight = 0;
-                       this.cumulativeWeightAdditive = 0;
-
-                       if (weight < 1) {
-                               // accuN := accuN + original * ( 1 - cumulativeWeight )
-                               const originalValueOffset = stride * this._origIndex;
-
-                               this._mixBufferRegion(buffer, offset, originalValueOffset, 1 - weight, stride);
-                       }
-
-                       if (weightAdditive > 0) {
-                               // accuN := accuN + additive accuN
-                               this._mixBufferRegionAdditive(buffer, offset, this._addIndex * stride, 1, stride);
-                       }
-
-                       for (let i = stride, e = stride + stride; i !== e; ++i) {
-                               if (buffer[i] !== buffer[i + stride]) {
-                                       // value has changed -> update scene graph
-                                       binding.setValue(buffer, offset);
-                                       break;
-                               }
-                       }
-               } // remember the state of the bound property and copy it to both accus
-
-
-               saveOriginalState() {
-                       const binding = this.binding;
-                       const buffer = this.buffer,
-                                               stride = this.valueSize,
-                                               originalValueOffset = stride * this._origIndex;
-                       binding.getValue(buffer, originalValueOffset); // accu[0..1] := orig -- initially detect changes against the original
-
-                       for (let i = stride, e = originalValueOffset; i !== e; ++i) {
-                               buffer[i] = buffer[originalValueOffset + i % stride];
-                       } // Add to identity for additive
-
-
-                       this._setIdentity();
-
-                       this.cumulativeWeight = 0;
-                       this.cumulativeWeightAdditive = 0;
-               } // apply the state previously taken via 'saveOriginalState' to the binding
-
-
-               restoreOriginalState() {
-                       const originalValueOffset = this.valueSize * 3;
-                       this.binding.setValue(this.buffer, originalValueOffset);
-               }
-
-               _setAdditiveIdentityNumeric() {
-                       const startIndex = this._addIndex * this.valueSize;
-                       const endIndex = startIndex + this.valueSize;
-
-                       for (let i = startIndex; i < endIndex; i++) {
-                               this.buffer[i] = 0;
-                       }
-               }
-
-               _setAdditiveIdentityQuaternion() {
-                       this._setAdditiveIdentityNumeric();
-
-                       this.buffer[this._addIndex * this.valueSize + 3] = 1;
-               }
-
-               _setAdditiveIdentityOther() {
-                       const startIndex = this._origIndex * this.valueSize;
-                       const targetIndex = this._addIndex * this.valueSize;
-
-                       for (let i = 0; i < this.valueSize; i++) {
-                               this.buffer[targetIndex + i] = this.buffer[startIndex + i];
-                       }
-               } // mix functions
-
-
-               _select(buffer, dstOffset, srcOffset, t, stride) {
-                       if (t >= 0.5) {
-                               for (let i = 0; i !== stride; ++i) {
-                                       buffer[dstOffset + i] = buffer[srcOffset + i];
-                               }
-                       }
-               }
-
-               _slerp(buffer, dstOffset, srcOffset, t) {
-                       Quaternion.slerpFlat(buffer, dstOffset, buffer, dstOffset, buffer, srcOffset, t);
-               }
-
-               _slerpAdditive(buffer, dstOffset, srcOffset, t, stride) {
-                       const workOffset = this._workIndex * stride; // Store result in intermediate buffer offset
-
-                       Quaternion.multiplyQuaternionsFlat(buffer, workOffset, buffer, dstOffset, buffer, srcOffset); // Slerp to the intermediate result
-
-                       Quaternion.slerpFlat(buffer, dstOffset, buffer, dstOffset, buffer, workOffset, t);
-               }
-
-               _lerp(buffer, dstOffset, srcOffset, t, stride) {
-                       const s = 1 - t;
-
-                       for (let i = 0; i !== stride; ++i) {
-                               const j = dstOffset + i;
-                               buffer[j] = buffer[j] * s + buffer[srcOffset + i] * t;
-                       }
-               }
-
-               _lerpAdditive(buffer, dstOffset, srcOffset, t, stride) {
-                       for (let i = 0; i !== stride; ++i) {
-                               const j = dstOffset + i;
-                               buffer[j] = buffer[j] + buffer[srcOffset + i] * t;
-                       }
-               }
-
-       }
-
-       // Characters [].:/ are reserved for track binding syntax.
-       const _RESERVED_CHARS_RE = '\\[\\]\\.:\\/';
-
-       const _reservedRe = new RegExp('[' + _RESERVED_CHARS_RE + ']', 'g'); // Attempts to allow node names from any language. ES5's `\w` regexp matches
-       // only latin characters, and the unicode \p{L} is not yet supported. So
-       // instead, we exclude reserved characters and match everything else.
-
-
-       const _wordChar = '[^' + _RESERVED_CHARS_RE + ']';
-
-       const _wordCharOrDot = '[^' + _RESERVED_CHARS_RE.replace('\\.', '') + ']'; // Parent directories, delimited by '/' or ':'. Currently unused, but must
-       // be matched to parse the rest of the track name.
-
-
-       const _directoryRe = /((?:WC+[\/:])*)/.source.replace('WC', _wordChar); // Target node. May contain word characters (a-zA-Z0-9_) and '.' or '-'.
-
-
-       const _nodeRe = /(WCOD+)?/.source.replace('WCOD', _wordCharOrDot); // Object on target node, and accessor. May not contain reserved
-       // characters. Accessor may contain any character except closing bracket.
-
-
-       const _objectRe = /(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace('WC', _wordChar); // Property and accessor. May not contain reserved characters. Accessor may
-       // contain any non-bracket characters.
-
-
-       const _propertyRe = /\.(WC+)(?:\[(.+)\])?/.source.replace('WC', _wordChar);
-
-       const _trackRe = new RegExp('' + '^' + _directoryRe + _nodeRe + _objectRe + _propertyRe + '$');
-
-       const _supportedObjectNames = ['material', 'materials', 'bones'];
-
-       class Composite {
-               constructor(targetGroup, path, optionalParsedPath) {
-                       const parsedPath = optionalParsedPath || PropertyBinding.parseTrackName(path);
-                       this._targetGroup = targetGroup;
-                       this._bindings = targetGroup.subscribe_(path, parsedPath);
-               }
-
-               getValue(array, offset) {
-                       this.bind(); // bind all binding
-
-                       const firstValidIndex = this._targetGroup.nCachedObjects_,
-                                               binding = this._bindings[firstValidIndex]; // and only call .getValue on the first
-
-                       if (binding !== undefined) binding.getValue(array, offset);
-               }
-
-               setValue(array, offset) {
-                       const bindings = this._bindings;
-
-                       for (let i = this._targetGroup.nCachedObjects_, n = bindings.length; i !== n; ++i) {
-                               bindings[i].setValue(array, offset);
-                       }
-               }
-
-               bind() {
-                       const bindings = this._bindings;
-
-                       for (let i = this._targetGroup.nCachedObjects_, n = bindings.length; i !== n; ++i) {
-                               bindings[i].bind();
-                       }
-               }
-
-               unbind() {
-                       const bindings = this._bindings;
-
-                       for (let i = this._targetGroup.nCachedObjects_, n = bindings.length; i !== n; ++i) {
-                               bindings[i].unbind();
-                       }
-               }
-
-       } // Note: This class uses a State pattern on a per-method basis:
-       // 'bind' sets 'this.getValue' / 'setValue' and shadows the
-       // prototype version of these methods with one that represents
-       // the bound state. When the property is not found, the methods
-       // become no-ops.
-
-
-       class PropertyBinding {
-               constructor(rootNode, path, parsedPath) {
-                       this.path = path;
-                       this.parsedPath = parsedPath || PropertyBinding.parseTrackName(path);
-                       this.node = PropertyBinding.findNode(rootNode, this.parsedPath.nodeName) || rootNode;
-                       this.rootNode = rootNode; // initial state of these methods that calls 'bind'
-
-                       this.getValue = this._getValue_unbound;
-                       this.setValue = this._setValue_unbound;
-               }
-
-               static create(root, path, parsedPath) {
-                       if (!(root && root.isAnimationObjectGroup)) {
-                               return new PropertyBinding(root, path, parsedPath);
-                       } else {
-                               return new PropertyBinding.Composite(root, path, parsedPath);
-                       }
-               }
-               /**
-                * Replaces spaces with underscores and removes unsupported characters from
-                * node names, to ensure compatibility with parseTrackName().
-                *
-                * @param {string} name Node name to be sanitized.
-                * @return {string}
-                */
-
-
-               static sanitizeNodeName(name) {
-                       return name.replace(/\s/g, '_').replace(_reservedRe, '');
-               }
-
-               static parseTrackName(trackName) {
-                       const matches = _trackRe.exec(trackName);
-
-                       if (!matches) {
-                               throw new Error('PropertyBinding: Cannot parse trackName: ' + trackName);
-                       }
-
-                       const results = {
-                               // directoryName: matches[ 1 ], // (tschw) currently unused
-                               nodeName: matches[2],
-                               objectName: matches[3],
-                               objectIndex: matches[4],
-                               propertyName: matches[5],
-                               // required
-                               propertyIndex: matches[6]
-                       };
-                       const lastDot = results.nodeName && results.nodeName.lastIndexOf('.');
-
-                       if (lastDot !== undefined && lastDot !== -1) {
-                               const objectName = results.nodeName.substring(lastDot + 1); // Object names must be checked against an allowlist. Otherwise, there
-                               // is no way to parse 'foo.bar.baz': 'baz' must be a property, but
-                               // 'bar' could be the objectName, or part of a nodeName (which can
-                               // include '.' characters).
-
-                               if (_supportedObjectNames.indexOf(objectName) !== -1) {
-                                       results.nodeName = results.nodeName.substring(0, lastDot);
-                                       results.objectName = objectName;
-                               }
-                       }
-
-                       if (results.propertyName === null || results.propertyName.length === 0) {
-                               throw new Error('PropertyBinding: can not parse propertyName from trackName: ' + trackName);
-                       }
-
-                       return results;
-               }
-
-               static findNode(root, nodeName) {
-                       if (!nodeName || nodeName === '' || nodeName === '.' || nodeName === -1 || nodeName === root.name || nodeName === root.uuid) {
-                               return root;
-                       } // search into skeleton bones.
-
-
-                       if (root.skeleton) {
-                               const bone = root.skeleton.getBoneByName(nodeName);
-
-                               if (bone !== undefined) {
-                                       return bone;
-                               }
-                       } // search into node subtree.
-
-
-                       if (root.children) {
-                               const searchNodeSubtree = function (children) {
-                                       for (let i = 0; i < children.length; i++) {
-                                               const childNode = children[i];
-
-                                               if (childNode.name === nodeName || childNode.uuid === nodeName) {
-                                                       return childNode;
-                                               }
-
-                                               const result = searchNodeSubtree(childNode.children);
-                                               if (result) return result;
-                                       }
-
-                                       return null;
-                               };
-
-                               const subTreeNode = searchNodeSubtree(root.children);
-
-                               if (subTreeNode) {
-                                       return subTreeNode;
-                               }
-                       }
-
-                       return null;
-               } // these are used to "bind" a nonexistent property
-
-
-               _getValue_unavailable() {}
-
-               _setValue_unavailable() {} // Getters
-
-
-               _getValue_direct(buffer, offset) {
-                       buffer[offset] = this.targetObject[this.propertyName];
-               }
-
-               _getValue_array(buffer, offset) {
-                       const source = this.resolvedProperty;
-
-                       for (let i = 0, n = source.length; i !== n; ++i) {
-                               buffer[offset++] = source[i];
-                       }
-               }
-
-               _getValue_arrayElement(buffer, offset) {
-                       buffer[offset] = this.resolvedProperty[this.propertyIndex];
-               }
-
-               _getValue_toArray(buffer, offset) {
-                       this.resolvedProperty.toArray(buffer, offset);
-               } // Direct
-
-
-               _setValue_direct(buffer, offset) {
-                       this.targetObject[this.propertyName] = buffer[offset];
-               }
-
-               _setValue_direct_setNeedsUpdate(buffer, offset) {
-                       this.targetObject[this.propertyName] = buffer[offset];
-                       this.targetObject.needsUpdate = true;
-               }
-
-               _setValue_direct_setMatrixWorldNeedsUpdate(buffer, offset) {
-                       this.targetObject[this.propertyName] = buffer[offset];
-                       this.targetObject.matrixWorldNeedsUpdate = true;
-               } // EntireArray
-
-
-               _setValue_array(buffer, offset) {
-                       const dest = this.resolvedProperty;
-
-                       for (let i = 0, n = dest.length; i !== n; ++i) {
-                               dest[i] = buffer[offset++];
-                       }
-               }
-
-               _setValue_array_setNeedsUpdate(buffer, offset) {
-                       const dest = this.resolvedProperty;
-
-                       for (let i = 0, n = dest.length; i !== n; ++i) {
-                               dest[i] = buffer[offset++];
-                       }
-
-                       this.targetObject.needsUpdate = true;
-               }
-
-               _setValue_array_setMatrixWorldNeedsUpdate(buffer, offset) {
-                       const dest = this.resolvedProperty;
-
-                       for (let i = 0, n = dest.length; i !== n; ++i) {
-                               dest[i] = buffer[offset++];
-                       }
-
-                       this.targetObject.matrixWorldNeedsUpdate = true;
-               } // ArrayElement
-
-
-               _setValue_arrayElement(buffer, offset) {
-                       this.resolvedProperty[this.propertyIndex] = buffer[offset];
-               }
-
-               _setValue_arrayElement_setNeedsUpdate(buffer, offset) {
-                       this.resolvedProperty[this.propertyIndex] = buffer[offset];
-                       this.targetObject.needsUpdate = true;
-               }
-
-               _setValue_arrayElement_setMatrixWorldNeedsUpdate(buffer, offset) {
-                       this.resolvedProperty[this.propertyIndex] = buffer[offset];
-                       this.targetObject.matrixWorldNeedsUpdate = true;
-               } // HasToFromArray
-
-
-               _setValue_fromArray(buffer, offset) {
-                       this.resolvedProperty.fromArray(buffer, offset);
-               }
-
-               _setValue_fromArray_setNeedsUpdate(buffer, offset) {
-                       this.resolvedProperty.fromArray(buffer, offset);
-                       this.targetObject.needsUpdate = true;
-               }
-
-               _setValue_fromArray_setMatrixWorldNeedsUpdate(buffer, offset) {
-                       this.resolvedProperty.fromArray(buffer, offset);
-                       this.targetObject.matrixWorldNeedsUpdate = true;
-               }
-
-               _getValue_unbound(targetArray, offset) {
-                       this.bind();
-                       this.getValue(targetArray, offset);
-               }
-
-               _setValue_unbound(sourceArray, offset) {
-                       this.bind();
-                       this.setValue(sourceArray, offset);
-               } // create getter / setter pair for a property in the scene graph
-
-
-               bind() {
-                       let targetObject = this.node;
-                       const parsedPath = this.parsedPath;
-                       const objectName = parsedPath.objectName;
-                       const propertyName = parsedPath.propertyName;
-                       let propertyIndex = parsedPath.propertyIndex;
-
-                       if (!targetObject) {
-                               targetObject = PropertyBinding.findNode(this.rootNode, parsedPath.nodeName) || this.rootNode;
-                               this.node = targetObject;
-                       } // set fail state so we can just 'return' on error
-
-
-                       this.getValue = this._getValue_unavailable;
-                       this.setValue = this._setValue_unavailable; // ensure there is a value node
-
-                       if (!targetObject) {
-                               console.error('THREE.PropertyBinding: Trying to update node for track: ' + this.path + ' but it wasn\'t found.');
-                               return;
-                       }
-
-                       if (objectName) {
-                               let objectIndex = parsedPath.objectIndex; // special cases were we need to reach deeper into the hierarchy to get the face materials....
-
-                               switch (objectName) {
-                                       case 'materials':
-                                               if (!targetObject.material) {
-                                                       console.error('THREE.PropertyBinding: Can not bind to material as node does not have a material.', this);
-                                                       return;
-                                               }
-
-                                               if (!targetObject.material.materials) {
-                                                       console.error('THREE.PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.', this);
-                                                       return;
-                                               }
-
-                                               targetObject = targetObject.material.materials;
-                                               break;
-
-                                       case 'bones':
-                                               if (!targetObject.skeleton) {
-                                                       console.error('THREE.PropertyBinding: Can not bind to bones as node does not have a skeleton.', this);
-                                                       return;
-                                               } // potential future optimization: skip this if propertyIndex is already an integer
-                                               // and convert the integer string to a true integer.
-
-
-                                               targetObject = targetObject.skeleton.bones; // support resolving morphTarget names into indices.
-
-                                               for (let i = 0; i < targetObject.length; i++) {
-                                                       if (targetObject[i].name === objectIndex) {
-                                                               objectIndex = i;
-                                                               break;
-                                                       }
-                                               }
-
-                                               break;
-
-                                       default:
-                                               if (targetObject[objectName] === undefined) {
-                                                       console.error('THREE.PropertyBinding: Can not bind to objectName of node undefined.', this);
-                                                       return;
-                                               }
-
-                                               targetObject = targetObject[objectName];
-                               }
-
-                               if (objectIndex !== undefined) {
-                                       if (targetObject[objectIndex] === undefined) {
-                                               console.error('THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.', this, targetObject);
-                                               return;
-                                       }
-
-                                       targetObject = targetObject[objectIndex];
-                               }
-                       } // resolve property
-
-
-                       const nodeProperty = targetObject[propertyName];
-
-                       if (nodeProperty === undefined) {
-                               const nodeName = parsedPath.nodeName;
-                               console.error('THREE.PropertyBinding: Trying to update property for track: ' + nodeName + '.' + propertyName + ' but it wasn\'t found.', targetObject);
-                               return;
-                       } // determine versioning scheme
-
-
-                       let versioning = this.Versioning.None;
-                       this.targetObject = targetObject;
-
-                       if (targetObject.needsUpdate !== undefined) {
-                               // material
-                               versioning = this.Versioning.NeedsUpdate;
-                       } else if (targetObject.matrixWorldNeedsUpdate !== undefined) {
-                               // node transform
-                               versioning = this.Versioning.MatrixWorldNeedsUpdate;
-                       } // determine how the property gets bound
-
-
-                       let bindingType = this.BindingType.Direct;
-
-                       if (propertyIndex !== undefined) {
-                               // access a sub element of the property array (only primitives are supported right now)
-                               if (propertyName === 'morphTargetInfluences') {
-                                       // potential optimization, skip this if propertyIndex is already an integer, and convert the integer string to a true integer.
-                                       // support resolving morphTarget names into indices.
-                                       if (!targetObject.geometry) {
-                                               console.error('THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.', this);
-                                               return;
-                                       }
-
-                                       if (targetObject.geometry.isBufferGeometry) {
-                                               if (!targetObject.geometry.morphAttributes) {
-                                                       console.error('THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.', this);
-                                                       return;
-                                               }
-
-                                               if (targetObject.morphTargetDictionary[propertyIndex] !== undefined) {
-                                                       propertyIndex = targetObject.morphTargetDictionary[propertyIndex];
-                                               }
-                                       } else {
-                                               console.error('THREE.PropertyBinding: Can not bind to morphTargetInfluences on THREE.Geometry. Use THREE.BufferGeometry instead.', this);
-                                               return;
-                                       }
-                               }
-
-                               bindingType = this.BindingType.ArrayElement;
-                               this.resolvedProperty = nodeProperty;
-                               this.propertyIndex = propertyIndex;
-                       } else if (nodeProperty.fromArray !== undefined && nodeProperty.toArray !== undefined) {
-                               // must use copy for Object3D.Euler/Quaternion
-                               bindingType = this.BindingType.HasFromToArray;
-                               this.resolvedProperty = nodeProperty;
-                       } else if (Array.isArray(nodeProperty)) {
-                               bindingType = this.BindingType.EntireArray;
-                               this.resolvedProperty = nodeProperty;
-                       } else {
-                               this.propertyName = propertyName;
-                       } // select getter / setter
-
-
-                       this.getValue = this.GetterByBindingType[bindingType];
-                       this.setValue = this.SetterByBindingTypeAndVersioning[bindingType][versioning];
-               }
-
-               unbind() {
-                       this.node = null; // back to the prototype version of getValue / setValue
-                       // note: avoiding to mutate the shape of 'this' via 'delete'
-
-                       this.getValue = this._getValue_unbound;
-                       this.setValue = this._setValue_unbound;
-               }
-
-       }
-
-       PropertyBinding.Composite = Composite;
-       PropertyBinding.prototype.BindingType = {
-               Direct: 0,
-               EntireArray: 1,
-               ArrayElement: 2,
-               HasFromToArray: 3
-       };
-       PropertyBinding.prototype.Versioning = {
-               None: 0,
-               NeedsUpdate: 1,
-               MatrixWorldNeedsUpdate: 2
-       };
-       PropertyBinding.prototype.GetterByBindingType = [PropertyBinding.prototype._getValue_direct, PropertyBinding.prototype._getValue_array, PropertyBinding.prototype._getValue_arrayElement, PropertyBinding.prototype._getValue_toArray];
-       PropertyBinding.prototype.SetterByBindingTypeAndVersioning = [[// Direct
-       PropertyBinding.prototype._setValue_direct, PropertyBinding.prototype._setValue_direct_setNeedsUpdate, PropertyBinding.prototype._setValue_direct_setMatrixWorldNeedsUpdate], [// EntireArray
-       PropertyBinding.prototype._setValue_array, PropertyBinding.prototype._setValue_array_setNeedsUpdate, PropertyBinding.prototype._setValue_array_setMatrixWorldNeedsUpdate], [// ArrayElement
-       PropertyBinding.prototype._setValue_arrayElement, PropertyBinding.prototype._setValue_arrayElement_setNeedsUpdate, PropertyBinding.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate], [// HasToFromArray
-       PropertyBinding.prototype._setValue_fromArray, PropertyBinding.prototype._setValue_fromArray_setNeedsUpdate, PropertyBinding.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];
-
-       /**
-        *
-        * A group of objects that receives a shared animation state.
-        *
-        * Usage:
-        *
-        *      - Add objects you would otherwise pass as 'root' to the
-        *              constructor or the .clipAction method of AnimationMixer.
-        *
-        *      - Instead pass this object as 'root'.
-        *
-        *      - You can also add and remove objects later when the mixer
-        *              is running.
-        *
-        * Note:
-        *
-        *              Objects of this class appear as one object to the mixer,
-        *              so cache control of the individual objects must be done
-        *              on the group.
-        *
-        * Limitation:
-        *
-        *      - The animated properties must be compatible among the
-        *              all objects in the group.
-        *
-        *      - A single property can either be controlled through a
-        *              target group or directly, but not both.
-        */
-
-       class AnimationObjectGroup {
-               constructor() {
-                       this.uuid = generateUUID(); // cached objects followed by the active ones
-
-                       this._objects = Array.prototype.slice.call(arguments);
-                       this.nCachedObjects_ = 0; // threshold
-                       // note: read by PropertyBinding.Composite
-
-                       const indices = {};
-                       this._indicesByUUID = indices; // for bookkeeping
-
-                       for (let i = 0, n = arguments.length; i !== n; ++i) {
-                               indices[arguments[i].uuid] = i;
-                       }
-
-                       this._paths = []; // inside: string
-
-                       this._parsedPaths = []; // inside: { we don't care, here }
-
-                       this._bindings = []; // inside: Array< PropertyBinding >
-
-                       this._bindingsIndicesByPath = {}; // inside: indices in these arrays
-
-                       const scope = this;
-                       this.stats = {
-                               objects: {
-                                       get total() {
-                                               return scope._objects.length;
-                                       },
-
-                                       get inUse() {
-                                               return this.total - scope.nCachedObjects_;
-                                       }
-
-                               },
-
-                               get bindingsPerObject() {
-                                       return scope._bindings.length;
-                               }
-
-                       };
-               }
-
-               add() {
-                       const objects = this._objects,
-                                               indicesByUUID = this._indicesByUUID,
-                                               paths = this._paths,
-                                               parsedPaths = this._parsedPaths,
-                                               bindings = this._bindings,
-                                               nBindings = bindings.length;
-                       let knownObject = undefined,
-                                       nObjects = objects.length,
-                                       nCachedObjects = this.nCachedObjects_;
-
-                       for (let i = 0, n = arguments.length; i !== n; ++i) {
-                               const object = arguments[i],
-                                                       uuid = object.uuid;
-                               let index = indicesByUUID[uuid];
-
-                               if (index === undefined) {
-                                       // unknown object -> add it to the ACTIVE region
-                                       index = nObjects++;
-                                       indicesByUUID[uuid] = index;
-                                       objects.push(object); // accounting is done, now do the same for all bindings
-
-                                       for (let j = 0, m = nBindings; j !== m; ++j) {
-                                               bindings[j].push(new PropertyBinding(object, paths[j], parsedPaths[j]));
-                                       }
-                               } else if (index < nCachedObjects) {
-                                       knownObject = objects[index]; // move existing object to the ACTIVE region
-
-                                       const firstActiveIndex = --nCachedObjects,
-                                                               lastCachedObject = objects[firstActiveIndex];
-                                       indicesByUUID[lastCachedObject.uuid] = index;
-                                       objects[index] = lastCachedObject;
-                                       indicesByUUID[uuid] = firstActiveIndex;
-                                       objects[firstActiveIndex] = object; // accounting is done, now do the same for all bindings
-
-                                       for (let j = 0, m = nBindings; j !== m; ++j) {
-                                               const bindingsForPath = bindings[j],
-                                                                       lastCached = bindingsForPath[firstActiveIndex];
-                                               let binding = bindingsForPath[index];
-                                               bindingsForPath[index] = lastCached;
-
-                                               if (binding === undefined) {
-                                                       // since we do not bother to create new bindings
-                                                       // for objects that are cached, the binding may
-                                                       // or may not exist
-                                                       binding = new PropertyBinding(object, paths[j], parsedPaths[j]);
-                                               }
-
-                                               bindingsForPath[firstActiveIndex] = binding;
-                                       }
-                               } else if (objects[index] !== knownObject) {
-                                       console.error('THREE.AnimationObjectGroup: Different objects with the same UUID ' + 'detected. Clean the caches or recreate your infrastructure when reloading scenes.');
-                               } // else the object is already where we want it to be
-
-                       } // for arguments
-
-
-                       this.nCachedObjects_ = nCachedObjects;
-               }
-
-               remove() {
-                       const objects = this._objects,
-                                               indicesByUUID = this._indicesByUUID,
-                                               bindings = this._bindings,
-                                               nBindings = bindings.length;
-                       let nCachedObjects = this.nCachedObjects_;
-
-                       for (let i = 0, n = arguments.length; i !== n; ++i) {
-                               const object = arguments[i],
-                                                       uuid = object.uuid,
-                                                       index = indicesByUUID[uuid];
-
-                               if (index !== undefined && index >= nCachedObjects) {
-                                       // move existing object into the CACHED region
-                                       const lastCachedIndex = nCachedObjects++,
-                                                               firstActiveObject = objects[lastCachedIndex];
-                                       indicesByUUID[firstActiveObject.uuid] = index;
-                                       objects[index] = firstActiveObject;
-                                       indicesByUUID[uuid] = lastCachedIndex;
-                                       objects[lastCachedIndex] = object; // accounting is done, now do the same for all bindings
-
-                                       for (let j = 0, m = nBindings; j !== m; ++j) {
-                                               const bindingsForPath = bindings[j],
-                                                                       firstActive = bindingsForPath[lastCachedIndex],
-                                                                       binding = bindingsForPath[index];
-                                               bindingsForPath[index] = firstActive;
-                                               bindingsForPath[lastCachedIndex] = binding;
-                                       }
-                               }
-                       } // for arguments
-
-
-                       this.nCachedObjects_ = nCachedObjects;
-               } // remove & forget
-
-
-               uncache() {
-                       const objects = this._objects,
-                                               indicesByUUID = this._indicesByUUID,
-                                               bindings = this._bindings,
-                                               nBindings = bindings.length;
-                       let nCachedObjects = this.nCachedObjects_,
-                                       nObjects = objects.length;
-
-                       for (let i = 0, n = arguments.length; i !== n; ++i) {
-                               const object = arguments[i],
-                                                       uuid = object.uuid,
-                                                       index = indicesByUUID[uuid];
-
-                               if (index !== undefined) {
-                                       delete indicesByUUID[uuid];
-
-                                       if (index < nCachedObjects) {
-                                               // object is cached, shrink the CACHED region
-                                               const firstActiveIndex = --nCachedObjects,
-                                                                       lastCachedObject = objects[firstActiveIndex],
-                                                                       lastIndex = --nObjects,
-                                                                       lastObject = objects[lastIndex]; // last cached object takes this object's place
-
-                                               indicesByUUID[lastCachedObject.uuid] = index;
-                                               objects[index] = lastCachedObject; // last object goes to the activated slot and pop
-
-                                               indicesByUUID[lastObject.uuid] = firstActiveIndex;
-                                               objects[firstActiveIndex] = lastObject;
-                                               objects.pop(); // accounting is done, now do the same for all bindings
-
-                                               for (let j = 0, m = nBindings; j !== m; ++j) {
-                                                       const bindingsForPath = bindings[j],
-                                                                               lastCached = bindingsForPath[firstActiveIndex],
-                                                                               last = bindingsForPath[lastIndex];
-                                                       bindingsForPath[index] = lastCached;
-                                                       bindingsForPath[firstActiveIndex] = last;
-                                                       bindingsForPath.pop();
-                                               }
-                                       } else {
-                                               // object is active, just swap with the last and pop
-                                               const lastIndex = --nObjects,
-                                                                       lastObject = objects[lastIndex];
-
-                                               if (lastIndex > 0) {
-                                                       indicesByUUID[lastObject.uuid] = index;
-                                               }
-
-                                               objects[index] = lastObject;
-                                               objects.pop(); // accounting is done, now do the same for all bindings
-
-                                               for (let j = 0, m = nBindings; j !== m; ++j) {
-                                                       const bindingsForPath = bindings[j];
-                                                       bindingsForPath[index] = bindingsForPath[lastIndex];
-                                                       bindingsForPath.pop();
-                                               }
-                                       } // cached or active
-
-                               } // if object is known
-
-                       } // for arguments
-
-
-                       this.nCachedObjects_ = nCachedObjects;
-               } // Internal interface used by befriended PropertyBinding.Composite:
-
-
-               subscribe_(path, parsedPath) {
-                       // returns an array of bindings for the given path that is changed
-                       // according to the contained objects in the group
-                       const indicesByPath = this._bindingsIndicesByPath;
-                       let index = indicesByPath[path];
-                       const bindings = this._bindings;
-                       if (index !== undefined) return bindings[index];
-                       const paths = this._paths,
-                                               parsedPaths = this._parsedPaths,
-                                               objects = this._objects,
-                                               nObjects = objects.length,
-                                               nCachedObjects = this.nCachedObjects_,
-                                               bindingsForPath = new Array(nObjects);
-                       index = bindings.length;
-                       indicesByPath[path] = index;
-                       paths.push(path);
-                       parsedPaths.push(parsedPath);
-                       bindings.push(bindingsForPath);
-
-                       for (let i = nCachedObjects, n = objects.length; i !== n; ++i) {
-                               const object = objects[i];
-                               bindingsForPath[i] = new PropertyBinding(object, path, parsedPath);
-                       }
-
-                       return bindingsForPath;
-               }
-
-               unsubscribe_(path) {
-                       // tells the group to forget about a property path and no longer
-                       // update the array previously obtained with 'subscribe_'
-                       const indicesByPath = this._bindingsIndicesByPath,
-                                               index = indicesByPath[path];
-
-                       if (index !== undefined) {
-                               const paths = this._paths,
-                                                       parsedPaths = this._parsedPaths,
-                                                       bindings = this._bindings,
-                                                       lastBindingsIndex = bindings.length - 1,
-                                                       lastBindings = bindings[lastBindingsIndex],
-                                                       lastBindingsPath = path[lastBindingsIndex];
-                               indicesByPath[lastBindingsPath] = index;
-                               bindings[index] = lastBindings;
-                               bindings.pop();
-                               parsedPaths[index] = parsedPaths[lastBindingsIndex];
-                               parsedPaths.pop();
-                               paths[index] = paths[lastBindingsIndex];
-                               paths.pop();
-                       }
-               }
-
-       }
-
-       AnimationObjectGroup.prototype.isAnimationObjectGroup = true;
-
-       class AnimationAction {
-               constructor(mixer, clip, localRoot = null, blendMode = clip.blendMode) {
-                       this._mixer = mixer;
-                       this._clip = clip;
-                       this._localRoot = localRoot;
-                       this.blendMode = blendMode;
-                       const tracks = clip.tracks,
-                                               nTracks = tracks.length,
-                                               interpolants = new Array(nTracks);
-                       const interpolantSettings = {
-                               endingStart: ZeroCurvatureEnding,
-                               endingEnd: ZeroCurvatureEnding
-                       };
-
-                       for (let i = 0; i !== nTracks; ++i) {
-                               const interpolant = tracks[i].createInterpolant(null);
-                               interpolants[i] = interpolant;
-                               interpolant.settings = interpolantSettings;
-                       }
-
-                       this._interpolantSettings = interpolantSettings;
-                       this._interpolants = interpolants; // bound by the mixer
-                       // inside: PropertyMixer (managed by the mixer)
-
-                       this._propertyBindings = new Array(nTracks);
-                       this._cacheIndex = null; // for the memory manager
-
-                       this._byClipCacheIndex = null; // for the memory manager
-
-                       this._timeScaleInterpolant = null;
-                       this._weightInterpolant = null;
-                       this.loop = LoopRepeat;
-                       this._loopCount = -1; // global mixer time when the action is to be started
-                       // it's set back to 'null' upon start of the action
-
-                       this._startTime = null; // scaled local time of the action
-                       // gets clamped or wrapped to 0..clip.duration according to loop
-
-                       this.time = 0;
-                       this.timeScale = 1;
-                       this._effectiveTimeScale = 1;
-                       this.weight = 1;
-                       this._effectiveWeight = 1;
-                       this.repetitions = Infinity; // no. of repetitions when looping
-
-                       this.paused = false; // true -> zero effective time scale
-
-                       this.enabled = true; // false -> zero effective weight
-
-                       this.clampWhenFinished = false; // keep feeding the last frame?
-
-                       this.zeroSlopeAtStart = true; // for smooth interpolation w/o separate
-
-                       this.zeroSlopeAtEnd = true; // clips for start, loop and end
-               } // State & Scheduling
-
-
-               play() {
-                       this._mixer._activateAction(this);
-
-                       return this;
-               }
-
-               stop() {
-                       this._mixer._deactivateAction(this);
-
-                       return this.reset();
-               }
-
-               reset() {
-                       this.paused = false;
-                       this.enabled = true;
-                       this.time = 0; // restart clip
-
-                       this._loopCount = -1; // forget previous loops
-
-                       this._startTime = null; // forget scheduling
-
-                       return this.stopFading().stopWarping();
-               }
-
-               isRunning() {
-                       return this.enabled && !this.paused && this.timeScale !== 0 && this._startTime === null && this._mixer._isActiveAction(this);
-               } // return true when play has been called
-
-
-               isScheduled() {
-                       return this._mixer._isActiveAction(this);
-               }
-
-               startAt(time) {
-                       this._startTime = time;
-                       return this;
-               }
-
-               setLoop(mode, repetitions) {
-                       this.loop = mode;
-                       this.repetitions = repetitions;
-                       return this;
-               } // Weight
-               // set the weight stopping any scheduled fading
-               // although .enabled = false yields an effective weight of zero, this
-               // method does *not* change .enabled, because it would be confusing
-
-
-               setEffectiveWeight(weight) {
-                       this.weight = weight; // note: same logic as when updated at runtime
-
-                       this._effectiveWeight = this.enabled ? weight : 0;
-                       return this.stopFading();
-               } // return the weight considering fading and .enabled
-
-
-               getEffectiveWeight() {
-                       return this._effectiveWeight;
-               }
-
-               fadeIn(duration) {
-                       return this._scheduleFading(duration, 0, 1);
-               }
-
-               fadeOut(duration) {
-                       return this._scheduleFading(duration, 1, 0);
-               }
-
-               crossFadeFrom(fadeOutAction, duration, warp) {
-                       fadeOutAction.fadeOut(duration);
-                       this.fadeIn(duration);
-
-                       if (warp) {
-                               const fadeInDuration = this._clip.duration,
-                                                       fadeOutDuration = fadeOutAction._clip.duration,
-                                                       startEndRatio = fadeOutDuration / fadeInDuration,
-                                                       endStartRatio = fadeInDuration / fadeOutDuration;
-                               fadeOutAction.warp(1.0, startEndRatio, duration);
-                               this.warp(endStartRatio, 1.0, duration);
-                       }
-
-                       return this;
-               }
-
-               crossFadeTo(fadeInAction, duration, warp) {
-                       return fadeInAction.crossFadeFrom(this, duration, warp);
-               }
-
-               stopFading() {
-                       const weightInterpolant = this._weightInterpolant;
-
-                       if (weightInterpolant !== null) {
-                               this._weightInterpolant = null;
-
-                               this._mixer._takeBackControlInterpolant(weightInterpolant);
-                       }
-
-                       return this;
-               } // Time Scale Control
-               // set the time scale stopping any scheduled warping
-               // although .paused = true yields an effective time scale of zero, this
-               // method does *not* change .paused, because it would be confusing
-
-
-               setEffectiveTimeScale(timeScale) {
-                       this.timeScale = timeScale;
-                       this._effectiveTimeScale = this.paused ? 0 : timeScale;
-                       return this.stopWarping();
-               } // return the time scale considering warping and .paused
-
-
-               getEffectiveTimeScale() {
-                       return this._effectiveTimeScale;
-               }
-
-               setDuration(duration) {
-                       this.timeScale = this._clip.duration / duration;
-                       return this.stopWarping();
-               }
-
-               syncWith(action) {
-                       this.time = action.time;
-                       this.timeScale = action.timeScale;
-                       return this.stopWarping();
-               }
-
-               halt(duration) {
-                       return this.warp(this._effectiveTimeScale, 0, duration);
-               }
-
-               warp(startTimeScale, endTimeScale, duration) {
-                       const mixer = this._mixer,
-                                               now = mixer.time,
-                                               timeScale = this.timeScale;
-                       let interpolant = this._timeScaleInterpolant;
-
-                       if (interpolant === null) {
-                               interpolant = mixer._lendControlInterpolant();
-                               this._timeScaleInterpolant = interpolant;
-                       }
-
-                       const times = interpolant.parameterPositions,
-                                               values = interpolant.sampleValues;
-                       times[0] = now;
-                       times[1] = now + duration;
-                       values[0] = startTimeScale / timeScale;
-                       values[1] = endTimeScale / timeScale;
-                       return this;
-               }
-
-               stopWarping() {
-                       const timeScaleInterpolant = this._timeScaleInterpolant;
-
-                       if (timeScaleInterpolant !== null) {
-                               this._timeScaleInterpolant = null;
-
-                               this._mixer._takeBackControlInterpolant(timeScaleInterpolant);
-                       }
-
-                       return this;
-               } // Object Accessors
-
-
-               getMixer() {
-                       return this._mixer;
-               }
-
-               getClip() {
-                       return this._clip;
-               }
-
-               getRoot() {
-                       return this._localRoot || this._mixer._root;
-               } // Interna
-
-
-               _update(time, deltaTime, timeDirection, accuIndex) {
-                       // called by the mixer
-                       if (!this.enabled) {
-                               // call ._updateWeight() to update ._effectiveWeight
-                               this._updateWeight(time);
-
-                               return;
-                       }
-
-                       const startTime = this._startTime;
-
-                       if (startTime !== null) {
-                               // check for scheduled start of action
-                               const timeRunning = (time - startTime) * timeDirection;
-
-                               if (timeRunning < 0 || timeDirection === 0) {
-                                       return; // yet to come / don't decide when delta = 0
-                               } // start
-
-
-                               this._startTime = null; // unschedule
-
-                               deltaTime = timeDirection * timeRunning;
-                       } // apply time scale and advance time
-
-
-                       deltaTime *= this._updateTimeScale(time);
-
-                       const clipTime = this._updateTime(deltaTime); // note: _updateTime may disable the action resulting in
-                       // an effective weight of 0
-
-
-                       const weight = this._updateWeight(time);
-
-                       if (weight > 0) {
-                               const interpolants = this._interpolants;
-                               const propertyMixers = this._propertyBindings;
-
-                               switch (this.blendMode) {
-                                       case AdditiveAnimationBlendMode:
-                                               for (let j = 0, m = interpolants.length; j !== m; ++j) {
-                                                       interpolants[j].evaluate(clipTime);
-                                                       propertyMixers[j].accumulateAdditive(weight);
-                                               }
-
-                                               break;
-
-                                       case NormalAnimationBlendMode:
-                                       default:
-                                               for (let j = 0, m = interpolants.length; j !== m; ++j) {
-                                                       interpolants[j].evaluate(clipTime);
-                                                       propertyMixers[j].accumulate(accuIndex, weight);
-                                               }
-
-                               }
-                       }
-               }
-
-               _updateWeight(time) {
-                       let weight = 0;
-
-                       if (this.enabled) {
-                               weight = this.weight;
-                               const interpolant = this._weightInterpolant;
-
-                               if (interpolant !== null) {
-                                       const interpolantValue = interpolant.evaluate(time)[0];
-                                       weight *= interpolantValue;
-
-                                       if (time > interpolant.parameterPositions[1]) {
-                                               this.stopFading();
-
-                                               if (interpolantValue === 0) {
-                                                       // faded out, disable
-                                                       this.enabled = false;
-                                               }
-                                       }
-                               }
-                       }
-
-                       this._effectiveWeight = weight;
-                       return weight;
-               }
-
-               _updateTimeScale(time) {
-                       let timeScale = 0;
-
-                       if (!this.paused) {
-                               timeScale = this.timeScale;
-                               const interpolant = this._timeScaleInterpolant;
-
-                               if (interpolant !== null) {
-                                       const interpolantValue = interpolant.evaluate(time)[0];
-                                       timeScale *= interpolantValue;
-
-                                       if (time > interpolant.parameterPositions[1]) {
-                                               this.stopWarping();
-
-                                               if (timeScale === 0) {
-                                                       // motion has halted, pause
-                                                       this.paused = true;
-                                               } else {
-                                                       // warp done - apply final time scale
-                                                       this.timeScale = timeScale;
-                                               }
-                                       }
-                               }
-                       }
-
-                       this._effectiveTimeScale = timeScale;
-                       return timeScale;
-               }
-
-               _updateTime(deltaTime) {
-                       const duration = this._clip.duration;
-                       const loop = this.loop;
-                       let time = this.time + deltaTime;
-                       let loopCount = this._loopCount;
-                       const pingPong = loop === LoopPingPong;
-
-                       if (deltaTime === 0) {
-                               if (loopCount === -1) return time;
-                               return pingPong && (loopCount & 1) === 1 ? duration - time : time;
-                       }
-
-                       if (loop === LoopOnce) {
-                               if (loopCount === -1) {
-                                       // just started
-                                       this._loopCount = 0;
-
-                                       this._setEndings(true, true, false);
-                               }
-
-                               handle_stop: {
-                                       if (time >= duration) {
-                                               time = duration;
-                                       } else if (time < 0) {
-                                               time = 0;
-                                       } else {
-                                               this.time = time;
-                                               break handle_stop;
-                                       }
-
-                                       if (this.clampWhenFinished) this.paused = true;else this.enabled = false;
-                                       this.time = time;
-
-                                       this._mixer.dispatchEvent({
-                                               type: 'finished',
-                                               action: this,
-                                               direction: deltaTime < 0 ? -1 : 1
-                                       });
-                               }
-                       } else {
-                               // repetitive Repeat or PingPong
-                               if (loopCount === -1) {
-                                       // just started
-                                       if (deltaTime >= 0) {
-                                               loopCount = 0;
-
-                                               this._setEndings(true, this.repetitions === 0, pingPong);
-                                       } else {
-                                               // when looping in reverse direction, the initial
-                                               // transition through zero counts as a repetition,
-                                               // so leave loopCount at -1
-                                               this._setEndings(this.repetitions === 0, true, pingPong);
-                                       }
-                               }
-
-                               if (time >= duration || time < 0) {
-                                       // wrap around
-                                       const loopDelta = Math.floor(time / duration); // signed
-
-                                       time -= duration * loopDelta;
-                                       loopCount += Math.abs(loopDelta);
-                                       const pending = this.repetitions - loopCount;
-
-                                       if (pending <= 0) {
-                                               // have to stop (switch state, clamp time, fire event)
-                                               if (this.clampWhenFinished) this.paused = true;else this.enabled = false;
-                                               time = deltaTime > 0 ? duration : 0;
-                                               this.time = time;
-
-                                               this._mixer.dispatchEvent({
-                                                       type: 'finished',
-                                                       action: this,
-                                                       direction: deltaTime > 0 ? 1 : -1
-                                               });
-                                       } else {
-                                               // keep running
-                                               if (pending === 1) {
-                                                       // entering the last round
-                                                       const atStart = deltaTime < 0;
-
-                                                       this._setEndings(atStart, !atStart, pingPong);
-                                               } else {
-                                                       this._setEndings(false, false, pingPong);
-                                               }
-
-                                               this._loopCount = loopCount;
-                                               this.time = time;
-
-                                               this._mixer.dispatchEvent({
-                                                       type: 'loop',
-                                                       action: this,
-                                                       loopDelta: loopDelta
-                                               });
-                                       }
-                               } else {
-                                       this.time = time;
-                               }
-
-                               if (pingPong && (loopCount & 1) === 1) {
-                                       // invert time for the "pong round"
-                                       return duration - time;
-                               }
-                       }
-
-                       return time;
-               }
-
-               _setEndings(atStart, atEnd, pingPong) {
-                       const settings = this._interpolantSettings;
-
-                       if (pingPong) {
-                               settings.endingStart = ZeroSlopeEnding;
-                               settings.endingEnd = ZeroSlopeEnding;
-                       } else {
-                               // assuming for LoopOnce atStart == atEnd == true
-                               if (atStart) {
-                                       settings.endingStart = this.zeroSlopeAtStart ? ZeroSlopeEnding : ZeroCurvatureEnding;
-                               } else {
-                                       settings.endingStart = WrapAroundEnding;
-                               }
-
-                               if (atEnd) {
-                                       settings.endingEnd = this.zeroSlopeAtEnd ? ZeroSlopeEnding : ZeroCurvatureEnding;
-                               } else {
-                                       settings.endingEnd = WrapAroundEnding;
-                               }
-                       }
-               }
-
-               _scheduleFading(duration, weightNow, weightThen) {
-                       const mixer = this._mixer,
-                                               now = mixer.time;
-                       let interpolant = this._weightInterpolant;
-
-                       if (interpolant === null) {
-                               interpolant = mixer._lendControlInterpolant();
-                               this._weightInterpolant = interpolant;
-                       }
-
-                       const times = interpolant.parameterPositions,
-                                               values = interpolant.sampleValues;
-                       times[0] = now;
-                       values[0] = weightNow;
-                       times[1] = now + duration;
-                       values[1] = weightThen;
-                       return this;
-               }
-
-       }
-
-       class AnimationMixer extends EventDispatcher {
-               constructor(root) {
-                       super();
-                       this._root = root;
-
-                       this._initMemoryManager();
-
-                       this._accuIndex = 0;
-                       this.time = 0;
-                       this.timeScale = 1.0;
-               }
-
-               _bindAction(action, prototypeAction) {
-                       const root = action._localRoot || this._root,
-                                               tracks = action._clip.tracks,
-                                               nTracks = tracks.length,
-                                               bindings = action._propertyBindings,
-                                               interpolants = action._interpolants,
-                                               rootUuid = root.uuid,
-                                               bindingsByRoot = this._bindingsByRootAndName;
-                       let bindingsByName = bindingsByRoot[rootUuid];
-
-                       if (bindingsByName === undefined) {
-                               bindingsByName = {};
-                               bindingsByRoot[rootUuid] = bindingsByName;
-                       }
-
-                       for (let i = 0; i !== nTracks; ++i) {
-                               const track = tracks[i],
-                                                       trackName = track.name;
-                               let binding = bindingsByName[trackName];
-
-                               if (binding !== undefined) {
-                                       bindings[i] = binding;
-                               } else {
-                                       binding = bindings[i];
-
-                                       if (binding !== undefined) {
-                                               // existing binding, make sure the cache knows
-                                               if (binding._cacheIndex === null) {
-                                                       ++binding.referenceCount;
-
-                                                       this._addInactiveBinding(binding, rootUuid, trackName);
-                                               }
-
-                                               continue;
-                                       }
-
-                                       const path = prototypeAction && prototypeAction._propertyBindings[i].binding.parsedPath;
-                                       binding = new PropertyMixer(PropertyBinding.create(root, trackName, path), track.ValueTypeName, track.getValueSize());
-                                       ++binding.referenceCount;
-
-                                       this._addInactiveBinding(binding, rootUuid, trackName);
-
-                                       bindings[i] = binding;
-                               }
-
-                               interpolants[i].resultBuffer = binding.buffer;
-                       }
-               }
-
-               _activateAction(action) {
-                       if (!this._isActiveAction(action)) {
-                               if (action._cacheIndex === null) {
-                                       // this action has been forgotten by the cache, but the user
-                                       // appears to be still using it -> rebind
-                                       const rootUuid = (action._localRoot || this._root).uuid,
-                                                               clipUuid = action._clip.uuid,
-                                                               actionsForClip = this._actionsByClip[clipUuid];
-
-                                       this._bindAction(action, actionsForClip && actionsForClip.knownActions[0]);
-
-                                       this._addInactiveAction(action, clipUuid, rootUuid);
-                               }
-
-                               const bindings = action._propertyBindings; // increment reference counts / sort out state
-
-                               for (let i = 0, n = bindings.length; i !== n; ++i) {
-                                       const binding = bindings[i];
-
-                                       if (binding.useCount++ === 0) {
-                                               this._lendBinding(binding);
-
-                                               binding.saveOriginalState();
-                                       }
-                               }
-
-                               this._lendAction(action);
-                       }
-               }
-
-               _deactivateAction(action) {
-                       if (this._isActiveAction(action)) {
-                               const bindings = action._propertyBindings; // decrement reference counts / sort out state
-
-                               for (let i = 0, n = bindings.length; i !== n; ++i) {
-                                       const binding = bindings[i];
-
-                                       if (--binding.useCount === 0) {
-                                               binding.restoreOriginalState();
-
-                                               this._takeBackBinding(binding);
-                                       }
-                               }
-
-                               this._takeBackAction(action);
-                       }
-               } // Memory manager
-
-
-               _initMemoryManager() {
-                       this._actions = []; // 'nActiveActions' followed by inactive ones
-
-                       this._nActiveActions = 0;
-                       this._actionsByClip = {}; // inside:
-                       // {
-                       //      knownActions: Array< AnimationAction > - used as prototypes
-                       //      actionByRoot: AnimationAction - lookup
-                       // }
-
-                       this._bindings = []; // 'nActiveBindings' followed by inactive ones
-
-                       this._nActiveBindings = 0;
-                       this._bindingsByRootAndName = {}; // inside: Map< name, PropertyMixer >
-
-                       this._controlInterpolants = []; // same game as above
-
-                       this._nActiveControlInterpolants = 0;
-                       const scope = this;
-                       this.stats = {
-                               actions: {
-                                       get total() {
-                                               return scope._actions.length;
-                                       },
-
-                                       get inUse() {
-                                               return scope._nActiveActions;
-                                       }
-
-                               },
-                               bindings: {
-                                       get total() {
-                                               return scope._bindings.length;
-                                       },
-
-                                       get inUse() {
-                                               return scope._nActiveBindings;
-                                       }
-
-                               },
-                               controlInterpolants: {
-                                       get total() {
-                                               return scope._controlInterpolants.length;
-                                       },
-
-                                       get inUse() {
-                                               return scope._nActiveControlInterpolants;
-                                       }
-
-                               }
-                       };
-               } // Memory management for AnimationAction objects
-
-
-               _isActiveAction(action) {
-                       const index = action._cacheIndex;
-                       return index !== null && index < this._nActiveActions;
-               }
-
-               _addInactiveAction(action, clipUuid, rootUuid) {
-                       const actions = this._actions,
-                                               actionsByClip = this._actionsByClip;
-                       let actionsForClip = actionsByClip[clipUuid];
-
-                       if (actionsForClip === undefined) {
-                               actionsForClip = {
-                                       knownActions: [action],
-                                       actionByRoot: {}
-                               };
-                               action._byClipCacheIndex = 0;
-                               actionsByClip[clipUuid] = actionsForClip;
-                       } else {
-                               const knownActions = actionsForClip.knownActions;
-                               action._byClipCacheIndex = knownActions.length;
-                               knownActions.push(action);
-                       }
-
-                       action._cacheIndex = actions.length;
-                       actions.push(action);
-                       actionsForClip.actionByRoot[rootUuid] = action;
-               }
-
-               _removeInactiveAction(action) {
-                       const actions = this._actions,
-                                               lastInactiveAction = actions[actions.length - 1],
-                                               cacheIndex = action._cacheIndex;
-                       lastInactiveAction._cacheIndex = cacheIndex;
-                       actions[cacheIndex] = lastInactiveAction;
-                       actions.pop();
-                       action._cacheIndex = null;
-                       const clipUuid = action._clip.uuid,
-                                               actionsByClip = this._actionsByClip,
-                                               actionsForClip = actionsByClip[clipUuid],
-                                               knownActionsForClip = actionsForClip.knownActions,
-                                               lastKnownAction = knownActionsForClip[knownActionsForClip.length - 1],
-                                               byClipCacheIndex = action._byClipCacheIndex;
-                       lastKnownAction._byClipCacheIndex = byClipCacheIndex;
-                       knownActionsForClip[byClipCacheIndex] = lastKnownAction;
-                       knownActionsForClip.pop();
-                       action._byClipCacheIndex = null;
-                       const actionByRoot = actionsForClip.actionByRoot,
-                                               rootUuid = (action._localRoot || this._root).uuid;
-                       delete actionByRoot[rootUuid];
-
-                       if (knownActionsForClip.length === 0) {
-                               delete actionsByClip[clipUuid];
-                       }
-
-                       this._removeInactiveBindingsForAction(action);
-               }
-
-               _removeInactiveBindingsForAction(action) {
-                       const bindings = action._propertyBindings;
-
-                       for (let i = 0, n = bindings.length; i !== n; ++i) {
-                               const binding = bindings[i];
-
-                               if (--binding.referenceCount === 0) {
-                                       this._removeInactiveBinding(binding);
-                               }
-                       }
-               }
-
-               _lendAction(action) {
-                       // [ active actions |   inactive actions        ]
-                       // [    active actions >| inactive actions ]
-                       //                                                               s                              a
-                       //                                                                      <-swap->
-                       //                                                               a                              s
-                       const actions = this._actions,
-                                               prevIndex = action._cacheIndex,
-                                               lastActiveIndex = this._nActiveActions++,
-                                               firstInactiveAction = actions[lastActiveIndex];
-                       action._cacheIndex = lastActiveIndex;
-                       actions[lastActiveIndex] = action;
-                       firstInactiveAction._cacheIndex = prevIndex;
-                       actions[prevIndex] = firstInactiveAction;
-               }
-
-               _takeBackAction(action) {
-                       // [    active actions  | inactive actions ]
-                       // [ active actions |< inactive actions ]
-                       //                              a                               s
-                       //                               <-swap->
-                       //                              s                               a
-                       const actions = this._actions,
-                                               prevIndex = action._cacheIndex,
-                                               firstInactiveIndex = --this._nActiveActions,
-                                               lastActiveAction = actions[firstInactiveIndex];
-                       action._cacheIndex = firstInactiveIndex;
-                       actions[firstInactiveIndex] = action;
-                       lastActiveAction._cacheIndex = prevIndex;
-                       actions[prevIndex] = lastActiveAction;
-               } // Memory management for PropertyMixer objects
-
-
-               _addInactiveBinding(binding, rootUuid, trackName) {
-                       const bindingsByRoot = this._bindingsByRootAndName,
-                                               bindings = this._bindings;
-                       let bindingByName = bindingsByRoot[rootUuid];
-
-                       if (bindingByName === undefined) {
-                               bindingByName = {};
-                               bindingsByRoot[rootUuid] = bindingByName;
-                       }
-
-                       bindingByName[trackName] = binding;
-                       binding._cacheIndex = bindings.length;
-                       bindings.push(binding);
-               }
-
-               _removeInactiveBinding(binding) {
-                       const bindings = this._bindings,
-                                               propBinding = binding.binding,
-                                               rootUuid = propBinding.rootNode.uuid,
-                                               trackName = propBinding.path,
-                                               bindingsByRoot = this._bindingsByRootAndName,
-                                               bindingByName = bindingsByRoot[rootUuid],
-                                               lastInactiveBinding = bindings[bindings.length - 1],
-                                               cacheIndex = binding._cacheIndex;
-                       lastInactiveBinding._cacheIndex = cacheIndex;
-                       bindings[cacheIndex] = lastInactiveBinding;
-                       bindings.pop();
-                       delete bindingByName[trackName];
-
-                       if (Object.keys(bindingByName).length === 0) {
-                               delete bindingsByRoot[rootUuid];
-                       }
-               }
-
-               _lendBinding(binding) {
-                       const bindings = this._bindings,
-                                               prevIndex = binding._cacheIndex,
-                                               lastActiveIndex = this._nActiveBindings++,
-                                               firstInactiveBinding = bindings[lastActiveIndex];
-                       binding._cacheIndex = lastActiveIndex;
-                       bindings[lastActiveIndex] = binding;
-                       firstInactiveBinding._cacheIndex = prevIndex;
-                       bindings[prevIndex] = firstInactiveBinding;
-               }
-
-               _takeBackBinding(binding) {
-                       const bindings = this._bindings,
-                                               prevIndex = binding._cacheIndex,
-                                               firstInactiveIndex = --this._nActiveBindings,
-                                               lastActiveBinding = bindings[firstInactiveIndex];
-                       binding._cacheIndex = firstInactiveIndex;
-                       bindings[firstInactiveIndex] = binding;
-                       lastActiveBinding._cacheIndex = prevIndex;
-                       bindings[prevIndex] = lastActiveBinding;
-               } // Memory management of Interpolants for weight and time scale
-
-
-               _lendControlInterpolant() {
-                       const interpolants = this._controlInterpolants,
-                                               lastActiveIndex = this._nActiveControlInterpolants++;
-                       let interpolant = interpolants[lastActiveIndex];
-
-                       if (interpolant === undefined) {
-                               interpolant = new LinearInterpolant(new Float32Array(2), new Float32Array(2), 1, this._controlInterpolantsResultBuffer);
-                               interpolant.__cacheIndex = lastActiveIndex;
-                               interpolants[lastActiveIndex] = interpolant;
-                       }
-
-                       return interpolant;
-               }
-
-               _takeBackControlInterpolant(interpolant) {
-                       const interpolants = this._controlInterpolants,
-                                               prevIndex = interpolant.__cacheIndex,
-                                               firstInactiveIndex = --this._nActiveControlInterpolants,
-                                               lastActiveInterpolant = interpolants[firstInactiveIndex];
-                       interpolant.__cacheIndex = firstInactiveIndex;
-                       interpolants[firstInactiveIndex] = interpolant;
-                       lastActiveInterpolant.__cacheIndex = prevIndex;
-                       interpolants[prevIndex] = lastActiveInterpolant;
-               } // return an action for a clip optionally using a custom root target
-               // object (this method allocates a lot of dynamic memory in case a
-               // previously unknown clip/root combination is specified)
-
-
-               clipAction(clip, optionalRoot, blendMode) {
-                       const root = optionalRoot || this._root,
-                                               rootUuid = root.uuid;
-                       let clipObject = typeof clip === 'string' ? AnimationClip.findByName(root, clip) : clip;
-                       const clipUuid = clipObject !== null ? clipObject.uuid : clip;
-                       const actionsForClip = this._actionsByClip[clipUuid];
-                       let prototypeAction = null;
-
-                       if (blendMode === undefined) {
-                               if (clipObject !== null) {
-                                       blendMode = clipObject.blendMode;
-                               } else {
-                                       blendMode = NormalAnimationBlendMode;
-                               }
-                       }
-
-                       if (actionsForClip !== undefined) {
-                               const existingAction = actionsForClip.actionByRoot[rootUuid];
-
-                               if (existingAction !== undefined && existingAction.blendMode === blendMode) {
-                                       return existingAction;
-                               } // we know the clip, so we don't have to parse all
-                               // the bindings again but can just copy
-
-
-                               prototypeAction = actionsForClip.knownActions[0]; // also, take the clip from the prototype action
-
-                               if (clipObject === null) clipObject = prototypeAction._clip;
-                       } // clip must be known when specified via string
-
-
-                       if (clipObject === null) return null; // allocate all resources required to run it
-
-                       const newAction = new AnimationAction(this, clipObject, optionalRoot, blendMode);
-
-                       this._bindAction(newAction, prototypeAction); // and make the action known to the memory manager
-
-
-                       this._addInactiveAction(newAction, clipUuid, rootUuid);
-
-                       return newAction;
-               } // get an existing action
-
-
-               existingAction(clip, optionalRoot) {
-                       const root = optionalRoot || this._root,
-                                               rootUuid = root.uuid,
-                                               clipObject = typeof clip === 'string' ? AnimationClip.findByName(root, clip) : clip,
-                                               clipUuid = clipObject ? clipObject.uuid : clip,
-                                               actionsForClip = this._actionsByClip[clipUuid];
-
-                       if (actionsForClip !== undefined) {
-                               return actionsForClip.actionByRoot[rootUuid] || null;
-                       }
-
-                       return null;
-               } // deactivates all previously scheduled actions
-
-
-               stopAllAction() {
-                       const actions = this._actions,
-                                               nActions = this._nActiveActions;
-
-                       for (let i = nActions - 1; i >= 0; --i) {
-                               actions[i].stop();
-                       }
-
-                       return this;
-               } // advance the time and update apply the animation
-
-
-               update(deltaTime) {
-                       deltaTime *= this.timeScale;
-                       const actions = this._actions,
-                                               nActions = this._nActiveActions,
-                                               time = this.time += deltaTime,
-                                               timeDirection = Math.sign(deltaTime),
-                                               accuIndex = this._accuIndex ^= 1; // run active actions
-
-                       for (let i = 0; i !== nActions; ++i) {
-                               const action = actions[i];
-
-                               action._update(time, deltaTime, timeDirection, accuIndex);
-                       } // update scene graph
-
-
-                       const bindings = this._bindings,
-                                               nBindings = this._nActiveBindings;
-
-                       for (let i = 0; i !== nBindings; ++i) {
-                               bindings[i].apply(accuIndex);
-                       }
-
-                       return this;
-               } // Allows you to seek to a specific time in an animation.
-
-
-               setTime(timeInSeconds) {
-                       this.time = 0; // Zero out time attribute for AnimationMixer object;
-
-                       for (let i = 0; i < this._actions.length; i++) {
-                               this._actions[i].time = 0; // Zero out time attribute for all associated AnimationAction objects.
-                       }
-
-                       return this.update(timeInSeconds); // Update used to set exact time. Returns "this" AnimationMixer object.
-               } // return this mixer's root target object
-
-
-               getRoot() {
-                       return this._root;
-               } // free all resources specific to a particular clip
-
-
-               uncacheClip(clip) {
-                       const actions = this._actions,
-                                               clipUuid = clip.uuid,
-                                               actionsByClip = this._actionsByClip,
-                                               actionsForClip = actionsByClip[clipUuid];
-
-                       if (actionsForClip !== undefined) {
-                               // note: just calling _removeInactiveAction would mess up the
-                               // iteration state and also require updating the state we can
-                               // just throw away
-                               const actionsToRemove = actionsForClip.knownActions;
-
-                               for (let i = 0, n = actionsToRemove.length; i !== n; ++i) {
-                                       const action = actionsToRemove[i];
-
-                                       this._deactivateAction(action);
-
-                                       const cacheIndex = action._cacheIndex,
-                                                               lastInactiveAction = actions[actions.length - 1];
-                                       action._cacheIndex = null;
-                                       action._byClipCacheIndex = null;
-                                       lastInactiveAction._cacheIndex = cacheIndex;
-                                       actions[cacheIndex] = lastInactiveAction;
-                                       actions.pop();
-
-                                       this._removeInactiveBindingsForAction(action);
-                               }
-
-                               delete actionsByClip[clipUuid];
-                       }
-               } // free all resources specific to a particular root target object
-
-
-               uncacheRoot(root) {
-                       const rootUuid = root.uuid,
-                                               actionsByClip = this._actionsByClip;
-
-                       for (const clipUuid in actionsByClip) {
-                               const actionByRoot = actionsByClip[clipUuid].actionByRoot,
-                                                       action = actionByRoot[rootUuid];
-
-                               if (action !== undefined) {
-                                       this._deactivateAction(action);
-
-                                       this._removeInactiveAction(action);
-                               }
-                       }
-
-                       const bindingsByRoot = this._bindingsByRootAndName,
-                                               bindingByName = bindingsByRoot[rootUuid];
-
-                       if (bindingByName !== undefined) {
-                               for (const trackName in bindingByName) {
-                                       const binding = bindingByName[trackName];
-                                       binding.restoreOriginalState();
-
-                                       this._removeInactiveBinding(binding);
-                               }
-                       }
-               } // remove a targeted clip from the cache
-
-
-               uncacheAction(clip, optionalRoot) {
-                       const action = this.existingAction(clip, optionalRoot);
-
-                       if (action !== null) {
-                               this._deactivateAction(action);
-
-                               this._removeInactiveAction(action);
-                       }
-               }
-
-       }
-
-       AnimationMixer.prototype._controlInterpolantsResultBuffer = new Float32Array(1);
-
-       class Uniform {
-               constructor(value) {
-                       if (typeof value === 'string') {
-                               console.warn('THREE.Uniform: Type parameter is no longer needed.');
-                               value = arguments[1];
-                       }
-
-                       this.value = value;
-               }
-
-               clone() {
-                       return new Uniform(this.value.clone === undefined ? this.value : this.value.clone());
-               }
-
-       }
-
-       class InstancedInterleavedBuffer extends InterleavedBuffer {
-               constructor(array, stride, meshPerAttribute = 1) {
-                       super(array, stride);
-                       this.meshPerAttribute = meshPerAttribute;
-               }
-
-               copy(source) {
-                       super.copy(source);
-                       this.meshPerAttribute = source.meshPerAttribute;
-                       return this;
-               }
-
-               clone(data) {
-                       const ib = super.clone(data);
-                       ib.meshPerAttribute = this.meshPerAttribute;
-                       return ib;
-               }
-
-               toJSON(data) {
-                       const json = super.toJSON(data);
-                       json.isInstancedInterleavedBuffer = true;
-                       json.meshPerAttribute = this.meshPerAttribute;
-                       return json;
-               }
-
-       }
-
-       InstancedInterleavedBuffer.prototype.isInstancedInterleavedBuffer = true;
-
-       class GLBufferAttribute {
-               constructor(buffer, type, itemSize, elementSize, count) {
-                       this.buffer = buffer;
-                       this.type = type;
-                       this.itemSize = itemSize;
-                       this.elementSize = elementSize;
-                       this.count = count;
-                       this.version = 0;
-               }
-
-               set needsUpdate(value) {
-                       if (value === true) this.version++;
-               }
-
-               setBuffer(buffer) {
-                       this.buffer = buffer;
-                       return this;
-               }
-
-               setType(type, elementSize) {
-                       this.type = type;
-                       this.elementSize = elementSize;
-                       return this;
-               }
-
-               setItemSize(itemSize) {
-                       this.itemSize = itemSize;
-                       return this;
-               }
-
-               setCount(count) {
-                       this.count = count;
-                       return this;
-               }
-
-       }
-
-       GLBufferAttribute.prototype.isGLBufferAttribute = true;
-
-       class Raycaster {
-               constructor(origin, direction, near = 0, far = Infinity) {
-                       this.ray = new Ray(origin, direction); // direction is assumed to be normalized (for accurate distance calculations)
-
-                       this.near = near;
-                       this.far = far;
-                       this.camera = null;
-                       this.layers = new Layers();
-                       this.params = {
-                               Mesh: {},
-                               Line: {
-                                       threshold: 1
-                               },
-                               LOD: {},
-                               Points: {
-                                       threshold: 1
-                               },
-                               Sprite: {}
-                       };
-               }
-
-               set(origin, direction) {
-                       // direction is assumed to be normalized (for accurate distance calculations)
-                       this.ray.set(origin, direction);
-               }
-
-               setFromCamera(coords, camera) {
-                       if (camera && camera.isPerspectiveCamera) {
-                               this.ray.origin.setFromMatrixPosition(camera.matrixWorld);
-                               this.ray.direction.set(coords.x, coords.y, 0.5).unproject(camera).sub(this.ray.origin).normalize();
-                               this.camera = camera;
-                       } else if (camera && camera.isOrthographicCamera) {
-                               this.ray.origin.set(coords.x, coords.y, (camera.near + camera.far) / (camera.near - camera.far)).unproject(camera); // set origin in plane of camera
-
-                               this.ray.direction.set(0, 0, -1).transformDirection(camera.matrixWorld);
-                               this.camera = camera;
-                       } else {
-                               console.error('THREE.Raycaster: Unsupported camera type: ' + camera.type);
-                       }
-               }
-
-               intersectObject(object, recursive = false, intersects = []) {
-                       intersectObject(object, this, intersects, recursive);
-                       intersects.sort(ascSort);
-                       return intersects;
-               }
-
-               intersectObjects(objects, recursive = false, intersects = []) {
-                       for (let i = 0, l = objects.length; i < l; i++) {
-                               intersectObject(objects[i], this, intersects, recursive);
-                       }
-
-                       intersects.sort(ascSort);
-                       return intersects;
-               }
-
-       }
-
-       function ascSort(a, b) {
-               return a.distance - b.distance;
-       }
-
-       function intersectObject(object, raycaster, intersects, recursive) {
-               if (object.layers.test(raycaster.layers)) {
-                       object.raycast(raycaster, intersects);
-               }
-
-               if (recursive === true) {
-                       const children = object.children;
-
-                       for (let i = 0, l = children.length; i < l; i++) {
-                               intersectObject(children[i], raycaster, intersects, true);
-                       }
-               }
-       }
-
-       /**
-        * Ref: https://en.wikipedia.org/wiki/Spherical_coordinate_system
-        *
-        * The polar angle (phi) is measured from the positive y-axis. The positive y-axis is up.
-        * The azimuthal angle (theta) is measured from the positive z-axis.
-        */
-
-       class Spherical {
-               constructor(radius = 1, phi = 0, theta = 0) {
-                       this.radius = radius;
-                       this.phi = phi; // polar angle
-
-                       this.theta = theta; // azimuthal angle
-
-                       return this;
-               }
-
-               set(radius, phi, theta) {
-                       this.radius = radius;
-                       this.phi = phi;
-                       this.theta = theta;
-                       return this;
-               }
-
-               copy(other) {
-                       this.radius = other.radius;
-                       this.phi = other.phi;
-                       this.theta = other.theta;
-                       return this;
-               } // restrict phi to be betwee EPS and PI-EPS
-
-
-               makeSafe() {
-                       const EPS = 0.000001;
-                       this.phi = Math.max(EPS, Math.min(Math.PI - EPS, this.phi));
-                       return this;
-               }
-
-               setFromVector3(v) {
-                       return this.setFromCartesianCoords(v.x, v.y, v.z);
-               }
-
-               setFromCartesianCoords(x, y, z) {
-                       this.radius = Math.sqrt(x * x + y * y + z * z);
-
-                       if (this.radius === 0) {
-                               this.theta = 0;
-                               this.phi = 0;
-                       } else {
-                               this.theta = Math.atan2(x, z);
-                               this.phi = Math.acos(clamp(y / this.radius, -1, 1));
-                       }
-
-                       return this;
-               }
-
-               clone() {
-                       return new this.constructor().copy(this);
-               }
-
-       }
-
-       /**
-        * Ref: https://en.wikipedia.org/wiki/Cylindrical_coordinate_system
-        */
-       class Cylindrical {
-               constructor(radius = 1, theta = 0, y = 0) {
-                       this.radius = radius; // distance from the origin to a point in the x-z plane
-
-                       this.theta = theta; // counterclockwise angle in the x-z plane measured in radians from the positive z-axis
-
-                       this.y = y; // height above the x-z plane
-
-                       return this;
-               }
-
-               set(radius, theta, y) {
-                       this.radius = radius;
-                       this.theta = theta;
-                       this.y = y;
-                       return this;
-               }
-
-               copy(other) {
-                       this.radius = other.radius;
-                       this.theta = other.theta;
-                       this.y = other.y;
-                       return this;
-               }
-
-               setFromVector3(v) {
-                       return this.setFromCartesianCoords(v.x, v.y, v.z);
-               }
-
-               setFromCartesianCoords(x, y, z) {
-                       this.radius = Math.sqrt(x * x + z * z);
-                       this.theta = Math.atan2(x, z);
-                       this.y = y;
-                       return this;
-               }
-
-               clone() {
-                       return new this.constructor().copy(this);
-               }
-
-       }
-
-       const _vector$4 = /*@__PURE__*/new Vector2();
-
-       class Box2 {
-               constructor(min = new Vector2(+Infinity, +Infinity), max = new Vector2(-Infinity, -Infinity)) {
-                       this.min = min;
-                       this.max = max;
-               }
-
-               set(min, max) {
-                       this.min.copy(min);
-                       this.max.copy(max);
-                       return this;
-               }
-
-               setFromPoints(points) {
-                       this.makeEmpty();
-
-                       for (let i = 0, il = points.length; i < il; i++) {
-                               this.expandByPoint(points[i]);
-                       }
-
-                       return this;
-               }
-
-               setFromCenterAndSize(center, size) {
-                       const halfSize = _vector$4.copy(size).multiplyScalar(0.5);
-
-                       this.min.copy(center).sub(halfSize);
-                       this.max.copy(center).add(halfSize);
-                       return this;
-               }
-
-               clone() {
-                       return new this.constructor().copy(this);
-               }
-
-               copy(box) {
-                       this.min.copy(box.min);
-                       this.max.copy(box.max);
-                       return this;
-               }
-
-               makeEmpty() {
-                       this.min.x = this.min.y = +Infinity;
-                       this.max.x = this.max.y = -Infinity;
-                       return this;
-               }
-
-               isEmpty() {
-                       // this is a more robust check for empty than ( volume <= 0 ) because volume can get positive with two negative axes
-                       return this.max.x < this.min.x || this.max.y < this.min.y;
-               }
-
-               getCenter(target) {
-                       return this.isEmpty() ? target.set(0, 0) : target.addVectors(this.min, this.max).multiplyScalar(0.5);
-               }
-
-               getSize(target) {
-                       return this.isEmpty() ? target.set(0, 0) : target.subVectors(this.max, this.min);
-               }
-
-               expandByPoint(point) {
-                       this.min.min(point);
-                       this.max.max(point);
-                       return this;
-               }
-
-               expandByVector(vector) {
-                       this.min.sub(vector);
-                       this.max.add(vector);
-                       return this;
-               }
-
-               expandByScalar(scalar) {
-                       this.min.addScalar(-scalar);
-                       this.max.addScalar(scalar);
-                       return this;
-               }
-
-               containsPoint(point) {
-                       return point.x < this.min.x || point.x > this.max.x || point.y < this.min.y || point.y > this.max.y ? false : true;
-               }
-
-               containsBox(box) {
-                       return this.min.x <= box.min.x && box.max.x <= this.max.x && this.min.y <= box.min.y && box.max.y <= this.max.y;
-               }
-
-               getParameter(point, target) {
-                       // This can potentially have a divide by zero if the box
-                       // has a size dimension of 0.
-                       return target.set((point.x - this.min.x) / (this.max.x - this.min.x), (point.y - this.min.y) / (this.max.y - this.min.y));
-               }
-
-               intersectsBox(box) {
-                       // using 4 splitting planes to rule out intersections
-                       return box.max.x < this.min.x || box.min.x > this.max.x || box.max.y < this.min.y || box.min.y > this.max.y ? false : true;
-               }
-
-               clampPoint(point, target) {
-                       return target.copy(point).clamp(this.min, this.max);
-               }
-
-               distanceToPoint(point) {
-                       const clampedPoint = _vector$4.copy(point).clamp(this.min, this.max);
-
-                       return clampedPoint.sub(point).length();
-               }
-
-               intersect(box) {
-                       this.min.max(box.min);
-                       this.max.min(box.max);
-                       return this;
-               }
-
-               union(box) {
-                       this.min.min(box.min);
-                       this.max.max(box.max);
-                       return this;
-               }
-
-               translate(offset) {
-                       this.min.add(offset);
-                       this.max.add(offset);
-                       return this;
-               }
-
-               equals(box) {
-                       return box.min.equals(this.min) && box.max.equals(this.max);
-               }
-
-       }
-
-       Box2.prototype.isBox2 = true;
-
-       const _startP = /*@__PURE__*/new Vector3();
-
-       const _startEnd = /*@__PURE__*/new Vector3();
-
-       class Line3 {
-               constructor(start = new Vector3(), end = new Vector3()) {
-                       this.start = start;
-                       this.end = end;
-               }
-
-               set(start, end) {
-                       this.start.copy(start);
-                       this.end.copy(end);
-                       return this;
-               }
-
-               copy(line) {
-                       this.start.copy(line.start);
-                       this.end.copy(line.end);
-                       return this;
-               }
-
-               getCenter(target) {
-                       return target.addVectors(this.start, this.end).multiplyScalar(0.5);
-               }
-
-               delta(target) {
-                       return target.subVectors(this.end, this.start);
-               }
-
-               distanceSq() {
-                       return this.start.distanceToSquared(this.end);
-               }
-
-               distance() {
-                       return this.start.distanceTo(this.end);
-               }
-
-               at(t, target) {
-                       return this.delta(target).multiplyScalar(t).add(this.start);
-               }
-
-               closestPointToPointParameter(point, clampToLine) {
-                       _startP.subVectors(point, this.start);
-
-                       _startEnd.subVectors(this.end, this.start);
-
-                       const startEnd2 = _startEnd.dot(_startEnd);
-
-                       const startEnd_startP = _startEnd.dot(_startP);
-
-                       let t = startEnd_startP / startEnd2;
-
-                       if (clampToLine) {
-                               t = clamp(t, 0, 1);
-                       }
-
-                       return t;
-               }
-
-               closestPointToPoint(point, clampToLine, target) {
-                       const t = this.closestPointToPointParameter(point, clampToLine);
-                       return this.delta(target).multiplyScalar(t).add(this.start);
-               }
-
-               applyMatrix4(matrix) {
-                       this.start.applyMatrix4(matrix);
-                       this.end.applyMatrix4(matrix);
-                       return this;
-               }
-
-               equals(line) {
-                       return line.start.equals(this.start) && line.end.equals(this.end);
-               }
-
-               clone() {
-                       return new this.constructor().copy(this);
-               }
-
-       }
-
-       class ImmediateRenderObject extends Object3D {
-               constructor(material) {
-                       super();
-                       this.material = material;
-
-                       this.render = function () {};
-
-                       this.hasPositions = false;
-                       this.hasNormals = false;
-                       this.hasColors = false;
-                       this.hasUvs = false;
-                       this.positionArray = null;
-                       this.normalArray = null;
-                       this.colorArray = null;
-                       this.uvArray = null;
-                       this.count = 0;
-               }
-
-       }
-
-       ImmediateRenderObject.prototype.isImmediateRenderObject = true;
-
-       const _vector$3 = /*@__PURE__*/new Vector3();
-
-       class SpotLightHelper extends Object3D {
-               constructor(light, color) {
-                       super();
-                       this.light = light;
-                       this.light.updateMatrixWorld();
-                       this.matrix = light.matrixWorld;
-                       this.matrixAutoUpdate = false;
-                       this.color = color;
-                       const geometry = new BufferGeometry();
-                       const positions = [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 i = 0, j = 1, l = 32; i < l; i++, j++) {
-                               const p1 = i / l * Math.PI * 2;
-                               const p2 = j / l * Math.PI * 2;
-                               positions.push(Math.cos(p1), Math.sin(p1), 1, Math.cos(p2), Math.sin(p2), 1);
-                       }
-
-                       geometry.setAttribute('position', new Float32BufferAttribute(positions, 3));
-                       const material = new LineBasicMaterial({
-                               fog: false,
-                               toneMapped: false
-                       });
-                       this.cone = new LineSegments(geometry, material);
-                       this.add(this.cone);
-                       this.update();
-               }
-
-               dispose() {
-                       this.cone.geometry.dispose();
-                       this.cone.material.dispose();
-               }
-
-               update() {
-                       this.light.updateMatrixWorld();
-                       const coneLength = this.light.distance ? this.light.distance : 1000;
-                       const coneWidth = coneLength * Math.tan(this.light.angle);
-                       this.cone.scale.set(coneWidth, coneWidth, coneLength);
-
-                       _vector$3.setFromMatrixPosition(this.light.target.matrixWorld);
-
-                       this.cone.lookAt(_vector$3);
-
-                       if (this.color !== undefined) {
-                               this.cone.material.color.set(this.color);
-                       } else {
-                               this.cone.material.color.copy(this.light.color);
-                       }
-               }
-
-       }
-
-       const _vector$2 = /*@__PURE__*/new Vector3();
-
-       const _boneMatrix = /*@__PURE__*/new Matrix4();
-
-       const _matrixWorldInv = /*@__PURE__*/new Matrix4();
-
-       class SkeletonHelper extends LineSegments {
-               constructor(object) {
-                       const bones = getBoneList(object);
-                       const geometry = new BufferGeometry();
-                       const vertices = [];
-                       const colors = [];
-                       const color1 = new Color(0, 0, 1);
-                       const color2 = new Color(0, 1, 0);
-
-                       for (let i = 0; i < bones.length; i++) {
-                               const bone = bones[i];
-
-                               if (bone.parent && bone.parent.isBone) {
-                                       vertices.push(0, 0, 0);
-                                       vertices.push(0, 0, 0);
-                                       colors.push(color1.r, color1.g, color1.b);
-                                       colors.push(color2.r, color2.g, color2.b);
-                               }
-                       }
-
-                       geometry.setAttribute('position', new Float32BufferAttribute(vertices, 3));
-                       geometry.setAttribute('color', new Float32BufferAttribute(colors, 3));
-                       const material = new LineBasicMaterial({
-                               vertexColors: true,
-                               depthTest: false,
-                               depthWrite: false,
-                               toneMapped: false,
-                               transparent: true
-                       });
-                       super(geometry, material);
-                       this.type = 'SkeletonHelper';
-                       this.isSkeletonHelper = true;
-                       this.root = object;
-                       this.bones = bones;
-                       this.matrix = object.matrixWorld;
-                       this.matrixAutoUpdate = false;
-               }
-
-               updateMatrixWorld(force) {
-                       const bones = this.bones;
-                       const geometry = this.geometry;
-                       const position = geometry.getAttribute('position');
-
-                       _matrixWorldInv.copy(this.root.matrixWorld).invert();
-
-                       for (let i = 0, j = 0; i < bones.length; i++) {
-                               const bone = bones[i];
-
-                               if (bone.parent && bone.parent.isBone) {
-                                       _boneMatrix.multiplyMatrices(_matrixWorldInv, bone.matrixWorld);
-
-                                       _vector$2.setFromMatrixPosition(_boneMatrix);
-
-                                       position.setXYZ(j, _vector$2.x, _vector$2.y, _vector$2.z);
-
-                                       _boneMatrix.multiplyMatrices(_matrixWorldInv, bone.parent.matrixWorld);
-
-                                       _vector$2.setFromMatrixPosition(_boneMatrix);
-
-                                       position.setXYZ(j + 1, _vector$2.x, _vector$2.y, _vector$2.z);
-                                       j += 2;
-                               }
-                       }
-
-                       geometry.getAttribute('position').needsUpdate = true;
-                       super.updateMatrixWorld(force);
-               }
-
-       }
-
-       function getBoneList(object) {
-               const boneList = [];
-
-               if (object && object.isBone) {
-                       boneList.push(object);
-               }
-
-               for (let i = 0; i < object.children.length; i++) {
-                       boneList.push.apply(boneList, getBoneList(object.children[i]));
-               }
-
-               return boneList;
-       }
-
-       class PointLightHelper extends Mesh {
-               constructor(light, sphereSize, color) {
-                       const geometry = new SphereGeometry(sphereSize, 4, 2);
-                       const material = new MeshBasicMaterial({
-                               wireframe: true,
-                               fog: false,
-                               toneMapped: false
-                       });
-                       super(geometry, material);
-                       this.light = light;
-                       this.light.updateMatrixWorld();
-                       this.color = color;
-                       this.type = 'PointLightHelper';
-                       this.matrix = this.light.matrixWorld;
-                       this.matrixAutoUpdate = false;
-                       this.update();
-                       /*
-                       // TODO: delete this comment?
-                       const distanceGeometry = new THREE.IcosahedronBufferGeometry( 1, 2 );
-                       const distanceMaterial = new THREE.MeshBasicMaterial( { color: hexColor, fog: false, wireframe: true, opacity: 0.1, transparent: true } );
-                       this.lightSphere = new THREE.Mesh( bulbGeometry, bulbMaterial );
-                       this.lightDistance = new THREE.Mesh( distanceGeometry, distanceMaterial );
-                       const d = light.distance;
-                       if ( d === 0.0 ) {
-                               this.lightDistance.visible = false;
-                       } else {
-                               this.lightDistance.scale.set( d, d, d );
-                       }
-                       this.add( this.lightDistance );
-                       */
-               }
-
-               dispose() {
-                       this.geometry.dispose();
-                       this.material.dispose();
-               }
-
-               update() {
-                       if (this.color !== undefined) {
-                               this.material.color.set(this.color);
-                       } else {
-                               this.material.color.copy(this.light.color);
-                       }
-                       /*
-                       const d = this.light.distance;
-                               if ( d === 0.0 ) {
-                                       this.lightDistance.visible = false;
-                               } else {
-                                       this.lightDistance.visible = true;
-                               this.lightDistance.scale.set( d, d, d );
-                               }
-                       */
-
-               }
-
-       }
-
-       const _vector$1 = /*@__PURE__*/new Vector3();
-
-       const _color1 = /*@__PURE__*/new Color();
-
-       const _color2 = /*@__PURE__*/new Color();
-
-       class HemisphereLightHelper extends Object3D {
-               constructor(light, size, color) {
-                       super();
-                       this.light = light;
-                       this.light.updateMatrixWorld();
-                       this.matrix = light.matrixWorld;
-                       this.matrixAutoUpdate = false;
-                       this.color = color;
-                       const geometry = new OctahedronGeometry(size);
-                       geometry.rotateY(Math.PI * 0.5);
-                       this.material = new MeshBasicMaterial({
-                               wireframe: true,
-                               fog: false,
-                               toneMapped: false
-                       });
-                       if (this.color === undefined) this.material.vertexColors = true;
-                       const position = geometry.getAttribute('position');
-                       const colors = new Float32Array(position.count * 3);
-                       geometry.setAttribute('color', new BufferAttribute(colors, 3));
-                       this.add(new Mesh(geometry, this.material));
-                       this.update();
-               }
-
-               dispose() {
-                       this.children[0].geometry.dispose();
-                       this.children[0].material.dispose();
-               }
-
-               update() {
-                       const mesh = this.children[0];
-
-                       if (this.color !== undefined) {
-                               this.material.color.set(this.color);
-                       } else {
-                               const colors = mesh.geometry.getAttribute('color');
-
-                               _color1.copy(this.light.color);
-
-                               _color2.copy(this.light.groundColor);
-
-                               for (let i = 0, l = colors.count; i < l; i++) {
-                                       const color = i < l / 2 ? _color1 : _color2;
-                                       colors.setXYZ(i, color.r, color.g, color.b);
-                               }
-
-                               colors.needsUpdate = true;
-                       }
-
-                       mesh.lookAt(_vector$1.setFromMatrixPosition(this.light.matrixWorld).negate());
-               }
-
-       }
-
-       class GridHelper extends LineSegments {
-               constructor(size = 10, divisions = 10, color1 = 0x444444, color2 = 0x888888) {
-                       color1 = new Color(color1);
-                       color2 = new Color(color2);
-                       const center = divisions / 2;
-                       const step = size / divisions;
-                       const halfSize = size / 2;
-                       const vertices = [],
-                                               colors = [];
-
-                       for (let i = 0, j = 0, k = -halfSize; i <= divisions; i++, k += step) {
-                               vertices.push(-halfSize, 0, k, halfSize, 0, k);
-                               vertices.push(k, 0, -halfSize, k, 0, halfSize);
-                               const color = i === center ? color1 : color2;
-                               color.toArray(colors, j);
-                               j += 3;
-                               color.toArray(colors, j);
-                               j += 3;
-                               color.toArray(colors, j);
-                               j += 3;
-                               color.toArray(colors, j);
-                               j += 3;
-                       }
-
-                       const geometry = new BufferGeometry();
-                       geometry.setAttribute('position', new Float32BufferAttribute(vertices, 3));
-                       geometry.setAttribute('color', new Float32BufferAttribute(colors, 3));
-                       const material = new LineBasicMaterial({
-                               vertexColors: true,
-                               toneMapped: false
-                       });
-                       super(geometry, material);
-                       this.type = 'GridHelper';
-               }
-
-       }
-
-       class PolarGridHelper extends LineSegments {
-               constructor(radius = 10, radials = 16, circles = 8, divisions = 64, color1 = 0x444444, color2 = 0x888888) {
-                       color1 = new Color(color1);
-                       color2 = new Color(color2);
-                       const vertices = [];
-                       const colors = []; // create the radials
-
-                       for (let i = 0; i <= radials; i++) {
-                               const v = i / radials * (Math.PI * 2);
-                               const x = Math.sin(v) * radius;
-                               const z = Math.cos(v) * radius;
-                               vertices.push(0, 0, 0);
-                               vertices.push(x, 0, z);
-                               const color = i & 1 ? color1 : color2;
-                               colors.push(color.r, color.g, color.b);
-                               colors.push(color.r, color.g, color.b);
-                       } // create the circles
-
-
-                       for (let i = 0; i <= circles; i++) {
-                               const color = i & 1 ? color1 : color2;
-                               const r = radius - radius / circles * i;
-
-                               for (let j = 0; j < divisions; j++) {
-                                       // first vertex
-                                       let v = j / divisions * (Math.PI * 2);
-                                       let x = Math.sin(v) * r;
-                                       let z = Math.cos(v) * r;
-                                       vertices.push(x, 0, z);
-                                       colors.push(color.r, color.g, color.b); // second vertex
-
-                                       v = (j + 1) / divisions * (Math.PI * 2);
-                                       x = Math.sin(v) * r;
-                                       z = Math.cos(v) * r;
-                                       vertices.push(x, 0, z);
-                                       colors.push(color.r, color.g, color.b);
-                               }
-                       }
-
-                       const geometry = new BufferGeometry();
-                       geometry.setAttribute('position', new Float32BufferAttribute(vertices, 3));
-                       geometry.setAttribute('color', new Float32BufferAttribute(colors, 3));
-                       const material = new LineBasicMaterial({
-                               vertexColors: true,
-                               toneMapped: false
-                       });
-                       super(geometry, material);
-                       this.type = 'PolarGridHelper';
-               }
-
-       }
-
-       const _v1 = /*@__PURE__*/new Vector3();
-
-       const _v2 = /*@__PURE__*/new Vector3();
-
-       const _v3 = /*@__PURE__*/new Vector3();
-
-       class DirectionalLightHelper extends Object3D {
-               constructor(light, size, color) {
-                       super();
-                       this.light = light;
-                       this.light.updateMatrixWorld();
-                       this.matrix = light.matrixWorld;
-                       this.matrixAutoUpdate = false;
-                       this.color = color;
-                       if (size === undefined) size = 1;
-                       let geometry = new BufferGeometry();
-                       geometry.setAttribute('position', new Float32BufferAttribute([-size, size, 0, size, size, 0, size, -size, 0, -size, -size, 0, -size, size, 0], 3));
-                       const material = new LineBasicMaterial({
-                               fog: false,
-                               toneMapped: false
-                       });
-                       this.lightPlane = new Line(geometry, material);
-                       this.add(this.lightPlane);
-                       geometry = new BufferGeometry();
-                       geometry.setAttribute('position', new Float32BufferAttribute([0, 0, 0, 0, 0, 1], 3));
-                       this.targetLine = new Line(geometry, material);
-                       this.add(this.targetLine);
-                       this.update();
-               }
-
-               dispose() {
-                       this.lightPlane.geometry.dispose();
-                       this.lightPlane.material.dispose();
-                       this.targetLine.geometry.dispose();
-                       this.targetLine.material.dispose();
-               }
-
-               update() {
-                       _v1.setFromMatrixPosition(this.light.matrixWorld);
-
-                       _v2.setFromMatrixPosition(this.light.target.matrixWorld);
-
-                       _v3.subVectors(_v2, _v1);
-
-                       this.lightPlane.lookAt(_v2);
-
-                       if (this.color !== undefined) {
-                               this.lightPlane.material.color.set(this.color);
-                               this.targetLine.material.color.set(this.color);
-                       } else {
-                               this.lightPlane.material.color.copy(this.light.color);
-                               this.targetLine.material.color.copy(this.light.color);
-                       }
-
-                       this.targetLine.lookAt(_v2);
-                       this.targetLine.scale.z = _v3.length();
-               }
-
-       }
-
-       const _vector = /*@__PURE__*/new Vector3();
-
-       const _camera = /*@__PURE__*/new Camera();
-       /**
-        *      - shows frustum, line of sight and up of the camera
-        *      - suitable for fast updates
-        *      - based on frustum visualization in lightgl.js shadowmap example
-        *              http://evanw.github.com/lightgl.js/tests/shadowmap.html
-        */
-
-
-       class CameraHelper extends LineSegments {
-               constructor(camera) {
-                       const geometry = new BufferGeometry();
-                       const material = new LineBasicMaterial({
-                               color: 0xffffff,
-                               vertexColors: true,
-                               toneMapped: false
-                       });
-                       const vertices = [];
-                       const colors = [];
-                       const pointMap = {}; // colors
-
-                       const colorFrustum = new Color(0xffaa00);
-                       const colorCone = new Color(0xff0000);
-                       const colorUp = new Color(0x00aaff);
-                       const colorTarget = new Color(0xffffff);
-                       const colorCross = new Color(0x333333); // near
-
-                       addLine('n1', 'n2', colorFrustum);
-                       addLine('n2', 'n4', colorFrustum);
-                       addLine('n4', 'n3', colorFrustum);
-                       addLine('n3', 'n1', colorFrustum); // far
-
-                       addLine('f1', 'f2', colorFrustum);
-                       addLine('f2', 'f4', colorFrustum);
-                       addLine('f4', 'f3', colorFrustum);
-                       addLine('f3', 'f1', colorFrustum); // sides
-
-                       addLine('n1', 'f1', colorFrustum);
-                       addLine('n2', 'f2', colorFrustum);
-                       addLine('n3', 'f3', colorFrustum);
-                       addLine('n4', 'f4', colorFrustum); // cone
-
-                       addLine('p', 'n1', colorCone);
-                       addLine('p', 'n2', colorCone);
-                       addLine('p', 'n3', colorCone);
-                       addLine('p', 'n4', colorCone); // up
-
-                       addLine('u1', 'u2', colorUp);
-                       addLine('u2', 'u3', colorUp);
-                       addLine('u3', 'u1', colorUp); // target
-
-                       addLine('c', 't', colorTarget);
-                       addLine('p', 'c', colorCross); // cross
-
-                       addLine('cn1', 'cn2', colorCross);
-                       addLine('cn3', 'cn4', colorCross);
-                       addLine('cf1', 'cf2', colorCross);
-                       addLine('cf3', 'cf4', colorCross);
-
-                       function addLine(a, b, color) {
-                               addPoint(a, color);
-                               addPoint(b, color);
-                       }
-
-                       function addPoint(id, color) {
-                               vertices.push(0, 0, 0);
-                               colors.push(color.r, color.g, color.b);
-
-                               if (pointMap[id] === undefined) {
-                                       pointMap[id] = [];
-                               }
-
-                               pointMap[id].push(vertices.length / 3 - 1);
-                       }
-
-                       geometry.setAttribute('position', new Float32BufferAttribute(vertices, 3));
-                       geometry.setAttribute('color', new Float32BufferAttribute(colors, 3));
-                       super(geometry, material);
-                       this.type = 'CameraHelper';
-                       this.camera = camera;
-                       if (this.camera.updateProjectionMatrix) this.camera.updateProjectionMatrix();
-                       this.matrix = camera.matrixWorld;
-                       this.matrixAutoUpdate = false;
-                       this.pointMap = pointMap;
-                       this.update();
-               }
-
-               update() {
-                       const geometry = this.geometry;
-                       const pointMap = this.pointMap;
-                       const w = 1,
-                                               h = 1; // we need just camera projection matrix inverse
-                       // world matrix must be identity
-
-                       _camera.projectionMatrixInverse.copy(this.camera.projectionMatrixInverse); // center / target
-
-
-                       setPoint('c', pointMap, geometry, _camera, 0, 0, -1);
-                       setPoint('t', pointMap, geometry, _camera, 0, 0, 1); // near
-
-                       setPoint('n1', pointMap, geometry, _camera, -w, -h, -1);
-                       setPoint('n2', pointMap, geometry, _camera, w, -h, -1);
-                       setPoint('n3', pointMap, geometry, _camera, -w, h, -1);
-                       setPoint('n4', pointMap, geometry, _camera, w, h, -1); // far
-
-                       setPoint('f1', pointMap, geometry, _camera, -w, -h, 1);
-                       setPoint('f2', pointMap, geometry, _camera, w, -h, 1);
-                       setPoint('f3', pointMap, geometry, _camera, -w, h, 1);
-                       setPoint('f4', pointMap, geometry, _camera, w, h, 1); // up
-
-                       setPoint('u1', pointMap, geometry, _camera, w * 0.7, h * 1.1, -1);
-                       setPoint('u2', pointMap, geometry, _camera, -w * 0.7, h * 1.1, -1);
-                       setPoint('u3', pointMap, geometry, _camera, 0, h * 2, -1); // cross
-
-                       setPoint('cf1', pointMap, geometry, _camera, -w, 0, 1);
-                       setPoint('cf2', pointMap, geometry, _camera, w, 0, 1);
-                       setPoint('cf3', pointMap, geometry, _camera, 0, -h, 1);
-                       setPoint('cf4', pointMap, geometry, _camera, 0, h, 1);
-                       setPoint('cn1', pointMap, geometry, _camera, -w, 0, -1);
-                       setPoint('cn2', pointMap, geometry, _camera, w, 0, -1);
-                       setPoint('cn3', pointMap, geometry, _camera, 0, -h, -1);
-                       setPoint('cn4', pointMap, geometry, _camera, 0, h, -1);
-                       geometry.getAttribute('position').needsUpdate = true;
-               }
-
-               dispose() {
-                       this.geometry.dispose();
-                       this.material.dispose();
-               }
-
-       }
-
-       function setPoint(point, pointMap, geometry, camera, x, y, z) {
-               _vector.set(x, y, z).unproject(camera);
-
-               const points = pointMap[point];
-
-               if (points !== undefined) {
-                       const position = geometry.getAttribute('position');
-
-                       for (let i = 0, l = points.length; i < l; i++) {
-                               position.setXYZ(points[i], _vector.x, _vector.y, _vector.z);
-                       }
-               }
-       }
-
-       const _box = /*@__PURE__*/new Box3();
-
-       class BoxHelper extends LineSegments {
-               constructor(object, color = 0xffff00) {
-                       const indices = 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]);
-                       const positions = new Float32Array(8 * 3);
-                       const geometry = new BufferGeometry();
-                       geometry.setIndex(new BufferAttribute(indices, 1));
-                       geometry.setAttribute('position', new BufferAttribute(positions, 3));
-                       super(geometry, new LineBasicMaterial({
-                               color: color,
-                               toneMapped: false
-                       }));
-                       this.object = object;
-                       this.type = 'BoxHelper';
-                       this.matrixAutoUpdate = false;
-                       this.update();
-               }
-
-               update(object) {
-                       if (object !== undefined) {
-                               console.warn('THREE.BoxHelper: .update() has no longer arguments.');
-                       }
-
-                       if (this.object !== undefined) {
-                               _box.setFromObject(this.object);
-                       }
-
-                       if (_box.isEmpty()) return;
-                       const min = _box.min;
-                       const max = _box.max;
-                       /*
-                               5____4
-                       1/___0/|
-                       | 6__|_7
-                       2/___3/
-                               0: max.x, max.y, max.z
-                       1: min.x, max.y, max.z
-                       2: min.x, min.y, max.z
-                       3: max.x, min.y, max.z
-                       4: max.x, max.y, min.z
-                       5: min.x, max.y, min.z
-                       6: min.x, min.y, min.z
-                       7: max.x, min.y, min.z
-                       */
-
-                       const position = this.geometry.attributes.position;
-                       const array = position.array;
-                       array[0] = max.x;
-                       array[1] = max.y;
-                       array[2] = max.z;
-                       array[3] = min.x;
-                       array[4] = max.y;
-                       array[5] = max.z;
-                       array[6] = min.x;
-                       array[7] = min.y;
-                       array[8] = max.z;
-                       array[9] = max.x;
-                       array[10] = min.y;
-                       array[11] = max.z;
-                       array[12] = max.x;
-                       array[13] = max.y;
-                       array[14] = min.z;
-                       array[15] = min.x;
-                       array[16] = max.y;
-                       array[17] = min.z;
-                       array[18] = min.x;
-                       array[19] = min.y;
-                       array[20] = min.z;
-                       array[21] = max.x;
-                       array[22] = min.y;
-                       array[23] = min.z;
-                       position.needsUpdate = true;
-                       this.geometry.computeBoundingSphere();
-               }
-
-               setFromObject(object) {
-                       this.object = object;
-                       this.update();
-                       return this;
-               }
-
-               copy(source) {
-                       LineSegments.prototype.copy.call(this, source);
-                       this.object = source.object;
-                       return this;
-               }
-
-       }
-
-       class Box3Helper extends LineSegments {
-               constructor(box, color = 0xffff00) {
-                       const indices = 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]);
-                       const positions = [1, 1, 1, -1, 1, 1, -1, -1, 1, 1, -1, 1, 1, 1, -1, -1, 1, -1, -1, -1, -1, 1, -1, -1];
-                       const geometry = new BufferGeometry();
-                       geometry.setIndex(new BufferAttribute(indices, 1));
-                       geometry.setAttribute('position', new Float32BufferAttribute(positions, 3));
-                       super(geometry, new LineBasicMaterial({
-                               color: color,
-                               toneMapped: false
-                       }));
-                       this.box = box;
-                       this.type = 'Box3Helper';
-                       this.geometry.computeBoundingSphere();
-               }
-
-               updateMatrixWorld(force) {
-                       const box = this.box;
-                       if (box.isEmpty()) return;
-                       box.getCenter(this.position);
-                       box.getSize(this.scale);
-                       this.scale.multiplyScalar(0.5);
-                       super.updateMatrixWorld(force);
-               }
-
-       }
-
-       class PlaneHelper extends Line {
-               constructor(plane, size = 1, hex = 0xffff00) {
-                       const color = hex;
-                       const positions = [1, -1, 1, -1, 1, 1, -1, -1, 1, 1, 1, 1, -1, 1, 1, -1, -1, 1, 1, -1, 1, 1, 1, 1, 0, 0, 1, 0, 0, 0];
-                       const geometry = new BufferGeometry();
-                       geometry.setAttribute('position', new Float32BufferAttribute(positions, 3));
-                       geometry.computeBoundingSphere();
-                       super(geometry, new LineBasicMaterial({
-                               color: color,
-                               toneMapped: false
-                       }));
-                       this.type = 'PlaneHelper';
-                       this.plane = plane;
-                       this.size = size;
-                       const positions2 = [1, 1, 1, -1, 1, 1, -1, -1, 1, 1, 1, 1, -1, -1, 1, 1, -1, 1];
-                       const geometry2 = new BufferGeometry();
-                       geometry2.setAttribute('position', new Float32BufferAttribute(positions2, 3));
-                       geometry2.computeBoundingSphere();
-                       this.add(new Mesh(geometry2, new MeshBasicMaterial({
-                               color: color,
-                               opacity: 0.2,
-                               transparent: true,
-                               depthWrite: false,
-                               toneMapped: false
-                       })));
-               }
-
-               updateMatrixWorld(force) {
-                       let scale = -this.plane.constant;
-                       if (Math.abs(scale) < 1e-8) scale = 1e-8; // sign does not matter
-
-                       this.scale.set(0.5 * this.size, 0.5 * this.size, scale);
-                       this.children[0].material.side = scale < 0 ? BackSide : FrontSide; // renderer flips side when determinant < 0; flipping not wanted here
-
-                       this.lookAt(this.plane.normal);
-                       super.updateMatrixWorld(force);
-               }
-
-       }
-
-       const _axis = /*@__PURE__*/new Vector3();
-
-       let _lineGeometry, _coneGeometry;
-
-       class ArrowHelper extends Object3D {
-               // dir is assumed to be normalized
-               constructor(dir = new Vector3(0, 0, 1), origin = new Vector3(0, 0, 0), length = 1, color = 0xffff00, headLength = length * 0.2, headWidth = headLength * 0.2) {
-                       super();
-                       this.type = 'ArrowHelper';
-
-                       if (_lineGeometry === undefined) {
-                               _lineGeometry = new BufferGeometry();
-
-                               _lineGeometry.setAttribute('position', new Float32BufferAttribute([0, 0, 0, 0, 1, 0], 3));
-
-                               _coneGeometry = new CylinderGeometry(0, 0.5, 1, 5, 1);
-
-                               _coneGeometry.translate(0, -0.5, 0);
-                       }
-
-                       this.position.copy(origin);
-                       this.line = new Line(_lineGeometry, new LineBasicMaterial({
-                               color: color,
-                               toneMapped: false
-                       }));
-                       this.line.matrixAutoUpdate = false;
-                       this.add(this.line);
-                       this.cone = new Mesh(_coneGeometry, new MeshBasicMaterial({
-                               color: color,
-                               toneMapped: false
-                       }));
-                       this.cone.matrixAutoUpdate = false;
-                       this.add(this.cone);
-                       this.setDirection(dir);
-                       this.setLength(length, headLength, headWidth);
-               }
-
-               setDirection(dir) {
-                       // dir is assumed to be normalized
-                       if (dir.y > 0.99999) {
-                               this.quaternion.set(0, 0, 0, 1);
-                       } else if (dir.y < -0.99999) {
-                               this.quaternion.set(1, 0, 0, 0);
-                       } else {
-                               _axis.set(dir.z, 0, -dir.x).normalize();
-
-                               const radians = Math.acos(dir.y);
-                               this.quaternion.setFromAxisAngle(_axis, radians);
-                       }
-               }
-
-               setLength(length, headLength = length * 0.2, headWidth = headLength * 0.2) {
-                       this.line.scale.set(1, Math.max(0.0001, length - headLength), 1); // see #17458
-
-                       this.line.updateMatrix();
-                       this.cone.scale.set(headWidth, headLength, headWidth);
-                       this.cone.position.y = length;
-                       this.cone.updateMatrix();
-               }
-
-               setColor(color) {
-                       this.line.material.color.set(color);
-                       this.cone.material.color.set(color);
-               }
-
-               copy(source) {
-                       super.copy(source, false);
-                       this.line.copy(source.line);
-                       this.cone.copy(source.cone);
-                       return this;
-               }
-
-       }
-
-       class AxesHelper extends LineSegments {
-               constructor(size = 1) {
-                       const vertices = [0, 0, 0, size, 0, 0, 0, 0, 0, 0, size, 0, 0, 0, 0, 0, 0, size];
-                       const colors = [1, 0, 0, 1, 0.6, 0, 0, 1, 0, 0.6, 1, 0, 0, 0, 1, 0, 0.6, 1];
-                       const geometry = new BufferGeometry();
-                       geometry.setAttribute('position', new Float32BufferAttribute(vertices, 3));
-                       geometry.setAttribute('color', new Float32BufferAttribute(colors, 3));
-                       const material = new LineBasicMaterial({
-                               vertexColors: true,
-                               toneMapped: false
-                       });
-                       super(geometry, material);
-                       this.type = 'AxesHelper';
-               }
-
-               setColors(xAxisColor, yAxisColor, zAxisColor) {
-                       const color = new Color();
-                       const array = this.geometry.attributes.color.array;
-                       color.set(xAxisColor);
-                       color.toArray(array, 0);
-                       color.toArray(array, 3);
-                       color.set(yAxisColor);
-                       color.toArray(array, 6);
-                       color.toArray(array, 9);
-                       color.set(zAxisColor);
-                       color.toArray(array, 12);
-                       color.toArray(array, 15);
-                       this.geometry.attributes.color.needsUpdate = true;
-                       return this;
-               }
-
-               dispose() {
-                       this.geometry.dispose();
-                       this.material.dispose();
-               }
-
-       }
-
-       const _floatView = new Float32Array(1);
-
-       const _int32View = new Int32Array(_floatView.buffer);
-
-       class DataUtils {
-               // Converts float32 to float16 (stored as uint16 value).
-               static toHalfFloat(val) {
-                       // Source: http://gamedev.stackexchange.com/questions/17326/conversion-of-a-number-from-single-precision-floating-point-representation-to-a/17410#17410
-
-                       /* This method is faster than the OpenEXR implementation (very often
-                       * used, eg. in Ogre), with the additional benefit of rounding, inspired
-                       * by James Tursa?s half-precision code. */
-                       _floatView[0] = val;
-                       const x = _int32View[0];
-                       let bits = x >> 16 & 0x8000;
-                       /* Get the sign */
-
-                       let m = x >> 12 & 0x07ff;
-                       /* Keep one extra bit for rounding */
-
-                       const e = x >> 23 & 0xff;
-                       /* Using int is faster here */
-
-                       /* If zero, or denormal, or exponent underflows too much for a denormal
-                               * half, return signed zero. */
-
-                       if (e < 103) return bits;
-                       /* If NaN, return NaN. If Inf or exponent overflow, return Inf. */
-
-                       if (e > 142) {
-                               bits |= 0x7c00;
-                               /* If exponent was 0xff and one mantissa bit was set, it means NaN,
-                                                       * not Inf, so make sure we set one mantissa bit too. */
-
-                               bits |= (e == 255 ? 0 : 1) && x & 0x007fffff;
-                               return bits;
-                       }
-                       /* If exponent underflows but not too much, return a denormal */
-
-
-                       if (e < 113) {
-                               m |= 0x0800;
-                               /* Extra rounding may overflow and set mantissa to 0 and exponent
-                                       * to 1, which is OK. */
-
-                               bits |= (m >> 114 - e) + (m >> 113 - e & 1);
-                               return bits;
-                       }
-
-                       bits |= e - 112 << 10 | m >> 1;
-                       /* Extra rounding. An overflow will set mantissa to 0 and increment
-                               * the exponent, which is OK. */
-
-                       bits += m & 1;
-                       return bits;
-               }
-
-       }
-
-       const LineStrip = 0;
-       const LinePieces = 1;
-       const NoColors = 0;
-       const FaceColors = 1;
-       const VertexColors = 2;
-       function MeshFaceMaterial(materials) {
-               console.warn('THREE.MeshFaceMaterial has been removed. Use an Array instead.');
-               return materials;
-       }
-       function MultiMaterial(materials = []) {
-               console.warn('THREE.MultiMaterial has been removed. Use an Array instead.');
-               materials.isMultiMaterial = true;
-               materials.materials = materials;
-
-               materials.clone = function () {
-                       return materials.slice();
-               };
-
-               return materials;
-       }
-       function PointCloud(geometry, material) {
-               console.warn('THREE.PointCloud has been renamed to THREE.Points.');
-               return new Points(geometry, material);
-       }
-       function Particle(material) {
-               console.warn('THREE.Particle has been renamed to THREE.Sprite.');
-               return new Sprite(material);
-       }
-       function ParticleSystem(geometry, material) {
-               console.warn('THREE.ParticleSystem has been renamed to THREE.Points.');
-               return new Points(geometry, material);
-       }
-       function PointCloudMaterial(parameters) {
-               console.warn('THREE.PointCloudMaterial has been renamed to THREE.PointsMaterial.');
-               return new PointsMaterial(parameters);
-       }
-       function ParticleBasicMaterial(parameters) {
-               console.warn('THREE.ParticleBasicMaterial has been renamed to THREE.PointsMaterial.');
-               return new PointsMaterial(parameters);
-       }
-       function ParticleSystemMaterial(parameters) {
-               console.warn('THREE.ParticleSystemMaterial has been renamed to THREE.PointsMaterial.');
-               return new PointsMaterial(parameters);
-       }
-       function Vertex(x, y, z) {
-               console.warn('THREE.Vertex has been removed. Use THREE.Vector3 instead.');
-               return new Vector3(x, y, z);
-       } //
-
-       function DynamicBufferAttribute(array, itemSize) {
-               console.warn('THREE.DynamicBufferAttribute has been removed. Use new THREE.BufferAttribute().setUsage( THREE.DynamicDrawUsage ) instead.');
-               return new BufferAttribute(array, itemSize).setUsage(DynamicDrawUsage);
-       }
-       function Int8Attribute(array, itemSize) {
-               console.warn('THREE.Int8Attribute has been removed. Use new THREE.Int8BufferAttribute() instead.');
-               return new Int8BufferAttribute(array, itemSize);
-       }
-       function Uint8Attribute(array, itemSize) {
-               console.warn('THREE.Uint8Attribute has been removed. Use new THREE.Uint8BufferAttribute() instead.');
-               return new Uint8BufferAttribute(array, itemSize);
-       }
-       function Uint8ClampedAttribute(array, itemSize) {
-               console.warn('THREE.Uint8ClampedAttribute has been removed. Use new THREE.Uint8ClampedBufferAttribute() instead.');
-               return new Uint8ClampedBufferAttribute(array, itemSize);
-       }
-       function Int16Attribute(array, itemSize) {
-               console.warn('THREE.Int16Attribute has been removed. Use new THREE.Int16BufferAttribute() instead.');
-               return new Int16BufferAttribute(array, itemSize);
-       }
-       function Uint16Attribute(array, itemSize) {
-               console.warn('THREE.Uint16Attribute has been removed. Use new THREE.Uint16BufferAttribute() instead.');
-               return new Uint16BufferAttribute(array, itemSize);
-       }
-       function Int32Attribute(array, itemSize) {
-               console.warn('THREE.Int32Attribute has been removed. Use new THREE.Int32BufferAttribute() instead.');
-               return new Int32BufferAttribute(array, itemSize);
-       }
-       function Uint32Attribute(array, itemSize) {
-               console.warn('THREE.Uint32Attribute has been removed. Use new THREE.Uint32BufferAttribute() instead.');
-               return new Uint32BufferAttribute(array, itemSize);
-       }
-       function Float32Attribute(array, itemSize) {
-               console.warn('THREE.Float32Attribute has been removed. Use new THREE.Float32BufferAttribute() instead.');
-               return new Float32BufferAttribute(array, itemSize);
-       }
-       function Float64Attribute(array, itemSize) {
-               console.warn('THREE.Float64Attribute has been removed. Use new THREE.Float64BufferAttribute() instead.');
-               return new Float64BufferAttribute(array, itemSize);
-       } //
-
-       Curve.create = function (construct, getPoint) {
-               console.log('THREE.Curve.create() has been deprecated');
-               construct.prototype = Object.create(Curve.prototype);
-               construct.prototype.constructor = construct;
-               construct.prototype.getPoint = getPoint;
-               return construct;
-       }; //
-
-
-       Path.prototype.fromPoints = function (points) {
-               console.warn('THREE.Path: .fromPoints() has been renamed to .setFromPoints().');
-               return this.setFromPoints(points);
-       }; //
-
-
-       function AxisHelper(size) {
-               console.warn('THREE.AxisHelper has been renamed to THREE.AxesHelper.');
-               return new AxesHelper(size);
-       }
-       function BoundingBoxHelper(object, color) {
-               console.warn('THREE.BoundingBoxHelper has been deprecated. Creating a THREE.BoxHelper instead.');
-               return new BoxHelper(object, color);
-       }
-       function EdgesHelper(object, hex) {
-               console.warn('THREE.EdgesHelper has been removed. Use THREE.EdgesGeometry instead.');
-               return new LineSegments(new EdgesGeometry(object.geometry), new LineBasicMaterial({
-                       color: hex !== undefined ? hex : 0xffffff
-               }));
-       }
-
-       GridHelper.prototype.setColors = function () {
-               console.error('THREE.GridHelper: setColors() has been deprecated, pass them in the constructor instead.');
-       };
-
-       SkeletonHelper.prototype.update = function () {
-               console.error('THREE.SkeletonHelper: update() no longer needs to be called.');
-       };
-
-       function WireframeHelper(object, hex) {
-               console.warn('THREE.WireframeHelper has been removed. Use THREE.WireframeGeometry instead.');
-               return new LineSegments(new WireframeGeometry(object.geometry), new LineBasicMaterial({
-                       color: hex !== undefined ? hex : 0xffffff
-               }));
-       } //
-
-       Loader.prototype.extractUrlBase = function (url) {
-               console.warn('THREE.Loader: .extractUrlBase() has been deprecated. Use THREE.LoaderUtils.extractUrlBase() instead.');
-               return LoaderUtils.extractUrlBase(url);
-       };
-
-       Loader.Handlers = {
-               add: function () {
-                       console.error('THREE.Loader: Handlers.add() has been removed. Use LoadingManager.addHandler() instead.');
-               },
-               get: function () {
-                       console.error('THREE.Loader: Handlers.get() has been removed. Use LoadingManager.getHandler() instead.');
-               }
-       };
-       function XHRLoader(manager) {
-               console.warn('THREE.XHRLoader has been renamed to THREE.FileLoader.');
-               return new FileLoader(manager);
-       }
-       function BinaryTextureLoader(manager) {
-               console.warn('THREE.BinaryTextureLoader has been renamed to THREE.DataTextureLoader.');
-               return new DataTextureLoader(manager);
-       } //
-
-       Box2.prototype.center = function (optionalTarget) {
-               console.warn('THREE.Box2: .center() has been renamed to .getCenter().');
-               return this.getCenter(optionalTarget);
-       };
-
-       Box2.prototype.empty = function () {
-               console.warn('THREE.Box2: .empty() has been renamed to .isEmpty().');
-               return this.isEmpty();
-       };
-
-       Box2.prototype.isIntersectionBox = function (box) {
-               console.warn('THREE.Box2: .isIntersectionBox() has been renamed to .intersectsBox().');
-               return this.intersectsBox(box);
-       };
-
-       Box2.prototype.size = function (optionalTarget) {
-               console.warn('THREE.Box2: .size() has been renamed to .getSize().');
-               return this.getSize(optionalTarget);
-       }; //
-
-
-       Box3.prototype.center = function (optionalTarget) {
-               console.warn('THREE.Box3: .center() has been renamed to .getCenter().');
-               return this.getCenter(optionalTarget);
-       };
-
-       Box3.prototype.empty = function () {
-               console.warn('THREE.Box3: .empty() has been renamed to .isEmpty().');
-               return this.isEmpty();
-       };
-
-       Box3.prototype.isIntersectionBox = function (box) {
-               console.warn('THREE.Box3: .isIntersectionBox() has been renamed to .intersectsBox().');
-               return this.intersectsBox(box);
-       };
-
-       Box3.prototype.isIntersectionSphere = function (sphere) {
-               console.warn('THREE.Box3: .isIntersectionSphere() has been renamed to .intersectsSphere().');
-               return this.intersectsSphere(sphere);
-       };
-
-       Box3.prototype.size = function (optionalTarget) {
-               console.warn('THREE.Box3: .size() has been renamed to .getSize().');
-               return this.getSize(optionalTarget);
-       }; //
-
-
-       Sphere.prototype.empty = function () {
-               console.warn('THREE.Sphere: .empty() has been renamed to .isEmpty().');
-               return this.isEmpty();
-       }; //
-
-
-       Frustum.prototype.setFromMatrix = function (m) {
-               console.warn('THREE.Frustum: .setFromMatrix() has been renamed to .setFromProjectionMatrix().');
-               return this.setFromProjectionMatrix(m);
-       }; //
-
-
-       Line3.prototype.center = function (optionalTarget) {
-               console.warn('THREE.Line3: .center() has been renamed to .getCenter().');
-               return this.getCenter(optionalTarget);
-       }; //
-
-
-       Matrix3.prototype.flattenToArrayOffset = function (array, offset) {
-               console.warn('THREE.Matrix3: .flattenToArrayOffset() has been deprecated. Use .toArray() instead.');
-               return this.toArray(array, offset);
-       };
-
-       Matrix3.prototype.multiplyVector3 = function (vector) {
-               console.warn('THREE.Matrix3: .multiplyVector3() has been removed. Use vector.applyMatrix3( matrix ) instead.');
-               return vector.applyMatrix3(this);
-       };
-
-       Matrix3.prototype.multiplyVector3Array = function () {
-               console.error('THREE.Matrix3: .multiplyVector3Array() has been removed.');
-       };
-
-       Matrix3.prototype.applyToBufferAttribute = function (attribute) {
-               console.warn('THREE.Matrix3: .applyToBufferAttribute() has been removed. Use attribute.applyMatrix3( matrix ) instead.');
-               return attribute.applyMatrix3(this);
-       };
-
-       Matrix3.prototype.applyToVector3Array = function () {
-               console.error('THREE.Matrix3: .applyToVector3Array() has been removed.');
-       };
-
-       Matrix3.prototype.getInverse = function (matrix) {
-               console.warn('THREE.Matrix3: .getInverse() has been removed. Use matrixInv.copy( matrix ).invert(); instead.');
-               return this.copy(matrix).invert();
-       }; //
-
-
-       Matrix4.prototype.extractPosition = function (m) {
-               console.warn('THREE.Matrix4: .extractPosition() has been renamed to .copyPosition().');
-               return this.copyPosition(m);
-       };
-
-       Matrix4.prototype.flattenToArrayOffset = function (array, offset) {
-               console.warn('THREE.Matrix4: .flattenToArrayOffset() has been deprecated. Use .toArray() instead.');
-               return this.toArray(array, offset);
-       };
-
-       Matrix4.prototype.getPosition = function () {
-               console.warn('THREE.Matrix4: .getPosition() has been removed. Use Vector3.setFromMatrixPosition( matrix ) instead.');
-               return new Vector3().setFromMatrixColumn(this, 3);
-       };
-
-       Matrix4.prototype.setRotationFromQuaternion = function (q) {
-               console.warn('THREE.Matrix4: .setRotationFromQuaternion() has been renamed to .makeRotationFromQuaternion().');
-               return this.makeRotationFromQuaternion(q);
-       };
-
-       Matrix4.prototype.multiplyToArray = function () {
-               console.warn('THREE.Matrix4: .multiplyToArray() has been removed.');
-       };
-
-       Matrix4.prototype.multiplyVector3 = function (vector) {
-               console.warn('THREE.Matrix4: .multiplyVector3() has been removed. Use vector.applyMatrix4( matrix ) instead.');
-               return vector.applyMatrix4(this);
-       };
-
-       Matrix4.prototype.multiplyVector4 = function (vector) {
-               console.warn('THREE.Matrix4: .multiplyVector4() has been removed. Use vector.applyMatrix4( matrix ) instead.');
-               return vector.applyMatrix4(this);
-       };
-
-       Matrix4.prototype.multiplyVector3Array = function () {
-               console.error('THREE.Matrix4: .multiplyVector3Array() has been removed.');
-       };
-
-       Matrix4.prototype.rotateAxis = function (v) {
-               console.warn('THREE.Matrix4: .rotateAxis() has been removed. Use Vector3.transformDirection( matrix ) instead.');
-               v.transformDirection(this);
-       };
-
-       Matrix4.prototype.crossVector = function (vector) {
-               console.warn('THREE.Matrix4: .crossVector() has been removed. Use vector.applyMatrix4( matrix ) instead.');
-               return vector.applyMatrix4(this);
-       };
-
-       Matrix4.prototype.translate = function () {
-               console.error('THREE.Matrix4: .translate() has been removed.');
-       };
-
-       Matrix4.prototype.rotateX = function () {
-               console.error('THREE.Matrix4: .rotateX() has been removed.');
-       };
-
-       Matrix4.prototype.rotateY = function () {
-               console.error('THREE.Matrix4: .rotateY() has been removed.');
-       };
-
-       Matrix4.prototype.rotateZ = function () {
-               console.error('THREE.Matrix4: .rotateZ() has been removed.');
-       };
-
-       Matrix4.prototype.rotateByAxis = function () {
-               console.error('THREE.Matrix4: .rotateByAxis() has been removed.');
-       };
-
-       Matrix4.prototype.applyToBufferAttribute = function (attribute) {
-               console.warn('THREE.Matrix4: .applyToBufferAttribute() has been removed. Use attribute.applyMatrix4( matrix ) instead.');
-               return attribute.applyMatrix4(this);
-       };
-
-       Matrix4.prototype.applyToVector3Array = function () {
-               console.error('THREE.Matrix4: .applyToVector3Array() has been removed.');
-       };
-
-       Matrix4.prototype.makeFrustum = function (left, right, bottom, top, near, far) {
-               console.warn('THREE.Matrix4: .makeFrustum() has been removed. Use .makePerspective( left, right, top, bottom, near, far ) instead.');
-               return this.makePerspective(left, right, top, bottom, near, far);
-       };
-
-       Matrix4.prototype.getInverse = function (matrix) {
-               console.warn('THREE.Matrix4: .getInverse() has been removed. Use matrixInv.copy( matrix ).invert(); instead.');
-               return this.copy(matrix).invert();
-       }; //
-
-
-       Plane.prototype.isIntersectionLine = function (line) {
-               console.warn('THREE.Plane: .isIntersectionLine() has been renamed to .intersectsLine().');
-               return this.intersectsLine(line);
-       }; //
-
-
-       Quaternion.prototype.multiplyVector3 = function (vector) {
-               console.warn('THREE.Quaternion: .multiplyVector3() has been removed. Use is now vector.applyQuaternion( quaternion ) instead.');
-               return vector.applyQuaternion(this);
-       };
-
-       Quaternion.prototype.inverse = function () {
-               console.warn('THREE.Quaternion: .inverse() has been renamed to invert().');
-               return this.invert();
-       }; //
-
-
-       Ray.prototype.isIntersectionBox = function (box) {
-               console.warn('THREE.Ray: .isIntersectionBox() has been renamed to .intersectsBox().');
-               return this.intersectsBox(box);
-       };
-
-       Ray.prototype.isIntersectionPlane = function (plane) {
-               console.warn('THREE.Ray: .isIntersectionPlane() has been renamed to .intersectsPlane().');
-               return this.intersectsPlane(plane);
-       };
-
-       Ray.prototype.isIntersectionSphere = function (sphere) {
-               console.warn('THREE.Ray: .isIntersectionSphere() has been renamed to .intersectsSphere().');
-               return this.intersectsSphere(sphere);
-       }; //
-
-
-       Triangle.prototype.area = function () {
-               console.warn('THREE.Triangle: .area() has been renamed to .getArea().');
-               return this.getArea();
-       };
-
-       Triangle.prototype.barycoordFromPoint = function (point, target) {
-               console.warn('THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord().');
-               return this.getBarycoord(point, target);
-       };
-
-       Triangle.prototype.midpoint = function (target) {
-               console.warn('THREE.Triangle: .midpoint() has been renamed to .getMidpoint().');
-               return this.getMidpoint(target);
-       };
-
-       Triangle.prototypenormal = function (target) {
-               console.warn('THREE.Triangle: .normal() has been renamed to .getNormal().');
-               return this.getNormal(target);
-       };
-
-       Triangle.prototype.plane = function (target) {
-               console.warn('THREE.Triangle: .plane() has been renamed to .getPlane().');
-               return this.getPlane(target);
-       };
-
-       Triangle.barycoordFromPoint = function (point, a, b, c, target) {
-               console.warn('THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord().');
-               return Triangle.getBarycoord(point, a, b, c, target);
-       };
-
-       Triangle.normal = function (a, b, c, target) {
-               console.warn('THREE.Triangle: .normal() has been renamed to .getNormal().');
-               return Triangle.getNormal(a, b, c, target);
-       }; //
-
-
-       Shape.prototype.extractAllPoints = function (divisions) {
-               console.warn('THREE.Shape: .extractAllPoints() has been removed. Use .extractPoints() instead.');
-               return this.extractPoints(divisions);
-       };
-
-       Shape.prototype.extrude = function (options) {
-               console.warn('THREE.Shape: .extrude() has been removed. Use ExtrudeGeometry() instead.');
-               return new ExtrudeGeometry(this, options);
-       };
-
-       Shape.prototype.makeGeometry = function (options) {
-               console.warn('THREE.Shape: .makeGeometry() has been removed. Use ShapeGeometry() instead.');
-               return new ShapeGeometry(this, options);
-       }; //
-
-
-       Vector2.prototype.fromAttribute = function (attribute, index, offset) {
-               console.warn('THREE.Vector2: .fromAttribute() has been renamed to .fromBufferAttribute().');
-               return this.fromBufferAttribute(attribute, index, offset);
-       };
-
-       Vector2.prototype.distanceToManhattan = function (v) {
-               console.warn('THREE.Vector2: .distanceToManhattan() has been renamed to .manhattanDistanceTo().');
-               return this.manhattanDistanceTo(v);
-       };
-
-       Vector2.prototype.lengthManhattan = function () {
-               console.warn('THREE.Vector2: .lengthManhattan() has been renamed to .manhattanLength().');
-               return this.manhattanLength();
-       }; //
-
-
-       Vector3.prototype.setEulerFromRotationMatrix = function () {
-               console.error('THREE.Vector3: .setEulerFromRotationMatrix() has been removed. Use Euler.setFromRotationMatrix() instead.');
-       };
-
-       Vector3.prototype.setEulerFromQuaternion = function () {
-               console.error('THREE.Vector3: .setEulerFromQuaternion() has been removed. Use Euler.setFromQuaternion() instead.');
-       };
-
-       Vector3.prototype.getPositionFromMatrix = function (m) {
-               console.warn('THREE.Vector3: .getPositionFromMatrix() has been renamed to .setFromMatrixPosition().');
-               return this.setFromMatrixPosition(m);
-       };
-
-       Vector3.prototype.getScaleFromMatrix = function (m) {
-               console.warn('THREE.Vector3: .getScaleFromMatrix() has been renamed to .setFromMatrixScale().');
-               return this.setFromMatrixScale(m);
-       };
-
-       Vector3.prototype.getColumnFromMatrix = function (index, matrix) {
-               console.warn('THREE.Vector3: .getColumnFromMatrix() has been renamed to .setFromMatrixColumn().');
-               return this.setFromMatrixColumn(matrix, index);
-       };
-
-       Vector3.prototype.applyProjection = function (m) {
-               console.warn('THREE.Vector3: .applyProjection() has been removed. Use .applyMatrix4( m ) instead.');
-               return this.applyMatrix4(m);
-       };
-
-       Vector3.prototype.fromAttribute = function (attribute, index, offset) {
-               console.warn('THREE.Vector3: .fromAttribute() has been renamed to .fromBufferAttribute().');
-               return this.fromBufferAttribute(attribute, index, offset);
-       };
-
-       Vector3.prototype.distanceToManhattan = function (v) {
-               console.warn('THREE.Vector3: .distanceToManhattan() has been renamed to .manhattanDistanceTo().');
-               return this.manhattanDistanceTo(v);
-       };
-
-       Vector3.prototype.lengthManhattan = function () {
-               console.warn('THREE.Vector3: .lengthManhattan() has been renamed to .manhattanLength().');
-               return this.manhattanLength();
-       }; //
-
-
-       Vector4.prototype.fromAttribute = function (attribute, index, offset) {
-               console.warn('THREE.Vector4: .fromAttribute() has been renamed to .fromBufferAttribute().');
-               return this.fromBufferAttribute(attribute, index, offset);
-       };
-
-       Vector4.prototype.lengthManhattan = function () {
-               console.warn('THREE.Vector4: .lengthManhattan() has been renamed to .manhattanLength().');
-               return this.manhattanLength();
-       }; //
-
-
-       Object3D.prototype.getChildByName = function (name) {
-               console.warn('THREE.Object3D: .getChildByName() has been renamed to .getObjectByName().');
-               return this.getObjectByName(name);
-       };
-
-       Object3D.prototype.renderDepth = function () {
-               console.warn('THREE.Object3D: .renderDepth has been removed. Use .renderOrder, instead.');
-       };
-
-       Object3D.prototype.translate = function (distance, axis) {
-               console.warn('THREE.Object3D: .translate() has been removed. Use .translateOnAxis( axis, distance ) instead.');
-               return this.translateOnAxis(axis, distance);
-       };
-
-       Object3D.prototype.getWorldRotation = function () {
-               console.error('THREE.Object3D: .getWorldRotation() has been removed. Use THREE.Object3D.getWorldQuaternion( target ) instead.');
-       };
-
-       Object3D.prototype.applyMatrix = function (matrix) {
-               console.warn('THREE.Object3D: .applyMatrix() has been renamed to .applyMatrix4().');
-               return this.applyMatrix4(matrix);
-       };
-
-       Object.defineProperties(Object3D.prototype, {
-               eulerOrder: {
-                       get: function () {
-                               console.warn('THREE.Object3D: .eulerOrder is now .rotation.order.');
-                               return this.rotation.order;
-                       },
-                       set: function (value) {
-                               console.warn('THREE.Object3D: .eulerOrder is now .rotation.order.');
-                               this.rotation.order = value;
-                       }
-               },
-               useQuaternion: {
-                       get: function () {
-                               console.warn('THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.');
-                       },
-                       set: function () {
-                               console.warn('THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.');
-                       }
-               }
-       });
-
-       Mesh.prototype.setDrawMode = function () {
-               console.error('THREE.Mesh: .setDrawMode() has been removed. The renderer now always assumes THREE.TrianglesDrawMode. Transform your geometry via BufferGeometryUtils.toTrianglesDrawMode() if necessary.');
-       };
-
-       Object.defineProperties(Mesh.prototype, {
-               drawMode: {
-                       get: function () {
-                               console.error('THREE.Mesh: .drawMode has been removed. The renderer now always assumes THREE.TrianglesDrawMode.');
-                               return TrianglesDrawMode;
-                       },
-                       set: function () {
-                               console.error('THREE.Mesh: .drawMode has been removed. The renderer now always assumes THREE.TrianglesDrawMode. Transform your geometry via BufferGeometryUtils.toTrianglesDrawMode() if necessary.');
-                       }
-               }
-       });
-
-       SkinnedMesh.prototype.initBones = function () {
-               console.error('THREE.SkinnedMesh: initBones() has been removed.');
-       }; //
-
-
-       PerspectiveCamera.prototype.setLens = function (focalLength, filmGauge) {
-               console.warn('THREE.PerspectiveCamera.setLens is deprecated. ' + 'Use .setFocalLength and .filmGauge for a photographic setup.');
-               if (filmGauge !== undefined) this.filmGauge = filmGauge;
-               this.setFocalLength(focalLength);
-       }; //
-
-
-       Object.defineProperties(Light.prototype, {
-               onlyShadow: {
-                       set: function () {
-                               console.warn('THREE.Light: .onlyShadow has been removed.');
-                       }
-               },
-               shadowCameraFov: {
-                       set: function (value) {
-                               console.warn('THREE.Light: .shadowCameraFov is now .shadow.camera.fov.');
-                               this.shadow.camera.fov = value;
-                       }
-               },
-               shadowCameraLeft: {
-                       set: function (value) {
-                               console.warn('THREE.Light: .shadowCameraLeft is now .shadow.camera.left.');
-                               this.shadow.camera.left = value;
-                       }
-               },
-               shadowCameraRight: {
-                       set: function (value) {
-                               console.warn('THREE.Light: .shadowCameraRight is now .shadow.camera.right.');
-                               this.shadow.camera.right = value;
-                       }
-               },
-               shadowCameraTop: {
-                       set: function (value) {
-                               console.warn('THREE.Light: .shadowCameraTop is now .shadow.camera.top.');
-                               this.shadow.camera.top = value;
-                       }
-               },
-               shadowCameraBottom: {
-                       set: function (value) {
-                               console.warn('THREE.Light: .shadowCameraBottom is now .shadow.camera.bottom.');
-                               this.shadow.camera.bottom = value;
-                       }
-               },
-               shadowCameraNear: {
-                       set: function (value) {
-                               console.warn('THREE.Light: .shadowCameraNear is now .shadow.camera.near.');
-                               this.shadow.camera.near = value;
-                       }
-               },
-               shadowCameraFar: {
-                       set: function (value) {
-                               console.warn('THREE.Light: .shadowCameraFar is now .shadow.camera.far.');
-                               this.shadow.camera.far = value;
-                       }
-               },
-               shadowCameraVisible: {
-                       set: function () {
-                               console.warn('THREE.Light: .shadowCameraVisible has been removed. Use new THREE.CameraHelper( light.shadow.camera ) instead.');
-                       }
-               },
-               shadowBias: {
-                       set: function (value) {
-                               console.warn('THREE.Light: .shadowBias is now .shadow.bias.');
-                               this.shadow.bias = value;
-                       }
-               },
-               shadowDarkness: {
-                       set: function () {
-                               console.warn('THREE.Light: .shadowDarkness has been removed.');
-                       }
-               },
-               shadowMapWidth: {
-                       set: function (value) {
-                               console.warn('THREE.Light: .shadowMapWidth is now .shadow.mapSize.width.');
-                               this.shadow.mapSize.width = value;
-                       }
-               },
-               shadowMapHeight: {
-                       set: function (value) {
-                               console.warn('THREE.Light: .shadowMapHeight is now .shadow.mapSize.height.');
-                               this.shadow.mapSize.height = value;
-                       }
-               }
-       }); //
-
-       Object.defineProperties(BufferAttribute.prototype, {
-               length: {
-                       get: function () {
-                               console.warn('THREE.BufferAttribute: .length has been deprecated. Use .count instead.');
-                               return this.array.length;
-                       }
-               },
-               dynamic: {
-                       get: function () {
-                               console.warn('THREE.BufferAttribute: .dynamic has been deprecated. Use .usage instead.');
-                               return this.usage === DynamicDrawUsage;
-                       },
-                       set: function () {
-                               console.warn('THREE.BufferAttribute: .dynamic has been deprecated. Use .usage instead.');
-                               this.setUsage(DynamicDrawUsage);
-                       }
-               }
-       });
-
-       BufferAttribute.prototype.setDynamic = function (value) {
-               console.warn('THREE.BufferAttribute: .setDynamic() has been deprecated. Use .setUsage() instead.');
-               this.setUsage(value === true ? DynamicDrawUsage : StaticDrawUsage);
-               return this;
-       };
-
-       BufferAttribute.prototype.copyIndicesArray = function () {
-               console.error('THREE.BufferAttribute: .copyIndicesArray() has been removed.');
-       }, BufferAttribute.prototype.setArray = function () {
-               console.error('THREE.BufferAttribute: .setArray has been removed. Use BufferGeometry .setAttribute to replace/resize attribute buffers');
-       }; //
-
-       BufferGeometry.prototype.addIndex = function (index) {
-               console.warn('THREE.BufferGeometry: .addIndex() has been renamed to .setIndex().');
-               this.setIndex(index);
-       };
-
-       BufferGeometry.prototype.addAttribute = function (name, attribute) {
-               console.warn('THREE.BufferGeometry: .addAttribute() has been renamed to .setAttribute().');
-
-               if (!(attribute && attribute.isBufferAttribute) && !(attribute && attribute.isInterleavedBufferAttribute)) {
-                       console.warn('THREE.BufferGeometry: .addAttribute() now expects ( name, attribute ).');
-                       return this.setAttribute(name, new BufferAttribute(arguments[1], arguments[2]));
-               }
-
-               if (name === 'index') {
-                       console.warn('THREE.BufferGeometry.addAttribute: Use .setIndex() for index attribute.');
-                       this.setIndex(attribute);
-                       return this;
-               }
-
-               return this.setAttribute(name, attribute);
-       };
-
-       BufferGeometry.prototype.addDrawCall = function (start, count, indexOffset) {
-               if (indexOffset !== undefined) {
-                       console.warn('THREE.BufferGeometry: .addDrawCall() no longer supports indexOffset.');
-               }
-
-               console.warn('THREE.BufferGeometry: .addDrawCall() is now .addGroup().');
-               this.addGroup(start, count);
-       };
-
-       BufferGeometry.prototype.clearDrawCalls = function () {
-               console.warn('THREE.BufferGeometry: .clearDrawCalls() is now .clearGroups().');
-               this.clearGroups();
-       };
-
-       BufferGeometry.prototype.computeOffsets = function () {
-               console.warn('THREE.BufferGeometry: .computeOffsets() has been removed.');
-       };
-
-       BufferGeometry.prototype.removeAttribute = function (name) {
-               console.warn('THREE.BufferGeometry: .removeAttribute() has been renamed to .deleteAttribute().');
-               return this.deleteAttribute(name);
-       };
-
-       BufferGeometry.prototype.applyMatrix = function (matrix) {
-               console.warn('THREE.BufferGeometry: .applyMatrix() has been renamed to .applyMatrix4().');
-               return this.applyMatrix4(matrix);
-       };
-
-       Object.defineProperties(BufferGeometry.prototype, {
-               drawcalls: {
-                       get: function () {
-                               console.error('THREE.BufferGeometry: .drawcalls has been renamed to .groups.');
-                               return this.groups;
-                       }
-               },
-               offsets: {
-                       get: function () {
-                               console.warn('THREE.BufferGeometry: .offsets has been renamed to .groups.');
-                               return this.groups;
-                       }
-               }
-       });
-
-       InterleavedBuffer.prototype.setDynamic = function (value) {
-               console.warn('THREE.InterleavedBuffer: .setDynamic() has been deprecated. Use .setUsage() instead.');
-               this.setUsage(value === true ? DynamicDrawUsage : StaticDrawUsage);
-               return this;
-       };
-
-       InterleavedBuffer.prototype.setArray = function () {
-               console.error('THREE.InterleavedBuffer: .setArray has been removed. Use BufferGeometry .setAttribute to replace/resize attribute buffers');
-       }; //
-
-
-       ExtrudeGeometry.prototype.getArrays = function () {
-               console.error('THREE.ExtrudeGeometry: .getArrays() has been removed.');
-       };
-
-       ExtrudeGeometry.prototype.addShapeList = function () {
-               console.error('THREE.ExtrudeGeometry: .addShapeList() has been removed.');
-       };
-
-       ExtrudeGeometry.prototype.addShape = function () {
-               console.error('THREE.ExtrudeGeometry: .addShape() has been removed.');
-       }; //
-
-
-       Scene.prototype.dispose = function () {
-               console.error('THREE.Scene: .dispose() has been removed.');
-       }; //
-
-
-       Uniform.prototype.onUpdate = function () {
-               console.warn('THREE.Uniform: .onUpdate() has been removed. Use object.onBeforeRender() instead.');
-               return this;
-       }; //
-
-
-       Object.defineProperties(Material.prototype, {
-               wrapAround: {
-                       get: function () {
-                               console.warn('THREE.Material: .wrapAround has been removed.');
-                       },
-                       set: function () {
-                               console.warn('THREE.Material: .wrapAround has been removed.');
-                       }
-               },
-               overdraw: {
-                       get: function () {
-                               console.warn('THREE.Material: .overdraw has been removed.');
-                       },
-                       set: function () {
-                               console.warn('THREE.Material: .overdraw has been removed.');
-                       }
-               },
-               wrapRGB: {
-                       get: function () {
-                               console.warn('THREE.Material: .wrapRGB has been removed.');
-                               return new Color();
-                       }
-               },
-               shading: {
-                       get: function () {
-                               console.error('THREE.' + this.type + ': .shading has been removed. Use the boolean .flatShading instead.');
-                       },
-                       set: function (value) {
-                               console.warn('THREE.' + this.type + ': .shading has been removed. Use the boolean .flatShading instead.');
-                               this.flatShading = value === FlatShading;
-                       }
-               },
-               stencilMask: {
-                       get: function () {
-                               console.warn('THREE.' + this.type + ': .stencilMask has been removed. Use .stencilFuncMask instead.');
-                               return this.stencilFuncMask;
-                       },
-                       set: function (value) {
-                               console.warn('THREE.' + this.type + ': .stencilMask has been removed. Use .stencilFuncMask instead.');
-                               this.stencilFuncMask = value;
-                       }
-               },
-               vertexTangents: {
-                       get: function () {
-                               console.warn('THREE.' + this.type + ': .vertexTangents has been removed.');
-                       },
-                       set: function () {
-                               console.warn('THREE.' + this.type + ': .vertexTangents has been removed.');
-                       }
-               }
-       });
-       Object.defineProperties(ShaderMaterial.prototype, {
-               derivatives: {
-                       get: function () {
-                               console.warn('THREE.ShaderMaterial: .derivatives has been moved to .extensions.derivatives.');
-                               return this.extensions.derivatives;
-                       },
-                       set: function (value) {
-                               console.warn('THREE. ShaderMaterial: .derivatives has been moved to .extensions.derivatives.');
-                               this.extensions.derivatives = value;
-                       }
-               }
-       }); //
-
-       WebGLRenderer.prototype.clearTarget = function (renderTarget, color, depth, stencil) {
-               console.warn('THREE.WebGLRenderer: .clearTarget() has been deprecated. Use .setRenderTarget() and .clear() instead.');
-               this.setRenderTarget(renderTarget);
-               this.clear(color, depth, stencil);
-       };
-
-       WebGLRenderer.prototype.animate = function (callback) {
-               console.warn('THREE.WebGLRenderer: .animate() is now .setAnimationLoop().');
-               this.setAnimationLoop(callback);
-       };
-
-       WebGLRenderer.prototype.getCurrentRenderTarget = function () {
-               console.warn('THREE.WebGLRenderer: .getCurrentRenderTarget() is now .getRenderTarget().');
-               return this.getRenderTarget();
-       };
-
-       WebGLRenderer.prototype.getMaxAnisotropy = function () {
-               console.warn('THREE.WebGLRenderer: .getMaxAnisotropy() is now .capabilities.getMaxAnisotropy().');
-               return this.capabilities.getMaxAnisotropy();
-       };
-
-       WebGLRenderer.prototype.getPrecision = function () {
-               console.warn('THREE.WebGLRenderer: .getPrecision() is now .capabilities.precision.');
-               return this.capabilities.precision;
-       };
-
-       WebGLRenderer.prototype.resetGLState = function () {
-               console.warn('THREE.WebGLRenderer: .resetGLState() is now .state.reset().');
-               return this.state.reset();
-       };
-
-       WebGLRenderer.prototype.supportsFloatTextures = function () {
-               console.warn('THREE.WebGLRenderer: .supportsFloatTextures() is now .extensions.get( \'OES_texture_float\' ).');
-               return this.extensions.get('OES_texture_float');
-       };
-
-       WebGLRenderer.prototype.supportsHalfFloatTextures = function () {
-               console.warn('THREE.WebGLRenderer: .supportsHalfFloatTextures() is now .extensions.get( \'OES_texture_half_float\' ).');
-               return this.extensions.get('OES_texture_half_float');
-       };
-
-       WebGLRenderer.prototype.supportsStandardDerivatives = function () {
-               console.warn('THREE.WebGLRenderer: .supportsStandardDerivatives() is now .extensions.get( \'OES_standard_derivatives\' ).');
-               return this.extensions.get('OES_standard_derivatives');
-       };
-
-       WebGLRenderer.prototype.supportsCompressedTextureS3TC = function () {
-               console.warn('THREE.WebGLRenderer: .supportsCompressedTextureS3TC() is now .extensions.get( \'WEBGL_compressed_texture_s3tc\' ).');
-               return this.extensions.get('WEBGL_compressed_texture_s3tc');
-       };
-
-       WebGLRenderer.prototype.supportsCompressedTexturePVRTC = function () {
-               console.warn('THREE.WebGLRenderer: .supportsCompressedTexturePVRTC() is now .extensions.get( \'WEBGL_compressed_texture_pvrtc\' ).');
-               return this.extensions.get('WEBGL_compressed_texture_pvrtc');
-       };
-
-       WebGLRenderer.prototype.supportsBlendMinMax = function () {
-               console.warn('THREE.WebGLRenderer: .supportsBlendMinMax() is now .extensions.get( \'EXT_blend_minmax\' ).');
-               return this.extensions.get('EXT_blend_minmax');
-       };
-
-       WebGLRenderer.prototype.supportsVertexTextures = function () {
-               console.warn('THREE.WebGLRenderer: .supportsVertexTextures() is now .capabilities.vertexTextures.');
-               return this.capabilities.vertexTextures;
-       };
-
-       WebGLRenderer.prototype.supportsInstancedArrays = function () {
-               console.warn('THREE.WebGLRenderer: .supportsInstancedArrays() is now .extensions.get( \'ANGLE_instanced_arrays\' ).');
-               return this.extensions.get('ANGLE_instanced_arrays');
-       };
-
-       WebGLRenderer.prototype.enableScissorTest = function (boolean) {
-               console.warn('THREE.WebGLRenderer: .enableScissorTest() is now .setScissorTest().');
-               this.setScissorTest(boolean);
-       };
-
-       WebGLRenderer.prototype.initMaterial = function () {
-               console.warn('THREE.WebGLRenderer: .initMaterial() has been removed.');
-       };
-
-       WebGLRenderer.prototype.addPrePlugin = function () {
-               console.warn('THREE.WebGLRenderer: .addPrePlugin() has been removed.');
-       };
-
-       WebGLRenderer.prototype.addPostPlugin = function () {
-               console.warn('THREE.WebGLRenderer: .addPostPlugin() has been removed.');
-       };
-
-       WebGLRenderer.prototype.updateShadowMap = function () {
-               console.warn('THREE.WebGLRenderer: .updateShadowMap() has been removed.');
-       };
-
-       WebGLRenderer.prototype.setFaceCulling = function () {
-               console.warn('THREE.WebGLRenderer: .setFaceCulling() has been removed.');
-       };
-
-       WebGLRenderer.prototype.allocTextureUnit = function () {
-               console.warn('THREE.WebGLRenderer: .allocTextureUnit() has been removed.');
-       };
-
-       WebGLRenderer.prototype.setTexture = function () {
-               console.warn('THREE.WebGLRenderer: .setTexture() has been removed.');
-       };
-
-       WebGLRenderer.prototype.setTexture2D = function () {
-               console.warn('THREE.WebGLRenderer: .setTexture2D() has been removed.');
-       };
-
-       WebGLRenderer.prototype.setTextureCube = function () {
-               console.warn('THREE.WebGLRenderer: .setTextureCube() has been removed.');
-       };
-
-       WebGLRenderer.prototype.getActiveMipMapLevel = function () {
-               console.warn('THREE.WebGLRenderer: .getActiveMipMapLevel() is now .getActiveMipmapLevel().');
-               return this.getActiveMipmapLevel();
-       };
-
-       Object.defineProperties(WebGLRenderer.prototype, {
-               shadowMapEnabled: {
-                       get: function () {
-                               return this.shadowMap.enabled;
-                       },
-                       set: function (value) {
-                               console.warn('THREE.WebGLRenderer: .shadowMapEnabled is now .shadowMap.enabled.');
-                               this.shadowMap.enabled = value;
-                       }
-               },
-               shadowMapType: {
-                       get: function () {
-                               return this.shadowMap.type;
-                       },
-                       set: function (value) {
-                               console.warn('THREE.WebGLRenderer: .shadowMapType is now .shadowMap.type.');
-                               this.shadowMap.type = value;
-                       }
-               },
-               shadowMapCullFace: {
-                       get: function () {
-                               console.warn('THREE.WebGLRenderer: .shadowMapCullFace has been removed. Set Material.shadowSide instead.');
-                               return undefined;
-                       },
-                       set: function () {
-                               console.warn('THREE.WebGLRenderer: .shadowMapCullFace has been removed. Set Material.shadowSide instead.');
-                       }
-               },
-               context: {
-                       get: function () {
-                               console.warn('THREE.WebGLRenderer: .context has been removed. Use .getContext() instead.');
-                               return this.getContext();
-                       }
-               },
-               vr: {
-                       get: function () {
-                               console.warn('THREE.WebGLRenderer: .vr has been renamed to .xr');
-                               return this.xr;
-                       }
-               },
-               gammaInput: {
-                       get: function () {
-                               console.warn('THREE.WebGLRenderer: .gammaInput has been removed. Set the encoding for textures via Texture.encoding instead.');
-                               return false;
-                       },
-                       set: function () {
-                               console.warn('THREE.WebGLRenderer: .gammaInput has been removed. Set the encoding for textures via Texture.encoding instead.');
-                       }
-               },
-               gammaOutput: {
-                       get: function () {
-                               console.warn('THREE.WebGLRenderer: .gammaOutput has been removed. Set WebGLRenderer.outputEncoding instead.');
-                               return false;
-                       },
-                       set: function (value) {
-                               console.warn('THREE.WebGLRenderer: .gammaOutput has been removed. Set WebGLRenderer.outputEncoding instead.');
-                               this.outputEncoding = value === true ? sRGBEncoding : LinearEncoding;
-                       }
-               },
-               toneMappingWhitePoint: {
-                       get: function () {
-                               console.warn('THREE.WebGLRenderer: .toneMappingWhitePoint has been removed.');
-                               return 1.0;
-                       },
-                       set: function () {
-                               console.warn('THREE.WebGLRenderer: .toneMappingWhitePoint has been removed.');
-                       }
-               }
-       });
-       Object.defineProperties(WebGLShadowMap.prototype, {
-               cullFace: {
-                       get: function () {
-                               console.warn('THREE.WebGLRenderer: .shadowMap.cullFace has been removed. Set Material.shadowSide instead.');
-                               return undefined;
-                       },
-                       set: function () {
-                               console.warn('THREE.WebGLRenderer: .shadowMap.cullFace has been removed. Set Material.shadowSide instead.');
-                       }
-               },
-               renderReverseSided: {
-                       get: function () {
-                               console.warn('THREE.WebGLRenderer: .shadowMap.renderReverseSided has been removed. Set Material.shadowSide instead.');
-                               return undefined;
-                       },
-                       set: function () {
-                               console.warn('THREE.WebGLRenderer: .shadowMap.renderReverseSided has been removed. Set Material.shadowSide instead.');
-                       }
-               },
-               renderSingleSided: {
-                       get: function () {
-                               console.warn('THREE.WebGLRenderer: .shadowMap.renderSingleSided has been removed. Set Material.shadowSide instead.');
-                               return undefined;
-                       },
-                       set: function () {
-                               console.warn('THREE.WebGLRenderer: .shadowMap.renderSingleSided has been removed. Set Material.shadowSide instead.');
-                       }
-               }
-       });
-       function WebGLRenderTargetCube(width, height, options) {
-               console.warn('THREE.WebGLRenderTargetCube( width, height, options ) is now WebGLCubeRenderTarget( size, options ).');
-               return new WebGLCubeRenderTarget(width, options);
-       } //
-
-       Object.defineProperties(WebGLRenderTarget.prototype, {
-               wrapS: {
-                       get: function () {
-                               console.warn('THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS.');
-                               return this.texture.wrapS;
-                       },
-                       set: function (value) {
-                               console.warn('THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS.');
-                               this.texture.wrapS = value;
-                       }
-               },
-               wrapT: {
-                       get: function () {
-                               console.warn('THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT.');
-                               return this.texture.wrapT;
-                       },
-                       set: function (value) {
-                               console.warn('THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT.');
-                               this.texture.wrapT = value;
-                       }
-               },
-               magFilter: {
-                       get: function () {
-                               console.warn('THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter.');
-                               return this.texture.magFilter;
-                       },
-                       set: function (value) {
-                               console.warn('THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter.');
-                               this.texture.magFilter = value;
-                       }
-               },
-               minFilter: {
-                       get: function () {
-                               console.warn('THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter.');
-                               return this.texture.minFilter;
-                       },
-                       set: function (value) {
-                               console.warn('THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter.');
-                               this.texture.minFilter = value;
-                       }
-               },
-               anisotropy: {
-                       get: function () {
-                               console.warn('THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy.');
-                               return this.texture.anisotropy;
-                       },
-                       set: function (value) {
-                               console.warn('THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy.');
-                               this.texture.anisotropy = value;
-                       }
-               },
-               offset: {
-                       get: function () {
-                               console.warn('THREE.WebGLRenderTarget: .offset is now .texture.offset.');
-                               return this.texture.offset;
-                       },
-                       set: function (value) {
-                               console.warn('THREE.WebGLRenderTarget: .offset is now .texture.offset.');
-                               this.texture.offset = value;
-                       }
-               },
-               repeat: {
-                       get: function () {
-                               console.warn('THREE.WebGLRenderTarget: .repeat is now .texture.repeat.');
-                               return this.texture.repeat;
-                       },
-                       set: function (value) {
-                               console.warn('THREE.WebGLRenderTarget: .repeat is now .texture.repeat.');
-                               this.texture.repeat = value;
-                       }
-               },
-               format: {
-                       get: function () {
-                               console.warn('THREE.WebGLRenderTarget: .format is now .texture.format.');
-                               return this.texture.format;
-                       },
-                       set: function (value) {
-                               console.warn('THREE.WebGLRenderTarget: .format is now .texture.format.');
-                               this.texture.format = value;
-                       }
-               },
-               type: {
-                       get: function () {
-                               console.warn('THREE.WebGLRenderTarget: .type is now .texture.type.');
-                               return this.texture.type;
-                       },
-                       set: function (value) {
-                               console.warn('THREE.WebGLRenderTarget: .type is now .texture.type.');
-                               this.texture.type = value;
-                       }
-               },
-               generateMipmaps: {
-                       get: function () {
-                               console.warn('THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps.');
-                               return this.texture.generateMipmaps;
-                       },
-                       set: function (value) {
-                               console.warn('THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps.');
-                               this.texture.generateMipmaps = value;
-                       }
-               }
-       }); //
-
-       Audio.prototype.load = function (file) {
-               console.warn('THREE.Audio: .load has been deprecated. Use THREE.AudioLoader instead.');
-               const scope = this;
-               const audioLoader = new AudioLoader();
-               audioLoader.load(file, function (buffer) {
-                       scope.setBuffer(buffer);
-               });
-               return this;
-       };
-
-       AudioAnalyser.prototype.getData = function () {
-               console.warn('THREE.AudioAnalyser: .getData() is now .getFrequencyData().');
-               return this.getFrequencyData();
-       }; //
-
-
-       CubeCamera.prototype.updateCubeMap = function (renderer, scene) {
-               console.warn('THREE.CubeCamera: .updateCubeMap() is now .update().');
-               return this.update(renderer, scene);
-       };
-
-       CubeCamera.prototype.clear = function (renderer, color, depth, stencil) {
-               console.warn('THREE.CubeCamera: .clear() is now .renderTarget.clear().');
-               return this.renderTarget.clear(renderer, color, depth, stencil);
-       };
-
-       ImageUtils.crossOrigin = undefined;
-
-       ImageUtils.loadTexture = function (url, mapping, onLoad, onError) {
-               console.warn('THREE.ImageUtils.loadTexture has been deprecated. Use THREE.TextureLoader() instead.');
-               const loader = new TextureLoader();
-               loader.setCrossOrigin(this.crossOrigin);
-               const texture = loader.load(url, onLoad, undefined, onError);
-               if (mapping) texture.mapping = mapping;
-               return texture;
-       };
-
-       ImageUtils.loadTextureCube = function (urls, mapping, onLoad, onError) {
-               console.warn('THREE.ImageUtils.loadTextureCube has been deprecated. Use THREE.CubeTextureLoader() instead.');
-               const loader = new CubeTextureLoader();
-               loader.setCrossOrigin(this.crossOrigin);
-               const texture = loader.load(urls, onLoad, undefined, onError);
-               if (mapping) texture.mapping = mapping;
-               return texture;
-       };
-
-       ImageUtils.loadCompressedTexture = function () {
-               console.error('THREE.ImageUtils.loadCompressedTexture has been removed. Use THREE.DDSLoader instead.');
-       };
-
-       ImageUtils.loadCompressedTextureCube = function () {
-               console.error('THREE.ImageUtils.loadCompressedTextureCube has been removed. Use THREE.DDSLoader instead.');
-       }; //
-
-
-       function CanvasRenderer() {
-               console.error('THREE.CanvasRenderer has been removed');
-       } //
-
-       function JSONLoader() {
-               console.error('THREE.JSONLoader has been removed.');
-       } //
-
-       const SceneUtils = {
-               createMultiMaterialObject: function () {
-                       console.error('THREE.SceneUtils has been moved to /examples/jsm/utils/SceneUtils.js');
-               },
-               detach: function () {
-                       console.error('THREE.SceneUtils has been moved to /examples/jsm/utils/SceneUtils.js');
-               },
-               attach: function () {
-                       console.error('THREE.SceneUtils has been moved to /examples/jsm/utils/SceneUtils.js');
-               }
-       }; //
-
-       function LensFlare() {
-               console.error('THREE.LensFlare has been moved to /examples/jsm/objects/Lensflare.js');
-       }
-
-       if (typeof __THREE_DEVTOOLS__ !== 'undefined') {
-               /* eslint-disable no-undef */
-               __THREE_DEVTOOLS__.dispatchEvent(new CustomEvent('register', {
-                       detail: {
-                               revision: REVISION
-                       }
-               }));
-               /* eslint-enable no-undef */
-
-       }
-
-       if (typeof window !== 'undefined') {
-               if (window.__THREE__) {
-                       console.warn('WARNING: Multiple instances of Three.js being imported.');
-               } else {
-                       window.__THREE__ = REVISION;
-               }
-       }
-
-       exports.ACESFilmicToneMapping = ACESFilmicToneMapping;
-       exports.AddEquation = AddEquation;
-       exports.AddOperation = AddOperation;
-       exports.AdditiveAnimationBlendMode = AdditiveAnimationBlendMode;
-       exports.AdditiveBlending = AdditiveBlending;
-       exports.AlphaFormat = AlphaFormat;
-       exports.AlwaysDepth = AlwaysDepth;
-       exports.AlwaysStencilFunc = AlwaysStencilFunc;
-       exports.AmbientLight = AmbientLight;
-       exports.AmbientLightProbe = AmbientLightProbe;
-       exports.AnimationClip = AnimationClip;
-       exports.AnimationLoader = AnimationLoader;
-       exports.AnimationMixer = AnimationMixer;
-       exports.AnimationObjectGroup = AnimationObjectGroup;
-       exports.AnimationUtils = AnimationUtils;
-       exports.ArcCurve = ArcCurve;
-       exports.ArrayCamera = ArrayCamera;
-       exports.ArrowHelper = ArrowHelper;
-       exports.Audio = Audio;
-       exports.AudioAnalyser = AudioAnalyser;
-       exports.AudioContext = AudioContext;
-       exports.AudioListener = AudioListener;
-       exports.AudioLoader = AudioLoader;
-       exports.AxesHelper = AxesHelper;
-       exports.AxisHelper = AxisHelper;
-       exports.BackSide = BackSide;
-       exports.BasicDepthPacking = BasicDepthPacking;
-       exports.BasicShadowMap = BasicShadowMap;
-       exports.BinaryTextureLoader = BinaryTextureLoader;
-       exports.Bone = Bone;
-       exports.BooleanKeyframeTrack = BooleanKeyframeTrack;
-       exports.BoundingBoxHelper = BoundingBoxHelper;
-       exports.Box2 = Box2;
-       exports.Box3 = Box3;
-       exports.Box3Helper = Box3Helper;
-       exports.BoxBufferGeometry = BoxGeometry;
-       exports.BoxGeometry = BoxGeometry;
-       exports.BoxHelper = BoxHelper;
-       exports.BufferAttribute = BufferAttribute;
-       exports.BufferGeometry = BufferGeometry;
-       exports.BufferGeometryLoader = BufferGeometryLoader;
-       exports.ByteType = ByteType;
-       exports.Cache = Cache;
-       exports.Camera = Camera;
-       exports.CameraHelper = CameraHelper;
-       exports.CanvasRenderer = CanvasRenderer;
-       exports.CanvasTexture = CanvasTexture;
-       exports.CatmullRomCurve3 = CatmullRomCurve3;
-       exports.CineonToneMapping = CineonToneMapping;
-       exports.CircleBufferGeometry = CircleGeometry;
-       exports.CircleGeometry = CircleGeometry;
-       exports.ClampToEdgeWrapping = ClampToEdgeWrapping;
-       exports.Clock = Clock;
-       exports.Color = Color;
-       exports.ColorKeyframeTrack = ColorKeyframeTrack;
-       exports.CompressedTexture = CompressedTexture;
-       exports.CompressedTextureLoader = CompressedTextureLoader;
-       exports.ConeBufferGeometry = ConeGeometry;
-       exports.ConeGeometry = ConeGeometry;
-       exports.CubeCamera = CubeCamera;
-       exports.CubeReflectionMapping = CubeReflectionMapping;
-       exports.CubeRefractionMapping = CubeRefractionMapping;
-       exports.CubeTexture = CubeTexture;
-       exports.CubeTextureLoader = CubeTextureLoader;
-       exports.CubeUVReflectionMapping = CubeUVReflectionMapping;
-       exports.CubeUVRefractionMapping = CubeUVRefractionMapping;
-       exports.CubicBezierCurve = CubicBezierCurve;
-       exports.CubicBezierCurve3 = CubicBezierCurve3;
-       exports.CubicInterpolant = CubicInterpolant;
-       exports.CullFaceBack = CullFaceBack;
-       exports.CullFaceFront = CullFaceFront;
-       exports.CullFaceFrontBack = CullFaceFrontBack;
-       exports.CullFaceNone = CullFaceNone;
-       exports.Curve = Curve;
-       exports.CurvePath = CurvePath;
-       exports.CustomBlending = CustomBlending;
-       exports.CustomToneMapping = CustomToneMapping;
-       exports.CylinderBufferGeometry = CylinderGeometry;
-       exports.CylinderGeometry = CylinderGeometry;
-       exports.Cylindrical = Cylindrical;
-       exports.DataTexture = DataTexture;
-       exports.DataTexture2DArray = DataTexture2DArray;
-       exports.DataTexture3D = DataTexture3D;
-       exports.DataTextureLoader = DataTextureLoader;
-       exports.DataUtils = DataUtils;
-       exports.DecrementStencilOp = DecrementStencilOp;
-       exports.DecrementWrapStencilOp = DecrementWrapStencilOp;
-       exports.DefaultLoadingManager = DefaultLoadingManager;
-       exports.DepthFormat = DepthFormat;
-       exports.DepthStencilFormat = DepthStencilFormat;
-       exports.DepthTexture = DepthTexture;
-       exports.DirectionalLight = DirectionalLight;
-       exports.DirectionalLightHelper = DirectionalLightHelper;
-       exports.DiscreteInterpolant = DiscreteInterpolant;
-       exports.DodecahedronBufferGeometry = DodecahedronGeometry;
-       exports.DodecahedronGeometry = DodecahedronGeometry;
-       exports.DoubleSide = DoubleSide;
-       exports.DstAlphaFactor = DstAlphaFactor;
-       exports.DstColorFactor = DstColorFactor;
-       exports.DynamicBufferAttribute = DynamicBufferAttribute;
-       exports.DynamicCopyUsage = DynamicCopyUsage;
-       exports.DynamicDrawUsage = DynamicDrawUsage;
-       exports.DynamicReadUsage = DynamicReadUsage;
-       exports.EdgesGeometry = EdgesGeometry;
-       exports.EdgesHelper = EdgesHelper;
-       exports.EllipseCurve = EllipseCurve;
-       exports.EqualDepth = EqualDepth;
-       exports.EqualStencilFunc = EqualStencilFunc;
-       exports.EquirectangularReflectionMapping = EquirectangularReflectionMapping;
-       exports.EquirectangularRefractionMapping = EquirectangularRefractionMapping;
-       exports.Euler = Euler;
-       exports.EventDispatcher = EventDispatcher;
-       exports.ExtrudeBufferGeometry = ExtrudeGeometry;
-       exports.ExtrudeGeometry = ExtrudeGeometry;
-       exports.FaceColors = FaceColors;
-       exports.FileLoader = FileLoader;
-       exports.FlatShading = FlatShading;
-       exports.Float16BufferAttribute = Float16BufferAttribute;
-       exports.Float32Attribute = Float32Attribute;
-       exports.Float32BufferAttribute = Float32BufferAttribute;
-       exports.Float64Attribute = Float64Attribute;
-       exports.Float64BufferAttribute = Float64BufferAttribute;
-       exports.FloatType = FloatType;
-       exports.Fog = Fog;
-       exports.FogExp2 = FogExp2;
-       exports.Font = Font;
-       exports.FontLoader = FontLoader;
-       exports.FrontSide = FrontSide;
-       exports.Frustum = Frustum;
-       exports.GLBufferAttribute = GLBufferAttribute;
-       exports.GLSL1 = GLSL1;
-       exports.GLSL3 = GLSL3;
-       exports.GammaEncoding = GammaEncoding;
-       exports.GreaterDepth = GreaterDepth;
-       exports.GreaterEqualDepth = GreaterEqualDepth;
-       exports.GreaterEqualStencilFunc = GreaterEqualStencilFunc;
-       exports.GreaterStencilFunc = GreaterStencilFunc;
-       exports.GridHelper = GridHelper;
-       exports.Group = Group;
-       exports.HalfFloatType = HalfFloatType;
-       exports.HemisphereLight = HemisphereLight;
-       exports.HemisphereLightHelper = HemisphereLightHelper;
-       exports.HemisphereLightProbe = HemisphereLightProbe;
-       exports.IcosahedronBufferGeometry = IcosahedronGeometry;
-       exports.IcosahedronGeometry = IcosahedronGeometry;
-       exports.ImageBitmapLoader = ImageBitmapLoader;
-       exports.ImageLoader = ImageLoader;
-       exports.ImageUtils = ImageUtils;
-       exports.ImmediateRenderObject = ImmediateRenderObject;
-       exports.IncrementStencilOp = IncrementStencilOp;
-       exports.IncrementWrapStencilOp = IncrementWrapStencilOp;
-       exports.InstancedBufferAttribute = InstancedBufferAttribute;
-       exports.InstancedBufferGeometry = InstancedBufferGeometry;
-       exports.InstancedInterleavedBuffer = InstancedInterleavedBuffer;
-       exports.InstancedMesh = InstancedMesh;
-       exports.Int16Attribute = Int16Attribute;
-       exports.Int16BufferAttribute = Int16BufferAttribute;
-       exports.Int32Attribute = Int32Attribute;
-       exports.Int32BufferAttribute = Int32BufferAttribute;
-       exports.Int8Attribute = Int8Attribute;
-       exports.Int8BufferAttribute = Int8BufferAttribute;
-       exports.IntType = IntType;
-       exports.InterleavedBuffer = InterleavedBuffer;
-       exports.InterleavedBufferAttribute = InterleavedBufferAttribute;
-       exports.Interpolant = Interpolant;
-       exports.InterpolateDiscrete = InterpolateDiscrete;
-       exports.InterpolateLinear = InterpolateLinear;
-       exports.InterpolateSmooth = InterpolateSmooth;
-       exports.InvertStencilOp = InvertStencilOp;
-       exports.JSONLoader = JSONLoader;
-       exports.KeepStencilOp = KeepStencilOp;
-       exports.KeyframeTrack = KeyframeTrack;
-       exports.LOD = LOD;
-       exports.LatheBufferGeometry = LatheGeometry;
-       exports.LatheGeometry = LatheGeometry;
-       exports.Layers = Layers;
-       exports.LensFlare = LensFlare;
-       exports.LessDepth = LessDepth;
-       exports.LessEqualDepth = LessEqualDepth;
-       exports.LessEqualStencilFunc = LessEqualStencilFunc;
-       exports.LessStencilFunc = LessStencilFunc;
-       exports.Light = Light;
-       exports.LightProbe = LightProbe;
-       exports.Line = Line;
-       exports.Line3 = Line3;
-       exports.LineBasicMaterial = LineBasicMaterial;
-       exports.LineCurve = LineCurve;
-       exports.LineCurve3 = LineCurve3;
-       exports.LineDashedMaterial = LineDashedMaterial;
-       exports.LineLoop = LineLoop;
-       exports.LinePieces = LinePieces;
-       exports.LineSegments = LineSegments;
-       exports.LineStrip = LineStrip;
-       exports.LinearEncoding = LinearEncoding;
-       exports.LinearFilter = LinearFilter;
-       exports.LinearInterpolant = LinearInterpolant;
-       exports.LinearMipMapLinearFilter = LinearMipMapLinearFilter;
-       exports.LinearMipMapNearestFilter = LinearMipMapNearestFilter;
-       exports.LinearMipmapLinearFilter = LinearMipmapLinearFilter;
-       exports.LinearMipmapNearestFilter = LinearMipmapNearestFilter;
-       exports.LinearToneMapping = LinearToneMapping;
-       exports.Loader = Loader;
-       exports.LoaderUtils = LoaderUtils;
-       exports.LoadingManager = LoadingManager;
-       exports.LogLuvEncoding = LogLuvEncoding;
-       exports.LoopOnce = LoopOnce;
-       exports.LoopPingPong = LoopPingPong;
-       exports.LoopRepeat = LoopRepeat;
-       exports.LuminanceAlphaFormat = LuminanceAlphaFormat;
-       exports.LuminanceFormat = LuminanceFormat;
-       exports.MOUSE = MOUSE;
-       exports.Material = Material;
-       exports.MaterialLoader = MaterialLoader;
-       exports.Math = MathUtils;
-       exports.MathUtils = MathUtils;
-       exports.Matrix3 = Matrix3;
-       exports.Matrix4 = Matrix4;
-       exports.MaxEquation = MaxEquation;
-       exports.Mesh = Mesh;
-       exports.MeshBasicMaterial = MeshBasicMaterial;
-       exports.MeshDepthMaterial = MeshDepthMaterial;
-       exports.MeshDistanceMaterial = MeshDistanceMaterial;
-       exports.MeshFaceMaterial = MeshFaceMaterial;
-       exports.MeshLambertMaterial = MeshLambertMaterial;
-       exports.MeshMatcapMaterial = MeshMatcapMaterial;
-       exports.MeshNormalMaterial = MeshNormalMaterial;
-       exports.MeshPhongMaterial = MeshPhongMaterial;
-       exports.MeshPhysicalMaterial = MeshPhysicalMaterial;
-       exports.MeshStandardMaterial = MeshStandardMaterial;
-       exports.MeshToonMaterial = MeshToonMaterial;
-       exports.MinEquation = MinEquation;
-       exports.MirroredRepeatWrapping = MirroredRepeatWrapping;
-       exports.MixOperation = MixOperation;
-       exports.MultiMaterial = MultiMaterial;
-       exports.MultiplyBlending = MultiplyBlending;
-       exports.MultiplyOperation = MultiplyOperation;
-       exports.NearestFilter = NearestFilter;
-       exports.NearestMipMapLinearFilter = NearestMipMapLinearFilter;
-       exports.NearestMipMapNearestFilter = NearestMipMapNearestFilter;
-       exports.NearestMipmapLinearFilter = NearestMipmapLinearFilter;
-       exports.NearestMipmapNearestFilter = NearestMipmapNearestFilter;
-       exports.NeverDepth = NeverDepth;
-       exports.NeverStencilFunc = NeverStencilFunc;
-       exports.NoBlending = NoBlending;
-       exports.NoColors = NoColors;
-       exports.NoToneMapping = NoToneMapping;
-       exports.NormalAnimationBlendMode = NormalAnimationBlendMode;
-       exports.NormalBlending = NormalBlending;
-       exports.NotEqualDepth = NotEqualDepth;
-       exports.NotEqualStencilFunc = NotEqualStencilFunc;
-       exports.NumberKeyframeTrack = NumberKeyframeTrack;
-       exports.Object3D = Object3D;
-       exports.ObjectLoader = ObjectLoader;
-       exports.ObjectSpaceNormalMap = ObjectSpaceNormalMap;
-       exports.OctahedronBufferGeometry = OctahedronGeometry;
-       exports.OctahedronGeometry = OctahedronGeometry;
-       exports.OneFactor = OneFactor;
-       exports.OneMinusDstAlphaFactor = OneMinusDstAlphaFactor;
-       exports.OneMinusDstColorFactor = OneMinusDstColorFactor;
-       exports.OneMinusSrcAlphaFactor = OneMinusSrcAlphaFactor;
-       exports.OneMinusSrcColorFactor = OneMinusSrcColorFactor;
-       exports.OrthographicCamera = OrthographicCamera;
-       exports.PCFShadowMap = PCFShadowMap;
-       exports.PCFSoftShadowMap = PCFSoftShadowMap;
-       exports.PMREMGenerator = PMREMGenerator;
-       exports.ParametricBufferGeometry = ParametricGeometry;
-       exports.ParametricGeometry = ParametricGeometry;
-       exports.Particle = Particle;
-       exports.ParticleBasicMaterial = ParticleBasicMaterial;
-       exports.ParticleSystem = ParticleSystem;
-       exports.ParticleSystemMaterial = ParticleSystemMaterial;
-       exports.Path = Path;
-       exports.PerspectiveCamera = PerspectiveCamera;
-       exports.Plane = Plane;
-       exports.PlaneBufferGeometry = PlaneGeometry;
-       exports.PlaneGeometry = PlaneGeometry;
-       exports.PlaneHelper = PlaneHelper;
-       exports.PointCloud = PointCloud;
-       exports.PointCloudMaterial = PointCloudMaterial;
-       exports.PointLight = PointLight;
-       exports.PointLightHelper = PointLightHelper;
-       exports.Points = Points;
-       exports.PointsMaterial = PointsMaterial;
-       exports.PolarGridHelper = PolarGridHelper;
-       exports.PolyhedronBufferGeometry = PolyhedronGeometry;
-       exports.PolyhedronGeometry = PolyhedronGeometry;
-       exports.PositionalAudio = PositionalAudio;
-       exports.PropertyBinding = PropertyBinding;
-       exports.PropertyMixer = PropertyMixer;
-       exports.QuadraticBezierCurve = QuadraticBezierCurve;
-       exports.QuadraticBezierCurve3 = QuadraticBezierCurve3;
-       exports.Quaternion = Quaternion;
-       exports.QuaternionKeyframeTrack = QuaternionKeyframeTrack;
-       exports.QuaternionLinearInterpolant = QuaternionLinearInterpolant;
-       exports.REVISION = REVISION;
-       exports.RGBADepthPacking = RGBADepthPacking;
-       exports.RGBAFormat = RGBAFormat;
-       exports.RGBAIntegerFormat = RGBAIntegerFormat;
-       exports.RGBA_ASTC_10x10_Format = RGBA_ASTC_10x10_Format;
-       exports.RGBA_ASTC_10x5_Format = RGBA_ASTC_10x5_Format;
-       exports.RGBA_ASTC_10x6_Format = RGBA_ASTC_10x6_Format;
-       exports.RGBA_ASTC_10x8_Format = RGBA_ASTC_10x8_Format;
-       exports.RGBA_ASTC_12x10_Format = RGBA_ASTC_12x10_Format;
-       exports.RGBA_ASTC_12x12_Format = RGBA_ASTC_12x12_Format;
-       exports.RGBA_ASTC_4x4_Format = RGBA_ASTC_4x4_Format;
-       exports.RGBA_ASTC_5x4_Format = RGBA_ASTC_5x4_Format;
-       exports.RGBA_ASTC_5x5_Format = RGBA_ASTC_5x5_Format;
-       exports.RGBA_ASTC_6x5_Format = RGBA_ASTC_6x5_Format;
-       exports.RGBA_ASTC_6x6_Format = RGBA_ASTC_6x6_Format;
-       exports.RGBA_ASTC_8x5_Format = RGBA_ASTC_8x5_Format;
-       exports.RGBA_ASTC_8x6_Format = RGBA_ASTC_8x6_Format;
-       exports.RGBA_ASTC_8x8_Format = RGBA_ASTC_8x8_Format;
-       exports.RGBA_BPTC_Format = RGBA_BPTC_Format;
-       exports.RGBA_ETC2_EAC_Format = RGBA_ETC2_EAC_Format;
-       exports.RGBA_PVRTC_2BPPV1_Format = RGBA_PVRTC_2BPPV1_Format;
-       exports.RGBA_PVRTC_4BPPV1_Format = RGBA_PVRTC_4BPPV1_Format;
-       exports.RGBA_S3TC_DXT1_Format = RGBA_S3TC_DXT1_Format;
-       exports.RGBA_S3TC_DXT3_Format = RGBA_S3TC_DXT3_Format;
-       exports.RGBA_S3TC_DXT5_Format = RGBA_S3TC_DXT5_Format;
-       exports.RGBDEncoding = RGBDEncoding;
-       exports.RGBEEncoding = RGBEEncoding;
-       exports.RGBEFormat = RGBEFormat;
-       exports.RGBFormat = RGBFormat;
-       exports.RGBIntegerFormat = RGBIntegerFormat;
-       exports.RGBM16Encoding = RGBM16Encoding;
-       exports.RGBM7Encoding = RGBM7Encoding;
-       exports.RGB_ETC1_Format = RGB_ETC1_Format;
-       exports.RGB_ETC2_Format = RGB_ETC2_Format;
-       exports.RGB_PVRTC_2BPPV1_Format = RGB_PVRTC_2BPPV1_Format;
-       exports.RGB_PVRTC_4BPPV1_Format = RGB_PVRTC_4BPPV1_Format;
-       exports.RGB_S3TC_DXT1_Format = RGB_S3TC_DXT1_Format;
-       exports.RGFormat = RGFormat;
-       exports.RGIntegerFormat = RGIntegerFormat;
-       exports.RawShaderMaterial = RawShaderMaterial;
-       exports.Ray = Ray;
-       exports.Raycaster = Raycaster;
-       exports.RectAreaLight = RectAreaLight;
-       exports.RedFormat = RedFormat;
-       exports.RedIntegerFormat = RedIntegerFormat;
-       exports.ReinhardToneMapping = ReinhardToneMapping;
-       exports.RepeatWrapping = RepeatWrapping;
-       exports.ReplaceStencilOp = ReplaceStencilOp;
-       exports.ReverseSubtractEquation = ReverseSubtractEquation;
-       exports.RingBufferGeometry = RingGeometry;
-       exports.RingGeometry = RingGeometry;
-       exports.SRGB8_ALPHA8_ASTC_10x10_Format = SRGB8_ALPHA8_ASTC_10x10_Format;
-       exports.SRGB8_ALPHA8_ASTC_10x5_Format = SRGB8_ALPHA8_ASTC_10x5_Format;
-       exports.SRGB8_ALPHA8_ASTC_10x6_Format = SRGB8_ALPHA8_ASTC_10x6_Format;
-       exports.SRGB8_ALPHA8_ASTC_10x8_Format = SRGB8_ALPHA8_ASTC_10x8_Format;
-       exports.SRGB8_ALPHA8_ASTC_12x10_Format = SRGB8_ALPHA8_ASTC_12x10_Format;
-       exports.SRGB8_ALPHA8_ASTC_12x12_Format = SRGB8_ALPHA8_ASTC_12x12_Format;
-       exports.SRGB8_ALPHA8_ASTC_4x4_Format = SRGB8_ALPHA8_ASTC_4x4_Format;
-       exports.SRGB8_ALPHA8_ASTC_5x4_Format = SRGB8_ALPHA8_ASTC_5x4_Format;
-       exports.SRGB8_ALPHA8_ASTC_5x5_Format = SRGB8_ALPHA8_ASTC_5x5_Format;
-       exports.SRGB8_ALPHA8_ASTC_6x5_Format = SRGB8_ALPHA8_ASTC_6x5_Format;
-       exports.SRGB8_ALPHA8_ASTC_6x6_Format = SRGB8_ALPHA8_ASTC_6x6_Format;
-       exports.SRGB8_ALPHA8_ASTC_8x5_Format = SRGB8_ALPHA8_ASTC_8x5_Format;
-       exports.SRGB8_ALPHA8_ASTC_8x6_Format = SRGB8_ALPHA8_ASTC_8x6_Format;
-       exports.SRGB8_ALPHA8_ASTC_8x8_Format = SRGB8_ALPHA8_ASTC_8x8_Format;
-       exports.Scene = Scene;
-       exports.SceneUtils = SceneUtils;
-       exports.ShaderChunk = ShaderChunk;
-       exports.ShaderLib = ShaderLib;
-       exports.ShaderMaterial = ShaderMaterial;
-       exports.ShadowMaterial = ShadowMaterial;
-       exports.Shape = Shape;
-       exports.ShapeBufferGeometry = ShapeGeometry;
-       exports.ShapeGeometry = ShapeGeometry;
-       exports.ShapePath = ShapePath;
-       exports.ShapeUtils = ShapeUtils;
-       exports.ShortType = ShortType;
-       exports.Skeleton = Skeleton;
-       exports.SkeletonHelper = SkeletonHelper;
-       exports.SkinnedMesh = SkinnedMesh;
-       exports.SmoothShading = SmoothShading;
-       exports.Sphere = Sphere;
-       exports.SphereBufferGeometry = SphereGeometry;
-       exports.SphereGeometry = SphereGeometry;
-       exports.Spherical = Spherical;
-       exports.SphericalHarmonics3 = SphericalHarmonics3;
-       exports.SplineCurve = SplineCurve;
-       exports.SpotLight = SpotLight;
-       exports.SpotLightHelper = SpotLightHelper;
-       exports.Sprite = Sprite;
-       exports.SpriteMaterial = SpriteMaterial;
-       exports.SrcAlphaFactor = SrcAlphaFactor;
-       exports.SrcAlphaSaturateFactor = SrcAlphaSaturateFactor;
-       exports.SrcColorFactor = SrcColorFactor;
-       exports.StaticCopyUsage = StaticCopyUsage;
-       exports.StaticDrawUsage = StaticDrawUsage;
-       exports.StaticReadUsage = StaticReadUsage;
-       exports.StereoCamera = StereoCamera;
-       exports.StreamCopyUsage = StreamCopyUsage;
-       exports.StreamDrawUsage = StreamDrawUsage;
-       exports.StreamReadUsage = StreamReadUsage;
-       exports.StringKeyframeTrack = StringKeyframeTrack;
-       exports.SubtractEquation = SubtractEquation;
-       exports.SubtractiveBlending = SubtractiveBlending;
-       exports.TOUCH = TOUCH;
-       exports.TangentSpaceNormalMap = TangentSpaceNormalMap;
-       exports.TetrahedronBufferGeometry = TetrahedronGeometry;
-       exports.TetrahedronGeometry = TetrahedronGeometry;
-       exports.TextBufferGeometry = TextGeometry;
-       exports.TextGeometry = TextGeometry;
-       exports.Texture = Texture;
-       exports.TextureLoader = TextureLoader;
-       exports.TorusBufferGeometry = TorusGeometry;
-       exports.TorusGeometry = TorusGeometry;
-       exports.TorusKnotBufferGeometry = TorusKnotGeometry;
-       exports.TorusKnotGeometry = TorusKnotGeometry;
-       exports.Triangle = Triangle;
-       exports.TriangleFanDrawMode = TriangleFanDrawMode;
-       exports.TriangleStripDrawMode = TriangleStripDrawMode;
-       exports.TrianglesDrawMode = TrianglesDrawMode;
-       exports.TubeBufferGeometry = TubeGeometry;
-       exports.TubeGeometry = TubeGeometry;
-       exports.UVMapping = UVMapping;
-       exports.Uint16Attribute = Uint16Attribute;
-       exports.Uint16BufferAttribute = Uint16BufferAttribute;
-       exports.Uint32Attribute = Uint32Attribute;
-       exports.Uint32BufferAttribute = Uint32BufferAttribute;
-       exports.Uint8Attribute = Uint8Attribute;
-       exports.Uint8BufferAttribute = Uint8BufferAttribute;
-       exports.Uint8ClampedAttribute = Uint8ClampedAttribute;
-       exports.Uint8ClampedBufferAttribute = Uint8ClampedBufferAttribute;
-       exports.Uniform = Uniform;
-       exports.UniformsLib = UniformsLib;
-       exports.UniformsUtils = UniformsUtils;
-       exports.UnsignedByteType = UnsignedByteType;
-       exports.UnsignedInt248Type = UnsignedInt248Type;
-       exports.UnsignedIntType = UnsignedIntType;
-       exports.UnsignedShort4444Type = UnsignedShort4444Type;
-       exports.UnsignedShort5551Type = UnsignedShort5551Type;
-       exports.UnsignedShort565Type = UnsignedShort565Type;
-       exports.UnsignedShortType = UnsignedShortType;
-       exports.VSMShadowMap = VSMShadowMap;
-       exports.Vector2 = Vector2;
-       exports.Vector3 = Vector3;
-       exports.Vector4 = Vector4;
-       exports.VectorKeyframeTrack = VectorKeyframeTrack;
-       exports.Vertex = Vertex;
-       exports.VertexColors = VertexColors;
-       exports.VideoTexture = VideoTexture;
-       exports.WebGL1Renderer = WebGL1Renderer;
-       exports.WebGLCubeRenderTarget = WebGLCubeRenderTarget;
-       exports.WebGLMultipleRenderTargets = WebGLMultipleRenderTargets;
-       exports.WebGLMultisampleRenderTarget = WebGLMultisampleRenderTarget;
-       exports.WebGLRenderTarget = WebGLRenderTarget;
-       exports.WebGLRenderTargetCube = WebGLRenderTargetCube;
-       exports.WebGLRenderer = WebGLRenderer;
-       exports.WebGLUtils = WebGLUtils;
-       exports.WireframeGeometry = WireframeGeometry;
-       exports.WireframeHelper = WireframeHelper;
-       exports.WrapAroundEnding = WrapAroundEnding;
-       exports.XHRLoader = XHRLoader;
-       exports.ZeroCurvatureEnding = ZeroCurvatureEnding;
-       exports.ZeroFactor = ZeroFactor;
-       exports.ZeroSlopeEnding = ZeroSlopeEnding;
-       exports.ZeroStencilOp = ZeroStencilOp;
-       exports.sRGBEncoding = sRGBEncoding;
-
-       Object.defineProperty(exports, '__esModule', { value: true });
-
-})));
-
-},{}]},{},[1]);
index 124f980bf4b5e0fc4a547027023d62ce2d5c3e7a..87c1a44f3b4afbe5c069551171128d97fbd8d998 100644 (file)
@@ -3,6 +3,10 @@
                return new Promise(resolve => window.setTimeout(resolve, amount));
        }
 
+       function frame() {
+               return new Promise(resolve => window.requestAnimationFrame(resolve));
+       }
+
        window.addEventListener("load", function () {
                // Tylan alphabet
                async function tylanToFont(input, output) {
                }
        });
 
+       window.addEventListener("load", function () {
+               // Mesh viewing
+               const canvases = document.getElementsByTagName("canvas");
+               for (const canvas of canvases) {
+                       const modelName = canvas.getAttribute("data-model");
+                       if (modelName == null || modelName === "") continue;
+
+                       (async () => {
+                               let threeData = {};
+
+                               threeData.camera = new THREE.PerspectiveCamera(69, 1, 0.01, 1000.0);
+
+                               threeData.scene = new THREE.Scene();
+                               threeData.scene.add(new THREE.AmbientLight("#555555", 1.0));
+
+                               threeData.renderer = new THREE.WebGLRenderer({"canvas": canvas, "antialias": true});
+
+                               threeData.controls = new THREE.OrbitControls(threeData.camera, canvas);
+
+                               function render() {
+                                       threeData.controls.update();
+                                       threeData.renderer.render(threeData.scene, threeData.camera);
+                                       window.requestAnimationFrame(render);
+                               }
+
+                               function onResize() {
+                                       const dim = canvas.getBoundingClientRect();
+                                       threeData.camera.aspect = dim.width / dim.height;
+                                       threeData.camera.updateProjectionMatrix();
+                                       threeData.renderer.setSize(dim.width, dim.height, false);
+                               }
+
+                               window.addEventListener('resize', onResize);
+                               await frame();
+                               onResize();
+
+                               const mtlPath = modelName + ".mtl";
+                               const mtlLib = await (new THREE.MTLLoader()).setPath("/assets/meshes/").setResourcePath("/assets/meshes/").loadAsync(mtlPath);
+                               mtlLib.preload();
+
+                               const objPath = modelName + ".obj";
+                               const objMesh = await (new THREE.OBJLoader()).setPath("/assets/meshes/").setResourcePath("/assets/meshes/").setMaterials(mtlLib).loadAsync(objPath);
+                               threeData.scene.add(objMesh);
+
+                               const bbox = new THREE.Box3().setFromObject(threeData.scene);
+                               bbox.dimensions = {
+                                       x: bbox.max.x - bbox.min.x,
+                                       y: bbox.max.y - bbox.min.y,
+                                       z: bbox.max.z - bbox.min.z
+                               };
+                               objMesh.position.sub(new THREE.Vector3(bbox.min.x + bbox.dimensions.x / 2, bbox.min.y + bbox.dimensions.y / 2, bbox.min.z + bbox.dimensions.z / 2));
+
+                               threeData.camera.position.set(bbox.dimensions.x / 2, bbox.dimensions.y / 2, Math.max(bbox.dimensions.x, bbox.dimensions.y, bbox.dimensions.z));
+
+                               threeData.light = new THREE.PointLight("#AAAAAA", 1.0);
+                               threeData.scene.add(threeData.camera);
+                               threeData.camera.add(threeData.light);
+                               threeData.light.position.set(0, 0, 0);
+
+                               render();
+                       })().catch(reason => {
+                               console.error("Error rendering model " + modelName, reason);
+                       });
+               }
+       });
+
        window.addEventListener("load", function () {
                // Allow POSTing with <a>s
                const anchors = document.getElementsByTagName("a");
diff --git a/src/main/resources/static/obj-viewer/OrbitControls.js b/src/main/resources/static/obj-viewer/OrbitControls.js
new file mode 100644 (file)
index 0000000..151f0c8
--- /dev/null
@@ -0,0 +1,1042 @@
+/**
+ * @author qiao / https://github.com/qiao
+ * @author mrdoob / http://mrdoob.com
+ * @author alteredq / http://alteredqualia.com/
+ * @author WestLangley / http://github.com/WestLangley
+ * @author erich666 / http://erichaines.com
+ */
+
+// This set of controls performs orbiting, dollying (zooming), and panning.
+// Unlike TrackballControls, it maintains the "up" direction object.up (+Y by default).
+//
+//    Orbit - left mouse / touch: one finger move
+//    Zoom - middle mouse, or mousewheel / touch: two finger spread or squish
+//    Pan - right mouse, or arrow keys / touch: three finger swipe
+
+THREE.OrbitControls = function ( object, domElement ) {
+
+       this.object = object;
+
+       this.domElement = ( domElement !== undefined ) ? domElement : document;
+
+       // Set to false to disable this control
+       this.enabled = true;
+
+       // "target" sets the location of focus, where the object orbits around
+       this.target = new THREE.Vector3();
+
+       // How far you can dolly in and out ( PerspectiveCamera only )
+       this.minDistance = 0;
+       this.maxDistance = Infinity;
+
+       // How far you can zoom in and out ( OrthographicCamera only )
+       this.minZoom = 0;
+       this.maxZoom = Infinity;
+
+       // How far you can orbit vertically, upper and lower limits.
+       // Range is 0 to Math.PI radians.
+       this.minPolarAngle = 0; // radians
+       this.maxPolarAngle = Math.PI; // radians
+
+       // How far you can orbit horizontally, upper and lower limits.
+       // If set, must be a sub-interval of the interval [ - Math.PI, Math.PI ].
+       this.minAzimuthAngle = - Infinity; // radians
+       this.maxAzimuthAngle = Infinity; // radians
+
+       // Set to true to enable damping (inertia)
+       // If damping is enabled, you must call controls.update() in your animation loop
+       this.enableDamping = false;
+       this.dampingFactor = 0.25;
+
+       // This option actually enables dollying in and out; left as "zoom" for backwards compatibility.
+       // Set to false to disable zooming
+       this.enableZoom = true;
+       this.zoomSpeed = 1.0;
+
+       // Set to false to disable rotating
+       this.enableRotate = true;
+       this.rotateSpeed = 1.0;
+
+       // Set to false to disable panning
+       this.enablePan = true;
+       this.keyPanSpeed = 7.0; // pixels moved per arrow key push
+
+       // Set to true to automatically rotate around the target
+       // If auto-rotate is enabled, you must call controls.update() in your animation loop
+       this.autoRotate = false;
+       this.autoRotateSpeed = 2.0; // 30 seconds per round when fps is 60
+
+       // Set to false to disable use of the keys
+       this.enableKeys = true;
+
+       // The four arrow keys
+       this.keys = { LEFT: 37, UP: 38, RIGHT: 39, BOTTOM: 40 };
+
+       // Mouse buttons
+       this.mouseButtons = { ORBIT: THREE.MOUSE.LEFT, ZOOM: THREE.MOUSE.MIDDLE, PAN: THREE.MOUSE.RIGHT };
+
+       // for reset
+       this.target0 = this.target.clone();
+       this.position0 = this.object.position.clone();
+       this.zoom0 = this.object.zoom;
+
+       //
+       // public methods
+       //
+
+       this.getPolarAngle = function () {
+
+               return spherical.phi;
+
+       };
+
+       this.getAzimuthalAngle = function () {
+
+               return spherical.theta;
+
+       };
+
+       this.saveState = function () {
+
+               scope.target0.copy( scope.target );
+               scope.position0.copy( scope.object.position );
+               scope.zoom0 = scope.object.zoom;
+
+       };
+
+       this.reset = function () {
+
+               scope.target.copy( scope.target0 );
+               scope.object.position.copy( scope.position0 );
+               scope.object.zoom = scope.zoom0;
+
+               scope.object.updateProjectionMatrix();
+               scope.dispatchEvent( changeEvent );
+
+               scope.update();
+
+               state = STATE.NONE;
+
+       };
+
+       // this method is exposed, but perhaps it would be better if we can make it private...
+       this.update = function () {
+
+               var offset = new THREE.Vector3();
+
+               // so camera.up is the orbit axis
+               var quat = new THREE.Quaternion().setFromUnitVectors( object.up, new THREE.Vector3( 0, 1, 0 ) );
+               var quatInverse = quat.clone().inverse();
+
+               var lastPosition = new THREE.Vector3();
+               var lastQuaternion = new THREE.Quaternion();
+
+               return function update() {
+
+                       var position = scope.object.position;
+
+                       offset.copy( position ).sub( scope.target );
+
+                       // rotate offset to "y-axis-is-up" space
+                       offset.applyQuaternion( quat );
+
+                       // angle from z-axis around y-axis
+                       spherical.setFromVector3( offset );
+
+                       if ( scope.autoRotate && state === STATE.NONE ) {
+
+                               rotateLeft( getAutoRotationAngle() );
+
+                       }
+
+                       spherical.theta += sphericalDelta.theta;
+                       spherical.phi += sphericalDelta.phi;
+
+                       // restrict theta to be between desired limits
+                       spherical.theta = Math.max( scope.minAzimuthAngle, Math.min( scope.maxAzimuthAngle, spherical.theta ) );
+
+                       // restrict phi to be between desired limits
+                       spherical.phi = Math.max( scope.minPolarAngle, Math.min( scope.maxPolarAngle, spherical.phi ) );
+
+                       spherical.makeSafe();
+
+
+                       spherical.radius *= scale;
+
+                       // restrict radius to be between desired limits
+                       spherical.radius = Math.max( scope.minDistance, Math.min( scope.maxDistance, spherical.radius ) );
+
+                       // move target to panned location
+                       scope.target.add( panOffset );
+
+                       offset.setFromSpherical( spherical );
+
+                       // rotate offset back to "camera-up-vector-is-up" space
+                       offset.applyQuaternion( quatInverse );
+
+                       position.copy( scope.target ).add( offset );
+
+                       scope.object.lookAt( scope.target );
+
+                       if ( scope.enableDamping === true ) {
+
+                               sphericalDelta.theta *= ( 1 - scope.dampingFactor );
+                               sphericalDelta.phi *= ( 1 - scope.dampingFactor );
+
+                       } else {
+
+                               sphericalDelta.set( 0, 0, 0 );
+
+                       }
+
+                       scale = 1;
+                       panOffset.set( 0, 0, 0 );
+
+                       // update condition is:
+                       // min(camera displacement, camera rotation in radians)^2 > EPS
+                       // using small-angle approximation cos(x/2) = 1 - x^2 / 8
+
+                       if ( zoomChanged ||
+                               lastPosition.distanceToSquared( scope.object.position ) > EPS ||
+                               8 * ( 1 - lastQuaternion.dot( scope.object.quaternion ) ) > EPS ) {
+
+                               scope.dispatchEvent( changeEvent );
+
+                               lastPosition.copy( scope.object.position );
+                               lastQuaternion.copy( scope.object.quaternion );
+                               zoomChanged = false;
+
+                               return true;
+
+                       }
+
+                       return false;
+
+               };
+
+       }();
+
+       this.dispose = function () {
+
+               scope.domElement.removeEventListener( 'contextmenu', onContextMenu, false );
+               scope.domElement.removeEventListener( 'mousedown', onMouseDown, false );
+               scope.domElement.removeEventListener( 'wheel', onMouseWheel, false );
+
+               scope.domElement.removeEventListener( 'touchstart', onTouchStart, false );
+               scope.domElement.removeEventListener( 'touchend', onTouchEnd, false );
+               scope.domElement.removeEventListener( 'touchmove', onTouchMove, false );
+
+               document.removeEventListener( 'mousemove', onMouseMove, false );
+               document.removeEventListener( 'mouseup', onMouseUp, false );
+
+               window.removeEventListener( 'keydown', onKeyDown, false );
+
+               //scope.dispatchEvent( { type: 'dispose' } ); // should this be added here?
+
+       };
+
+       //
+       // internals
+       //
+
+       var scope = this;
+
+       var changeEvent = { type: 'change' };
+       var startEvent = { type: 'start' };
+       var endEvent = { type: 'end' };
+
+       var STATE = { NONE: - 1, ROTATE: 0, DOLLY: 1, PAN: 2, TOUCH_ROTATE: 3, TOUCH_DOLLY: 4, TOUCH_PAN: 5 };
+
+       var state = STATE.NONE;
+
+       var EPS = 0.000001;
+
+       // current position in spherical coordinates
+       var spherical = new THREE.Spherical();
+       var sphericalDelta = new THREE.Spherical();
+
+       var scale = 1;
+       var panOffset = new THREE.Vector3();
+       var zoomChanged = false;
+
+       var rotateStart = new THREE.Vector2();
+       var rotateEnd = new THREE.Vector2();
+       var rotateDelta = new THREE.Vector2();
+
+       var panStart = new THREE.Vector2();
+       var panEnd = new THREE.Vector2();
+       var panDelta = new THREE.Vector2();
+
+       var dollyStart = new THREE.Vector2();
+       var dollyEnd = new THREE.Vector2();
+       var dollyDelta = new THREE.Vector2();
+
+       function getAutoRotationAngle() {
+
+               return 2 * Math.PI / 60 / 60 * scope.autoRotateSpeed;
+
+       }
+
+       function getZoomScale() {
+
+               return Math.pow( 0.95, scope.zoomSpeed );
+
+       }
+
+       function rotateLeft( angle ) {
+
+               sphericalDelta.theta -= angle;
+
+       }
+
+       function rotateUp( angle ) {
+
+               sphericalDelta.phi -= angle;
+
+       }
+
+       var panLeft = function () {
+
+               var v = new THREE.Vector3();
+
+               return function panLeft( distance, objectMatrix ) {
+
+                       v.setFromMatrixColumn( objectMatrix, 0 ); // get X column of objectMatrix
+                       v.multiplyScalar( - distance );
+
+                       panOffset.add( v );
+
+               };
+
+       }();
+
+       var panUp = function () {
+
+               var v = new THREE.Vector3();
+
+               return function panUp( distance, objectMatrix ) {
+
+                       v.setFromMatrixColumn( objectMatrix, 1 ); // get Y column of objectMatrix
+                       v.multiplyScalar( distance );
+
+                       panOffset.add( v );
+
+               };
+
+       }();
+
+       // deltaX and deltaY are in pixels; right and down are positive
+       var pan = function () {
+
+               var offset = new THREE.Vector3();
+
+               return function pan( deltaX, deltaY ) {
+
+                       var element = scope.domElement === document ? scope.domElement.body : scope.domElement;
+
+                       if ( scope.object instanceof THREE.PerspectiveCamera ) {
+
+                               // perspective
+                               var position = scope.object.position;
+                               offset.copy( position ).sub( scope.target );
+                               var targetDistance = offset.length();
+
+                               // half of the fov is center to top of screen
+                               targetDistance *= Math.tan( ( scope.object.fov / 2 ) * Math.PI / 180.0 );
+
+                               // we actually don't use screenWidth, since perspective camera is fixed to screen height
+                               panLeft( 2 * deltaX * targetDistance / element.clientHeight, scope.object.matrix );
+                               panUp( 2 * deltaY * targetDistance / element.clientHeight, scope.object.matrix );
+
+                       } else if ( scope.object instanceof THREE.OrthographicCamera ) {
+
+                               // orthographic
+                               panLeft( deltaX * ( scope.object.right - scope.object.left ) / scope.object.zoom / element.clientWidth, scope.object.matrix );
+                               panUp( deltaY * ( scope.object.top - scope.object.bottom ) / scope.object.zoom / element.clientHeight, scope.object.matrix );
+
+                       } else {
+
+                               // camera neither orthographic nor perspective
+                               console.warn( 'WARNING: OrbitControls.js encountered an unknown camera type - pan disabled.' );
+                               scope.enablePan = false;
+
+                       }
+
+               };
+
+       }();
+
+       function dollyIn( dollyScale ) {
+
+               if ( scope.object instanceof THREE.PerspectiveCamera ) {
+
+                       scale /= dollyScale;
+
+               } else if ( scope.object instanceof THREE.OrthographicCamera ) {
+
+                       scope.object.zoom = Math.max( scope.minZoom, Math.min( scope.maxZoom, scope.object.zoom * dollyScale ) );
+                       scope.object.updateProjectionMatrix();
+                       zoomChanged = true;
+
+               } else {
+
+                       console.warn( 'WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled.' );
+                       scope.enableZoom = false;
+
+               }
+
+       }
+
+       function dollyOut( dollyScale ) {
+
+               if ( scope.object instanceof THREE.PerspectiveCamera ) {
+
+                       scale *= dollyScale;
+
+               } else if ( scope.object instanceof THREE.OrthographicCamera ) {
+
+                       scope.object.zoom = Math.max( scope.minZoom, Math.min( scope.maxZoom, scope.object.zoom / dollyScale ) );
+                       scope.object.updateProjectionMatrix();
+                       zoomChanged = true;
+
+               } else {
+
+                       console.warn( 'WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled.' );
+                       scope.enableZoom = false;
+
+               }
+
+       }
+
+       //
+       // event callbacks - update the object state
+       //
+
+       function handleMouseDownRotate( event ) {
+
+               //console.log( 'handleMouseDownRotate' );
+
+               rotateStart.set( event.clientX, event.clientY );
+
+       }
+
+       function handleMouseDownDolly( event ) {
+
+               //console.log( 'handleMouseDownDolly' );
+
+               dollyStart.set( event.clientX, event.clientY );
+
+       }
+
+       function handleMouseDownPan( event ) {
+
+               //console.log( 'handleMouseDownPan' );
+
+               panStart.set( event.clientX, event.clientY );
+
+       }
+
+       function handleMouseMoveRotate( event ) {
+
+               //console.log( 'handleMouseMoveRotate' );
+
+               rotateEnd.set( event.clientX, event.clientY );
+               rotateDelta.subVectors( rotateEnd, rotateStart );
+
+               var element = scope.domElement === document ? scope.domElement.body : scope.domElement;
+
+               // rotating across whole screen goes 360 degrees around
+               rotateLeft( 2 * Math.PI * rotateDelta.x / element.clientWidth * scope.rotateSpeed );
+
+               // rotating up and down along whole screen attempts to go 360, but limited to 180
+               rotateUp( 2 * Math.PI * rotateDelta.y / element.clientHeight * scope.rotateSpeed );
+
+               rotateStart.copy( rotateEnd );
+
+               scope.update();
+
+       }
+
+       function handleMouseMoveDolly( event ) {
+
+               //console.log( 'handleMouseMoveDolly' );
+
+               dollyEnd.set( event.clientX, event.clientY );
+
+               dollyDelta.subVectors( dollyEnd, dollyStart );
+
+               if ( dollyDelta.y > 0 ) {
+
+                       dollyIn( getZoomScale() );
+
+               } else if ( dollyDelta.y < 0 ) {
+
+                       dollyOut( getZoomScale() );
+
+               }
+
+               dollyStart.copy( dollyEnd );
+
+               scope.update();
+
+       }
+
+       function handleMouseMovePan( event ) {
+
+               //console.log( 'handleMouseMovePan' );
+
+               panEnd.set( event.clientX, event.clientY );
+
+               panDelta.subVectors( panEnd, panStart );
+
+               pan( panDelta.x, panDelta.y );
+
+               panStart.copy( panEnd );
+
+               scope.update();
+
+       }
+
+       function handleMouseUp( event ) {
+
+               // console.log( 'handleMouseUp' );
+
+       }
+
+       function handleMouseWheel( event ) {
+
+               // console.log( 'handleMouseWheel' );
+
+               if ( event.deltaY < 0 ) {
+
+                       dollyOut( getZoomScale() );
+
+               } else if ( event.deltaY > 0 ) {
+
+                       dollyIn( getZoomScale() );
+
+               }
+
+               scope.update();
+
+       }
+
+       function handleKeyDown( event ) {
+
+               //console.log( 'handleKeyDown' );
+
+               switch ( event.keyCode ) {
+
+                       case scope.keys.UP:
+                               pan( 0, scope.keyPanSpeed );
+                               scope.update();
+                               break;
+
+                       case scope.keys.BOTTOM:
+                               pan( 0, - scope.keyPanSpeed );
+                               scope.update();
+                               break;
+
+                       case scope.keys.LEFT:
+                               pan( scope.keyPanSpeed, 0 );
+                               scope.update();
+                               break;
+
+                       case scope.keys.RIGHT:
+                               pan( - scope.keyPanSpeed, 0 );
+                               scope.update();
+                               break;
+
+               }
+
+       }
+
+       function handleTouchStartRotate( event ) {
+
+               //console.log( 'handleTouchStartRotate' );
+
+               rotateStart.set( event.touches[ 0 ].pageX, event.touches[ 0 ].pageY );
+
+       }
+
+       function handleTouchStartDolly( event ) {
+
+               //console.log( 'handleTouchStartDolly' );
+
+               var dx = event.touches[ 0 ].pageX - event.touches[ 1 ].pageX;
+               var dy = event.touches[ 0 ].pageY - event.touches[ 1 ].pageY;
+
+               var distance = Math.sqrt( dx * dx + dy * dy );
+
+               dollyStart.set( 0, distance );
+
+       }
+
+       function handleTouchStartPan( event ) {
+
+               //console.log( 'handleTouchStartPan' );
+
+               panStart.set( event.touches[ 0 ].pageX, event.touches[ 0 ].pageY );
+
+       }
+
+       function handleTouchMoveRotate( event ) {
+
+               //console.log( 'handleTouchMoveRotate' );
+
+               rotateEnd.set( event.touches[ 0 ].pageX, event.touches[ 0 ].pageY );
+               rotateDelta.subVectors( rotateEnd, rotateStart );
+
+               var element = scope.domElement === document ? scope.domElement.body : scope.domElement;
+
+               // rotating across whole screen goes 360 degrees around
+               rotateLeft( 2 * Math.PI * rotateDelta.x / element.clientWidth * scope.rotateSpeed );
+
+               // rotating up and down along whole screen attempts to go 360, but limited to 180
+               rotateUp( 2 * Math.PI * rotateDelta.y / element.clientHeight * scope.rotateSpeed );
+
+               rotateStart.copy( rotateEnd );
+
+               scope.update();
+
+       }
+
+       function handleTouchMoveDolly( event ) {
+
+               //console.log( 'handleTouchMoveDolly' );
+
+               var dx = event.touches[ 0 ].pageX - event.touches[ 1 ].pageX;
+               var dy = event.touches[ 0 ].pageY - event.touches[ 1 ].pageY;
+
+               var distance = Math.sqrt( dx * dx + dy * dy );
+
+               dollyEnd.set( 0, distance );
+
+               dollyDelta.subVectors( dollyEnd, dollyStart );
+
+               if ( dollyDelta.y > 0 ) {
+
+                       dollyOut( getZoomScale() );
+
+               } else if ( dollyDelta.y < 0 ) {
+
+                       dollyIn( getZoomScale() );
+
+               }
+
+               dollyStart.copy( dollyEnd );
+
+               scope.update();
+
+       }
+
+       function handleTouchMovePan( event ) {
+
+               //console.log( 'handleTouchMovePan' );
+
+               panEnd.set( event.touches[ 0 ].pageX, event.touches[ 0 ].pageY );
+
+               panDelta.subVectors( panEnd, panStart );
+
+               pan( panDelta.x, panDelta.y );
+
+               panStart.copy( panEnd );
+
+               scope.update();
+
+       }
+
+       function handleTouchEnd( event ) {
+
+               //console.log( 'handleTouchEnd' );
+
+       }
+
+       //
+       // event handlers - FSM: listen for events and reset state
+       //
+
+       function onMouseDown( event ) {
+
+               if ( scope.enabled === false ) return;
+
+               event.preventDefault();
+
+               switch ( event.button ) {
+
+                       case scope.mouseButtons.ORBIT:
+
+                               if ( scope.enableRotate === false ) return;
+
+                               handleMouseDownRotate( event );
+
+                               state = STATE.ROTATE;
+
+                               break;
+
+                       case scope.mouseButtons.ZOOM:
+
+                               if ( scope.enableZoom === false ) return;
+
+                               handleMouseDownDolly( event );
+
+                               state = STATE.DOLLY;
+
+                               break;
+
+                       case scope.mouseButtons.PAN:
+
+                               if ( scope.enablePan === false ) return;
+
+                               handleMouseDownPan( event );
+
+                               state = STATE.PAN;
+
+                               break;
+
+               }
+
+               if ( state !== STATE.NONE ) {
+
+                       document.addEventListener( 'mousemove', onMouseMove, false );
+                       document.addEventListener( 'mouseup', onMouseUp, false );
+
+                       scope.dispatchEvent( startEvent );
+
+               }
+
+       }
+
+       function onMouseMove( event ) {
+
+               if ( scope.enabled === false ) return;
+
+               event.preventDefault();
+
+               switch ( state ) {
+
+                       case STATE.ROTATE:
+
+                               if ( scope.enableRotate === false ) return;
+
+                               handleMouseMoveRotate( event );
+
+                               break;
+
+                       case STATE.DOLLY:
+
+                               if ( scope.enableZoom === false ) return;
+
+                               handleMouseMoveDolly( event );
+
+                               break;
+
+                       case STATE.PAN:
+
+                               if ( scope.enablePan === false ) return;
+
+                               handleMouseMovePan( event );
+
+                               break;
+
+               }
+
+       }
+
+       function onMouseUp( event ) {
+
+               if ( scope.enabled === false ) return;
+
+               handleMouseUp( event );
+
+               document.removeEventListener( 'mousemove', onMouseMove, false );
+               document.removeEventListener( 'mouseup', onMouseUp, false );
+
+               scope.dispatchEvent( endEvent );
+
+               state = STATE.NONE;
+
+       }
+
+       function onMouseWheel( event ) {
+
+               if ( scope.enabled === false || scope.enableZoom === false || ( state !== STATE.NONE && state !== STATE.ROTATE ) ) return;
+
+               event.preventDefault();
+               event.stopPropagation();
+
+               handleMouseWheel( event );
+
+               scope.dispatchEvent( startEvent ); // not sure why these are here...
+               scope.dispatchEvent( endEvent );
+
+       }
+
+       function onKeyDown( event ) {
+
+               if ( scope.enabled === false || scope.enableKeys === false || scope.enablePan === false ) return;
+
+               handleKeyDown( event );
+
+       }
+
+       function onTouchStart( event ) {
+
+               if ( scope.enabled === false ) return;
+
+               switch ( event.touches.length ) {
+
+                       case 1: // one-fingered touch: rotate
+
+                               if ( scope.enableRotate === false ) return;
+
+                               handleTouchStartRotate( event );
+
+                               state = STATE.TOUCH_ROTATE;
+
+                               break;
+
+                       case 2: // two-fingered touch: dolly
+
+                               if ( scope.enableZoom === false ) return;
+
+                               handleTouchStartDolly( event );
+
+                               state = STATE.TOUCH_DOLLY;
+
+                               break;
+
+                       case 3: // three-fingered touch: pan
+
+                               if ( scope.enablePan === false ) return;
+
+                               handleTouchStartPan( event );
+
+                               state = STATE.TOUCH_PAN;
+
+                               break;
+
+                       default:
+
+                               state = STATE.NONE;
+
+               }
+
+               if ( state !== STATE.NONE ) {
+
+                       scope.dispatchEvent( startEvent );
+
+               }
+
+       }
+
+       function onTouchMove( event ) {
+
+               if ( scope.enabled === false ) return;
+
+               event.preventDefault();
+               event.stopPropagation();
+
+               switch ( event.touches.length ) {
+
+                       case 1: // one-fingered touch: rotate
+
+                               if ( scope.enableRotate === false ) return;
+                               if ( state !== STATE.TOUCH_ROTATE ) return; // is this needed?...
+
+                               handleTouchMoveRotate( event );
+
+                               break;
+
+                       case 2: // two-fingered touch: dolly
+
+                               if ( scope.enableZoom === false ) return;
+                               if ( state !== STATE.TOUCH_DOLLY ) return; // is this needed?...
+
+                               handleTouchMoveDolly( event );
+
+                               break;
+
+                       case 3: // three-fingered touch: pan
+
+                               if ( scope.enablePan === false ) return;
+                               if ( state !== STATE.TOUCH_PAN ) return; // is this needed?...
+
+                               handleTouchMovePan( event );
+
+                               break;
+
+                       default:
+
+                               state = STATE.NONE;
+
+               }
+
+       }
+
+       function onTouchEnd( event ) {
+
+               if ( scope.enabled === false ) return;
+
+               handleTouchEnd( event );
+
+               scope.dispatchEvent( endEvent );
+
+               state = STATE.NONE;
+
+       }
+
+       function onContextMenu( event ) {
+
+               if ( scope.enabled === false ) return;
+
+               event.preventDefault();
+
+       }
+
+       //
+
+       scope.domElement.addEventListener( 'contextmenu', onContextMenu, false );
+
+       scope.domElement.addEventListener( 'mousedown', onMouseDown, false );
+       scope.domElement.addEventListener( 'wheel', onMouseWheel, false );
+
+       scope.domElement.addEventListener( 'touchstart', onTouchStart, false );
+       scope.domElement.addEventListener( 'touchend', onTouchEnd, false );
+       scope.domElement.addEventListener( 'touchmove', onTouchMove, false );
+
+       window.addEventListener( 'keydown', onKeyDown, false );
+
+       // force an update at start
+
+       this.update();
+
+};
+
+THREE.OrbitControls.prototype = Object.create( THREE.EventDispatcher.prototype );
+THREE.OrbitControls.prototype.constructor = THREE.OrbitControls;
+
+Object.defineProperties( THREE.OrbitControls.prototype, {
+
+       center: {
+
+               get: function () {
+
+                       console.warn( 'THREE.OrbitControls: .center has been renamed to .target' );
+                       return this.target;
+
+               }
+
+       },
+
+       // backward compatibility
+
+       noZoom: {
+
+               get: function () {
+
+                       console.warn( 'THREE.OrbitControls: .noZoom has been deprecated. Use .enableZoom instead.' );
+                       return ! this.enableZoom;
+
+               },
+
+               set: function ( value ) {
+
+                       console.warn( 'THREE.OrbitControls: .noZoom has been deprecated. Use .enableZoom instead.' );
+                       this.enableZoom = ! value;
+
+               }
+
+       },
+
+       noRotate: {
+
+               get: function () {
+
+                       console.warn( 'THREE.OrbitControls: .noRotate has been deprecated. Use .enableRotate instead.' );
+                       return ! this.enableRotate;
+
+               },
+
+               set: function ( value ) {
+
+                       console.warn( 'THREE.OrbitControls: .noRotate has been deprecated. Use .enableRotate instead.' );
+                       this.enableRotate = ! value;
+
+               }
+
+       },
+
+       noPan: {
+
+               get: function () {
+
+                       console.warn( 'THREE.OrbitControls: .noPan has been deprecated. Use .enablePan instead.' );
+                       return ! this.enablePan;
+
+               },
+
+               set: function ( value ) {
+
+                       console.warn( 'THREE.OrbitControls: .noPan has been deprecated. Use .enablePan instead.' );
+                       this.enablePan = ! value;
+
+               }
+
+       },
+
+       noKeys: {
+
+               get: function () {
+
+                       console.warn( 'THREE.OrbitControls: .noKeys has been deprecated. Use .enableKeys instead.' );
+                       return ! this.enableKeys;
+
+               },
+
+               set: function ( value ) {
+
+                       console.warn( 'THREE.OrbitControls: .noKeys has been deprecated. Use .enableKeys instead.' );
+                       this.enableKeys = ! value;
+
+               }
+
+       },
+
+       staticMoving: {
+
+               get: function () {
+
+                       console.warn( 'THREE.OrbitControls: .staticMoving has been deprecated. Use .enableDamping instead.' );
+                       return ! this.enableDamping;
+
+               },
+
+               set: function ( value ) {
+
+                       console.warn( 'THREE.OrbitControls: .staticMoving has been deprecated. Use .enableDamping instead.' );
+                       this.enableDamping = ! value;
+
+               }
+
+       },
+
+       dynamicDampingFactor: {
+
+               get: function () {
+
+                       console.warn( 'THREE.OrbitControls: .dynamicDampingFactor has been renamed. Use .dampingFactor instead.' );
+                       return this.dampingFactor;
+
+               },
+
+               set: function ( value ) {
+
+                       console.warn( 'THREE.OrbitControls: .dynamicDampingFactor has been renamed. Use .dampingFactor instead.' );
+                       this.dampingFactor = value;
+
+               }
+
+       }
+
+} );
diff --git a/src/main/resources/static/obj-viewer/three-examples.js b/src/main/resources/static/obj-viewer/three-examples.js
new file mode 100644 (file)
index 0000000..7892ef1
--- /dev/null
@@ -0,0 +1,1452 @@
+(function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){
+window.THREE.MTLLoader = require("./MTLLoader").MTLLoader;
+
+},{"./MTLLoader":2}],2:[function(require,module,exports){
+/**
+ * Loads a Wavefront .mtl file specifying materials
+ */
+
+class MTLLoader extends THREE.Loader {
+
+       constructor(manager) {
+
+               super(manager);
+
+       }
+
+       /**
+        * Loads and parses a MTL asset from a URL.
+        *
+        * @param {String} url - URL to the MTL file.
+        * @param {Function} [onLoad] - Callback invoked with the loaded object.
+        * @param {Function} [onProgress] - Callback for download progress.
+        * @param {Function} [onError] - Callback for download errors.
+        *
+        * @see setPath setResourcePath
+        *
+        * @note In order for relative texture references to resolve correctly
+        * you must call setResourcePath() explicitly prior to load.
+        */
+       load(url, onLoad, onProgress, onError) {
+
+               const scope = this;
+
+               const path = (this.path === '') ? THREE.LoaderUtils.extractUrlBase(url) : this.path;
+
+               const loader = new THREE.FileLoader(this.manager);
+               loader.setPath(this.path);
+               loader.setRequestHeader(this.requestHeader);
+               loader.setWithCredentials(this.withCredentials);
+               loader.load(url, function (text) {
+
+                       try {
+
+                               onLoad(scope.parse(text, path));
+
+                       } catch (e) {
+
+                               if (onError) {
+
+                                       onError(e);
+
+                               } else {
+
+                                       console.error(e);
+
+                               }
+
+                               scope.manager.itemError(url);
+
+                       }
+
+               }, onProgress, onError);
+
+       }
+
+       setMaterialOptions(value) {
+
+               this.materialOptions = value;
+               return this;
+
+       }
+
+       /**
+        * Parses a MTL file.
+        *
+        * @param {String} text - Content of MTL file
+        * @return {MaterialCreator}
+        *
+        * @see setPath setResourcePath
+        *
+        * @note In order for relative texture references to resolve correctly
+        * you must call setResourcePath() explicitly prior to parse.
+        */
+       parse(text, path) {
+
+               const lines = text.split('\n');
+               let info = {};
+               const delimiter_pattern = /\s+/;
+               const materialsInfo = {};
+
+               for (let i = 0; i < lines.length; i++) {
+
+                       let line = lines[i];
+                       line = line.trim();
+
+                       if (line.length === 0 || line.charAt(0) === '#') {
+
+                               // Blank line or comment ignore
+                               continue;
+
+                       }
+
+                       const pos = line.indexOf(' ');
+
+                       let key = (pos >= 0) ? line.substring(0, pos) : line;
+                       key = key.toLowerCase();
+
+                       let value = (pos >= 0) ? line.substring(pos + 1) : '';
+                       value = value.trim();
+
+                       if (key === 'newmtl') {
+
+                               // New material
+
+                               info = {name: value};
+                               materialsInfo[value] = info;
+
+                       } else {
+
+                               if (key === 'ka' || key === 'kd' || key === 'ks' || key === 'ke') {
+
+                                       const ss = value.split(delimiter_pattern, 3);
+                                       info[key] = [parseFloat(ss[0]), parseFloat(ss[1]), parseFloat(ss[2])];
+
+                               } else {
+
+                                       info[key] = value;
+
+                               }
+
+                       }
+
+               }
+
+               const materialCreator = new MaterialCreator(this.resourcePath || path, this.materialOptions);
+               materialCreator.setCrossOrigin(this.crossOrigin);
+               materialCreator.setManager(this.manager);
+               materialCreator.setMaterials(materialsInfo);
+               return materialCreator;
+
+       }
+
+}
+
+/**
+ * Create a new MTLLoader.MaterialCreator
+ * @param baseUrl - Url relative to which textures are loaded
+ * @param options - Set of options on how to construct the materials
+ *                  side: Which side to apply the material
+ *                        THREE.FrontSide (default), THREE.BackSide, THREE.DoubleSide
+ *                  wrap: What type of wrapping to apply for textures
+ *                        THREE.RepeatWrapping (default), THREE.ClampToEdgeWrapping, THREE.MirroredRepeatWrapping
+ *                  normalizeRGB: RGBs need to be normalized to 0-1 from 0-255
+ *                                Default: false, assumed to be already normalized
+ *                  ignoreZeroRGBs: Ignore values of RGBs (Ka,Kd,Ks) that are all 0's
+ *                                  Default: false
+ * @constructor
+ */
+
+class MaterialCreator {
+
+       constructor(baseUrl = '', options = {}) {
+
+               this.baseUrl = baseUrl;
+               this.options = options;
+               this.materialsInfo = {};
+               this.materials = {};
+               this.materialsArray = [];
+               this.nameLookup = {};
+
+               this.crossOrigin = 'anonymous';
+
+               this.side = (this.options.side !== undefined) ? this.options.side : THREE.FrontSide;
+               this.wrap = (this.options.wrap !== undefined) ? this.options.wrap : THREE.RepeatWrapping;
+
+       }
+
+       setCrossOrigin(value) {
+
+               this.crossOrigin = value;
+               return this;
+
+       }
+
+       setManager(value) {
+
+               this.manager = value;
+
+       }
+
+       setMaterials(materialsInfo) {
+
+               this.materialsInfo = this.convert(materialsInfo);
+               this.materials = {};
+               this.materialsArray = [];
+               this.nameLookup = {};
+
+       }
+
+       convert(materialsInfo) {
+
+               if (!this.options) return materialsInfo;
+
+               const converted = {};
+
+               for (const mn in materialsInfo) {
+
+                       // Convert materials info into normalized form based on options
+
+                       const mat = materialsInfo[mn];
+
+                       const covmat = {};
+
+                       converted[mn] = covmat;
+
+                       for (const prop in mat) {
+
+                               let save = true;
+                               let value = mat[prop];
+                               const lprop = prop.toLowerCase();
+
+                               switch (lprop) {
+
+                                       case 'kd':
+                                       case 'ka':
+                                       case 'ks':
+
+                                               // Diffuse color (color under white light) using RGB values
+
+                                               if (this.options && this.options.normalizeRGB) {
+
+                                                       value = [value[0] / 255, value[1] / 255, value[2] / 255];
+
+                                               }
+
+                                               if (this.options && this.options.ignoreZeroRGBs) {
+
+                                                       if (value[0] === 0 && value[1] === 0 && value[2] === 0) {
+
+                                                               // ignore
+
+                                                               save = false;
+
+                                                       }
+
+                                               }
+
+                                               break;
+
+                                       default:
+
+                                               break;
+
+                               }
+
+                               if (save) {
+
+                                       covmat[lprop] = value;
+
+                               }
+
+                       }
+
+               }
+
+               return converted;
+
+       }
+
+       preload() {
+
+               for (const mn in this.materialsInfo) {
+
+                       this.create(mn);
+
+               }
+
+       }
+
+       getIndex(materialName) {
+
+               return this.nameLookup[materialName];
+
+       }
+
+       getAsArray() {
+
+               let index = 0;
+
+               for (const mn in this.materialsInfo) {
+
+                       this.materialsArray[index] = this.create(mn);
+                       this.nameLookup[mn] = index;
+                       index++;
+
+               }
+
+               return this.materialsArray;
+
+       }
+
+       create(materialName) {
+
+               if (this.materials[materialName] === undefined) {
+
+                       this.createMaterial_(materialName);
+
+               }
+
+               return this.materials[materialName];
+
+       }
+
+       createMaterial_(materialName) {
+
+               // Create material
+
+               const scope = this;
+               const mat = this.materialsInfo[materialName];
+               const params = {
+
+                       name: materialName,
+                       side: this.side
+
+               };
+
+               function resolveURL(baseUrl, url) {
+
+                       if (typeof url !== 'string' || url === '')
+                               return '';
+
+                       // Absolute URL
+                       if (/^https?:\/\//i.test(url)) return url;
+
+                       return baseUrl + url;
+
+               }
+
+               function setMapForType(mapType, value) {
+
+                       if (params[mapType]) return; // Keep the first encountered texture
+
+                       const texParams = scope.getTextureParams(value, params);
+                       const map = scope.loadTexture(resolveURL(scope.baseUrl, texParams.url));
+
+                       map.repeat.copy(texParams.scale);
+                       map.offset.copy(texParams.offset);
+
+                       map.wrapS = scope.wrap;
+                       map.wrapT = scope.wrap;
+
+                       params[mapType] = map;
+
+               }
+
+               for (const prop in mat) {
+
+                       const value = mat[prop];
+                       let n;
+
+                       if (value === '') continue;
+
+                       switch (prop.toLowerCase()) {
+
+                               // Ns is material specular exponent
+
+                               case 'kd':
+
+                                       // Diffuse color (color under white light) using RGB values
+
+                                       params.color = new THREE.Color().fromArray(value);
+
+                                       break;
+
+                               case 'ks':
+
+                                       // Specular color (color when light is reflected from shiny surface) using RGB values
+                                       params.specular = new THREE.Color().fromArray(value);
+
+                                       break;
+
+                               case 'ke':
+
+                                       // Emissive using RGB values
+                                       params.emissive = new THREE.Color().fromArray(value);
+
+                                       break;
+
+                               case 'map_kd':
+
+                                       // Diffuse texture map
+
+                                       setMapForType('map', value);
+
+                                       break;
+
+                               case 'map_ks':
+
+                                       // Specular map
+
+                                       setMapForType('specularMap', value);
+
+                                       break;
+
+                               case 'map_ke':
+
+                                       // Emissive map
+
+                                       setMapForType('emissiveMap', value);
+
+                                       break;
+
+                               case 'norm':
+
+                                       setMapForType('normalMap', value);
+
+                                       break;
+
+                               case 'map_bump':
+                               case 'bump':
+
+                                       // Bump texture map
+
+                                       setMapForType('bumpMap', value);
+
+                                       break;
+
+                               case 'map_d':
+
+                                       // Alpha map
+
+                                       setMapForType('alphaMap', value);
+                                       params.transparent = true;
+
+                                       break;
+
+                               case 'ns':
+
+                                       // The specular exponent (defines the focus of the specular highlight)
+                                       // A high exponent results in a tight, concentrated highlight. Ns values normally range from 0 to 1000.
+
+                                       params.shininess = parseFloat(value);
+
+                                       break;
+
+                               case 'd':
+                                       n = parseFloat(value);
+
+                                       if (n < 1) {
+
+                                               params.opacity = n;
+                                               params.transparent = true;
+
+                                       }
+
+                                       break;
+
+                               case 'tr':
+                                       n = parseFloat(value);
+
+                                       if (this.options && this.options.invertTrProperty) n = 1 - n;
+
+                                       if (n > 0) {
+
+                                               params.opacity = 1 - n;
+                                               params.transparent = true;
+
+                                       }
+
+                                       break;
+
+                               default:
+                                       break;
+
+                       }
+
+               }
+
+               this.materials[materialName] = new THREE.MeshPhongMaterial(params);
+               return this.materials[materialName];
+
+       }
+
+       getTextureParams(value, matParams) {
+
+               const texParams = {
+
+                       scale: new THREE.Vector2(1, 1),
+                       offset: new THREE.Vector2(0, 0)
+
+               };
+
+               const items = value.split(/\s+/);
+               let pos;
+
+               pos = items.indexOf('-bm');
+
+               if (pos >= 0) {
+
+                       matParams.bumpScale = parseFloat(items[pos + 1]);
+                       items.splice(pos, 2);
+
+               }
+
+               pos = items.indexOf('-s');
+
+               if (pos >= 0) {
+
+                       texParams.scale.set(parseFloat(items[pos + 1]), parseFloat(items[pos + 2]));
+                       items.splice(pos, 4); // we expect 3 parameters here!
+
+               }
+
+               pos = items.indexOf('-o');
+
+               if (pos >= 0) {
+
+                       texParams.offset.set(parseFloat(items[pos + 1]), parseFloat(items[pos + 2]));
+                       items.splice(pos, 4); // we expect 3 parameters here!
+
+               }
+
+               texParams.url = items.join(' ').trim();
+               return texParams;
+
+       }
+
+       loadTexture(url, mapping, onLoad, onProgress, onError) {
+
+               const manager = (this.manager !== undefined) ? this.manager : THREE.DefaultLoadingManager;
+               let loader = manager.getHandler(url);
+
+               if (loader === null) {
+
+                       loader = new THREE.TextureLoader(manager);
+
+               }
+
+               if (loader.setCrossOrigin) loader.setCrossOrigin(this.crossOrigin);
+
+               const texture = loader.load(url, onLoad, onProgress, onError);
+
+               if (mapping !== undefined) texture.mapping = mapping;
+
+               return texture;
+
+       }
+
+}
+
+module.exports = {MTLLoader: MTLLoader};
+
+},{}],3:[function(require,module,exports){
+window.THREE.OBJLoader = require("./OBJLoader").OBJLoader;
+
+},{"./OBJLoader":4}],4:[function(require,module,exports){
+// o object_name | g group_name
+const _object_pattern = /^[og]\s*(.+)?/;
+// mtllib file_reference
+const _material_library_pattern = /^mtllib /;
+// usemtl material_name
+const _material_use_pattern = /^usemtl /;
+// usemap map_name
+const _map_use_pattern = /^usemap /;
+
+const _vA = new THREE.Vector3();
+const _vB = new THREE.Vector3();
+const _vC = new THREE.Vector3();
+
+const _ab = new THREE.Vector3();
+const _cb = new THREE.Vector3();
+
+function ParserState() {
+
+       const state = {
+               objects: [],
+               object: {},
+
+               vertices: [],
+               normals: [],
+               colors: [],
+               uvs: [],
+
+               materials: {},
+               materialLibraries: [],
+
+               startObject: function (name, fromDeclaration) {
+
+                       // If the current object (initial from reset) is not from a g/o declaration in the parsed
+                       // file. We need to use it for the first parsed g/o to keep things in sync.
+                       if (this.object && this.object.fromDeclaration === false) {
+
+                               this.object.name = name;
+                               this.object.fromDeclaration = (fromDeclaration !== false);
+                               return;
+
+                       }
+
+                       const previousMaterial = (this.object && typeof this.object.currentMaterial === 'function' ? this.object.currentMaterial() : undefined);
+
+                       if (this.object && typeof this.object._finalize === 'function') {
+
+                               this.object._finalize(true);
+
+                       }
+
+                       this.object = {
+                               name: name || '',
+                               fromDeclaration: (fromDeclaration !== false),
+
+                               geometry: {
+                                       vertices: [],
+                                       normals: [],
+                                       colors: [],
+                                       uvs: [],
+                                       hasUVIndices: false
+                               },
+                               materials: [],
+                               smooth: true,
+
+                               startMaterial: function (name, libraries) {
+
+                                       const previous = this._finalize(false);
+
+                                       // New usemtl declaration overwrites an inherited material, except if faces were declared
+                                       // after the material, then it must be preserved for proper MultiMaterial continuation.
+                                       if (previous && (previous.inherited || previous.groupCount <= 0)) {
+
+                                               this.materials.splice(previous.index, 1);
+
+                                       }
+
+                                       const material = {
+                                               index: this.materials.length,
+                                               name: name || '',
+                                               mtllib: (Array.isArray(libraries) && libraries.length > 0 ? libraries[libraries.length - 1] : ''),
+                                               smooth: (previous !== undefined ? previous.smooth : this.smooth),
+                                               groupStart: (previous !== undefined ? previous.groupEnd : 0),
+                                               groupEnd: -1,
+                                               groupCount: -1,
+                                               inherited: false,
+
+                                               clone: function (index) {
+
+                                                       const cloned = {
+                                                               index: (typeof index === 'number' ? index : this.index),
+                                                               name: this.name,
+                                                               mtllib: this.mtllib,
+                                                               smooth: this.smooth,
+                                                               groupStart: 0,
+                                                               groupEnd: -1,
+                                                               groupCount: -1,
+                                                               inherited: false
+                                                       };
+                                                       cloned.clone = this.clone.bind(cloned);
+                                                       return cloned;
+
+                                               }
+                                       };
+
+                                       this.materials.push(material);
+
+                                       return material;
+
+                               },
+
+                               currentMaterial: function () {
+
+                                       if (this.materials.length > 0) {
+
+                                               return this.materials[this.materials.length - 1];
+
+                                       }
+
+                                       return undefined;
+
+                               },
+
+                               _finalize: function (end) {
+
+                                       const lastMultiMaterial = this.currentMaterial();
+                                       if (lastMultiMaterial && lastMultiMaterial.groupEnd === -1) {
+
+                                               lastMultiMaterial.groupEnd = this.geometry.vertices.length / 3;
+                                               lastMultiMaterial.groupCount = lastMultiMaterial.groupEnd - lastMultiMaterial.groupStart;
+                                               lastMultiMaterial.inherited = false;
+
+                                       }
+
+                                       // Ignore objects tail materials if no face declarations followed them before a new o/g started.
+                                       if (end && this.materials.length > 1) {
+
+                                               for (let mi = this.materials.length - 1; mi >= 0; mi--) {
+
+                                                       if (this.materials[mi].groupCount <= 0) {
+
+                                                               this.materials.splice(mi, 1);
+
+                                                       }
+
+                                               }
+
+                                       }
+
+                                       // Guarantee at least one empty material, this makes the creation later more straight forward.
+                                       if (end && this.materials.length === 0) {
+
+                                               this.materials.push({
+                                                       name: '',
+                                                       smooth: this.smooth
+                                               });
+
+                                       }
+
+                                       return lastMultiMaterial;
+
+                               }
+                       };
+
+                       // Inherit previous objects material.
+                       // Spec tells us that a declared material must be set to all objects until a new material is declared.
+                       // If a usemtl declaration is encountered while this new object is being parsed, it will
+                       // overwrite the inherited material. Exception being that there was already face declarations
+                       // to the inherited material, then it will be preserved for proper MultiMaterial continuation.
+
+                       if (previousMaterial && previousMaterial.name && typeof previousMaterial.clone === 'function') {
+
+                               const declared = previousMaterial.clone(0);
+                               declared.inherited = true;
+                               this.object.materials.push(declared);
+
+                       }
+
+                       this.objects.push(this.object);
+
+               },
+
+               finalize: function () {
+
+                       if (this.object && typeof this.object._finalize === 'function') {
+
+                               this.object._finalize(true);
+
+                       }
+
+               },
+
+               parseVertexIndex: function (value, len) {
+
+                       const index = parseInt(value, 10);
+                       return (index >= 0 ? index - 1 : index + len / 3) * 3;
+
+               },
+
+               parseNormalIndex: function (value, len) {
+
+                       const index = parseInt(value, 10);
+                       return (index >= 0 ? index - 1 : index + len / 3) * 3;
+
+               },
+
+               parseUVIndex: function (value, len) {
+
+                       const index = parseInt(value, 10);
+                       return (index >= 0 ? index - 1 : index + len / 2) * 2;
+
+               },
+
+               addVertex: function (a, b, c) {
+
+                       const src = this.vertices;
+                       const dst = this.object.geometry.vertices;
+
+                       dst.push(src[a + 0], src[a + 1], src[a + 2]);
+                       dst.push(src[b + 0], src[b + 1], src[b + 2]);
+                       dst.push(src[c + 0], src[c + 1], src[c + 2]);
+
+               },
+
+               addVertexPoint: function (a) {
+
+                       const src = this.vertices;
+                       const dst = this.object.geometry.vertices;
+
+                       dst.push(src[a + 0], src[a + 1], src[a + 2]);
+
+               },
+
+               addVertexLine: function (a) {
+
+                       const src = this.vertices;
+                       const dst = this.object.geometry.vertices;
+
+                       dst.push(src[a + 0], src[a + 1], src[a + 2]);
+
+               },
+
+               addNormal: function (a, b, c) {
+
+                       const src = this.normals;
+                       const dst = this.object.geometry.normals;
+
+                       dst.push(src[a + 0], src[a + 1], src[a + 2]);
+                       dst.push(src[b + 0], src[b + 1], src[b + 2]);
+                       dst.push(src[c + 0], src[c + 1], src[c + 2]);
+
+               },
+
+               addFaceNormal: function (a, b, c) {
+
+                       const src = this.vertices;
+                       const dst = this.object.geometry.normals;
+
+                       _vA.fromArray(src, a);
+                       _vB.fromArray(src, b);
+                       _vC.fromArray(src, c);
+
+                       _cb.subVectors(_vC, _vB);
+                       _ab.subVectors(_vA, _vB);
+                       _cb.cross(_ab);
+
+                       _cb.normalize();
+
+                       dst.push(_cb.x, _cb.y, _cb.z);
+                       dst.push(_cb.x, _cb.y, _cb.z);
+                       dst.push(_cb.x, _cb.y, _cb.z);
+
+               },
+
+               addColor: function (a, b, c) {
+
+                       const src = this.colors;
+                       const dst = this.object.geometry.colors;
+
+                       if (src[a] !== undefined) dst.push(src[a + 0], src[a + 1], src[a + 2]);
+                       if (src[b] !== undefined) dst.push(src[b + 0], src[b + 1], src[b + 2]);
+                       if (src[c] !== undefined) dst.push(src[c + 0], src[c + 1], src[c + 2]);
+
+               },
+
+               addUV: function (a, b, c) {
+
+                       const src = this.uvs;
+                       const dst = this.object.geometry.uvs;
+
+                       dst.push(src[a + 0], src[a + 1]);
+                       dst.push(src[b + 0], src[b + 1]);
+                       dst.push(src[c + 0], src[c + 1]);
+
+               },
+
+               addDefaultUV: function () {
+
+                       const dst = this.object.geometry.uvs;
+
+                       dst.push(0, 0);
+                       dst.push(0, 0);
+                       dst.push(0, 0);
+
+               },
+
+               addUVLine: function (a) {
+
+                       const src = this.uvs;
+                       const dst = this.object.geometry.uvs;
+
+                       dst.push(src[a + 0], src[a + 1]);
+
+               },
+
+               addFace: function (a, b, c, ua, ub, uc, na, nb, nc) {
+
+                       const vLen = this.vertices.length;
+
+                       let ia = this.parseVertexIndex(a, vLen);
+                       let ib = this.parseVertexIndex(b, vLen);
+                       let ic = this.parseVertexIndex(c, vLen);
+
+                       this.addVertex(ia, ib, ic);
+                       this.addColor(ia, ib, ic);
+
+                       // normals
+
+                       if (na !== undefined && na !== '') {
+
+                               const nLen = this.normals.length;
+
+                               ia = this.parseNormalIndex(na, nLen);
+                               ib = this.parseNormalIndex(nb, nLen);
+                               ic = this.parseNormalIndex(nc, nLen);
+
+                               this.addNormal(ia, ib, ic);
+
+                       } else {
+
+                               this.addFaceNormal(ia, ib, ic);
+
+                       }
+
+                       // uvs
+
+                       if (ua !== undefined && ua !== '') {
+
+                               const uvLen = this.uvs.length;
+
+                               ia = this.parseUVIndex(ua, uvLen);
+                               ib = this.parseUVIndex(ub, uvLen);
+                               ic = this.parseUVIndex(uc, uvLen);
+
+                               this.addUV(ia, ib, ic);
+
+                               this.object.geometry.hasUVIndices = true;
+
+                       } else {
+
+                               // add placeholder values (for inconsistent face definitions)
+
+                               this.addDefaultUV();
+
+                       }
+
+               },
+
+               addPointGeometry: function (vertices) {
+
+                       this.object.geometry.type = 'THREE.Points';
+
+                       const vLen = this.vertices.length;
+
+                       for (let vi = 0, l = vertices.length; vi < l; vi++) {
+
+                               const index = this.parseVertexIndex(vertices[vi], vLen);
+
+                               this.addVertexPoint(index);
+                               this.addColor(index);
+
+                       }
+
+               },
+
+               addLineGeometry: function (vertices, uvs) {
+
+                       this.object.geometry.type = 'Line';
+
+                       const vLen = this.vertices.length;
+                       const uvLen = this.uvs.length;
+
+                       for (let vi = 0, l = vertices.length; vi < l; vi++) {
+
+                               this.addVertexLine(this.parseVertexIndex(vertices[vi], vLen));
+
+                       }
+
+                       for (let uvi = 0, l = uvs.length; uvi < l; uvi++) {
+
+                               this.addUVLine(this.parseUVIndex(uvs[uvi], uvLen));
+
+                       }
+
+               }
+
+       };
+
+       state.startObject('', false);
+
+       return state;
+
+}
+
+//
+
+class OBJLoader extends THREE.Loader {
+
+       constructor(manager) {
+
+               super(manager);
+
+               this.materials = null;
+
+       }
+
+       load(url, onLoad, onProgress, onError) {
+
+               const scope = this;
+
+               const loader = new THREE.FileLoader(this.manager);
+               loader.setPath(this.path);
+               loader.setRequestHeader(this.requestHeader);
+               loader.setWithCredentials(this.withCredentials);
+               loader.load(url, function (text) {
+
+                       try {
+
+                               onLoad(scope.parse(text));
+
+                       } catch (e) {
+
+                               if (onError) {
+
+                                       onError(e);
+
+                               } else {
+
+                                       console.error(e);
+
+                               }
+
+                               scope.manager.itemError(url);
+
+                       }
+
+               }, onProgress, onError);
+
+       }
+
+       setMaterials(materials) {
+
+               this.materials = materials;
+
+               return this;
+
+       }
+
+       parse(text) {
+
+               const state = new ParserState();
+
+               if (text.indexOf('\r\n') !== -1) {
+
+                       // This is faster than String.split with regex that splits on both
+                       text = text.replace(/\r\n/g, '\n');
+
+               }
+
+               if (text.indexOf('\\\n') !== -1) {
+
+                       // join lines separated by a line continuation character (\)
+                       text = text.replace(/\\\n/g, '');
+
+               }
+
+               const lines = text.split('\n');
+               let line = '', lineFirstChar = '';
+               let lineLength = 0;
+               let result = [];
+
+               // Faster to just trim left side of the line. Use if available.
+               const trimLeft = (typeof ''.trimLeft === 'function');
+
+               for (let i = 0, l = lines.length; i < l; i++) {
+
+                       line = lines[i];
+
+                       line = trimLeft ? line.trimLeft() : line.trim();
+
+                       lineLength = line.length;
+
+                       if (lineLength === 0) continue;
+
+                       lineFirstChar = line.charAt(0);
+
+                       // @todo invoke passed in handler if any
+                       if (lineFirstChar === '#') continue;
+
+                       if (lineFirstChar === 'v') {
+
+                               const data = line.split(/\s+/);
+
+                               switch (data[0]) {
+
+                                       case 'v':
+                                               state.vertices.push(
+                                                       parseFloat(data[1]),
+                                                       parseFloat(data[2]),
+                                                       parseFloat(data[3])
+                                               );
+                                               if (data.length >= 7) {
+
+                                                       state.colors.push(
+                                                               parseFloat(data[4]),
+                                                               parseFloat(data[5]),
+                                                               parseFloat(data[6])
+                                                       );
+
+                                               } else {
+
+                                                       // if no colors are defined, add placeholders so color and vertex indices match
+
+                                                       state.colors.push(undefined, undefined, undefined);
+
+                                               }
+
+                                               break;
+                                       case 'vn':
+                                               state.normals.push(
+                                                       parseFloat(data[1]),
+                                                       parseFloat(data[2]),
+                                                       parseFloat(data[3])
+                                               );
+                                               break;
+                                       case 'vt':
+                                               state.uvs.push(
+                                                       parseFloat(data[1]),
+                                                       parseFloat(data[2])
+                                               );
+                                               break;
+
+                               }
+
+                       } else if (lineFirstChar === 'f') {
+
+                               const lineData = line.substr(1).trim();
+                               const vertexData = lineData.split(/\s+/);
+                               const faceVertices = [];
+
+                               // Parse the face vertex data into an easy to work with format
+
+                               for (let j = 0, jl = vertexData.length; j < jl; j++) {
+
+                                       const vertex = vertexData[j];
+
+                                       if (vertex.length > 0) {
+
+                                               const vertexParts = vertex.split('/');
+                                               faceVertices.push(vertexParts);
+
+                                       }
+
+                               }
+
+                               // Draw an edge between the first vertex and all subsequent vertices to form an n-gon
+
+                               const v1 = faceVertices[0];
+
+                               for (let j = 1, jl = faceVertices.length - 1; j < jl; j++) {
+
+                                       const v2 = faceVertices[j];
+                                       const v3 = faceVertices[j + 1];
+
+                                       state.addFace(
+                                               v1[0], v2[0], v3[0],
+                                               v1[1], v2[1], v3[1],
+                                               v1[2], v2[2], v3[2]
+                                       );
+
+                               }
+
+                       } else if (lineFirstChar === 'l') {
+
+                               const lineParts = line.substring(1).trim().split(' ');
+                               let lineVertices = [];
+                               const lineUVs = [];
+
+                               if (line.indexOf('/') === -1) {
+
+                                       lineVertices = lineParts;
+
+                               } else {
+
+                                       for (let li = 0, llen = lineParts.length; li < llen; li++) {
+
+                                               const parts = lineParts[li].split('/');
+
+                                               if (parts[0] !== '') lineVertices.push(parts[0]);
+                                               if (parts[1] !== '') lineUVs.push(parts[1]);
+
+                                       }
+
+                               }
+
+                               state.addLineGeometry(lineVertices, lineUVs);
+
+                       } else if (lineFirstChar === 'p') {
+
+                               const lineData = line.substr(1).trim();
+                               const pointData = lineData.split(' ');
+
+                               state.addPointGeometry(pointData);
+
+                       } else if ((result = _object_pattern.exec(line)) !== null) {
+
+                               // o object_name
+                               // or
+                               // g group_name
+
+                               // WORKAROUND: https://bugs.chromium.org/p/v8/issues/detail?id=2869
+                               // let name = result[ 0 ].substr( 1 ).trim();
+                               const name = (' ' + result[0].substr(1).trim()).substr(1);
+
+                               state.startObject(name);
+
+                       } else if (_material_use_pattern.test(line)) {
+
+                               // material
+
+                               state.object.startMaterial(line.substring(7).trim(), state.materialLibraries);
+
+                       } else if (_material_library_pattern.test(line)) {
+
+                               // mtl file
+
+                               state.materialLibraries.push(line.substring(7).trim());
+
+                       } else if (_map_use_pattern.test(line)) {
+
+                               // the line is parsed but ignored since the loader assumes textures are defined MTL files
+                               // (according to https://www.okino.com/conv/imp_wave.htm, 'usemap' is the old-style Wavefront texture reference method)
+
+                               console.warn('THREE.OBJLoader: Rendering identifier "usemap" not supported. Textures must be defined in MTL files.');
+
+                       } else if (lineFirstChar === 's') {
+
+                               result = line.split(' ');
+
+                               // smooth shading
+
+                               // @todo Handle files that have varying smooth values for a set of faces inside one geometry,
+                               // but does not define a usemtl for each face set.
+                               // This should be detected and a dummy material created (later MultiMaterial and geometry groups).
+                               // This requires some care to not create extra material on each smooth value for "normal" obj files.
+                               // where explicit usemtl defines geometry groups.
+                               // Example asset: examples/models/obj/cerberus/Cerberus.obj
+
+                               /*
+                                        * http://paulbourke.net/dataformats/obj/
+                                        * or
+                                        * http://www.cs.utah.edu/~boulos/cs3505/obj_spec.pdf
+                                        *
+                                        * From chapter "Grouping" Syntax explanation "s group_number":
+                                        * "group_number is the smoothing group number. To turn off smoothing groups, use a value of 0 or off.
+                                        * Polygonal elements use group numbers to put elements in different smoothing groups. For free-form
+                                        * surfaces, smoothing groups are either turned on or off; there is no difference between values greater
+                                        * than 0."
+                                        */
+                               if (result.length > 1) {
+
+                                       const value = result[1].trim().toLowerCase();
+                                       state.object.smooth = (value !== '0' && value !== 'off');
+
+                               } else {
+
+                                       // ZBrush can produce "s" lines #11707
+                                       state.object.smooth = true;
+
+                               }
+
+                               const material = state.object.currentMaterial();
+                               if (material) material.smooth = state.object.smooth;
+
+                       } else {
+
+                               // Handle null terminated files without exception
+                               if (line === '\0') continue;
+
+                               console.warn('THREE.OBJLoader: Unexpected line: "' + line + '"');
+
+                       }
+
+               }
+
+               state.finalize();
+
+               const container = new THREE.Group();
+               container.materialLibraries = [].concat(state.materialLibraries);
+
+               const hasPrimitives = !(state.objects.length === 1 && state.objects[0].geometry.vertices.length === 0);
+
+               if (hasPrimitives === true) {
+
+                       for (let i = 0, l = state.objects.length; i < l; i++) {
+
+                               const object = state.objects[i];
+                               const geometry = object.geometry;
+                               const materials = object.materials;
+                               const isLine = (geometry.type === 'Line');
+                               const isPoints = (geometry.type === 'THREE.Points');
+                               let hasVertexColors = false;
+
+                               // Skip o/g line declarations that did not follow with any faces
+                               if (geometry.vertices.length === 0) continue;
+
+                               const buffergeometry = new THREE.BufferGeometry();
+
+                               buffergeometry.setAttribute('position', new THREE.Float32BufferAttribute(geometry.vertices, 3));
+
+                               if (geometry.normals.length > 0) {
+
+                                       buffergeometry.setAttribute('normal', new THREE.Float32BufferAttribute(geometry.normals, 3));
+
+                               }
+
+                               if (geometry.colors.length > 0) {
+
+                                       hasVertexColors = true;
+                                       buffergeometry.setAttribute('color', new THREE.Float32BufferAttribute(geometry.colors, 3));
+
+                               }
+
+                               if (geometry.hasUVIndices === true) {
+
+                                       buffergeometry.setAttribute('uv', new THREE.Float32BufferAttribute(geometry.uvs, 2));
+
+                               }
+
+                               // Create materials
+
+                               const createdMaterials = [];
+
+                               for (let mi = 0, miLen = materials.length; mi < miLen; mi++) {
+
+                                       const sourceMaterial = materials[mi];
+                                       const materialHash = sourceMaterial.name + '_' + sourceMaterial.smooth + '_' + hasVertexColors;
+                                       let material = state.materials[materialHash];
+
+                                       if (this.materials !== null) {
+
+                                               material = this.materials.create(sourceMaterial.name);
+
+                                               // mtl etc. loaders probably can't create line materials correctly, copy properties to a line material.
+                                               if (isLine && material && !(material instanceof THREE.LineBasicMaterial)) {
+
+                                                       const materialLine = new THREE.LineBasicMaterial();
+                                                       THREE.Material.prototype.copy.call(materialLine, material);
+                                                       materialLine.color.copy(material.color);
+                                                       material = materialLine;
+
+                                               } else if (isPoints && material && !(material instanceof THREE.PointsMaterial)) {
+
+                                                       const materialPoints = new THREE.PointsMaterial({size: 10, sizeAttenuation: false});
+                                                       THREE.Material.prototype.copy.call(materialPoints, material);
+                                                       materialPoints.color.copy(material.color);
+                                                       materialPoints.map = material.map;
+                                                       material = materialPoints;
+
+                                               }
+
+                                       }
+
+                                       if (material === undefined) {
+
+                                               if (isLine) {
+
+                                                       material = new THREE.LineBasicMaterial();
+
+                                               } else if (isPoints) {
+
+                                                       material = new THREE.PointsMaterial({size: 1, sizeAttenuation: false});
+
+                                               } else {
+
+                                                       material = new THREE.MeshPhongMaterial();
+
+                                               }
+
+                                               material.name = sourceMaterial.name;
+                                               material.flatShading = sourceMaterial.smooth ? false : true;
+                                               material.vertexColors = hasVertexColors;
+
+                                               state.materials[materialHash] = material;
+
+                                       }
+
+                                       createdMaterials.push(material);
+
+                               }
+
+                               // Create mesh
+
+                               let mesh;
+
+                               if (createdMaterials.length > 1) {
+
+                                       for (let mi = 0, miLen = materials.length; mi < miLen; mi++) {
+
+                                               const sourceMaterial = materials[mi];
+                                               buffergeometry.addGroup(sourceMaterial.groupStart, sourceMaterial.groupCount, mi);
+
+                                       }
+
+                                       if (isLine) {
+
+                                               mesh = new THREE.LineSegments(buffergeometry, createdMaterials);
+
+                                       } else if (isPoints) {
+
+                                               mesh = new THREE.Points(buffergeometry, createdMaterials);
+
+                                       } else {
+
+                                               mesh = new THREE.Mesh(buffergeometry, createdMaterials);
+
+                                       }
+
+                               } else {
+
+                                       if (isLine) {
+
+                                               mesh = new THREE.LineSegments(buffergeometry, createdMaterials[0]);
+
+                                       } else if (isPoints) {
+
+                                               mesh = new THREE.Points(buffergeometry, createdMaterials[0]);
+
+                                       } else {
+
+                                               mesh = new THREE.Mesh(buffergeometry, createdMaterials[0]);
+
+                                       }
+
+                               }
+
+                               mesh.name = object.name;
+
+                               container.add(mesh);
+
+                       }
+
+               } else {
+
+                       // if there is only the default parser state object with no geometry data, interpret data as point cloud
+
+                       if (state.vertices.length > 0) {
+
+                               const material = new THREE.PointsMaterial({size: 1, sizeAttenuation: false});
+
+                               const buffergeometry = new THREE.BufferGeometry();
+
+                               buffergeometry.setAttribute('position', new THREE.Float32BufferAttribute(state.vertices, 3));
+
+                               if (state.colors.length > 0 && state.colors[0] !== undefined) {
+
+                                       buffergeometry.setAttribute('color', new THREE.Float32BufferAttribute(state.colors, 3));
+                                       material.vertexColors = true;
+
+                               }
+
+                               const points = new THREE.Points(buffergeometry, material);
+                               container.add(points);
+
+                       }
+
+               }
+
+               return container;
+
+       }
+
+}
+
+module.exports = {OBJLoader: OBJLoader};
+
+},{}]},{},[1,3]);
diff --git a/src/main/resources/static/obj-viewer/three.js b/src/main/resources/static/obj-viewer/three.js
new file mode 100644 (file)
index 0000000..595636b
--- /dev/null
@@ -0,0 +1,36493 @@
+(function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){
+window["THREE"] = require("three");
+},{"three":2}],2:[function(require,module,exports){
+/**
+ * @license
+ * Copyright 2010-2021 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 = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.THREE = {}));
+}(this, (function (exports) { 'use strict';
+
+       const REVISION = '132';
+       const MOUSE = {
+               LEFT: 0,
+               MIDDLE: 1,
+               RIGHT: 2,
+               ROTATE: 0,
+               DOLLY: 1,
+               PAN: 2
+       };
+       const TOUCH = {
+               ROTATE: 0,
+               PAN: 1,
+               DOLLY_PAN: 2,
+               DOLLY_ROTATE: 3
+       };
+       const CullFaceNone = 0;
+       const CullFaceBack = 1;
+       const CullFaceFront = 2;
+       const CullFaceFrontBack = 3;
+       const BasicShadowMap = 0;
+       const PCFShadowMap = 1;
+       const PCFSoftShadowMap = 2;
+       const VSMShadowMap = 3;
+       const FrontSide = 0;
+       const BackSide = 1;
+       const DoubleSide = 2;
+       const FlatShading = 1;
+       const SmoothShading = 2;
+       const NoBlending = 0;
+       const NormalBlending = 1;
+       const AdditiveBlending = 2;
+       const SubtractiveBlending = 3;
+       const MultiplyBlending = 4;
+       const CustomBlending = 5;
+       const AddEquation = 100;
+       const SubtractEquation = 101;
+       const ReverseSubtractEquation = 102;
+       const MinEquation = 103;
+       const MaxEquation = 104;
+       const ZeroFactor = 200;
+       const OneFactor = 201;
+       const SrcColorFactor = 202;
+       const OneMinusSrcColorFactor = 203;
+       const SrcAlphaFactor = 204;
+       const OneMinusSrcAlphaFactor = 205;
+       const DstAlphaFactor = 206;
+       const OneMinusDstAlphaFactor = 207;
+       const DstColorFactor = 208;
+       const OneMinusDstColorFactor = 209;
+       const SrcAlphaSaturateFactor = 210;
+       const NeverDepth = 0;
+       const AlwaysDepth = 1;
+       const LessDepth = 2;
+       const LessEqualDepth = 3;
+       const EqualDepth = 4;
+       const GreaterEqualDepth = 5;
+       const GreaterDepth = 6;
+       const NotEqualDepth = 7;
+       const MultiplyOperation = 0;
+       const MixOperation = 1;
+       const AddOperation = 2;
+       const NoToneMapping = 0;
+       const LinearToneMapping = 1;
+       const ReinhardToneMapping = 2;
+       const CineonToneMapping = 3;
+       const ACESFilmicToneMapping = 4;
+       const CustomToneMapping = 5;
+       const UVMapping = 300;
+       const CubeReflectionMapping = 301;
+       const CubeRefractionMapping = 302;
+       const EquirectangularReflectionMapping = 303;
+       const EquirectangularRefractionMapping = 304;
+       const CubeUVReflectionMapping = 306;
+       const CubeUVRefractionMapping = 307;
+       const RepeatWrapping = 1000;
+       const ClampToEdgeWrapping = 1001;
+       const MirroredRepeatWrapping = 1002;
+       const NearestFilter = 1003;
+       const NearestMipmapNearestFilter = 1004;
+       const NearestMipMapNearestFilter = 1004;
+       const NearestMipmapLinearFilter = 1005;
+       const NearestMipMapLinearFilter = 1005;
+       const LinearFilter = 1006;
+       const LinearMipmapNearestFilter = 1007;
+       const LinearMipMapNearestFilter = 1007;
+       const LinearMipmapLinearFilter = 1008;
+       const LinearMipMapLinearFilter = 1008;
+       const UnsignedByteType = 1009;
+       const ByteType = 1010;
+       const ShortType = 1011;
+       const UnsignedShortType = 1012;
+       const IntType = 1013;
+       const UnsignedIntType = 1014;
+       const FloatType = 1015;
+       const HalfFloatType = 1016;
+       const UnsignedShort4444Type = 1017;
+       const UnsignedShort5551Type = 1018;
+       const UnsignedShort565Type = 1019;
+       const UnsignedInt248Type = 1020;
+       const AlphaFormat = 1021;
+       const RGBFormat = 1022;
+       const RGBAFormat = 1023;
+       const LuminanceFormat = 1024;
+       const LuminanceAlphaFormat = 1025;
+       const RGBEFormat = RGBAFormat;
+       const DepthFormat = 1026;
+       const DepthStencilFormat = 1027;
+       const RedFormat = 1028;
+       const RedIntegerFormat = 1029;
+       const RGFormat = 1030;
+       const RGIntegerFormat = 1031;
+       const RGBIntegerFormat = 1032;
+       const RGBAIntegerFormat = 1033;
+       const RGB_S3TC_DXT1_Format = 33776;
+       const RGBA_S3TC_DXT1_Format = 33777;
+       const RGBA_S3TC_DXT3_Format = 33778;
+       const RGBA_S3TC_DXT5_Format = 33779;
+       const RGB_PVRTC_4BPPV1_Format = 35840;
+       const RGB_PVRTC_2BPPV1_Format = 35841;
+       const RGBA_PVRTC_4BPPV1_Format = 35842;
+       const RGBA_PVRTC_2BPPV1_Format = 35843;
+       const RGB_ETC1_Format = 36196;
+       const RGB_ETC2_Format = 37492;
+       const RGBA_ETC2_EAC_Format = 37496;
+       const RGBA_ASTC_4x4_Format = 37808;
+       const RGBA_ASTC_5x4_Format = 37809;
+       const RGBA_ASTC_5x5_Format = 37810;
+       const RGBA_ASTC_6x5_Format = 37811;
+       const RGBA_ASTC_6x6_Format = 37812;
+       const RGBA_ASTC_8x5_Format = 37813;
+       const RGBA_ASTC_8x6_Format = 37814;
+       const RGBA_ASTC_8x8_Format = 37815;
+       const RGBA_ASTC_10x5_Format = 37816;
+       const RGBA_ASTC_10x6_Format = 37817;
+       const RGBA_ASTC_10x8_Format = 37818;
+       const RGBA_ASTC_10x10_Format = 37819;
+       const RGBA_ASTC_12x10_Format = 37820;
+       const RGBA_ASTC_12x12_Format = 37821;
+       const RGBA_BPTC_Format = 36492;
+       const SRGB8_ALPHA8_ASTC_4x4_Format = 37840;
+       const SRGB8_ALPHA8_ASTC_5x4_Format = 37841;
+       const SRGB8_ALPHA8_ASTC_5x5_Format = 37842;
+       const SRGB8_ALPHA8_ASTC_6x5_Format = 37843;
+       const SRGB8_ALPHA8_ASTC_6x6_Format = 37844;
+       const SRGB8_ALPHA8_ASTC_8x5_Format = 37845;
+       const SRGB8_ALPHA8_ASTC_8x6_Format = 37846;
+       const SRGB8_ALPHA8_ASTC_8x8_Format = 37847;
+       const SRGB8_ALPHA8_ASTC_10x5_Format = 37848;
+       const SRGB8_ALPHA8_ASTC_10x6_Format = 37849;
+       const SRGB8_ALPHA8_ASTC_10x8_Format = 37850;
+       const SRGB8_ALPHA8_ASTC_10x10_Format = 37851;
+       const SRGB8_ALPHA8_ASTC_12x10_Format = 37852;
+       const SRGB8_ALPHA8_ASTC_12x12_Format = 37853;
+       const LoopOnce = 2200;
+       const LoopRepeat = 2201;
+       const LoopPingPong = 2202;
+       const InterpolateDiscrete = 2300;
+       const InterpolateLinear = 2301;
+       const InterpolateSmooth = 2302;
+       const ZeroCurvatureEnding = 2400;
+       const ZeroSlopeEnding = 2401;
+       const WrapAroundEnding = 2402;
+       const NormalAnimationBlendMode = 2500;
+       const AdditiveAnimationBlendMode = 2501;
+       const TrianglesDrawMode = 0;
+       const TriangleStripDrawMode = 1;
+       const TriangleFanDrawMode = 2;
+       const LinearEncoding = 3000;
+       const sRGBEncoding = 3001;
+       const GammaEncoding = 3007;
+       const RGBEEncoding = 3002;
+       const LogLuvEncoding = 3003;
+       const RGBM7Encoding = 3004;
+       const RGBM16Encoding = 3005;
+       const RGBDEncoding = 3006;
+       const BasicDepthPacking = 3200;
+       const RGBADepthPacking = 3201;
+       const TangentSpaceNormalMap = 0;
+       const ObjectSpaceNormalMap = 1;
+       const ZeroStencilOp = 0;
+       const KeepStencilOp = 7680;
+       const ReplaceStencilOp = 7681;
+       const IncrementStencilOp = 7682;
+       const DecrementStencilOp = 7683;
+       const IncrementWrapStencilOp = 34055;
+       const DecrementWrapStencilOp = 34056;
+       const InvertStencilOp = 5386;
+       const NeverStencilFunc = 512;
+       const LessStencilFunc = 513;
+       const EqualStencilFunc = 514;
+       const LessEqualStencilFunc = 515;
+       const GreaterStencilFunc = 516;
+       const NotEqualStencilFunc = 517;
+       const GreaterEqualStencilFunc = 518;
+       const AlwaysStencilFunc = 519;
+       const StaticDrawUsage = 35044;
+       const DynamicDrawUsage = 35048;
+       const StreamDrawUsage = 35040;
+       const StaticReadUsage = 35045;
+       const DynamicReadUsage = 35049;
+       const StreamReadUsage = 35041;
+       const StaticCopyUsage = 35046;
+       const DynamicCopyUsage = 35050;
+       const StreamCopyUsage = 35042;
+       const GLSL1 = '100';
+       const GLSL3 = '300 es';
+
+       /**
+        * https://github.com/mrdoob/eventdispatcher.js/
+        */
+       class EventDispatcher {
+               addEventListener(type, listener) {
+                       if (this._listeners === undefined) this._listeners = {};
+                       const listeners = this._listeners;
+
+                       if (listeners[type] === undefined) {
+                               listeners[type] = [];
+                       }
+
+                       if (listeners[type].indexOf(listener) === -1) {
+                               listeners[type].push(listener);
+                       }
+               }
+
+               hasEventListener(type, listener) {
+                       if (this._listeners === undefined) return false;
+                       const listeners = this._listeners;
+                       return listeners[type] !== undefined && listeners[type].indexOf(listener) !== -1;
+               }
+
+               removeEventListener(type, listener) {
+                       if (this._listeners === undefined) return;
+                       const listeners = this._listeners;
+                       const listenerArray = listeners[type];
+
+                       if (listenerArray !== undefined) {
+                               const index = listenerArray.indexOf(listener);
+
+                               if (index !== -1) {
+                                       listenerArray.splice(index, 1);
+                               }
+                       }
+               }
+
+               dispatchEvent(event) {
+                       if (this._listeners === undefined) return;
+                       const listeners = this._listeners;
+                       const listenerArray = listeners[event.type];
+
+                       if (listenerArray !== undefined) {
+                               event.target = this; // Make a copy, in case listeners are removed while iterating.
+
+                               const array = listenerArray.slice(0);
+
+                               for (let i = 0, l = array.length; i < l; i++) {
+                                       array[i].call(this, event);
+                               }
+
+                               event.target = null;
+                       }
+               }
+
+       }
+
+       const _lut = [];
+
+       for (let i = 0; i < 256; i++) {
+               _lut[i] = (i < 16 ? '0' : '') + i.toString(16);
+       }
+
+       let _seed = 1234567;
+       const DEG2RAD = Math.PI / 180;
+       const RAD2DEG = 180 / Math.PI; // http://stackoverflow.com/questions/105034/how-to-create-a-guid-uuid-in-javascript/21963136#21963136
+
+       function generateUUID() {
+               const d0 = Math.random() * 0xffffffff | 0;
+               const d1 = Math.random() * 0xffffffff | 0;
+               const d2 = Math.random() * 0xffffffff | 0;
+               const d3 = Math.random() * 0xffffffff | 0;
+               const uuid = _lut[d0 & 0xff] + _lut[d0 >> 8 & 0xff] + _lut[d0 >> 16 & 0xff] + _lut[d0 >> 24 & 0xff] + '-' + _lut[d1 & 0xff] + _lut[d1 >> 8 & 0xff] + '-' + _lut[d1 >> 16 & 0x0f | 0x40] + _lut[d1 >> 24 & 0xff] + '-' + _lut[d2 & 0x3f | 0x80] + _lut[d2 >> 8 & 0xff] + '-' + _lut[d2 >> 16 & 0xff] + _lut[d2 >> 24 & 0xff] + _lut[d3 & 0xff] + _lut[d3 >> 8 & 0xff] + _lut[d3 >> 16 & 0xff] + _lut[d3 >> 24 & 0xff]; // .toUpperCase() here flattens concatenated strings to save heap memory space.
+
+               return uuid.toUpperCase();
+       }
+
+       function clamp(value, min, max) {
+               return Math.max(min, Math.min(max, value));
+       } // compute euclidian modulo of m % n
+       // https://en.wikipedia.org/wiki/Modulo_operation
+
+
+       function euclideanModulo(n, m) {
+               return (n % m + m) % m;
+       } // Linear mapping from range <a1, a2> to range <b1, b2>
+
+
+       function mapLinear(x, a1, a2, b1, b2) {
+               return b1 + (x - a1) * (b2 - b1) / (a2 - a1);
+       } // https://www.gamedev.net/tutorials/programming/general-and-gameplay-programming/inverse-lerp-a-super-useful-yet-often-overlooked-function-r5230/
+
+
+       function inverseLerp(x, y, value) {
+               if (x !== y) {
+                       return (value - x) / (y - x);
+               } else {
+                       return 0;
+               }
+       } // https://en.wikipedia.org/wiki/Linear_interpolation
+
+
+       function lerp(x, y, t) {
+               return (1 - t) * x + t * y;
+       } // http://www.rorydriscoll.com/2016/03/07/frame-rate-independent-damping-using-lerp/
+
+
+       function damp(x, y, lambda, dt) {
+               return lerp(x, y, 1 - Math.exp(-lambda * dt));
+       } // https://www.desmos.com/calculator/vcsjnyz7x4
+
+
+       function pingpong(x, length = 1) {
+               return length - Math.abs(euclideanModulo(x, length * 2) - length);
+       } // http://en.wikipedia.org/wiki/Smoothstep
+
+
+       function smoothstep(x, min, max) {
+               if (x <= min) return 0;
+               if (x >= max) return 1;
+               x = (x - min) / (max - min);
+               return x * x * (3 - 2 * x);
+       }
+
+       function smootherstep(x, min, max) {
+               if (x <= min) return 0;
+               if (x >= max) return 1;
+               x = (x - min) / (max - min);
+               return x * x * x * (x * (x * 6 - 15) + 10);
+       } // Random integer from <low, high> interval
+
+
+       function randInt(low, high) {
+               return low + Math.floor(Math.random() * (high - low + 1));
+       } // Random float from <low, high> interval
+
+
+       function randFloat(low, high) {
+               return low + Math.random() * (high - low);
+       } // Random float from <-range/2, range/2> interval
+
+
+       function randFloatSpread(range) {
+               return range * (0.5 - Math.random());
+       } // Deterministic pseudo-random float in the interval [ 0, 1 ]
+
+
+       function seededRandom(s) {
+               if (s !== undefined) _seed = s % 2147483647; // Park-Miller algorithm
+
+               _seed = _seed * 16807 % 2147483647;
+               return (_seed - 1) / 2147483646;
+       }
+
+       function degToRad(degrees) {
+               return degrees * DEG2RAD;
+       }
+
+       function radToDeg(radians) {
+               return radians * RAD2DEG;
+       }
+
+       function isPowerOfTwo(value) {
+               return (value & value - 1) === 0 && value !== 0;
+       }
+
+       function ceilPowerOfTwo(value) {
+               return Math.pow(2, Math.ceil(Math.log(value) / Math.LN2));
+       }
+
+       function floorPowerOfTwo(value) {
+               return Math.pow(2, Math.floor(Math.log(value) / Math.LN2));
+       }
+
+       function setQuaternionFromProperEuler(q, a, b, c, order) {
+               // Intrinsic Proper Euler Angles - see https://en.wikipedia.org/wiki/Euler_angles
+               // rotations are applied to the axes in the order specified by 'order'
+               // rotation by angle 'a' is applied first, then by angle 'b', then by angle 'c'
+               // angles are in radians
+               const cos = Math.cos;
+               const sin = Math.sin;
+               const c2 = cos(b / 2);
+               const s2 = sin(b / 2);
+               const c13 = cos((a + c) / 2);
+               const s13 = sin((a + c) / 2);
+               const c1_3 = cos((a - c) / 2);
+               const s1_3 = sin((a - c) / 2);
+               const c3_1 = cos((c - a) / 2);
+               const s3_1 = sin((c - a) / 2);
+
+               switch (order) {
+                       case 'XYX':
+                               q.set(c2 * s13, s2 * c1_3, s2 * s1_3, c2 * c13);
+                               break;
+
+                       case 'YZY':
+                               q.set(s2 * s1_3, c2 * s13, s2 * c1_3, c2 * c13);
+                               break;
+
+                       case 'ZXZ':
+                               q.set(s2 * c1_3, s2 * s1_3, c2 * s13, c2 * c13);
+                               break;
+
+                       case 'XZX':
+                               q.set(c2 * s13, s2 * s3_1, s2 * c3_1, c2 * c13);
+                               break;
+
+                       case 'YXY':
+                               q.set(s2 * c3_1, c2 * s13, s2 * s3_1, c2 * c13);
+                               break;
+
+                       case 'ZYZ':
+                               q.set(s2 * s3_1, s2 * c3_1, c2 * s13, c2 * c13);
+                               break;
+
+                       default:
+                               console.warn('THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: ' + order);
+               }
+       }
+
+       var MathUtils = /*#__PURE__*/Object.freeze({
+               __proto__: null,
+               DEG2RAD: DEG2RAD,
+               RAD2DEG: RAD2DEG,
+               generateUUID: generateUUID,
+               clamp: clamp,
+               euclideanModulo: euclideanModulo,
+               mapLinear: mapLinear,
+               inverseLerp: inverseLerp,
+               lerp: lerp,
+               damp: damp,
+               pingpong: pingpong,
+               smoothstep: smoothstep,
+               smootherstep: smootherstep,
+               randInt: randInt,
+               randFloat: randFloat,
+               randFloatSpread: randFloatSpread,
+               seededRandom: seededRandom,
+               degToRad: degToRad,
+               radToDeg: radToDeg,
+               isPowerOfTwo: isPowerOfTwo,
+               ceilPowerOfTwo: ceilPowerOfTwo,
+               floorPowerOfTwo: floorPowerOfTwo,
+               setQuaternionFromProperEuler: setQuaternionFromProperEuler
+       });
+
+       class Vector2 {
+               constructor(x = 0, y = 0) {
+                       this.x = x;
+                       this.y = y;
+               }
+
+               get width() {
+                       return this.x;
+               }
+
+               set width(value) {
+                       this.x = value;
+               }
+
+               get height() {
+                       return this.y;
+               }
+
+               set height(value) {
+                       this.y = value;
+               }
+
+               set(x, y) {
+                       this.x = x;
+                       this.y = y;
+                       return this;
+               }
+
+               setScalar(scalar) {
+                       this.x = scalar;
+                       this.y = scalar;
+                       return this;
+               }
+
+               setX(x) {
+                       this.x = x;
+                       return this;
+               }
+
+               setY(y) {
+                       this.y = y;
+                       return this;
+               }
+
+               setComponent(index, value) {
+                       switch (index) {
+                               case 0:
+                                       this.x = value;
+                                       break;
+
+                               case 1:
+                                       this.y = value;
+                                       break;
+
+                               default:
+                                       throw new Error('index is out of range: ' + index);
+                       }
+
+                       return this;
+               }
+
+               getComponent(index) {
+                       switch (index) {
+                               case 0:
+                                       return this.x;
+
+                               case 1:
+                                       return this.y;
+
+                               default:
+                                       throw new Error('index is out of range: ' + index);
+                       }
+               }
+
+               clone() {
+                       return new this.constructor(this.x, this.y);
+               }
+
+               copy(v) {
+                       this.x = v.x;
+                       this.y = v.y;
+                       return this;
+               }
+
+               add(v, w) {
+                       if (w !== undefined) {
+                               console.warn('THREE.Vector2: .add() now only accepts one argument. Use .addVectors( a, b ) instead.');
+                               return this.addVectors(v, w);
+                       }
+
+                       this.x += v.x;
+                       this.y += v.y;
+                       return this;
+               }
+
+               addScalar(s) {
+                       this.x += s;
+                       this.y += s;
+                       return this;
+               }
+
+               addVectors(a, b) {
+                       this.x = a.x + b.x;
+                       this.y = a.y + b.y;
+                       return this;
+               }
+
+               addScaledVector(v, s) {
+                       this.x += v.x * s;
+                       this.y += v.y * s;
+                       return this;
+               }
+
+               sub(v, w) {
+                       if (w !== undefined) {
+                               console.warn('THREE.Vector2: .sub() now only accepts one argument. Use .subVectors( a, b ) instead.');
+                               return this.subVectors(v, w);
+                       }
+
+                       this.x -= v.x;
+                       this.y -= v.y;
+                       return this;
+               }
+
+               subScalar(s) {
+                       this.x -= s;
+                       this.y -= s;
+                       return this;
+               }
+
+               subVectors(a, b) {
+                       this.x = a.x - b.x;
+                       this.y = a.y - b.y;
+                       return this;
+               }
+
+               multiply(v) {
+                       this.x *= v.x;
+                       this.y *= v.y;
+                       return this;
+               }
+
+               multiplyScalar(scalar) {
+                       this.x *= scalar;
+                       this.y *= scalar;
+                       return this;
+               }
+
+               divide(v) {
+                       this.x /= v.x;
+                       this.y /= v.y;
+                       return this;
+               }
+
+               divideScalar(scalar) {
+                       return this.multiplyScalar(1 / scalar);
+               }
+
+               applyMatrix3(m) {
+                       const x = this.x,
+                                               y = this.y;
+                       const e = m.elements;
+                       this.x = e[0] * x + e[3] * y + e[6];
+                       this.y = e[1] * x + e[4] * y + e[7];
+                       return this;
+               }
+
+               min(v) {
+                       this.x = Math.min(this.x, v.x);
+                       this.y = Math.min(this.y, v.y);
+                       return this;
+               }
+
+               max(v) {
+                       this.x = Math.max(this.x, v.x);
+                       this.y = Math.max(this.y, v.y);
+                       return this;
+               }
+
+               clamp(min, max) {
+                       // assumes min < max, componentwise
+                       this.x = Math.max(min.x, Math.min(max.x, this.x));
+                       this.y = Math.max(min.y, Math.min(max.y, this.y));
+                       return this;
+               }
+
+               clampScalar(minVal, maxVal) {
+                       this.x = Math.max(minVal, Math.min(maxVal, this.x));
+                       this.y = Math.max(minVal, Math.min(maxVal, this.y));
+                       return this;
+               }
+
+               clampLength(min, max) {
+                       const length = this.length();
+                       return this.divideScalar(length || 1).multiplyScalar(Math.max(min, Math.min(max, length)));
+               }
+
+               floor() {
+                       this.x = Math.floor(this.x);
+                       this.y = Math.floor(this.y);
+                       return this;
+               }
+
+               ceil() {
+                       this.x = Math.ceil(this.x);
+                       this.y = Math.ceil(this.y);
+                       return this;
+               }
+
+               round() {
+                       this.x = Math.round(this.x);
+                       this.y = Math.round(this.y);
+                       return this;
+               }
+
+               roundToZero() {
+                       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);
+                       return this;
+               }
+
+               negate() {
+                       this.x = -this.x;
+                       this.y = -this.y;
+                       return this;
+               }
+
+               dot(v) {
+                       return this.x * v.x + this.y * v.y;
+               }
+
+               cross(v) {
+                       return this.x * v.y - this.y * v.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() {
+                       // computes the angle in radians with respect to the positive x-axis
+                       const angle = Math.atan2(-this.y, -this.x) + Math.PI;
+                       return angle;
+               }
+
+               distanceTo(v) {
+                       return Math.sqrt(this.distanceToSquared(v));
+               }
+
+               distanceToSquared(v) {
+                       const dx = this.x - v.x,
+                                               dy = this.y - v.y;
+                       return dx * dx + dy * dy;
+               }
+
+               manhattanDistanceTo(v) {
+                       return Math.abs(this.x - v.x) + Math.abs(this.y - v.y);
+               }
+
+               setLength(length) {
+                       return this.normalize().multiplyScalar(length);
+               }
+
+               lerp(v, alpha) {
+                       this.x += (v.x - this.x) * alpha;
+                       this.y += (v.y - this.y) * alpha;
+                       return this;
+               }
+
+               lerpVectors(v1, v2, alpha) {
+                       this.x = v1.x + (v2.x - v1.x) * alpha;
+                       this.y = v1.y + (v2.y - v1.y) * alpha;
+                       return this;
+               }
+
+               equals(v) {
+                       return v.x === this.x && v.y === this.y;
+               }
+
+               fromArray(array, offset = 0) {
+                       this.x = array[offset];
+                       this.y = array[offset + 1];
+                       return this;
+               }
+
+               toArray(array = [], offset = 0) {
+                       array[offset] = this.x;
+                       array[offset + 1] = this.y;
+                       return array;
+               }
+
+               fromBufferAttribute(attribute, index, offset) {
+                       if (offset !== undefined) {
+                               console.warn('THREE.Vector2: offset has been removed from .fromBufferAttribute().');
+                       }
+
+                       this.x = attribute.getX(index);
+                       this.y = attribute.getY(index);
+                       return this;
+               }
+
+               rotateAround(center, angle) {
+                       const c = Math.cos(angle),
+                                               s = Math.sin(angle);
+                       const x = this.x - center.x;
+                       const y = this.y - center.y;
+                       this.x = x * c - y * s + center.x;
+                       this.y = x * s + y * c + center.y;
+                       return this;
+               }
+
+               random() {
+                       this.x = Math.random();
+                       this.y = Math.random();
+                       return this;
+               }
+
+       }
+
+       Vector2.prototype.isVector2 = true;
+
+       class Matrix3 {
+               constructor() {
+                       this.elements = [1, 0, 0, 0, 1, 0, 0, 0, 1];
+
+                       if (arguments.length > 0) {
+                               console.error('THREE.Matrix3: the constructor no longer reads arguments. use .set() instead.');
+                       }
+               }
+
+               set(n11, n12, n13, n21, n22, n23, n31, n32, n33) {
+                       const te = this.elements;
+                       te[0] = n11;
+                       te[1] = n21;
+                       te[2] = n31;
+                       te[3] = n12;
+                       te[4] = n22;
+                       te[5] = n32;
+                       te[6] = n13;
+                       te[7] = n23;
+                       te[8] = n33;
+                       return this;
+               }
+
+               identity() {
+                       this.set(1, 0, 0, 0, 1, 0, 0, 0, 1);
+                       return this;
+               }
+
+               copy(m) {
+                       const te = this.elements;
+                       const me = m.elements;
+                       te[0] = me[0];
+                       te[1] = me[1];
+                       te[2] = me[2];
+                       te[3] = me[3];
+                       te[4] = me[4];
+                       te[5] = me[5];
+                       te[6] = me[6];
+                       te[7] = me[7];
+                       te[8] = me[8];
+                       return this;
+               }
+
+               extractBasis(xAxis, yAxis, zAxis) {
+                       xAxis.setFromMatrix3Column(this, 0);
+                       yAxis.setFromMatrix3Column(this, 1);
+                       zAxis.setFromMatrix3Column(this, 2);
+                       return this;
+               }
+
+               setFromMatrix4(m) {
+                       const me = m.elements;
+                       this.set(me[0], me[4], me[8], me[1], me[5], me[9], me[2], me[6], me[10]);
+                       return this;
+               }
+
+               multiply(m) {
+                       return this.multiplyMatrices(this, m);
+               }
+
+               premultiply(m) {
+                       return this.multiplyMatrices(m, this);
+               }
+
+               multiplyMatrices(a, b) {
+                       const ae = a.elements;
+                       const be = b.elements;
+                       const te = this.elements;
+                       const a11 = ae[0],
+                                               a12 = ae[3],
+                                               a13 = ae[6];
+                       const a21 = ae[1],
+                                               a22 = ae[4],
+                                               a23 = ae[7];
+                       const a31 = ae[2],
+                                               a32 = ae[5],
+                                               a33 = ae[8];
+                       const b11 = be[0],
+                                               b12 = be[3],
+                                               b13 = be[6];
+                       const b21 = be[1],
+                                               b22 = be[4],
+                                               b23 = be[7];
+                       const b31 = be[2],
+                                               b32 = be[5],
+                                               b33 = be[8];
+                       te[0] = a11 * b11 + a12 * b21 + a13 * b31;
+                       te[3] = a11 * b12 + a12 * b22 + a13 * b32;
+                       te[6] = a11 * b13 + a12 * b23 + a13 * b33;
+                       te[1] = a21 * b11 + a22 * b21 + a23 * b31;
+                       te[4] = a21 * b12 + a22 * b22 + a23 * b32;
+                       te[7] = a21 * b13 + a22 * b23 + a23 * b33;
+                       te[2] = a31 * b11 + a32 * b21 + a33 * b31;
+                       te[5] = a31 * b12 + a32 * b22 + a33 * b32;
+                       te[8] = a31 * b13 + a32 * b23 + a33 * b33;
+                       return this;
+               }
+
+               multiplyScalar(s) {
+                       const te = this.elements;
+                       te[0] *= s;
+                       te[3] *= s;
+                       te[6] *= s;
+                       te[1] *= s;
+                       te[4] *= s;
+                       te[7] *= s;
+                       te[2] *= s;
+                       te[5] *= s;
+                       te[8] *= s;
+                       return this;
+               }
+
+               determinant() {
+                       const te = this.elements;
+                       const a = te[0],
+                                               b = te[1],
+                                               c = te[2],
+                                               d = te[3],
+                                               e = te[4],
+                                               f = te[5],
+                                               g = te[6],
+                                               h = te[7],
+                                               i = te[8];
+                       return a * e * i - a * f * h - b * d * i + b * f * g + c * d * h - c * e * g;
+               }
+
+               invert() {
+                       const te = this.elements,
+                                               n11 = te[0],
+                                               n21 = te[1],
+                                               n31 = te[2],
+                                               n12 = te[3],
+                                               n22 = te[4],
+                                               n32 = te[5],
+                                               n13 = te[6],
+                                               n23 = te[7],
+                                               n33 = te[8],
+                                               t11 = n33 * n22 - n32 * n23,
+                                               t12 = n32 * n13 - n33 * n12,
+                                               t13 = n23 * n12 - n22 * n13,
+                                               det = n11 * t11 + n21 * t12 + n31 * t13;
+                       if (det === 0) return this.set(0, 0, 0, 0, 0, 0, 0, 0, 0);
+                       const detInv = 1 / det;
+                       te[0] = t11 * detInv;
+                       te[1] = (n31 * n23 - n33 * n21) * detInv;
+                       te[2] = (n32 * n21 - n31 * n22) * detInv;
+                       te[3] = t12 * detInv;
+                       te[4] = (n33 * n11 - n31 * n13) * detInv;
+                       te[5] = (n31 * n12 - n32 * n11) * detInv;
+                       te[6] = t13 * detInv;
+                       te[7] = (n21 * n13 - n23 * n11) * detInv;
+                       te[8] = (n22 * n11 - n21 * n12) * detInv;
+                       return this;
+               }
+
+               transpose() {
+                       let tmp;
+                       const m = this.elements;
+                       tmp = m[1];
+                       m[1] = m[3];
+                       m[3] = tmp;
+                       tmp = m[2];
+                       m[2] = m[6];
+                       m[6] = tmp;
+                       tmp = m[5];
+                       m[5] = m[7];
+                       m[7] = tmp;
+                       return this;
+               }
+
+               getNormalMatrix(matrix4) {
+                       return this.setFromMatrix4(matrix4).invert().transpose();
+               }
+
+               transposeIntoArray(r) {
+                       const m = this.elements;
+                       r[0] = m[0];
+                       r[1] = m[3];
+                       r[2] = m[6];
+                       r[3] = m[1];
+                       r[4] = m[4];
+                       r[5] = m[7];
+                       r[6] = m[2];
+                       r[7] = m[5];
+                       r[8] = m[8];
+                       return this;
+               }
+
+               setUvTransform(tx, ty, sx, sy, rotation, cx, cy) {
+                       const c = Math.cos(rotation);
+                       const s = Math.sin(rotation);
+                       this.set(sx * c, sx * s, -sx * (c * cx + s * cy) + cx + tx, -sy * s, sy * c, -sy * (-s * cx + c * cy) + cy + ty, 0, 0, 1);
+                       return this;
+               }
+
+               scale(sx, sy) {
+                       const te = this.elements;
+                       te[0] *= sx;
+                       te[3] *= sx;
+                       te[6] *= sx;
+                       te[1] *= sy;
+                       te[4] *= sy;
+                       te[7] *= sy;
+                       return this;
+               }
+
+               rotate(theta) {
+                       const c = Math.cos(theta);
+                       const s = Math.sin(theta);
+                       const te = this.elements;
+                       const a11 = te[0],
+                                               a12 = te[3],
+                                               a13 = te[6];
+                       const a21 = te[1],
+                                               a22 = te[4],
+                                               a23 = te[7];
+                       te[0] = c * a11 + s * a21;
+                       te[3] = c * a12 + s * a22;
+                       te[6] = c * a13 + s * a23;
+                       te[1] = -s * a11 + c * a21;
+                       te[4] = -s * a12 + c * a22;
+                       te[7] = -s * a13 + c * a23;
+                       return this;
+               }
+
+               translate(tx, ty) {
+                       const te = this.elements;
+                       te[0] += tx * te[2];
+                       te[3] += tx * te[5];
+                       te[6] += tx * te[8];
+                       te[1] += ty * te[2];
+                       te[4] += ty * te[5];
+                       te[7] += ty * te[8];
+                       return this;
+               }
+
+               equals(matrix) {
+                       const te = this.elements;
+                       const me = matrix.elements;
+
+                       for (let i = 0; i < 9; i++) {
+                               if (te[i] !== me[i]) return false;
+                       }
+
+                       return true;
+               }
+
+               fromArray(array, offset = 0) {
+                       for (let i = 0; i < 9; i++) {
+                               this.elements[i] = array[i + offset];
+                       }
+
+                       return this;
+               }
+
+               toArray(array = [], offset = 0) {
+                       const te = this.elements;
+                       array[offset] = te[0];
+                       array[offset + 1] = te[1];
+                       array[offset + 2] = te[2];
+                       array[offset + 3] = te[3];
+                       array[offset + 4] = te[4];
+                       array[offset + 5] = te[5];
+                       array[offset + 6] = te[6];
+                       array[offset + 7] = te[7];
+                       array[offset + 8] = te[8];
+                       return array;
+               }
+
+               clone() {
+                       return new this.constructor().fromArray(this.elements);
+               }
+
+       }
+
+       Matrix3.prototype.isMatrix3 = true;
+
+       let _canvas;
+
+       class ImageUtils {
+               static getDataURL(image) {
+                       if (/^data:/i.test(image.src)) {
+                               return image.src;
+                       }
+
+                       if (typeof HTMLCanvasElement == 'undefined') {
+                               return image.src;
+                       }
+
+                       let canvas;
+
+                       if (image instanceof HTMLCanvasElement) {
+                               canvas = image;
+                       } else {
+                               if (_canvas === undefined) _canvas = document.createElementNS('http://www.w3.org/1999/xhtml', 'canvas');
+                               _canvas.width = image.width;
+                               _canvas.height = image.height;
+
+                               const context = _canvas.getContext('2d');
+
+                               if (image instanceof ImageData) {
+                                       context.putImageData(image, 0, 0);
+                               } else {
+                                       context.drawImage(image, 0, 0, image.width, image.height);
+                               }
+
+                               canvas = _canvas;
+                       }
+
+                       if (canvas.width > 2048 || canvas.height > 2048) {
+                               console.warn('THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons', image);
+                               return canvas.toDataURL('image/jpeg', 0.6);
+                       } else {
+                               return canvas.toDataURL('image/png');
+                       }
+               }
+
+       }
+
+       let textureId = 0;
+
+       class Texture extends EventDispatcher {
+               constructor(image = Texture.DEFAULT_IMAGE, mapping = Texture.DEFAULT_MAPPING, wrapS = ClampToEdgeWrapping, wrapT = ClampToEdgeWrapping, magFilter = LinearFilter, minFilter = LinearMipmapLinearFilter, format = RGBAFormat, type = UnsignedByteType, anisotropy = 1, encoding = LinearEncoding) {
+                       super();
+                       Object.defineProperty(this, 'id', {
+                               value: textureId++
+                       });
+                       this.uuid = generateUUID();
+                       this.name = '';
+                       this.image = image;
+                       this.mipmaps = [];
+                       this.mapping = mapping;
+                       this.wrapS = wrapS;
+                       this.wrapT = wrapT;
+                       this.magFilter = magFilter;
+                       this.minFilter = minFilter;
+                       this.anisotropy = anisotropy;
+                       this.format = format;
+                       this.internalFormat = null;
+                       this.type = type;
+                       this.offset = new Vector2(0, 0);
+                       this.repeat = new Vector2(1, 1);
+                       this.center = new Vector2(0, 0);
+                       this.rotation = 0;
+                       this.matrixAutoUpdate = true;
+                       this.matrix = new Matrix3();
+                       this.generateMipmaps = true;
+                       this.premultiplyAlpha = false;
+                       this.flipY = true;
+                       this.unpackAlignment = 4; // valid values: 1, 2, 4, 8 (see http://www.khronos.org/opengles/sdk/docs/man/xhtml/glPixelStorei.xml)
+                       // Values of encoding !== THREE.LinearEncoding only supported on map, envMap and emissiveMap.
+                       //
+                       // Also changing the encoding after already used by a Material will not automatically make the Material
+                       // update. You need to explicitly call Material.needsUpdate to trigger it to recompile.
+
+                       this.encoding = encoding;
+                       this.version = 0;
+                       this.onUpdate = null;
+                       this.isRenderTargetTexture = false;
+               }
+
+               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(source) {
+                       this.name = source.name;
+                       this.image = source.image;
+                       this.mipmaps = source.mipmaps.slice(0);
+                       this.mapping = source.mapping;
+                       this.wrapS = source.wrapS;
+                       this.wrapT = source.wrapT;
+                       this.magFilter = source.magFilter;
+                       this.minFilter = source.minFilter;
+                       this.anisotropy = source.anisotropy;
+                       this.format = source.format;
+                       this.internalFormat = source.internalFormat;
+                       this.type = source.type;
+                       this.offset.copy(source.offset);
+                       this.repeat.copy(source.repeat);
+                       this.center.copy(source.center);
+                       this.rotation = source.rotation;
+                       this.matrixAutoUpdate = source.matrixAutoUpdate;
+                       this.matrix.copy(source.matrix);
+                       this.generateMipmaps = source.generateMipmaps;
+                       this.premultiplyAlpha = source.premultiplyAlpha;
+                       this.flipY = source.flipY;
+                       this.unpackAlignment = source.unpackAlignment;
+                       this.encoding = source.encoding;
+                       return this;
+               }
+
+               toJSON(meta) {
+                       const isRootObject = meta === undefined || typeof meta === 'string';
+
+                       if (!isRootObject && meta.textures[this.uuid] !== undefined) {
+                               return meta.textures[this.uuid];
+                       }
+
+                       const output = {
+                               metadata: {
+                                       version: 4.5,
+                                       type: 'Texture',
+                                       generator: 'Texture.toJSON'
+                               },
+                               uuid: this.uuid,
+                               name: this.name,
+                               mapping: this.mapping,
+                               repeat: [this.repeat.x, this.repeat.y],
+                               offset: [this.offset.x, this.offset.y],
+                               center: [this.center.x, this.center.y],
+                               rotation: this.rotation,
+                               wrap: [this.wrapS, this.wrapT],
+                               format: this.format,
+                               type: this.type,
+                               encoding: this.encoding,
+                               minFilter: this.minFilter,
+                               magFilter: this.magFilter,
+                               anisotropy: this.anisotropy,
+                               flipY: this.flipY,
+                               premultiplyAlpha: this.premultiplyAlpha,
+                               unpackAlignment: this.unpackAlignment
+                       };
+
+                       if (this.image !== undefined) {
+                               // TODO: Move to THREE.Image
+                               const image = this.image;
+
+                               if (image.uuid === undefined) {
+                                       image.uuid = generateUUID(); // UGH
+                               }
+
+                               if (!isRootObject && meta.images[image.uuid] === undefined) {
+                                       let url;
+
+                                       if (Array.isArray(image)) {
+                                               // process array of images e.g. CubeTexture
+                                               url = [];
+
+                                               for (let i = 0, l = image.length; i < l; i++) {
+                                                       // check cube texture with data textures
+                                                       if (image[i].isDataTexture) {
+                                                               url.push(serializeImage(image[i].image));
+                                                       } else {
+                                                               url.push(serializeImage(image[i]));
+                                                       }
+                                               }
+                                       } else {
+                                               // process single image
+                                               url = serializeImage(image);
+                                       }
+
+                                       meta.images[image.uuid] = {
+                                               uuid: image.uuid,
+                                               url: url
+                                       };
+                               }
+
+                               output.image = image.uuid;
+                       }
+
+                       if (!isRootObject) {
+                               meta.textures[this.uuid] = output;
+                       }
+
+                       return output;
+               }
+
+               dispose() {
+                       this.dispatchEvent({
+                               type: 'dispose'
+                       });
+               }
+
+               transformUv(uv) {
+                       if (this.mapping !== UVMapping) return uv;
+                       uv.applyMatrix3(this.matrix);
+
+                       if (uv.x < 0 || uv.x > 1) {
+                               switch (this.wrapS) {
+                                       case RepeatWrapping:
+                                               uv.x = uv.x - Math.floor(uv.x);
+                                               break;
+
+                                       case ClampToEdgeWrapping:
+                                               uv.x = uv.x < 0 ? 0 : 1;
+                                               break;
+
+                                       case MirroredRepeatWrapping:
+                                               if (Math.abs(Math.floor(uv.x) % 2) === 1) {
+                                                       uv.x = Math.ceil(uv.x) - uv.x;
+                                               } else {
+                                                       uv.x = uv.x - Math.floor(uv.x);
+                                               }
+
+                                               break;
+                               }
+                       }
+
+                       if (uv.y < 0 || uv.y > 1) {
+                               switch (this.wrapT) {
+                                       case RepeatWrapping:
+                                               uv.y = uv.y - Math.floor(uv.y);
+                                               break;
+
+                                       case ClampToEdgeWrapping:
+                                               uv.y = uv.y < 0 ? 0 : 1;
+                                               break;
+
+                                       case MirroredRepeatWrapping:
+                                               if (Math.abs(Math.floor(uv.y) % 2) === 1) {
+                                                       uv.y = Math.ceil(uv.y) - uv.y;
+                                               } else {
+                                                       uv.y = uv.y - Math.floor(uv.y);
+                                               }
+
+                                               break;
+                               }
+                       }
+
+                       if (this.flipY) {
+                               uv.y = 1 - uv.y;
+                       }
+
+                       return uv;
+               }
+
+               set needsUpdate(value) {
+                       if (value === true) this.version++;
+               }
+
+       }
+
+       Texture.DEFAULT_IMAGE = undefined;
+       Texture.DEFAULT_MAPPING = UVMapping;
+       Texture.prototype.isTexture = true;
+
+       function serializeImage(image) {
+               if (typeof HTMLImageElement !== 'undefined' && image instanceof HTMLImageElement || typeof HTMLCanvasElement !== 'undefined' && image instanceof HTMLCanvasElement || typeof ImageBitmap !== 'undefined' && image instanceof ImageBitmap) {
+                       // default images
+                       return ImageUtils.getDataURL(image);
+               } else {
+                       if (image.data) {
+                               // images of DataTexture
+                               return {
+                                       data: Array.prototype.slice.call(image.data),
+                                       width: image.width,
+                                       height: image.height,
+                                       type: image.data.constructor.name
+                               };
+                       } else {
+                               console.warn('THREE.Texture: Unable to serialize Texture.');
+                               return {};
+                       }
+               }
+       }
+
+       class Vector4 {
+               constructor(x = 0, y = 0, z = 0, w = 1) {
+                       this.x = x;
+                       this.y = y;
+                       this.z = z;
+                       this.w = w;
+               }
+
+               get width() {
+                       return this.z;
+               }
+
+               set width(value) {
+                       this.z = value;
+               }
+
+               get height() {
+                       return this.w;
+               }
+
+               set height(value) {
+                       this.w = value;
+               }
+
+               set(x, y, z, w) {
+                       this.x = x;
+                       this.y = y;
+                       this.z = z;
+                       this.w = w;
+                       return this;
+               }
+
+               setScalar(scalar) {
+                       this.x = scalar;
+                       this.y = scalar;
+                       this.z = scalar;
+                       this.w = scalar;
+                       return this;
+               }
+
+               setX(x) {
+                       this.x = x;
+                       return this;
+               }
+
+               setY(y) {
+                       this.y = y;
+                       return this;
+               }
+
+               setZ(z) {
+                       this.z = z;
+                       return this;
+               }
+
+               setW(w) {
+                       this.w = w;
+                       return this;
+               }
+
+               setComponent(index, value) {
+                       switch (index) {
+                               case 0:
+                                       this.x = value;
+                                       break;
+
+                               case 1:
+                                       this.y = value;
+                                       break;
+
+                               case 2:
+                                       this.z = value;
+                                       break;
+
+                               case 3:
+                                       this.w = value;
+                                       break;
+
+                               default:
+                                       throw new Error('index is out of range: ' + index);
+                       }
+
+                       return this;
+               }
+
+               getComponent(index) {
+                       switch (index) {
+                               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: ' + index);
+                       }
+               }
+
+               clone() {
+                       return new this.constructor(this.x, this.y, this.z, this.w);
+               }
+
+               copy(v) {
+                       this.x = v.x;
+                       this.y = v.y;
+                       this.z = v.z;
+                       this.w = v.w !== undefined ? v.w : 1;
+                       return this;
+               }
+
+               add(v, w) {
+                       if (w !== undefined) {
+                               console.warn('THREE.Vector4: .add() now only accepts one argument. Use .addVectors( a, b ) instead.');
+                               return this.addVectors(v, w);
+                       }
+
+                       this.x += v.x;
+                       this.y += v.y;
+                       this.z += v.z;
+                       this.w += v.w;
+                       return this;
+               }
+
+               addScalar(s) {
+                       this.x += s;
+                       this.y += s;
+                       this.z += s;
+                       this.w += s;
+                       return this;
+               }
+
+               addVectors(a, b) {
+                       this.x = a.x + b.x;
+                       this.y = a.y + b.y;
+                       this.z = a.z + b.z;
+                       this.w = a.w + b.w;
+                       return this;
+               }
+
+               addScaledVector(v, s) {
+                       this.x += v.x * s;
+                       this.y += v.y * s;
+                       this.z += v.z * s;
+                       this.w += v.w * s;
+                       return this;
+               }
+
+               sub(v, w) {
+                       if (w !== undefined) {
+                               console.warn('THREE.Vector4: .sub() now only accepts one argument. Use .subVectors( a, b ) instead.');
+                               return this.subVectors(v, w);
+                       }
+
+                       this.x -= v.x;
+                       this.y -= v.y;
+                       this.z -= v.z;
+                       this.w -= v.w;
+                       return this;
+               }
+
+               subScalar(s) {
+                       this.x -= s;
+                       this.y -= s;
+                       this.z -= s;
+                       this.w -= s;
+                       return this;
+               }
+
+               subVectors(a, b) {
+                       this.x = a.x - b.x;
+                       this.y = a.y - b.y;
+                       this.z = a.z - b.z;
+                       this.w = a.w - b.w;
+                       return this;
+               }
+
+               multiply(v) {
+                       this.x *= v.x;
+                       this.y *= v.y;
+                       this.z *= v.z;
+                       this.w *= v.w;
+                       return this;
+               }
+
+               multiplyScalar(scalar) {
+                       this.x *= scalar;
+                       this.y *= scalar;
+                       this.z *= scalar;
+                       this.w *= scalar;
+                       return this;
+               }
+
+               applyMatrix4(m) {
+                       const x = this.x,
+                                               y = this.y,
+                                               z = this.z,
+                                               w = this.w;
+                       const e = m.elements;
+                       this.x = e[0] * x + e[4] * y + e[8] * z + e[12] * w;
+                       this.y = e[1] * x + e[5] * y + e[9] * z + e[13] * w;
+                       this.z = e[2] * x + e[6] * y + e[10] * z + e[14] * w;
+                       this.w = e[3] * x + e[7] * y + e[11] * z + e[15] * w;
+                       return this;
+               }
+
+               divideScalar(scalar) {
+                       return this.multiplyScalar(1 / scalar);
+               }
+
+               setAxisAngleFromQuaternion(q) {
+                       // http://www.euclideanspace.com/maths/geometry/rotations/conversions/quaternionToAngle/index.htm
+                       // q is assumed to be normalized
+                       this.w = 2 * Math.acos(q.w);
+                       const s = Math.sqrt(1 - q.w * q.w);
+
+                       if (s < 0.0001) {
+                               this.x = 1;
+                               this.y = 0;
+                               this.z = 0;
+                       } else {
+                               this.x = q.x / s;
+                               this.y = q.y / s;
+                               this.z = q.z / s;
+                       }
+
+                       return this;
+               }
+
+               setAxisAngleFromRotationMatrix(m) {
+                       // http://www.euclideanspace.com/maths/geometry/rotations/conversions/matrixToAngle/index.htm
+                       // assumes the upper 3x3 of m is a pure rotation matrix (i.e, unscaled)
+                       let angle, x, y, z; // variables for result
+
+                       const epsilon = 0.01,
+                                               // margin to allow for rounding errors
+                       epsilon2 = 0.1,
+                                               // margin to distinguish between 0 and 180 degrees
+                       te = m.elements,
+                                               m11 = te[0],
+                                               m12 = te[4],
+                                               m13 = te[8],
+                                               m21 = te[1],
+                                               m22 = te[5],
+                                               m23 = te[9],
+                                               m31 = te[2],
+                                               m32 = te[6],
+                                               m33 = te[10];
+
+                       if (Math.abs(m12 - m21) < epsilon && Math.abs(m13 - m31) < epsilon && Math.abs(m23 - m32) < epsilon) {
+                               // singularity found
+                               // first check for identity matrix which must have +1 for all terms
+                               // in leading diagonal and zero in other terms
+                               if (Math.abs(m12 + m21) < epsilon2 && Math.abs(m13 + m31) < epsilon2 && Math.abs(m23 + m32) < epsilon2 && Math.abs(m11 + m22 + m33 - 3) < epsilon2) {
+                                       // this singularity is identity matrix so angle = 0
+                                       this.set(1, 0, 0, 0);
+                                       return this; // zero angle, arbitrary axis
+                               } // otherwise this singularity is angle = 180
+
+
+                               angle = Math.PI;
+                               const xx = (m11 + 1) / 2;
+                               const yy = (m22 + 1) / 2;
+                               const zz = (m33 + 1) / 2;
+                               const xy = (m12 + m21) / 4;
+                               const xz = (m13 + m31) / 4;
+                               const yz = (m23 + m32) / 4;
+
+                               if (xx > yy && xx > zz) {
+                                       // m11 is the largest diagonal term
+                                       if (xx < epsilon) {
+                                               x = 0;
+                                               y = 0.707106781;
+                                               z = 0.707106781;
+                                       } else {
+                                               x = Math.sqrt(xx);
+                                               y = xy / x;
+                                               z = xz / x;
+                                       }
+                               } else if (yy > zz) {
+                                       // m22 is the largest diagonal term
+                                       if (yy < epsilon) {
+                                               x = 0.707106781;
+                                               y = 0;
+                                               z = 0.707106781;
+                                       } else {
+                                               y = Math.sqrt(yy);
+                                               x = xy / y;
+                                               z = yz / y;
+                                       }
+                               } else {
+                                       // m33 is the largest diagonal term so base result on this
+                                       if (zz < epsilon) {
+                                               x = 0.707106781;
+                                               y = 0.707106781;
+                                               z = 0;
+                                       } else {
+                                               z = Math.sqrt(zz);
+                                               x = xz / z;
+                                               y = yz / z;
+                                       }
+                               }
+
+                               this.set(x, y, z, angle);
+                               return this; // return 180 deg rotation
+                       } // as we have reached here there are no singularities so we can handle normally
+
+
+                       let s = Math.sqrt((m32 - m23) * (m32 - m23) + (m13 - m31) * (m13 - m31) + (m21 - m12) * (m21 - m12)); // used to normalize
+
+                       if (Math.abs(s) < 0.001) s = 1; // prevent divide by zero, should not happen if matrix is orthogonal and should be
+                       // caught by singularity test above, but I've left it in just in case
+
+                       this.x = (m32 - m23) / s;
+                       this.y = (m13 - m31) / s;
+                       this.z = (m21 - m12) / s;
+                       this.w = Math.acos((m11 + m22 + m33 - 1) / 2);
+                       return this;
+               }
+
+               min(v) {
+                       this.x = Math.min(this.x, v.x);
+                       this.y = Math.min(this.y, v.y);
+                       this.z = Math.min(this.z, v.z);
+                       this.w = Math.min(this.w, v.w);
+                       return this;
+               }
+
+               max(v) {
+                       this.x = Math.max(this.x, v.x);
+                       this.y = Math.max(this.y, v.y);
+                       this.z = Math.max(this.z, v.z);
+                       this.w = Math.max(this.w, v.w);
+                       return this;
+               }
+
+               clamp(min, max) {
+                       // assumes min < max, componentwise
+                       this.x = Math.max(min.x, Math.min(max.x, this.x));
+                       this.y = Math.max(min.y, Math.min(max.y, this.y));
+                       this.z = Math.max(min.z, Math.min(max.z, this.z));
+                       this.w = Math.max(min.w, Math.min(max.w, this.w));
+                       return this;
+               }
+
+               clampScalar(minVal, maxVal) {
+                       this.x = Math.max(minVal, Math.min(maxVal, this.x));
+                       this.y = Math.max(minVal, Math.min(maxVal, this.y));
+                       this.z = Math.max(minVal, Math.min(maxVal, this.z));
+                       this.w = Math.max(minVal, Math.min(maxVal, this.w));
+                       return this;
+               }
+
+               clampLength(min, max) {
+                       const length = this.length();
+                       return this.divideScalar(length || 1).multiplyScalar(Math.max(min, Math.min(max, length)));
+               }
+
+               floor() {
+                       this.x = Math.floor(this.x);
+                       this.y = Math.floor(this.y);
+                       this.z = Math.floor(this.z);
+                       this.w = Math.floor(this.w);
+                       return this;
+               }
+
+               ceil() {
+                       this.x = Math.ceil(this.x);
+                       this.y = Math.ceil(this.y);
+                       this.z = Math.ceil(this.z);
+                       this.w = Math.ceil(this.w);
+                       return this;
+               }
+
+               round() {
+                       this.x = Math.round(this.x);
+                       this.y = Math.round(this.y);
+                       this.z = Math.round(this.z);
+                       this.w = Math.round(this.w);
+                       return this;
+               }
+
+               roundToZero() {
+                       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);
+                       return this;
+               }
+
+               negate() {
+                       this.x = -this.x;
+                       this.y = -this.y;
+                       this.z = -this.z;
+                       this.w = -this.w;
+                       return this;
+               }
+
+               dot(v) {
+                       return this.x * v.x + this.y * v.y + this.z * v.z + this.w * v.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(length) {
+                       return this.normalize().multiplyScalar(length);
+               }
+
+               lerp(v, alpha) {
+                       this.x += (v.x - this.x) * alpha;
+                       this.y += (v.y - this.y) * alpha;
+                       this.z += (v.z - this.z) * alpha;
+                       this.w += (v.w - this.w) * alpha;
+                       return this;
+               }
+
+               lerpVectors(v1, v2, alpha) {
+                       this.x = v1.x + (v2.x - v1.x) * alpha;
+                       this.y = v1.y + (v2.y - v1.y) * alpha;
+                       this.z = v1.z + (v2.z - v1.z) * alpha;
+                       this.w = v1.w + (v2.w - v1.w) * alpha;
+                       return this;
+               }
+
+               equals(v) {
+                       return v.x === this.x && v.y === this.y && v.z === this.z && v.w === this.w;
+               }
+
+               fromArray(array, offset = 0) {
+                       this.x = array[offset];
+                       this.y = array[offset + 1];
+                       this.z = array[offset + 2];
+                       this.w = array[offset + 3];
+                       return this;
+               }
+
+               toArray(array = [], offset = 0) {
+                       array[offset] = this.x;
+                       array[offset + 1] = this.y;
+                       array[offset + 2] = this.z;
+                       array[offset + 3] = this.w;
+                       return array;
+               }
+
+               fromBufferAttribute(attribute, index, offset) {
+                       if (offset !== undefined) {
+                               console.warn('THREE.Vector4: offset has been removed from .fromBufferAttribute().');
+                       }
+
+                       this.x = attribute.getX(index);
+                       this.y = attribute.getY(index);
+                       this.z = attribute.getZ(index);
+                       this.w = attribute.getW(index);
+                       return this;
+               }
+
+               random() {
+                       this.x = Math.random();
+                       this.y = Math.random();
+                       this.z = Math.random();
+                       this.w = Math.random();
+                       return this;
+               }
+
+       }
+
+       Vector4.prototype.isVector4 = true;
+
+       /*
+        In options, we can specify:
+        * Texture parameters for an auto-generated target texture
+        * depthBuffer/stencilBuffer: Booleans to indicate if we should generate these buffers
+       */
+
+       class WebGLRenderTarget extends EventDispatcher {
+               constructor(width, height, options = {}) {
+                       super();
+                       this.width = width;
+                       this.height = height;
+                       this.depth = 1;
+                       this.scissor = new Vector4(0, 0, width, height);
+                       this.scissorTest = false;
+                       this.viewport = new Vector4(0, 0, width, height);
+                       this.texture = new Texture(undefined, options.mapping, options.wrapS, options.wrapT, options.magFilter, options.minFilter, options.format, options.type, options.anisotropy, options.encoding);
+                       this.texture.isRenderTargetTexture = true;
+                       this.texture.image = {
+                               width: width,
+                               height: height,
+                               depth: 1
+                       };
+                       this.texture.generateMipmaps = options.generateMipmaps !== undefined ? options.generateMipmaps : false;
+                       this.texture.internalFormat = options.internalFormat !== undefined ? options.internalFormat : null;
+                       this.texture.minFilter = options.minFilter !== undefined ? options.minFilter : LinearFilter;
+                       this.depthBuffer = options.depthBuffer !== undefined ? options.depthBuffer : true;
+                       this.stencilBuffer = options.stencilBuffer !== undefined ? options.stencilBuffer : false;
+                       this.depthTexture = options.depthTexture !== undefined ? options.depthTexture : null;
+               }
+
+               setTexture(texture) {
+                       texture.image = {
+                               width: this.width,
+                               height: this.height,
+                               depth: this.depth
+                       };
+                       this.texture = texture;
+               }
+
+               setSize(width, height, depth = 1) {
+                       if (this.width !== width || this.height !== height || this.depth !== depth) {
+                               this.width = width;
+                               this.height = height;
+                               this.depth = depth;
+                               this.texture.image.width = width;
+                               this.texture.image.height = height;
+                               this.texture.image.depth = depth;
+                               this.dispose();
+                       }
+
+                       this.viewport.set(0, 0, width, height);
+                       this.scissor.set(0, 0, width, height);
+               }
+
+               clone() {
+                       return new this.constructor().copy(this);
+               }
+
+               copy(source) {
+                       this.width = source.width;
+                       this.height = source.height;
+                       this.depth = source.depth;
+                       this.viewport.copy(source.viewport);
+                       this.texture = source.texture.clone();
+                       this.texture.image = { ...this.texture.image
+                       }; // See #20328.
+
+                       this.depthBuffer = source.depthBuffer;
+                       this.stencilBuffer = source.stencilBuffer;
+                       this.depthTexture = source.depthTexture;
+                       return this;
+               }
+
+               dispose() {
+                       this.dispatchEvent({
+                               type: 'dispose'
+                       });
+               }
+
+       }
+
+       WebGLRenderTarget.prototype.isWebGLRenderTarget = true;
+
+       class WebGLMultipleRenderTargets extends WebGLRenderTarget {
+               constructor(width, height, count) {
+                       super(width, height);
+                       const texture = this.texture;
+                       this.texture = [];
+
+                       for (let i = 0; i < count; i++) {
+                               this.texture[i] = texture.clone();
+                       }
+               }
+
+               setSize(width, height, depth = 1) {
+                       if (this.width !== width || this.height !== height || this.depth !== depth) {
+                               this.width = width;
+                               this.height = height;
+                               this.depth = depth;
+
+                               for (let i = 0, il = this.texture.length; i < il; i++) {
+                                       this.texture[i].image.width = width;
+                                       this.texture[i].image.height = height;
+                                       this.texture[i].image.depth = depth;
+                               }
+
+                               this.dispose();
+                       }
+
+                       this.viewport.set(0, 0, width, height);
+                       this.scissor.set(0, 0, width, height);
+                       return this;
+               }
+
+               copy(source) {
+                       this.dispose();
+                       this.width = source.width;
+                       this.height = source.height;
+                       this.depth = source.depth;
+                       this.viewport.set(0, 0, this.width, this.height);
+                       this.scissor.set(0, 0, this.width, this.height);
+                       this.depthBuffer = source.depthBuffer;
+                       this.stencilBuffer = source.stencilBuffer;
+                       this.depthTexture = source.depthTexture;
+                       this.texture.length = 0;
+
+                       for (let i = 0, il = source.texture.length; i < il; i++) {
+                               this.texture[i] = source.texture[i].clone();
+                       }
+
+                       return this;
+               }
+
+       }
+
+       WebGLMultipleRenderTargets.prototype.isWebGLMultipleRenderTargets = true;
+
+       class WebGLMultisampleRenderTarget extends WebGLRenderTarget {
+               constructor(width, height, options) {
+                       super(width, height, options);
+                       this.samples = 4;
+               }
+
+               copy(source) {
+                       super.copy.call(this, source);
+                       this.samples = source.samples;
+                       return this;
+               }
+
+       }
+
+       WebGLMultisampleRenderTarget.prototype.isWebGLMultisampleRenderTarget = true;
+
+       class Quaternion {
+               constructor(x = 0, y = 0, z = 0, w = 1) {
+                       this._x = x;
+                       this._y = y;
+                       this._z = z;
+                       this._w = w;
+               }
+
+               static slerp(qa, qb, qm, t) {
+                       console.warn('THREE.Quaternion: Static .slerp() has been deprecated. Use qm.slerpQuaternions( qa, qb, t ) instead.');
+                       return qm.slerpQuaternions(qa, qb, t);
+               }
+
+               static slerpFlat(dst, dstOffset, src0, srcOffset0, src1, srcOffset1, t) {
+                       // fuzz-free, array-based Quaternion SLERP operation
+                       let x0 = src0[srcOffset0 + 0],
+                                       y0 = src0[srcOffset0 + 1],
+                                       z0 = src0[srcOffset0 + 2],
+                                       w0 = src0[srcOffset0 + 3];
+                       const x1 = src1[srcOffset1 + 0],
+                                               y1 = src1[srcOffset1 + 1],
+                                               z1 = src1[srcOffset1 + 2],
+                                               w1 = src1[srcOffset1 + 3];
+
+                       if (t === 0) {
+                               dst[dstOffset + 0] = x0;
+                               dst[dstOffset + 1] = y0;
+                               dst[dstOffset + 2] = z0;
+                               dst[dstOffset + 3] = w0;
+                               return;
+                       }
+
+                       if (t === 1) {
+                               dst[dstOffset + 0] = x1;
+                               dst[dstOffset + 1] = y1;
+                               dst[dstOffset + 2] = z1;
+                               dst[dstOffset + 3] = w1;
+                               return;
+                       }
+
+                       if (w0 !== w1 || x0 !== x1 || y0 !== y1 || z0 !== z1) {
+                               let s = 1 - t;
+                               const cos = x0 * x1 + y0 * y1 + z0 * z1 + w0 * w1,
+                                                       dir = cos >= 0 ? 1 : -1,
+                                                       sqrSin = 1 - cos * cos; // Skip the Slerp for tiny steps to avoid numeric problems:
+
+                               if (sqrSin > Number.EPSILON) {
+                                       const sin = Math.sqrt(sqrSin),
+                                                               len = Math.atan2(sin, cos * dir);
+                                       s = Math.sin(s * len) / sin;
+                                       t = Math.sin(t * len) / sin;
+                               }
+
+                               const tDir = t * dir;
+                               x0 = x0 * s + x1 * tDir;
+                               y0 = y0 * s + y1 * tDir;
+                               z0 = z0 * s + z1 * tDir;
+                               w0 = w0 * s + w1 * tDir; // Normalize in case we just did a lerp:
+
+                               if (s === 1 - t) {
+                                       const f = 1 / Math.sqrt(x0 * x0 + y0 * y0 + z0 * z0 + w0 * w0);
+                                       x0 *= f;
+                                       y0 *= f;
+                                       z0 *= f;
+                                       w0 *= f;
+                               }
+                       }
+
+                       dst[dstOffset] = x0;
+                       dst[dstOffset + 1] = y0;
+                       dst[dstOffset + 2] = z0;
+                       dst[dstOffset + 3] = w0;
+               }
+
+               static multiplyQuaternionsFlat(dst, dstOffset, src0, srcOffset0, src1, srcOffset1) {
+                       const x0 = src0[srcOffset0];
+                       const y0 = src0[srcOffset0 + 1];
+                       const z0 = src0[srcOffset0 + 2];
+                       const w0 = src0[srcOffset0 + 3];
+                       const x1 = src1[srcOffset1];
+                       const y1 = src1[srcOffset1 + 1];
+                       const z1 = src1[srcOffset1 + 2];
+                       const w1 = src1[srcOffset1 + 3];
+                       dst[dstOffset] = x0 * w1 + w0 * x1 + y0 * z1 - z0 * y1;
+                       dst[dstOffset + 1] = y0 * w1 + w0 * y1 + z0 * x1 - x0 * z1;
+                       dst[dstOffset + 2] = z0 * w1 + w0 * z1 + x0 * y1 - y0 * x1;
+                       dst[dstOffset + 3] = w0 * w1 - x0 * x1 - y0 * y1 - z0 * z1;
+                       return dst;
+               }
+
+               get x() {
+                       return this._x;
+               }
+
+               set x(value) {
+                       this._x = value;
+
+                       this._onChangeCallback();
+               }
+
+               get y() {
+                       return this._y;
+               }
+
+               set y(value) {
+                       this._y = value;
+
+                       this._onChangeCallback();
+               }
+
+               get z() {
+                       return this._z;
+               }
+
+               set z(value) {
+                       this._z = value;
+
+                       this._onChangeCallback();
+               }
+
+               get w() {
+                       return this._w;
+               }
+
+               set w(value) {
+                       this._w = value;
+
+                       this._onChangeCallback();
+               }
+
+               set(x, y, z, w) {
+                       this._x = x;
+                       this._y = y;
+                       this._z = z;
+                       this._w = w;
+
+                       this._onChangeCallback();
+
+                       return this;
+               }
+
+               clone() {
+                       return new this.constructor(this._x, this._y, this._z, this._w);
+               }
+
+               copy(quaternion) {
+                       this._x = quaternion.x;
+                       this._y = quaternion.y;
+                       this._z = quaternion.z;
+                       this._w = quaternion.w;
+
+                       this._onChangeCallback();
+
+                       return this;
+               }
+
+               setFromEuler(euler, update) {
+                       if (!(euler && euler.isEuler)) {
+                               throw new Error('THREE.Quaternion: .setFromEuler() now expects an Euler rotation rather than a Vector3 and order.');
+                       }
+
+                       const x = euler._x,
+                                               y = euler._y,
+                                               z = euler._z,
+                                               order = euler._order; // http://www.mathworks.com/matlabcentral/fileexchange/
+                       //      20696-function-to-convert-between-dcm-euler-angles-quaternions-and-euler-vectors/
+                       //      content/SpinCalc.m
+
+                       const cos = Math.cos;
+                       const sin = Math.sin;
+                       const c1 = cos(x / 2);
+                       const c2 = cos(y / 2);
+                       const c3 = cos(z / 2);
+                       const s1 = sin(x / 2);
+                       const s2 = sin(y / 2);
+                       const s3 = sin(z / 2);
+
+                       switch (order) {
+                               case 'XYZ':
+                                       this._x = s1 * c2 * c3 + c1 * s2 * s3;
+                                       this._y = c1 * s2 * c3 - s1 * c2 * s3;
+                                       this._z = c1 * c2 * s3 + s1 * s2 * c3;
+                                       this._w = c1 * c2 * c3 - s1 * s2 * s3;
+                                       break;
+
+                               case 'YXZ':
+                                       this._x = s1 * c2 * c3 + c1 * s2 * s3;
+                                       this._y = c1 * s2 * c3 - s1 * c2 * s3;
+                                       this._z = c1 * c2 * s3 - s1 * s2 * c3;
+                                       this._w = c1 * c2 * c3 + s1 * s2 * s3;
+                                       break;
+
+                               case 'ZXY':
+                                       this._x = s1 * c2 * c3 - c1 * s2 * s3;
+                                       this._y = c1 * s2 * c3 + s1 * c2 * s3;
+                                       this._z = c1 * c2 * s3 + s1 * s2 * c3;
+                                       this._w = c1 * c2 * c3 - s1 * s2 * s3;
+                                       break;
+
+                               case 'ZYX':
+                                       this._x = s1 * c2 * c3 - c1 * s2 * s3;
+                                       this._y = c1 * s2 * c3 + s1 * c2 * s3;
+                                       this._z = c1 * c2 * s3 - s1 * s2 * c3;
+                                       this._w = c1 * c2 * c3 + s1 * s2 * s3;
+                                       break;
+
+                               case 'YZX':
+                                       this._x = s1 * c2 * c3 + c1 * s2 * s3;
+                                       this._y = c1 * s2 * c3 + s1 * c2 * s3;
+                                       this._z = c1 * c2 * s3 - s1 * s2 * c3;
+                                       this._w = c1 * c2 * c3 - s1 * s2 * s3;
+                                       break;
+
+                               case 'XZY':
+                                       this._x = s1 * c2 * c3 - c1 * s2 * s3;
+                                       this._y = c1 * s2 * c3 - s1 * c2 * s3;
+                                       this._z = c1 * c2 * s3 + s1 * s2 * c3;
+                                       this._w = c1 * c2 * c3 + s1 * s2 * s3;
+                                       break;
+
+                               default:
+                                       console.warn('THREE.Quaternion: .setFromEuler() encountered an unknown order: ' + order);
+                       }
+
+                       if (update !== false) this._onChangeCallback();
+                       return this;
+               }
+
+               setFromAxisAngle(axis, angle) {
+                       // http://www.euclideanspace.com/maths/geometry/rotations/conversions/angleToQuaternion/index.htm
+                       // assumes axis is normalized
+                       const halfAngle = angle / 2,
+                                               s = Math.sin(halfAngle);
+                       this._x = axis.x * s;
+                       this._y = axis.y * s;
+                       this._z = axis.z * s;
+                       this._w = Math.cos(halfAngle);
+
+                       this._onChangeCallback();
+
+                       return this;
+               }
+
+               setFromRotationMatrix(m) {
+                       // http://www.euclideanspace.com/maths/geometry/rotations/conversions/matrixToQuaternion/index.htm
+                       // assumes the upper 3x3 of m is a pure rotation matrix (i.e, unscaled)
+                       const te = m.elements,
+                                               m11 = te[0],
+                                               m12 = te[4],
+                                               m13 = te[8],
+                                               m21 = te[1],
+                                               m22 = te[5],
+                                               m23 = te[9],
+                                               m31 = te[2],
+                                               m32 = te[6],
+                                               m33 = te[10],
+                                               trace = m11 + m22 + m33;
+
+                       if (trace > 0) {
+                               const s = 0.5 / Math.sqrt(trace + 1.0);
+                               this._w = 0.25 / s;
+                               this._x = (m32 - m23) * s;
+                               this._y = (m13 - m31) * s;
+                               this._z = (m21 - m12) * s;
+                       } else if (m11 > m22 && m11 > m33) {
+                               const s = 2.0 * Math.sqrt(1.0 + m11 - m22 - m33);
+                               this._w = (m32 - m23) / s;
+                               this._x = 0.25 * s;
+                               this._y = (m12 + m21) / s;
+                               this._z = (m13 + m31) / s;
+                       } else if (m22 > m33) {
+                               const s = 2.0 * Math.sqrt(1.0 + m22 - m11 - m33);
+                               this._w = (m13 - m31) / s;
+                               this._x = (m12 + m21) / s;
+                               this._y = 0.25 * s;
+                               this._z = (m23 + m32) / s;
+                       } else {
+                               const s = 2.0 * Math.sqrt(1.0 + m33 - m11 - m22);
+                               this._w = (m21 - m12) / s;
+                               this._x = (m13 + m31) / s;
+                               this._y = (m23 + m32) / s;
+                               this._z = 0.25 * s;
+                       }
+
+                       this._onChangeCallback();
+
+                       return this;
+               }
+
+               setFromUnitVectors(vFrom, vTo) {
+                       // assumes direction vectors vFrom and vTo are normalized
+                       let r = vFrom.dot(vTo) + 1;
+
+                       if (r < Number.EPSILON) {
+                               // vFrom and vTo point in opposite directions
+                               r = 0;
+
+                               if (Math.abs(vFrom.x) > Math.abs(vFrom.z)) {
+                                       this._x = -vFrom.y;
+                                       this._y = vFrom.x;
+                                       this._z = 0;
+                                       this._w = r;
+                               } else {
+                                       this._x = 0;
+                                       this._y = -vFrom.z;
+                                       this._z = vFrom.y;
+                                       this._w = r;
+                               }
+                       } else {
+                               // crossVectors( vFrom, vTo ); // inlined to avoid cyclic dependency on Vector3
+                               this._x = vFrom.y * vTo.z - vFrom.z * vTo.y;
+                               this._y = vFrom.z * vTo.x - vFrom.x * vTo.z;
+                               this._z = vFrom.x * vTo.y - vFrom.y * vTo.x;
+                               this._w = r;
+                       }
+
+                       return this.normalize();
+               }
+
+               angleTo(q) {
+                       return 2 * Math.acos(Math.abs(clamp(this.dot(q), -1, 1)));
+               }
+
+               rotateTowards(q, step) {
+                       const angle = this.angleTo(q);
+                       if (angle === 0) return this;
+                       const t = Math.min(1, step / angle);
+                       this.slerp(q, t);
+                       return this;
+               }
+
+               identity() {
+                       return this.set(0, 0, 0, 1);
+               }
+
+               invert() {
+                       // quaternion is assumed to have unit length
+                       return this.conjugate();
+               }
+
+               conjugate() {
+                       this._x *= -1;
+                       this._y *= -1;
+                       this._z *= -1;
+
+                       this._onChangeCallback();
+
+                       return this;
+               }
+
+               dot(v) {
+                       return this._x * v._x + this._y * v._y + this._z * v._z + this._w * v._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 l = this.length();
+
+                       if (l === 0) {
+                               this._x = 0;
+                               this._y = 0;
+                               this._z = 0;
+                               this._w = 1;
+                       } else {
+                               l = 1 / l;
+                               this._x = this._x * l;
+                               this._y = this._y * l;
+                               this._z = this._z * l;
+                               this._w = this._w * l;
+                       }
+
+                       this._onChangeCallback();
+
+                       return this;
+               }
+
+               multiply(q, p) {
+                       if (p !== undefined) {
+                               console.warn('THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead.');
+                               return this.multiplyQuaternions(q, p);
+                       }
+
+                       return this.multiplyQuaternions(this, q);
+               }
+
+               premultiply(q) {
+                       return this.multiplyQuaternions(q, this);
+               }
+
+               multiplyQuaternions(a, b) {
+                       // from http://www.euclideanspace.com/maths/algebra/realNormedAlgebra/quaternions/code/index.htm
+                       const qax = a._x,
+                                               qay = a._y,
+                                               qaz = a._z,
+                                               qaw = a._w;
+                       const qbx = b._x,
+                                               qby = b._y,
+                                               qbz = b._z,
+                                               qbw = b._w;
+                       this._x = qax * qbw + qaw * qbx + qay * qbz - qaz * qby;
+                       this._y = qay * qbw + qaw * qby + qaz * qbx - qax * qbz;
+                       this._z = qaz * qbw + qaw * qbz + qax * qby - qay * qbx;
+                       this._w = qaw * qbw - qax * qbx - qay * qby - qaz * qbz;
+
+                       this._onChangeCallback();
+
+                       return this;
+               }
+
+               slerp(qb, t) {
+                       if (t === 0) return this;
+                       if (t === 1) return this.copy(qb);
+                       const x = this._x,
+                                               y = this._y,
+                                               z = this._z,
+                                               w = this._w; // http://www.euclideanspace.com/maths/algebra/realNormedAlgebra/quaternions/slerp/
+
+                       let cosHalfTheta = w * qb._w + x * qb._x + y * qb._y + z * qb._z;
+
+                       if (cosHalfTheta < 0) {
+                               this._w = -qb._w;
+                               this._x = -qb._x;
+                               this._y = -qb._y;
+                               this._z = -qb._z;
+                               cosHalfTheta = -cosHalfTheta;
+                       } else {
+                               this.copy(qb);
+                       }
+
+                       if (cosHalfTheta >= 1.0) {
+                               this._w = w;
+                               this._x = x;
+                               this._y = y;
+                               this._z = z;
+                               return this;
+                       }
+
+                       const sqrSinHalfTheta = 1.0 - cosHalfTheta * cosHalfTheta;
+
+                       if (sqrSinHalfTheta <= Number.EPSILON) {
+                               const s = 1 - t;
+                               this._w = s * w + t * this._w;
+                               this._x = s * x + t * this._x;
+                               this._y = s * y + t * this._y;
+                               this._z = s * z + t * this._z;
+                               this.normalize();
+
+                               this._onChangeCallback();
+
+                               return this;
+                       }
+
+                       const sinHalfTheta = Math.sqrt(sqrSinHalfTheta);
+                       const halfTheta = Math.atan2(sinHalfTheta, cosHalfTheta);
+                       const ratioA = Math.sin((1 - t) * halfTheta) / sinHalfTheta,
+                                               ratioB = Math.sin(t * halfTheta) / sinHalfTheta;
+                       this._w = w * ratioA + this._w * ratioB;
+                       this._x = x * ratioA + this._x * ratioB;
+                       this._y = y * ratioA + this._y * ratioB;
+                       this._z = z * ratioA + this._z * ratioB;
+
+                       this._onChangeCallback();
+
+                       return this;
+               }
+
+               slerpQuaternions(qa, qb, t) {
+                       this.copy(qa).slerp(qb, t);
+               }
+
+               equals(quaternion) {
+                       return quaternion._x === this._x && quaternion._y === this._y && quaternion._z === this._z && quaternion._w === this._w;
+               }
+
+               fromArray(array, offset = 0) {
+                       this._x = array[offset];
+                       this._y = array[offset + 1];
+                       this._z = array[offset + 2];
+                       this._w = array[offset + 3];
+
+                       this._onChangeCallback();
+
+                       return this;
+               }
+
+               toArray(array = [], offset = 0) {
+                       array[offset] = this._x;
+                       array[offset + 1] = this._y;
+                       array[offset + 2] = this._z;
+                       array[offset + 3] = this._w;
+                       return array;
+               }
+
+               fromBufferAttribute(attribute, index) {
+                       this._x = attribute.getX(index);
+                       this._y = attribute.getY(index);
+                       this._z = attribute.getZ(index);
+                       this._w = attribute.getW(index);
+                       return this;
+               }
+
+               _onChange(callback) {
+                       this._onChangeCallback = callback;
+                       return this;
+               }
+
+               _onChangeCallback() {}
+
+       }
+
+       Quaternion.prototype.isQuaternion = true;
+
+       class Vector3 {
+               constructor(x = 0, y = 0, z = 0) {
+                       this.x = x;
+                       this.y = y;
+                       this.z = z;
+               }
+
+               set(x, y, z) {
+                       if (z === undefined) z = this.z; // sprite.scale.set(x,y)
+
+                       this.x = x;
+                       this.y = y;
+                       this.z = z;
+                       return this;
+               }
+
+               setScalar(scalar) {
+                       this.x = scalar;
+                       this.y = scalar;
+                       this.z = scalar;
+                       return this;
+               }
+
+               setX(x) {
+                       this.x = x;
+                       return this;
+               }
+
+               setY(y) {
+                       this.y = y;
+                       return this;
+               }
+
+               setZ(z) {
+                       this.z = z;
+                       return this;
+               }
+
+               setComponent(index, value) {
+                       switch (index) {
+                               case 0:
+                                       this.x = value;
+                                       break;
+
+                               case 1:
+                                       this.y = value;
+                                       break;
+
+                               case 2:
+                                       this.z = value;
+                                       break;
+
+                               default:
+                                       throw new Error('index is out of range: ' + index);
+                       }
+
+                       return this;
+               }
+
+               getComponent(index) {
+                       switch (index) {
+                               case 0:
+                                       return this.x;
+
+                               case 1:
+                                       return this.y;
+
+                               case 2:
+                                       return this.z;
+
+                               default:
+                                       throw new Error('index is out of range: ' + index);
+                       }
+               }
+
+               clone() {
+                       return new this.constructor(this.x, this.y, this.z);
+               }
+
+               copy(v) {
+                       this.x = v.x;
+                       this.y = v.y;
+                       this.z = v.z;
+                       return this;
+               }
+
+               add(v, w) {
+                       if (w !== undefined) {
+                               console.warn('THREE.Vector3: .add() now only accepts one argument. Use .addVectors( a, b ) instead.');
+                               return this.addVectors(v, w);
+                       }
+
+                       this.x += v.x;
+                       this.y += v.y;
+                       this.z += v.z;
+                       return this;
+               }
+
+               addScalar(s) {
+                       this.x += s;
+                       this.y += s;
+                       this.z += s;
+                       return this;
+               }
+
+               addVectors(a, b) {
+                       this.x = a.x + b.x;
+                       this.y = a.y + b.y;
+                       this.z = a.z + b.z;
+                       return this;
+               }
+
+               addScaledVector(v, s) {
+                       this.x += v.x * s;
+                       this.y += v.y * s;
+                       this.z += v.z * s;
+                       return this;
+               }
+
+               sub(v, w) {
+                       if (w !== undefined) {
+                               console.warn('THREE.Vector3: .sub() now only accepts one argument. Use .subVectors( a, b ) instead.');
+                               return this.subVectors(v, w);
+                       }
+
+                       this.x -= v.x;
+                       this.y -= v.y;
+                       this.z -= v.z;
+                       return this;
+               }
+
+               subScalar(s) {
+                       this.x -= s;
+                       this.y -= s;
+                       this.z -= s;
+                       return this;
+               }
+
+               subVectors(a, b) {
+                       this.x = a.x - b.x;
+                       this.y = a.y - b.y;
+                       this.z = a.z - b.z;
+                       return this;
+               }
+
+               multiply(v, w) {
+                       if (w !== undefined) {
+                               console.warn('THREE.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead.');
+                               return this.multiplyVectors(v, w);
+                       }
+
+                       this.x *= v.x;
+                       this.y *= v.y;
+                       this.z *= v.z;
+                       return this;
+               }
+
+               multiplyScalar(scalar) {
+                       this.x *= scalar;
+                       this.y *= scalar;
+                       this.z *= scalar;
+                       return this;
+               }
+
+               multiplyVectors(a, b) {
+                       this.x = a.x * b.x;
+                       this.y = a.y * b.y;
+                       this.z = a.z * b.z;
+                       return this;
+               }
+
+               applyEuler(euler) {
+                       if (!(euler && euler.isEuler)) {
+                               console.error('THREE.Vector3: .applyEuler() now expects an Euler rotation rather than a Vector3 and order.');
+                       }
+
+                       return this.applyQuaternion(_quaternion$4.setFromEuler(euler));
+               }
+
+               applyAxisAngle(axis, angle) {
+                       return this.applyQuaternion(_quaternion$4.setFromAxisAngle(axis, angle));
+               }
+
+               applyMatrix3(m) {
+                       const x = this.x,
+                                               y = this.y,
+                                               z = this.z;
+                       const e = m.elements;
+                       this.x = e[0] * x + e[3] * y + e[6] * z;
+                       this.y = e[1] * x + e[4] * y + e[7] * z;
+                       this.z = e[2] * x + e[5] * y + e[8] * z;
+                       return this;
+               }
+
+               applyNormalMatrix(m) {
+                       return this.applyMatrix3(m).normalize();
+               }
+
+               applyMatrix4(m) {
+                       const x = this.x,
+                                               y = this.y,
+                                               z = this.z;
+                       const e = m.elements;
+                       const w = 1 / (e[3] * x + e[7] * y + e[11] * z + e[15]);
+                       this.x = (e[0] * x + e[4] * y + e[8] * z + e[12]) * w;
+                       this.y = (e[1] * x + e[5] * y + e[9] * z + e[13]) * w;
+                       this.z = (e[2] * x + e[6] * y + e[10] * z + e[14]) * w;
+                       return this;
+               }
+
+               applyQuaternion(q) {
+                       const x = this.x,
+                                               y = this.y,
+                                               z = this.z;
+                       const qx = q.x,
+                                               qy = q.y,
+                                               qz = q.z,
+                                               qw = q.w; // calculate quat * vector
+
+                       const ix = qw * x + qy * z - qz * y;
+                       const iy = qw * y + qz * x - qx * z;
+                       const iz = qw * z + qx * y - qy * x;
+                       const iw = -qx * x - qy * y - qz * z; // calculate result * inverse quat
+
+                       this.x = ix * qw + iw * -qx + iy * -qz - iz * -qy;
+                       this.y = iy * qw + iw * -qy + iz * -qx - ix * -qz;
+                       this.z = iz * qw + iw * -qz + ix * -qy - iy * -qx;
+                       return this;
+               }
+
+               project(camera) {
+                       return this.applyMatrix4(camera.matrixWorldInverse).applyMatrix4(camera.projectionMatrix);
+               }
+
+               unproject(camera) {
+                       return this.applyMatrix4(camera.projectionMatrixInverse).applyMatrix4(camera.matrixWorld);
+               }
+
+               transformDirection(m) {
+                       // input: THREE.Matrix4 affine matrix
+                       // vector interpreted as a direction
+                       const x = this.x,
+                                               y = this.y,
+                                               z = this.z;
+                       const e = m.elements;
+                       this.x = e[0] * x + e[4] * y + e[8] * z;
+                       this.y = e[1] * x + e[5] * y + e[9] * z;
+                       this.z = e[2] * x + e[6] * y + e[10] * z;
+                       return this.normalize();
+               }
+
+               divide(v) {
+                       this.x /= v.x;
+                       this.y /= v.y;
+                       this.z /= v.z;
+                       return this;
+               }
+
+               divideScalar(scalar) {
+                       return this.multiplyScalar(1 / scalar);
+               }
+
+               min(v) {
+                       this.x = Math.min(this.x, v.x);
+                       this.y = Math.min(this.y, v.y);
+                       this.z = Math.min(this.z, v.z);
+                       return this;
+               }
+
+               max(v) {
+                       this.x = Math.max(this.x, v.x);
+                       this.y = Math.max(this.y, v.y);
+                       this.z = Math.max(this.z, v.z);
+                       return this;
+               }
+
+               clamp(min, max) {
+                       // assumes min < max, componentwise
+                       this.x = Math.max(min.x, Math.min(max.x, this.x));
+                       this.y = Math.max(min.y, Math.min(max.y, this.y));
+                       this.z = Math.max(min.z, Math.min(max.z, this.z));
+                       return this;
+               }
+
+               clampScalar(minVal, maxVal) {
+                       this.x = Math.max(minVal, Math.min(maxVal, this.x));
+                       this.y = Math.max(minVal, Math.min(maxVal, this.y));
+                       this.z = Math.max(minVal, Math.min(maxVal, this.z));
+                       return this;
+               }
+
+               clampLength(min, max) {
+                       const length = this.length();
+                       return this.divideScalar(length || 1).multiplyScalar(Math.max(min, Math.min(max, length)));
+               }
+
+               floor() {
+                       this.x = Math.floor(this.x);
+                       this.y = Math.floor(this.y);
+                       this.z = Math.floor(this.z);
+                       return this;
+               }
+
+               ceil() {
+                       this.x = Math.ceil(this.x);
+                       this.y = Math.ceil(this.y);
+                       this.z = Math.ceil(this.z);
+                       return this;
+               }
+
+               round() {
+                       this.x = Math.round(this.x);
+                       this.y = Math.round(this.y);
+                       this.z = Math.round(this.z);
+                       return this;
+               }
+
+               roundToZero() {
+                       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);
+                       return this;
+               }
+
+               negate() {
+                       this.x = -this.x;
+                       this.y = -this.y;
+                       this.z = -this.z;
+                       return this;
+               }
+
+               dot(v) {
+                       return this.x * v.x + this.y * v.y + this.z * v.z;
+               } // TODO lengthSquared?
+
+
+               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(length) {
+                       return this.normalize().multiplyScalar(length);
+               }
+
+               lerp(v, alpha) {
+                       this.x += (v.x - this.x) * alpha;
+                       this.y += (v.y - this.y) * alpha;
+                       this.z += (v.z - this.z) * alpha;
+                       return this;
+               }
+
+               lerpVectors(v1, v2, alpha) {
+                       this.x = v1.x + (v2.x - v1.x) * alpha;
+                       this.y = v1.y + (v2.y - v1.y) * alpha;
+                       this.z = v1.z + (v2.z - v1.z) * alpha;
+                       return this;
+               }
+
+               cross(v, w) {
+                       if (w !== undefined) {
+                               console.warn('THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead.');
+                               return this.crossVectors(v, w);
+                       }
+
+                       return this.crossVectors(this, v);
+               }
+
+               crossVectors(a, b) {
+                       const ax = a.x,
+                                               ay = a.y,
+                                               az = a.z;
+                       const bx = b.x,
+                                               by = b.y,
+                                               bz = b.z;
+                       this.x = ay * bz - az * by;
+                       this.y = az * bx - ax * bz;
+                       this.z = ax * by - ay * bx;
+                       return this;
+               }
+
+               projectOnVector(v) {
+                       const denominator = v.lengthSq();
+                       if (denominator === 0) return this.set(0, 0, 0);
+                       const scalar = v.dot(this) / denominator;
+                       return this.copy(v).multiplyScalar(scalar);
+               }
+
+               projectOnPlane(planeNormal) {
+                       _vector$c.copy(this).projectOnVector(planeNormal);
+
+                       return this.sub(_vector$c);
+               }
+
+               reflect(normal) {
+                       // reflect incident vector off plane orthogonal to normal
+                       // normal is assumed to have unit length
+                       return this.sub(_vector$c.copy(normal).multiplyScalar(2 * this.dot(normal)));
+               }
+
+               angleTo(v) {
+                       const denominator = Math.sqrt(this.lengthSq() * v.lengthSq());
+                       if (denominator === 0) return Math.PI / 2;
+                       const theta = this.dot(v) / denominator; // clamp, to handle numerical problems
+
+                       return Math.acos(clamp(theta, -1, 1));
+               }
+
+               distanceTo(v) {
+                       return Math.sqrt(this.distanceToSquared(v));
+               }
+
+               distanceToSquared(v) {
+                       const dx = this.x - v.x,
+                                               dy = this.y - v.y,
+                                               dz = this.z - v.z;
+                       return dx * dx + dy * dy + dz * dz;
+               }
+
+               manhattanDistanceTo(v) {
+                       return Math.abs(this.x - v.x) + Math.abs(this.y - v.y) + Math.abs(this.z - v.z);
+               }
+
+               setFromSpherical(s) {
+                       return this.setFromSphericalCoords(s.radius, s.phi, s.theta);
+               }
+
+               setFromSphericalCoords(radius, phi, theta) {
+                       const sinPhiRadius = Math.sin(phi) * radius;
+                       this.x = sinPhiRadius * Math.sin(theta);
+                       this.y = Math.cos(phi) * radius;
+                       this.z = sinPhiRadius * Math.cos(theta);
+                       return this;
+               }
+
+               setFromCylindrical(c) {
+                       return this.setFromCylindricalCoords(c.radius, c.theta, c.y);
+               }
+
+               setFromCylindricalCoords(radius, theta, y) {
+                       this.x = radius * Math.sin(theta);
+                       this.y = y;
+                       this.z = radius * Math.cos(theta);
+                       return this;
+               }
+
+               setFromMatrixPosition(m) {
+                       const e = m.elements;
+                       this.x = e[12];
+                       this.y = e[13];
+                       this.z = e[14];
+                       return this;
+               }
+
+               setFromMatrixScale(m) {
+                       const sx = this.setFromMatrixColumn(m, 0).length();
+                       const sy = this.setFromMatrixColumn(m, 1).length();
+                       const sz = this.setFromMatrixColumn(m, 2).length();
+                       this.x = sx;
+                       this.y = sy;
+                       this.z = sz;
+                       return this;
+               }
+
+               setFromMatrixColumn(m, index) {
+                       return this.fromArray(m.elements, index * 4);
+               }
+
+               setFromMatrix3Column(m, index) {
+                       return this.fromArray(m.elements, index * 3);
+               }
+
+               equals(v) {
+                       return v.x === this.x && v.y === this.y && v.z === this.z;
+               }
+
+               fromArray(array, offset = 0) {
+                       this.x = array[offset];
+                       this.y = array[offset + 1];
+                       this.z = array[offset + 2];
+                       return this;
+               }
+
+               toArray(array = [], offset = 0) {
+                       array[offset] = this.x;
+                       array[offset + 1] = this.y;
+                       array[offset + 2] = this.z;
+                       return array;
+               }
+
+               fromBufferAttribute(attribute, index, offset) {
+                       if (offset !== undefined) {
+                               console.warn('THREE.Vector3: offset has been removed from .fromBufferAttribute().');
+                       }
+
+                       this.x = attribute.getX(index);
+                       this.y = attribute.getY(index);
+                       this.z = attribute.getZ(index);
+                       return this;
+               }
+
+               random() {
+                       this.x = Math.random();
+                       this.y = Math.random();
+                       this.z = Math.random();
+                       return this;
+               }
+
+       }
+
+       Vector3.prototype.isVector3 = true;
+
+       const _vector$c = /*@__PURE__*/new Vector3();
+
+       const _quaternion$4 = /*@__PURE__*/new Quaternion();
+
+       class Box3 {
+               constructor(min = new Vector3(+Infinity, +Infinity, +Infinity), max = new Vector3(-Infinity, -Infinity, -Infinity)) {
+                       this.min = min;
+                       this.max = max;
+               }
+
+               set(min, max) {
+                       this.min.copy(min);
+                       this.max.copy(max);
+                       return this;
+               }
+
+               setFromArray(array) {
+                       let minX = +Infinity;
+                       let minY = +Infinity;
+                       let minZ = +Infinity;
+                       let maxX = -Infinity;
+                       let maxY = -Infinity;
+                       let maxZ = -Infinity;
+
+                       for (let i = 0, l = array.length; i < l; i += 3) {
+                               const x = array[i];
+                               const y = array[i + 1];
+                               const z = array[i + 2];
+                               if (x < minX) minX = x;
+                               if (y < minY) minY = y;
+                               if (z < minZ) minZ = z;
+                               if (x > maxX) maxX = x;
+                               if (y > maxY) maxY = y;
+                               if (z > maxZ) maxZ = z;
+                       }
+
+                       this.min.set(minX, minY, minZ);
+                       this.max.set(maxX, maxY, maxZ);
+                       return this;
+               }
+
+               setFromBufferAttribute(attribute) {
+                       let minX = +Infinity;
+                       let minY = +Infinity;
+                       let minZ = +Infinity;
+                       let maxX = -Infinity;
+                       let maxY = -Infinity;
+                       let maxZ = -Infinity;
+
+                       for (let i = 0, l = attribute.count; i < l; i++) {
+                               const x = attribute.getX(i);
+                               const y = attribute.getY(i);
+                               const z = attribute.getZ(i);
+                               if (x < minX) minX = x;
+                               if (y < minY) minY = y;
+                               if (z < minZ) minZ = z;
+                               if (x > maxX) maxX = x;
+                               if (y > maxY) maxY = y;
+                               if (z > maxZ) maxZ = z;
+                       }
+
+                       this.min.set(minX, minY, minZ);
+                       this.max.set(maxX, maxY, maxZ);
+                       return this;
+               }
+
+               setFromPoints(points) {
+                       this.makeEmpty();
+
+                       for (let i = 0, il = points.length; i < il; i++) {
+                               this.expandByPoint(points[i]);
+                       }
+
+                       return this;
+               }
+
+               setFromCenterAndSize(center, size) {
+                       const halfSize = _vector$b.copy(size).multiplyScalar(0.5);
+
+                       this.min.copy(center).sub(halfSize);
+                       this.max.copy(center).add(halfSize);
+                       return this;
+               }
+
+               setFromObject(object) {
+                       this.makeEmpty();
+                       return this.expandByObject(object);
+               }
+
+               clone() {
+                       return new this.constructor().copy(this);
+               }
+
+               copy(box) {
+                       this.min.copy(box.min);
+                       this.max.copy(box.max);
+                       return this;
+               }
+
+               makeEmpty() {
+                       this.min.x = this.min.y = this.min.z = +Infinity;
+                       this.max.x = this.max.y = this.max.z = -Infinity;
+                       return this;
+               }
+
+               isEmpty() {
+                       // this is a more robust check for empty than ( volume <= 0 ) because volume can get positive with two negative axes
+                       return this.max.x < this.min.x || this.max.y < this.min.y || this.max.z < this.min.z;
+               }
+
+               getCenter(target) {
+                       return this.isEmpty() ? target.set(0, 0, 0) : target.addVectors(this.min, this.max).multiplyScalar(0.5);
+               }
+
+               getSize(target) {
+                       return this.isEmpty() ? target.set(0, 0, 0) : target.subVectors(this.max, this.min);
+               }
+
+               expandByPoint(point) {
+                       this.min.min(point);
+                       this.max.max(point);
+                       return this;
+               }
+
+               expandByVector(vector) {
+                       this.min.sub(vector);
+                       this.max.add(vector);
+                       return this;
+               }
+
+               expandByScalar(scalar) {
+                       this.min.addScalar(-scalar);
+                       this.max.addScalar(scalar);
+                       return this;
+               }
+
+               expandByObject(object) {
+                       // Computes the world-axis-aligned bounding box of an object (including its children),
+                       // accounting for both the object's, and children's, world transforms
+                       object.updateWorldMatrix(false, false);
+                       const geometry = object.geometry;
+
+                       if (geometry !== undefined) {
+                               if (geometry.boundingBox === null) {
+                                       geometry.computeBoundingBox();
+                               }
+
+                               _box$3.copy(geometry.boundingBox);
+
+                               _box$3.applyMatrix4(object.matrixWorld);
+
+                               this.union(_box$3);
+                       }
+
+                       const children = object.children;
+
+                       for (let i = 0, l = children.length; i < l; i++) {
+                               this.expandByObject(children[i]);
+                       }
+
+                       return this;
+               }
+
+               containsPoint(point) {
+                       return point.x < this.min.x || point.x > this.max.x || point.y < this.min.y || point.y > this.max.y || point.z < this.min.z || point.z > this.max.z ? false : true;
+               }
+
+               containsBox(box) {
+                       return this.min.x <= box.min.x && box.max.x <= this.max.x && this.min.y <= box.min.y && box.max.y <= this.max.y && this.min.z <= box.min.z && box.max.z <= this.max.z;
+               }
+
+               getParameter(point, target) {
+                       // This can potentially have a divide by zero if the box
+                       // has a size dimension of 0.
+                       return target.set((point.x - this.min.x) / (this.max.x - this.min.x), (point.y - this.min.y) / (this.max.y - this.min.y), (point.z - this.min.z) / (this.max.z - this.min.z));
+               }
+
+               intersectsBox(box) {
+                       // using 6 splitting planes to rule out intersections.
+                       return box.max.x < this.min.x || box.min.x > this.max.x || box.max.y < this.min.y || box.min.y > this.max.y || box.max.z < this.min.z || box.min.z > this.max.z ? false : true;
+               }
+
+               intersectsSphere(sphere) {
+                       // Find the point on the AABB closest to the sphere center.
+                       this.clampPoint(sphere.center, _vector$b); // If that point is inside the sphere, the AABB and sphere intersect.
+
+                       return _vector$b.distanceToSquared(sphere.center) <= sphere.radius * sphere.radius;
+               }
+
+               intersectsPlane(plane) {
+                       // We compute the minimum and maximum dot product values. If those values
+                       // are on the same side (back or front) of the plane, then there is no intersection.
+                       let min, max;
+
+                       if (plane.normal.x > 0) {
+                               min = plane.normal.x * this.min.x;
+                               max = plane.normal.x * this.max.x;
+                       } else {
+                               min = plane.normal.x * this.max.x;
+                               max = plane.normal.x * this.min.x;
+                       }
+
+                       if (plane.normal.y > 0) {
+                               min += plane.normal.y * this.min.y;
+                               max += plane.normal.y * this.max.y;
+                       } else {
+                               min += plane.normal.y * this.max.y;
+                               max += plane.normal.y * this.min.y;
+                       }
+
+                       if (plane.normal.z > 0) {
+                               min += plane.normal.z * this.min.z;
+                               max += plane.normal.z * this.max.z;
+                       } else {
+                               min += plane.normal.z * this.max.z;
+                               max += plane.normal.z * this.min.z;
+                       }
+
+                       return min <= -plane.constant && max >= -plane.constant;
+               }
+
+               intersectsTriangle(triangle) {
+                       if (this.isEmpty()) {
+                               return false;
+                       } // compute box center and extents
+
+
+                       this.getCenter(_center);
+
+                       _extents.subVectors(this.max, _center); // translate triangle to aabb origin
+
+
+                       _v0$2.subVectors(triangle.a, _center);
+
+                       _v1$7.subVectors(triangle.b, _center);
+
+                       _v2$3.subVectors(triangle.c, _center); // compute edge vectors for triangle
+
+
+                       _f0.subVectors(_v1$7, _v0$2);
+
+                       _f1.subVectors(_v2$3, _v1$7);
+
+                       _f2.subVectors(_v0$2, _v2$3); // test against axes that are given by cross product combinations of the edges of the triangle and the edges of the aabb
+                       // make an axis testing of each of the 3 sides of the aabb against each of the 3 sides of the triangle = 9 axis of separation
+                       // axis_ij = u_i x f_j (u0, u1, u2 = face normals of aabb = x,y,z axes vectors since aabb is axis aligned)
+
+
+                       let axes = [0, -_f0.z, _f0.y, 0, -_f1.z, _f1.y, 0, -_f2.z, _f2.y, _f0.z, 0, -_f0.x, _f1.z, 0, -_f1.x, _f2.z, 0, -_f2.x, -_f0.y, _f0.x, 0, -_f1.y, _f1.x, 0, -_f2.y, _f2.x, 0];
+
+                       if (!satForAxes(axes, _v0$2, _v1$7, _v2$3, _extents)) {
+                               return false;
+                       } // test 3 face normals from the aabb
+
+
+                       axes = [1, 0, 0, 0, 1, 0, 0, 0, 1];
+
+                       if (!satForAxes(axes, _v0$2, _v1$7, _v2$3, _extents)) {
+                               return false;
+                       } // finally testing the face normal of the triangle
+                       // use already existing triangle edge vectors here
+
+
+                       _triangleNormal.crossVectors(_f0, _f1);
+
+                       axes = [_triangleNormal.x, _triangleNormal.y, _triangleNormal.z];
+                       return satForAxes(axes, _v0$2, _v1$7, _v2$3, _extents);
+               }
+
+               clampPoint(point, target) {
+                       return target.copy(point).clamp(this.min, this.max);
+               }
+
+               distanceToPoint(point) {
+                       const clampedPoint = _vector$b.copy(point).clamp(this.min, this.max);
+
+                       return clampedPoint.sub(point).length();
+               }
+
+               getBoundingSphere(target) {
+                       this.getCenter(target.center);
+                       target.radius = this.getSize(_vector$b).length() * 0.5;
+                       return target;
+               }
+
+               intersect(box) {
+                       this.min.max(box.min);
+                       this.max.min(box.max); // ensure that if there is no overlap, the result is fully empty, not slightly empty with non-inf/+inf values that will cause subsequence intersects to erroneously return valid values.
+
+                       if (this.isEmpty()) this.makeEmpty();
+                       return this;
+               }
+
+               union(box) {
+                       this.min.min(box.min);
+                       this.max.max(box.max);
+                       return this;
+               }
+
+               applyMatrix4(matrix) {
+                       // transform of empty box is an empty box.
+                       if (this.isEmpty()) return this; // NOTE: I am using a binary pattern to specify all 2^3 combinations below
+
+                       _points[0].set(this.min.x, this.min.y, this.min.z).applyMatrix4(matrix); // 000
+
+
+                       _points[1].set(this.min.x, this.min.y, this.max.z).applyMatrix4(matrix); // 001
+
+
+                       _points[2].set(this.min.x, this.max.y, this.min.z).applyMatrix4(matrix); // 010
+
+
+                       _points[3].set(this.min.x, this.max.y, this.max.z).applyMatrix4(matrix); // 011
+
+
+                       _points[4].set(this.max.x, this.min.y, this.min.z).applyMatrix4(matrix); // 100
+
+
+                       _points[5].set(this.max.x, this.min.y, this.max.z).applyMatrix4(matrix); // 101
+
+
+                       _points[6].set(this.max.x, this.max.y, this.min.z).applyMatrix4(matrix); // 110
+
+
+                       _points[7].set(this.max.x, this.max.y, this.max.z).applyMatrix4(matrix); // 111
+
+
+                       this.setFromPoints(_points);
+                       return this;
+               }
+
+               translate(offset) {
+                       this.min.add(offset);
+                       this.max.add(offset);
+                       return this;
+               }
+
+               equals(box) {
+                       return box.min.equals(this.min) && box.max.equals(this.max);
+               }
+
+       }
+
+       Box3.prototype.isBox3 = true;
+       const _points = [/*@__PURE__*/new Vector3(), /*@__PURE__*/new Vector3(), /*@__PURE__*/new Vector3(), /*@__PURE__*/new Vector3(), /*@__PURE__*/new Vector3(), /*@__PURE__*/new Vector3(), /*@__PURE__*/new Vector3(), /*@__PURE__*/new Vector3()];
+
+       const _vector$b = /*@__PURE__*/new Vector3();
+
+       const _box$3 = /*@__PURE__*/new Box3(); // triangle centered vertices
+
+
+       const _v0$2 = /*@__PURE__*/new Vector3();
+
+       const _v1$7 = /*@__PURE__*/new Vector3();
+
+       const _v2$3 = /*@__PURE__*/new Vector3(); // triangle edge vectors
+
+
+       const _f0 = /*@__PURE__*/new Vector3();
+
+       const _f1 = /*@__PURE__*/new Vector3();
+
+       const _f2 = /*@__PURE__*/new Vector3();
+
+       const _center = /*@__PURE__*/new Vector3();
+
+       const _extents = /*@__PURE__*/new Vector3();
+
+       const _triangleNormal = /*@__PURE__*/new Vector3();
+
+       const _testAxis = /*@__PURE__*/new Vector3();
+
+       function satForAxes(axes, v0, v1, v2, extents) {
+               for (let i = 0, j = axes.length - 3; i <= j; i += 3) {
+                       _testAxis.fromArray(axes, i); // project the aabb onto the seperating axis
+
+
+                       const r = extents.x * Math.abs(_testAxis.x) + extents.y * Math.abs(_testAxis.y) + extents.z * Math.abs(_testAxis.z); // project all 3 vertices of the triangle onto the seperating axis
+
+                       const p0 = v0.dot(_testAxis);
+                       const p1 = v1.dot(_testAxis);
+                       const p2 = v2.dot(_testAxis); // actual test, basically see if either of the most extreme of the triangle points intersects r
+
+                       if (Math.max(-Math.max(p0, p1, p2), Math.min(p0, p1, p2)) > r) {
+                               // points of the projected triangle are outside the projected half-length of the aabb
+                               // the axis is seperating and we can exit
+                               return false;
+                       }
+               }
+
+               return true;
+       }
+
+       const _box$2 = /*@__PURE__*/new Box3();
+
+       const _v1$6 = /*@__PURE__*/new Vector3();
+
+       const _toFarthestPoint = /*@__PURE__*/new Vector3();
+
+       const _toPoint = /*@__PURE__*/new Vector3();
+
+       class Sphere {
+               constructor(center = new Vector3(), radius = -1) {
+                       this.center = center;
+                       this.radius = radius;
+               }
+
+               set(center, radius) {
+                       this.center.copy(center);
+                       this.radius = radius;
+                       return this;
+               }
+
+               setFromPoints(points, optionalCenter) {
+                       const center = this.center;
+
+                       if (optionalCenter !== undefined) {
+                               center.copy(optionalCenter);
+                       } else {
+                               _box$2.setFromPoints(points).getCenter(center);
+                       }
+
+                       let maxRadiusSq = 0;
+
+                       for (let i = 0, il = points.length; i < il; i++) {
+                               maxRadiusSq = Math.max(maxRadiusSq, center.distanceToSquared(points[i]));
+                       }
+
+                       this.radius = Math.sqrt(maxRadiusSq);
+                       return this;
+               }
+
+               copy(sphere) {
+                       this.center.copy(sphere.center);
+                       this.radius = sphere.radius;
+                       return this;
+               }
+
+               isEmpty() {
+                       return this.radius < 0;
+               }
+
+               makeEmpty() {
+                       this.center.set(0, 0, 0);
+                       this.radius = -1;
+                       return this;
+               }
+
+               containsPoint(point) {
+                       return point.distanceToSquared(this.center) <= this.radius * this.radius;
+               }
+
+               distanceToPoint(point) {
+                       return point.distanceTo(this.center) - this.radius;
+               }
+
+               intersectsSphere(sphere) {
+                       const radiusSum = this.radius + sphere.radius;
+                       return sphere.center.distanceToSquared(this.center) <= radiusSum * radiusSum;
+               }
+
+               intersectsBox(box) {
+                       return box.intersectsSphere(this);
+               }
+
+               intersectsPlane(plane) {
+                       return Math.abs(plane.distanceToPoint(this.center)) <= this.radius;
+               }
+
+               clampPoint(point, target) {
+                       const deltaLengthSq = this.center.distanceToSquared(point);
+                       target.copy(point);
+
+                       if (deltaLengthSq > this.radius * this.radius) {
+                               target.sub(this.center).normalize();
+                               target.multiplyScalar(this.radius).add(this.center);
+                       }
+
+                       return target;
+               }
+
+               getBoundingBox(target) {
+                       if (this.isEmpty()) {
+                               // Empty sphere produces empty bounding box
+                               target.makeEmpty();
+                               return target;
+                       }
+
+                       target.set(this.center, this.center);
+                       target.expandByScalar(this.radius);
+                       return target;
+               }
+
+               applyMatrix4(matrix) {
+                       this.center.applyMatrix4(matrix);
+                       this.radius = this.radius * matrix.getMaxScaleOnAxis();
+                       return this;
+               }
+
+               translate(offset) {
+                       this.center.add(offset);
+                       return this;
+               }
+
+               expandByPoint(point) {
+                       // from https://github.com/juj/MathGeoLib/blob/2940b99b99cfe575dd45103ef20f4019dee15b54/src/Geometry/Sphere.cpp#L649-L671
+                       _toPoint.subVectors(point, this.center);
+
+                       const lengthSq = _toPoint.lengthSq();
+
+                       if (lengthSq > this.radius * this.radius) {
+                               const length = Math.sqrt(lengthSq);
+                               const missingRadiusHalf = (length - this.radius) * 0.5; // Nudge this sphere towards the target point. Add half the missing distance to radius,
+                               // and the other half to position. This gives a tighter enclosure, instead of if
+                               // the whole missing distance were just added to radius.
+
+                               this.center.add(_toPoint.multiplyScalar(missingRadiusHalf / length));
+                               this.radius += missingRadiusHalf;
+                       }
+
+                       return this;
+               }
+
+               union(sphere) {
+                       // from https://github.com/juj/MathGeoLib/blob/2940b99b99cfe575dd45103ef20f4019dee15b54/src/Geometry/Sphere.cpp#L759-L769
+                       // To enclose another sphere into this sphere, we only need to enclose two points:
+                       // 1) Enclose the farthest point on the other sphere into this sphere.
+                       // 2) Enclose the opposite point of the farthest point into this sphere.
+                       _toFarthestPoint.subVectors(sphere.center, this.center).normalize().multiplyScalar(sphere.radius);
+
+                       this.expandByPoint(_v1$6.copy(sphere.center).add(_toFarthestPoint));
+                       this.expandByPoint(_v1$6.copy(sphere.center).sub(_toFarthestPoint));
+                       return this;
+               }
+
+               equals(sphere) {
+                       return sphere.center.equals(this.center) && sphere.radius === this.radius;
+               }
+
+               clone() {
+                       return new this.constructor().copy(this);
+               }
+
+       }
+
+       const _vector$a = /*@__PURE__*/new Vector3();
+
+       const _segCenter = /*@__PURE__*/new Vector3();
+
+       const _segDir = /*@__PURE__*/new Vector3();
+
+       const _diff = /*@__PURE__*/new Vector3();
+
+       const _edge1 = /*@__PURE__*/new Vector3();
+
+       const _edge2 = /*@__PURE__*/new Vector3();
+
+       const _normal$1 = /*@__PURE__*/new Vector3();
+
+       class Ray {
+               constructor(origin = new Vector3(), direction = new Vector3(0, 0, -1)) {
+                       this.origin = origin;
+                       this.direction = direction;
+               }
+
+               set(origin, direction) {
+                       this.origin.copy(origin);
+                       this.direction.copy(direction);
+                       return this;
+               }
+
+               copy(ray) {
+                       this.origin.copy(ray.origin);
+                       this.direction.copy(ray.direction);
+                       return this;
+               }
+
+               at(t, target) {
+                       return target.copy(this.direction).multiplyScalar(t).add(this.origin);
+               }
+
+               lookAt(v) {
+                       this.direction.copy(v).sub(this.origin).normalize();
+                       return this;
+               }
+
+               recast(t) {
+                       this.origin.copy(this.at(t, _vector$a));
+                       return this;
+               }
+
+               closestPointToPoint(point, target) {
+                       target.subVectors(point, this.origin);
+                       const directionDistance = target.dot(this.direction);
+
+                       if (directionDistance < 0) {
+                               return target.copy(this.origin);
+                       }
+
+                       return target.copy(this.direction).multiplyScalar(directionDistance).add(this.origin);
+               }
+
+               distanceToPoint(point) {
+                       return Math.sqrt(this.distanceSqToPoint(point));
+               }
+
+               distanceSqToPoint(point) {
+                       const directionDistance = _vector$a.subVectors(point, this.origin).dot(this.direction); // point behind the ray
+
+
+                       if (directionDistance < 0) {
+                               return this.origin.distanceToSquared(point);
+                       }
+
+                       _vector$a.copy(this.direction).multiplyScalar(directionDistance).add(this.origin);
+
+                       return _vector$a.distanceToSquared(point);
+               }
+
+               distanceSqToSegment(v0, v1, optionalPointOnRay, optionalPointOnSegment) {
+                       // from http://www.geometrictools.com/GTEngine/Include/Mathematics/GteDistRaySegment.h
+                       // It returns the min distance between the ray and the segment
+                       // defined by v0 and v1
+                       // It can also set two optional targets :
+                       // - The closest point on the ray
+                       // - The closest point on the segment
+                       _segCenter.copy(v0).add(v1).multiplyScalar(0.5);
+
+                       _segDir.copy(v1).sub(v0).normalize();
+
+                       _diff.copy(this.origin).sub(_segCenter);
+
+                       const segExtent = v0.distanceTo(v1) * 0.5;
+                       const a01 = -this.direction.dot(_segDir);
+
+                       const b0 = _diff.dot(this.direction);
+
+                       const b1 = -_diff.dot(_segDir);
+
+                       const c = _diff.lengthSq();
+
+                       const det = Math.abs(1 - a01 * a01);
+                       let s0, s1, sqrDist, extDet;
+
+                       if (det > 0) {
+                               // The ray and segment are not parallel.
+                               s0 = a01 * b1 - b0;
+                               s1 = a01 * b0 - b1;
+                               extDet = segExtent * det;
+
+                               if (s0 >= 0) {
+                                       if (s1 >= -extDet) {
+                                               if (s1 <= extDet) {
+                                                       // region 0
+                                                       // Minimum at interior points of ray and segment.
+                                                       const invDet = 1 / det;
+                                                       s0 *= invDet;
+                                                       s1 *= invDet;
+                                                       sqrDist = s0 * (s0 + a01 * s1 + 2 * b0) + s1 * (a01 * s0 + s1 + 2 * b1) + c;
+                                               } else {
+                                                       // region 1
+                                                       s1 = segExtent;
+                                                       s0 = Math.max(0, -(a01 * s1 + b0));
+                                                       sqrDist = -s0 * s0 + s1 * (s1 + 2 * b1) + c;
+                                               }
+                                       } else {
+                                               // region 5
+                                               s1 = -segExtent;
+                                               s0 = Math.max(0, -(a01 * s1 + b0));
+                                               sqrDist = -s0 * s0 + s1 * (s1 + 2 * b1) + c;
+                                       }
+                               } else {
+                                       if (s1 <= -extDet) {
+                                               // region 4
+                                               s0 = Math.max(0, -(-a01 * segExtent + b0));
+                                               s1 = s0 > 0 ? -segExtent : Math.min(Math.max(-segExtent, -b1), segExtent);
+                                               sqrDist = -s0 * s0 + s1 * (s1 + 2 * b1) + c;
+                                       } else if (s1 <= extDet) {
+                                               // region 3
+                                               s0 = 0;
+                                               s1 = Math.min(Math.max(-segExtent, -b1), segExtent);
+                                               sqrDist = s1 * (s1 + 2 * b1) + c;
+                                       } else {
+                                               // region 2
+                                               s0 = Math.max(0, -(a01 * segExtent + b0));
+                                               s1 = s0 > 0 ? segExtent : Math.min(Math.max(-segExtent, -b1), segExtent);
+                                               sqrDist = -s0 * s0 + s1 * (s1 + 2 * b1) + c;
+                                       }
+                               }
+                       } else {
+                               // Ray and segment are parallel.
+                               s1 = a01 > 0 ? -segExtent : segExtent;
+                               s0 = Math.max(0, -(a01 * s1 + b0));
+                               sqrDist = -s0 * s0 + s1 * (s1 + 2 * b1) + c;
+                       }
+
+                       if (optionalPointOnRay) {
+                               optionalPointOnRay.copy(this.direction).multiplyScalar(s0).add(this.origin);
+                       }
+
+                       if (optionalPointOnSegment) {
+                               optionalPointOnSegment.copy(_segDir).multiplyScalar(s1).add(_segCenter);
+                       }
+
+                       return sqrDist;
+               }
+
+               intersectSphere(sphere, target) {
+                       _vector$a.subVectors(sphere.center, this.origin);
+
+                       const tca = _vector$a.dot(this.direction);
+
+                       const d2 = _vector$a.dot(_vector$a) - tca * tca;
+                       const radius2 = sphere.radius * sphere.radius;
+                       if (d2 > radius2) return null;
+                       const thc = Math.sqrt(radius2 - d2); // t0 = first intersect point - entrance on front of sphere
+
+                       const t0 = tca - thc; // t1 = second intersect point - exit point on back of sphere
+
+                       const t1 = tca + thc; // test to see if both t0 and t1 are behind the ray - if so, return null
+
+                       if (t0 < 0 && t1 < 0) return null; // test to see if t0 is behind the ray:
+                       // if it is, the ray is inside the sphere, so return the second exit point scaled by t1,
+                       // in order to always return an intersect point that is in front of the ray.
+
+                       if (t0 < 0) return this.at(t1, target); // else t0 is in front of the ray, so return the first collision point scaled by t0
+
+                       return this.at(t0, target);
+               }
+
+               intersectsSphere(sphere) {
+                       return this.distanceSqToPoint(sphere.center) <= sphere.radius * sphere.radius;
+               }
+
+               distanceToPlane(plane) {
+                       const denominator = plane.normal.dot(this.direction);
+
+                       if (denominator === 0) {
+                               // line is coplanar, return origin
+                               if (plane.distanceToPoint(this.origin) === 0) {
+                                       return 0;
+                               } // Null is preferable to undefined since undefined means.... it is undefined
+
+
+                               return null;
+                       }
+
+                       const t = -(this.origin.dot(plane.normal) + plane.constant) / denominator; // Return if the ray never intersects the plane
+
+                       return t >= 0 ? t : null;
+               }
+
+               intersectPlane(plane, target) {
+                       const t = this.distanceToPlane(plane);
+
+                       if (t === null) {
+                               return null;
+                       }
+
+                       return this.at(t, target);
+               }
+
+               intersectsPlane(plane) {
+                       // check if the ray lies on the plane first
+                       const distToPoint = plane.distanceToPoint(this.origin);
+
+                       if (distToPoint === 0) {
+                               return true;
+                       }
+
+                       const denominator = plane.normal.dot(this.direction);
+
+                       if (denominator * distToPoint < 0) {
+                               return true;
+                       } // ray origin is behind the plane (and is pointing behind it)
+
+
+                       return false;
+               }
+
+               intersectBox(box, target) {
+                       let tmin, tmax, tymin, tymax, tzmin, tzmax;
+                       const invdirx = 1 / this.direction.x,
+                                               invdiry = 1 / this.direction.y,
+                                               invdirz = 1 / this.direction.z;
+                       const origin = this.origin;
+
+                       if (invdirx >= 0) {
+                               tmin = (box.min.x - origin.x) * invdirx;
+                               tmax = (box.max.x - origin.x) * invdirx;
+                       } else {
+                               tmin = (box.max.x - origin.x) * invdirx;
+                               tmax = (box.min.x - origin.x) * invdirx;
+                       }
+
+                       if (invdiry >= 0) {
+                               tymin = (box.min.y - origin.y) * invdiry;
+                               tymax = (box.max.y - origin.y) * invdiry;
+                       } else {
+                               tymin = (box.max.y - origin.y) * invdiry;
+                               tymax = (box.min.y - origin.y) * invdiry;
+                       }
+
+                       if (tmin > tymax || tymin > tmax) return null; // These lines also handle the case where tmin or tmax is NaN
+                       // (result of 0 * Infinity). x !== x returns true if x is NaN
+
+                       if (tymin > tmin || tmin !== tmin) tmin = tymin;
+                       if (tymax < tmax || tmax !== tmax) tmax = tymax;
+
+                       if (invdirz >= 0) {
+                               tzmin = (box.min.z - origin.z) * invdirz;
+                               tzmax = (box.max.z - origin.z) * invdirz;
+                       } else {
+                               tzmin = (box.max.z - origin.z) * invdirz;
+                               tzmax = (box.min.z - origin.z) * invdirz;
+                       }
+
+                       if (tmin > tzmax || tzmin > tmax) return null;
+                       if (tzmin > tmin || tmin !== tmin) tmin = tzmin;
+                       if (tzmax < tmax || tmax !== tmax) tmax = tzmax; //return point closest to the ray (positive side)
+
+                       if (tmax < 0) return null;
+                       return this.at(tmin >= 0 ? tmin : tmax, target);
+               }
+
+               intersectsBox(box) {
+                       return this.intersectBox(box, _vector$a) !== null;
+               }
+
+               intersectTriangle(a, b, c, backfaceCulling, target) {
+                       // Compute the offset origin, edges, and normal.
+                       // from http://www.geometrictools.com/GTEngine/Include/Mathematics/GteIntrRay3Triangle3.h
+                       _edge1.subVectors(b, a);
+
+                       _edge2.subVectors(c, a);
+
+                       _normal$1.crossVectors(_edge1, _edge2); // Solve Q + t*D = b1*E1 + b2*E2 (Q = kDiff, D = ray direction,
+                       // E1 = kEdge1, E2 = kEdge2, N = Cross(E1,E2)) by
+                       //       |Dot(D,N)|*b1 = sign(Dot(D,N))*Dot(D,Cross(Q,E2))
+                       //       |Dot(D,N)|*b2 = sign(Dot(D,N))*Dot(D,Cross(E1,Q))
+                       //       |Dot(D,N)|*t = -sign(Dot(D,N))*Dot(Q,N)
+
+
+                       let DdN = this.direction.dot(_normal$1);
+                       let sign;
+
+                       if (DdN > 0) {
+                               if (backfaceCulling) return null;
+                               sign = 1;
+                       } else if (DdN < 0) {
+                               sign = -1;
+                               DdN = -DdN;
+                       } else {
+                               return null;
+                       }
+
+                       _diff.subVectors(this.origin, a);
+
+                       const DdQxE2 = sign * this.direction.dot(_edge2.crossVectors(_diff, _edge2)); // b1 < 0, no intersection
+
+                       if (DdQxE2 < 0) {
+                               return null;
+                       }
+
+                       const DdE1xQ = sign * this.direction.dot(_edge1.cross(_diff)); // b2 < 0, no intersection
+
+                       if (DdE1xQ < 0) {
+                               return null;
+                       } // b1+b2 > 1, no intersection
+
+
+                       if (DdQxE2 + DdE1xQ > DdN) {
+                               return null;
+                       } // Line intersects triangle, check if ray does.
+
+
+                       const QdN = -sign * _diff.dot(_normal$1); // t < 0, no intersection
+
+
+                       if (QdN < 0) {
+                               return null;
+                       } // Ray intersects triangle.
+
+
+                       return this.at(QdN / DdN, target);
+               }
+
+               applyMatrix4(matrix4) {
+                       this.origin.applyMatrix4(matrix4);
+                       this.direction.transformDirection(matrix4);
+                       return this;
+               }
+
+               equals(ray) {
+                       return ray.origin.equals(this.origin) && ray.direction.equals(this.direction);
+               }
+
+               clone() {
+                       return new this.constructor().copy(this);
+               }
+
+       }
+
+       class Matrix4 {
+               constructor() {
+                       this.elements = [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1];
+
+                       if (arguments.length > 0) {
+                               console.error('THREE.Matrix4: the constructor no longer reads arguments. use .set() instead.');
+                       }
+               }
+
+               set(n11, n12, n13, n14, n21, n22, n23, n24, n31, n32, n33, n34, n41, n42, n43, n44) {
+                       const te = this.elements;
+                       te[0] = n11;
+                       te[4] = n12;
+                       te[8] = n13;
+                       te[12] = n14;
+                       te[1] = n21;
+                       te[5] = n22;
+                       te[9] = n23;
+                       te[13] = n24;
+                       te[2] = n31;
+                       te[6] = n32;
+                       te[10] = n33;
+                       te[14] = n34;
+                       te[3] = n41;
+                       te[7] = n42;
+                       te[11] = n43;
+                       te[15] = n44;
+                       return this;
+               }
+
+               identity() {
+                       this.set(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);
+                       return this;
+               }
+
+               clone() {
+                       return new Matrix4().fromArray(this.elements);
+               }
+
+               copy(m) {
+                       const te = this.elements;
+                       const me = m.elements;
+                       te[0] = me[0];
+                       te[1] = me[1];
+                       te[2] = me[2];
+                       te[3] = me[3];
+                       te[4] = me[4];
+                       te[5] = me[5];
+                       te[6] = me[6];
+                       te[7] = me[7];
+                       te[8] = me[8];
+                       te[9] = me[9];
+                       te[10] = me[10];
+                       te[11] = me[11];
+                       te[12] = me[12];
+                       te[13] = me[13];
+                       te[14] = me[14];
+                       te[15] = me[15];
+                       return this;
+               }
+
+               copyPosition(m) {
+                       const te = this.elements,
+                                               me = m.elements;
+                       te[12] = me[12];
+                       te[13] = me[13];
+                       te[14] = me[14];
+                       return this;
+               }
+
+               setFromMatrix3(m) {
+                       const me = m.elements;
+                       this.set(me[0], me[3], me[6], 0, me[1], me[4], me[7], 0, me[2], me[5], me[8], 0, 0, 0, 0, 1);
+                       return this;
+               }
+
+               extractBasis(xAxis, yAxis, zAxis) {
+                       xAxis.setFromMatrixColumn(this, 0);
+                       yAxis.setFromMatrixColumn(this, 1);
+                       zAxis.setFromMatrixColumn(this, 2);
+                       return this;
+               }
+
+               makeBasis(xAxis, yAxis, zAxis) {
+                       this.set(xAxis.x, yAxis.x, zAxis.x, 0, xAxis.y, yAxis.y, zAxis.y, 0, xAxis.z, yAxis.z, zAxis.z, 0, 0, 0, 0, 1);
+                       return this;
+               }
+
+               extractRotation(m) {
+                       // this method does not support reflection matrices
+                       const te = this.elements;
+                       const me = m.elements;
+
+                       const scaleX = 1 / _v1$5.setFromMatrixColumn(m, 0).length();
+
+                       const scaleY = 1 / _v1$5.setFromMatrixColumn(m, 1).length();
+
+                       const scaleZ = 1 / _v1$5.setFromMatrixColumn(m, 2).length();
+
+                       te[0] = me[0] * scaleX;
+                       te[1] = me[1] * scaleX;
+                       te[2] = me[2] * scaleX;
+                       te[3] = 0;
+                       te[4] = me[4] * scaleY;
+                       te[5] = me[5] * scaleY;
+                       te[6] = me[6] * scaleY;
+                       te[7] = 0;
+                       te[8] = me[8] * scaleZ;
+                       te[9] = me[9] * scaleZ;
+                       te[10] = me[10] * scaleZ;
+                       te[11] = 0;
+                       te[12] = 0;
+                       te[13] = 0;
+                       te[14] = 0;
+                       te[15] = 1;
+                       return this;
+               }
+
+               makeRotationFromEuler(euler) {
+                       if (!(euler && euler.isEuler)) {
+                               console.error('THREE.Matrix4: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.');
+                       }
+
+                       const te = this.elements;
+                       const x = euler.x,
+                                               y = euler.y,
+                                               z = euler.z;
+                       const a = Math.cos(x),
+                                               b = Math.sin(x);
+                       const c = Math.cos(y),
+                                               d = Math.sin(y);
+                       const e = Math.cos(z),
+                                               f = Math.sin(z);
+
+                       if (euler.order === 'XYZ') {
+                               const ae = a * e,
+                                                       af = a * f,
+                                                       be = b * e,
+                                                       bf = b * f;
+                               te[0] = c * e;
+                               te[4] = -c * f;
+                               te[8] = d;
+                               te[1] = af + be * d;
+                               te[5] = ae - bf * d;
+                               te[9] = -b * c;
+                               te[2] = bf - ae * d;
+                               te[6] = be + af * d;
+                               te[10] = a * c;
+                       } else if (euler.order === 'YXZ') {
+                               const ce = c * e,
+                                                       cf = c * f,
+                                                       de = d * e,
+                                                       df = d * f;
+                               te[0] = ce + df * b;
+                               te[4] = de * b - cf;
+                               te[8] = a * d;
+                               te[1] = a * f;
+                               te[5] = a * e;
+                               te[9] = -b;
+                               te[2] = cf * b - de;
+                               te[6] = df + ce * b;
+                               te[10] = a * c;
+                       } else if (euler.order === 'ZXY') {
+                               const ce = c * e,
+                                                       cf = c * f,
+                                                       de = d * e,
+                                                       df = d * f;
+                               te[0] = ce - df * b;
+                               te[4] = -a * f;
+                               te[8] = de + cf * b;
+                               te[1] = cf + de * b;
+                               te[5] = a * e;
+                               te[9] = df - ce * b;
+                               te[2] = -a * d;
+                               te[6] = b;
+                               te[10] = a * c;
+                       } else if (euler.order === 'ZYX') {
+                               const ae = a * e,
+                                                       af = a * f,
+                                                       be = b * e,
+                                                       bf = b * f;
+                               te[0] = c * e;
+                               te[4] = be * d - af;
+                               te[8] = ae * d + bf;
+                               te[1] = c * f;
+                               te[5] = bf * d + ae;
+                               te[9] = af * d - be;
+                               te[2] = -d;
+                               te[6] = b * c;
+                               te[10] = a * c;
+                       } else if (euler.order === 'YZX') {
+                               const ac = a * c,
+                                                       ad = a * d,
+                                                       bc = b * c,
+                                                       bd = b * d;
+                               te[0] = c * e;
+                               te[4] = bd - ac * f;
+                               te[8] = bc * f + ad;
+                               te[1] = f;
+                               te[5] = a * e;
+                               te[9] = -b * e;
+                               te[2] = -d * e;
+                               te[6] = ad * f + bc;
+                               te[10] = ac - bd * f;
+                       } else if (euler.order === 'XZY') {
+                               const ac = a * c,
+                                                       ad = a * d,
+                                                       bc = b * c,
+                                                       bd = b * d;
+                               te[0] = c * e;
+                               te[4] = -f;
+                               te[8] = d * e;
+                               te[1] = ac * f + bd;
+                               te[5] = a * e;
+                               te[9] = ad * f - bc;
+                               te[2] = bc * f - ad;
+                               te[6] = b * e;
+                               te[10] = bd * f + ac;
+                       } // bottom row
+
+
+                       te[3] = 0;
+                       te[7] = 0;
+                       te[11] = 0; // last column
+
+                       te[12] = 0;
+                       te[13] = 0;
+                       te[14] = 0;
+                       te[15] = 1;
+                       return this;
+               }
+
+               makeRotationFromQuaternion(q) {
+                       return this.compose(_zero, q, _one);
+               }
+
+               lookAt(eye, target, up) {
+                       const te = this.elements;
+
+                       _z.subVectors(eye, target);
+
+                       if (_z.lengthSq() === 0) {
+                               // eye and target are in the same position
+                               _z.z = 1;
+                       }
+
+                       _z.normalize();
+
+                       _x.crossVectors(up, _z);
+
+                       if (_x.lengthSq() === 0) {
+                               // up and z are parallel
+                               if (Math.abs(up.z) === 1) {
+                                       _z.x += 0.0001;
+                               } else {
+                                       _z.z += 0.0001;
+                               }
+
+                               _z.normalize();
+
+                               _x.crossVectors(up, _z);
+                       }
+
+                       _x.normalize();
+
+                       _y.crossVectors(_z, _x);
+
+                       te[0] = _x.x;
+                       te[4] = _y.x;
+                       te[8] = _z.x;
+                       te[1] = _x.y;
+                       te[5] = _y.y;
+                       te[9] = _z.y;
+                       te[2] = _x.z;
+                       te[6] = _y.z;
+                       te[10] = _z.z;
+                       return this;
+               }
+
+               multiply(m, n) {
+                       if (n !== undefined) {
+                               console.warn('THREE.Matrix4: .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead.');
+                               return this.multiplyMatrices(m, n);
+                       }
+
+                       return this.multiplyMatrices(this, m);
+               }
+
+               premultiply(m) {
+                       return this.multiplyMatrices(m, this);
+               }
+
+               multiplyMatrices(a, b) {
+                       const ae = a.elements;
+                       const be = b.elements;
+                       const te = this.elements;
+                       const a11 = ae[0],
+                                               a12 = ae[4],
+                                               a13 = ae[8],
+                                               a14 = ae[12];
+                       const a21 = ae[1],
+                                               a22 = ae[5],
+                                               a23 = ae[9],
+                                               a24 = ae[13];
+                       const a31 = ae[2],
+                                               a32 = ae[6],
+                                               a33 = ae[10],
+                                               a34 = ae[14];
+                       const a41 = ae[3],
+                                               a42 = ae[7],
+                                               a43 = ae[11],
+                                               a44 = ae[15];
+                       const b11 = be[0],
+                                               b12 = be[4],
+                                               b13 = be[8],
+                                               b14 = be[12];
+                       const b21 = be[1],
+                                               b22 = be[5],
+                                               b23 = be[9],
+                                               b24 = be[13];
+                       const b31 = be[2],
+                                               b32 = be[6],
+                                               b33 = be[10],
+                                               b34 = be[14];
+                       const b41 = be[3],
+                                               b42 = be[7],
+                                               b43 = be[11],
+                                               b44 = be[15];
+                       te[0] = a11 * b11 + a12 * b21 + a13 * b31 + a14 * b41;
+                       te[4] = a11 * b12 + a12 * b22 + a13 * b32 + a14 * b42;
+                       te[8] = a11 * b13 + a12 * b23 + a13 * b33 + a14 * b43;
+                       te[12] = a11 * b14 + a12 * b24 + a13 * b34 + a14 * b44;
+                       te[1] = a21 * b11 + a22 * b21 + a23 * b31 + a24 * b41;
+                       te[5] = a21 * b12 + a22 * b22 + a23 * b32 + a24 * b42;
+                       te[9] = a21 * b13 + a22 * b23 + a23 * b33 + a24 * b43;
+                       te[13] = a21 * b14 + a22 * b24 + a23 * b34 + a24 * b44;
+                       te[2] = a31 * b11 + a32 * b21 + a33 * b31 + a34 * b41;
+                       te[6] = a31 * b12 + a32 * b22 + a33 * b32 + a34 * b42;
+                       te[10] = a31 * b13 + a32 * b23 + a33 * b33 + a34 * b43;
+                       te[14] = a31 * b14 + a32 * b24 + a33 * b34 + a34 * b44;
+                       te[3] = a41 * b11 + a42 * b21 + a43 * b31 + a44 * b41;
+                       te[7] = a41 * b12 + a42 * b22 + a43 * b32 + a44 * b42;
+                       te[11] = a41 * b13 + a42 * b23 + a43 * b33 + a44 * b43;
+                       te[15] = a41 * b14 + a42 * b24 + a43 * b34 + a44 * b44;
+                       return this;
+               }
+
+               multiplyScalar(s) {
+                       const te = this.elements;
+                       te[0] *= s;
+                       te[4] *= s;
+                       te[8] *= s;
+                       te[12] *= s;
+                       te[1] *= s;
+                       te[5] *= s;
+                       te[9] *= s;
+                       te[13] *= s;
+                       te[2] *= s;
+                       te[6] *= s;
+                       te[10] *= s;
+                       te[14] *= s;
+                       te[3] *= s;
+                       te[7] *= s;
+                       te[11] *= s;
+                       te[15] *= s;
+                       return this;
+               }
+
+               determinant() {
+                       const te = this.elements;
+                       const n11 = te[0],
+                                               n12 = te[4],
+                                               n13 = te[8],
+                                               n14 = te[12];
+                       const n21 = te[1],
+                                               n22 = te[5],
+                                               n23 = te[9],
+                                               n24 = te[13];
+                       const n31 = te[2],
+                                               n32 = te[6],
+                                               n33 = te[10],
+                                               n34 = te[14];
+                       const n41 = te[3],
+                                               n42 = te[7],
+                                               n43 = te[11],
+                                               n44 = te[15]; //TODO: make this more efficient
+                       //( based on http://www.euclideanspace.com/maths/algebra/matrix/functions/inverse/fourD/index.htm )
+
+                       return n41 * (+n14 * n23 * n32 - n13 * n24 * n32 - n14 * n22 * n33 + n12 * n24 * n33 + n13 * n22 * n34 - n12 * n23 * n34) + n42 * (+n11 * n23 * n34 - n11 * n24 * n33 + n14 * n21 * n33 - n13 * n21 * n34 + n13 * n24 * n31 - n14 * n23 * n31) + n43 * (+n11 * n24 * n32 - n11 * n22 * n34 - n14 * n21 * n32 + n12 * n21 * n34 + n14 * n22 * n31 - n12 * n24 * n31) + n44 * (-n13 * n22 * n31 - n11 * n23 * n32 + n11 * n22 * n33 + n13 * n21 * n32 - n12 * n21 * n33 + n12 * n23 * n31);
+               }
+
+               transpose() {
+                       const te = this.elements;
+                       let tmp;
+                       tmp = te[1];
+                       te[1] = te[4];
+                       te[4] = tmp;
+                       tmp = te[2];
+                       te[2] = te[8];
+                       te[8] = tmp;
+                       tmp = te[6];
+                       te[6] = te[9];
+                       te[9] = tmp;
+                       tmp = te[3];
+                       te[3] = te[12];
+                       te[12] = tmp;
+                       tmp = te[7];
+                       te[7] = te[13];
+                       te[13] = tmp;
+                       tmp = te[11];
+                       te[11] = te[14];
+                       te[14] = tmp;
+                       return this;
+               }
+
+               setPosition(x, y, z) {
+                       const te = this.elements;
+
+                       if (x.isVector3) {
+                               te[12] = x.x;
+                               te[13] = x.y;
+                               te[14] = x.z;
+                       } else {
+                               te[12] = x;
+                               te[13] = y;
+                               te[14] = z;
+                       }
+
+                       return this;
+               }
+
+               invert() {
+                       // based on http://www.euclideanspace.com/maths/algebra/matrix/functions/inverse/fourD/index.htm
+                       const te = this.elements,
+                                               n11 = te[0],
+                                               n21 = te[1],
+                                               n31 = te[2],
+                                               n41 = te[3],
+                                               n12 = te[4],
+                                               n22 = te[5],
+                                               n32 = te[6],
+                                               n42 = te[7],
+                                               n13 = te[8],
+                                               n23 = te[9],
+                                               n33 = te[10],
+                                               n43 = te[11],
+                                               n14 = te[12],
+                                               n24 = te[13],
+                                               n34 = te[14],
+                                               n44 = te[15],
+                                               t11 = n23 * n34 * n42 - n24 * n33 * n42 + n24 * n32 * n43 - n22 * n34 * n43 - n23 * n32 * n44 + n22 * n33 * n44,
+                                               t12 = n14 * n33 * n42 - n13 * n34 * n42 - n14 * n32 * n43 + n12 * n34 * n43 + n13 * n32 * n44 - n12 * n33 * n44,
+                                               t13 = n13 * n24 * n42 - n14 * n23 * n42 + n14 * n22 * n43 - n12 * n24 * n43 - n13 * n22 * n44 + n12 * n23 * n44,
+                                               t14 = n14 * n23 * n32 - n13 * n24 * n32 - n14 * n22 * n33 + n12 * n24 * n33 + n13 * n22 * n34 - n12 * n23 * n34;
+                       const det = n11 * t11 + n21 * t12 + n31 * t13 + n41 * t14;
+                       if (det === 0) return this.set(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
+                       const detInv = 1 / det;
+                       te[0] = t11 * detInv;
+                       te[1] = (n24 * n33 * n41 - n23 * n34 * n41 - n24 * n31 * n43 + n21 * n34 * n43 + n23 * n31 * n44 - n21 * n33 * n44) * detInv;
+                       te[2] = (n22 * n34 * n41 - n24 * n32 * n41 + n24 * n31 * n42 - n21 * n34 * n42 - n22 * n31 * n44 + n21 * n32 * n44) * detInv;
+                       te[3] = (n23 * n32 * n41 - n22 * n33 * n41 - n23 * n31 * n42 + n21 * n33 * n42 + n22 * n31 * n43 - n21 * n32 * n43) * detInv;
+                       te[4] = t12 * detInv;
+                       te[5] = (n13 * n34 * n41 - n14 * n33 * n41 + n14 * n31 * n43 - n11 * n34 * n43 - n13 * n31 * n44 + n11 * n33 * n44) * detInv;
+                       te[6] = (n14 * n32 * n41 - n12 * n34 * n41 - n14 * n31 * n42 + n11 * n34 * n42 + n12 * n31 * n44 - n11 * n32 * n44) * detInv;
+                       te[7] = (n12 * n33 * n41 - n13 * n32 * n41 + n13 * n31 * n42 - n11 * n33 * n42 - n12 * n31 * n43 + n11 * n32 * n43) * detInv;
+                       te[8] = t13 * detInv;
+                       te[9] = (n14 * n23 * n41 - n13 * n24 * n41 - n14 * n21 * n43 + n11 * n24 * n43 + n13 * n21 * n44 - n11 * n23 * n44) * detInv;
+                       te[10] = (n12 * n24 * n41 - n14 * n22 * n41 + n14 * n21 * n42 - n11 * n24 * n42 - n12 * n21 * n44 + n11 * n22 * n44) * detInv;
+                       te[11] = (n13 * n22 * n41 - n12 * n23 * n41 - n13 * n21 * n42 + n11 * n23 * n42 + n12 * n21 * n43 - n11 * n22 * n43) * detInv;
+                       te[12] = t14 * detInv;
+                       te[13] = (n13 * n24 * n31 - n14 * n23 * n31 + n14 * n21 * n33 - n11 * n24 * n33 - n13 * n21 * n34 + n11 * n23 * n34) * detInv;
+                       te[14] = (n14 * n22 * n31 - n12 * n24 * n31 - n14 * n21 * n32 + n11 * n24 * n32 + n12 * n21 * n34 - n11 * n22 * n34) * detInv;
+                       te[15] = (n12 * n23 * n31 - n13 * n22 * n31 + n13 * n21 * n32 - n11 * n23 * n32 - n12 * n21 * n33 + n11 * n22 * n33) * detInv;
+                       return this;
+               }
+
+               scale(v) {
+                       const te = this.elements;
+                       const x = v.x,
+                                               y = v.y,
+                                               z = v.z;
+                       te[0] *= x;
+                       te[4] *= y;
+                       te[8] *= z;
+                       te[1] *= x;
+                       te[5] *= y;
+                       te[9] *= z;
+                       te[2] *= x;
+                       te[6] *= y;
+                       te[10] *= z;
+                       te[3] *= x;
+                       te[7] *= y;
+                       te[11] *= z;
+                       return this;
+               }
+
+               getMaxScaleOnAxis() {
+                       const te = this.elements;
+                       const scaleXSq = te[0] * te[0] + te[1] * te[1] + te[2] * te[2];
+                       const scaleYSq = te[4] * te[4] + te[5] * te[5] + te[6] * te[6];
+                       const scaleZSq = te[8] * te[8] + te[9] * te[9] + te[10] * te[10];
+                       return Math.sqrt(Math.max(scaleXSq, scaleYSq, scaleZSq));
+               }
+
+               makeTranslation(x, y, z) {
+                       this.set(1, 0, 0, x, 0, 1, 0, y, 0, 0, 1, z, 0, 0, 0, 1);
+                       return this;
+               }
+
+               makeRotationX(theta) {
+                       const c = Math.cos(theta),
+                                               s = Math.sin(theta);
+                       this.set(1, 0, 0, 0, 0, c, -s, 0, 0, s, c, 0, 0, 0, 0, 1);
+                       return this;
+               }
+
+               makeRotationY(theta) {
+                       const c = Math.cos(theta),
+                                               s = Math.sin(theta);
+                       this.set(c, 0, s, 0, 0, 1, 0, 0, -s, 0, c, 0, 0, 0, 0, 1);
+                       return this;
+               }
+
+               makeRotationZ(theta) {
+                       const c = Math.cos(theta),
+                                               s = Math.sin(theta);
+                       this.set(c, -s, 0, 0, s, c, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);
+                       return this;
+               }
+
+               makeRotationAxis(axis, angle) {
+                       // Based on http://www.gamedev.net/reference/articles/article1199.asp
+                       const c = Math.cos(angle);
+                       const s = Math.sin(angle);
+                       const t = 1 - c;
+                       const x = axis.x,
+                                               y = axis.y,
+                                               z = axis.z;
+                       const tx = t * x,
+                                               ty = t * y;
+                       this.set(tx * x + c, tx * y - s * z, tx * z + s * y, 0, tx * y + s * z, ty * y + c, ty * z - s * x, 0, tx * z - s * y, ty * z + s * x, t * z * z + c, 0, 0, 0, 0, 1);
+                       return this;
+               }
+
+               makeScale(x, y, z) {
+                       this.set(x, 0, 0, 0, 0, y, 0, 0, 0, 0, z, 0, 0, 0, 0, 1);
+                       return this;
+               }
+
+               makeShear(xy, xz, yx, yz, zx, zy) {
+                       this.set(1, yx, zx, 0, xy, 1, zy, 0, xz, yz, 1, 0, 0, 0, 0, 1);
+                       return this;
+               }
+
+               compose(position, quaternion, scale) {
+                       const te = this.elements;
+                       const x = quaternion._x,
+                                               y = quaternion._y,
+                                               z = quaternion._z,
+                                               w = quaternion._w;
+                       const x2 = x + x,
+                                               y2 = y + y,
+                                               z2 = z + z;
+                       const xx = x * x2,
+                                               xy = x * y2,
+                                               xz = x * z2;
+                       const yy = y * y2,
+                                               yz = y * z2,
+                                               zz = z * z2;
+                       const wx = w * x2,
+                                               wy = w * y2,
+                                               wz = w * z2;
+                       const sx = scale.x,
+                                               sy = scale.y,
+                                               sz = scale.z;
+                       te[0] = (1 - (yy + zz)) * sx;
+                       te[1] = (xy + wz) * sx;
+                       te[2] = (xz - wy) * sx;
+                       te[3] = 0;
+                       te[4] = (xy - wz) * sy;
+                       te[5] = (1 - (xx + zz)) * sy;
+                       te[6] = (yz + wx) * sy;
+                       te[7] = 0;
+                       te[8] = (xz + wy) * sz;
+                       te[9] = (yz - wx) * sz;
+                       te[10] = (1 - (xx + yy)) * sz;
+                       te[11] = 0;
+                       te[12] = position.x;
+                       te[13] = position.y;
+                       te[14] = position.z;
+                       te[15] = 1;
+                       return this;
+               }
+
+               decompose(position, quaternion, scale) {
+                       const te = this.elements;
+
+                       let sx = _v1$5.set(te[0], te[1], te[2]).length();
+
+                       const sy = _v1$5.set(te[4], te[5], te[6]).length();
+
+                       const sz = _v1$5.set(te[8], te[9], te[10]).length(); // if determine is negative, we need to invert one scale
+
+
+                       const det = this.determinant();
+                       if (det < 0) sx = -sx;
+                       position.x = te[12];
+                       position.y = te[13];
+                       position.z = te[14]; // scale the rotation part
+
+                       _m1$2.copy(this);
+
+                       const invSX = 1 / sx;
+                       const invSY = 1 / sy;
+                       const invSZ = 1 / sz;
+                       _m1$2.elements[0] *= invSX;
+                       _m1$2.elements[1] *= invSX;
+                       _m1$2.elements[2] *= invSX;
+                       _m1$2.elements[4] *= invSY;
+                       _m1$2.elements[5] *= invSY;
+                       _m1$2.elements[6] *= invSY;
+                       _m1$2.elements[8] *= invSZ;
+                       _m1$2.elements[9] *= invSZ;
+                       _m1$2.elements[10] *= invSZ;
+                       quaternion.setFromRotationMatrix(_m1$2);
+                       scale.x = sx;
+                       scale.y = sy;
+                       scale.z = sz;
+                       return this;
+               }
+
+               makePerspective(left, right, top, bottom, near, far) {
+                       if (far === undefined) {
+                               console.warn('THREE.Matrix4: .makePerspective() has been redefined and has a new signature. Please check the docs.');
+                       }
+
+                       const te = this.elements;
+                       const x = 2 * near / (right - left);
+                       const y = 2 * near / (top - bottom);
+                       const a = (right + left) / (right - left);
+                       const b = (top + bottom) / (top - bottom);
+                       const c = -(far + near) / (far - near);
+                       const d = -2 * far * near / (far - near);
+                       te[0] = x;
+                       te[4] = 0;
+                       te[8] = a;
+                       te[12] = 0;
+                       te[1] = 0;
+                       te[5] = y;
+                       te[9] = b;
+                       te[13] = 0;
+                       te[2] = 0;
+                       te[6] = 0;
+                       te[10] = c;
+                       te[14] = d;
+                       te[3] = 0;
+                       te[7] = 0;
+                       te[11] = -1;
+                       te[15] = 0;
+                       return this;
+               }
+
+               makeOrthographic(left, right, top, bottom, near, far) {
+                       const te = this.elements;
+                       const w = 1.0 / (right - left);
+                       const h = 1.0 / (top - bottom);
+                       const p = 1.0 / (far - near);
+                       const x = (right + left) * w;
+                       const y = (top + bottom) * h;
+                       const z = (far + near) * p;
+                       te[0] = 2 * w;
+                       te[4] = 0;
+                       te[8] = 0;
+                       te[12] = -x;
+                       te[1] = 0;
+                       te[5] = 2 * h;
+                       te[9] = 0;
+                       te[13] = -y;
+                       te[2] = 0;
+                       te[6] = 0;
+                       te[10] = -2 * p;
+                       te[14] = -z;
+                       te[3] = 0;
+                       te[7] = 0;
+                       te[11] = 0;
+                       te[15] = 1;
+                       return this;
+               }
+
+               equals(matrix) {
+                       const te = this.elements;
+                       const me = matrix.elements;
+
+                       for (let i = 0; i < 16; i++) {
+                               if (te[i] !== me[i]) return false;
+                       }
+
+                       return true;
+               }
+
+               fromArray(array, offset = 0) {
+                       for (let i = 0; i < 16; i++) {
+                               this.elements[i] = array[i + offset];
+                       }
+
+                       return this;
+               }
+
+               toArray(array = [], offset = 0) {
+                       const te = this.elements;
+                       array[offset] = te[0];
+                       array[offset + 1] = te[1];
+                       array[offset + 2] = te[2];
+                       array[offset + 3] = te[3];
+                       array[offset + 4] = te[4];
+                       array[offset + 5] = te[5];
+                       array[offset + 6] = te[6];
+                       array[offset + 7] = te[7];
+                       array[offset + 8] = te[8];
+                       array[offset + 9] = te[9];
+                       array[offset + 10] = te[10];
+                       array[offset + 11] = te[11];
+                       array[offset + 12] = te[12];
+                       array[offset + 13] = te[13];
+                       array[offset + 14] = te[14];
+                       array[offset + 15] = te[15];
+                       return array;
+               }
+
+       }
+
+       Matrix4.prototype.isMatrix4 = true;
+
+       const _v1$5 = /*@__PURE__*/new Vector3();
+
+       const _m1$2 = /*@__PURE__*/new Matrix4();
+
+       const _zero = /*@__PURE__*/new Vector3(0, 0, 0);
+
+       const _one = /*@__PURE__*/new Vector3(1, 1, 1);
+
+       const _x = /*@__PURE__*/new Vector3();
+
+       const _y = /*@__PURE__*/new Vector3();
+
+       const _z = /*@__PURE__*/new Vector3();
+
+       const _matrix$1 = /*@__PURE__*/new Matrix4();
+
+       const _quaternion$3 = /*@__PURE__*/new Quaternion();
+
+       class Euler {
+               constructor(x = 0, y = 0, z = 0, order = Euler.DefaultOrder) {
+                       this._x = x;
+                       this._y = y;
+                       this._z = z;
+                       this._order = order;
+               }
+
+               get x() {
+                       return this._x;
+               }
+
+               set x(value) {
+                       this._x = value;
+
+                       this._onChangeCallback();
+               }
+
+               get y() {
+                       return this._y;
+               }
+
+               set y(value) {
+                       this._y = value;
+
+                       this._onChangeCallback();
+               }
+
+               get z() {
+                       return this._z;
+               }
+
+               set z(value) {
+                       this._z = value;
+
+                       this._onChangeCallback();
+               }
+
+               get order() {
+                       return this._order;
+               }
+
+               set order(value) {
+                       this._order = value;
+
+                       this._onChangeCallback();
+               }
+
+               set(x, y, z, order = this._order) {
+                       this._x = x;
+                       this._y = y;
+                       this._z = z;
+                       this._order = order;
+
+                       this._onChangeCallback();
+
+                       return this;
+               }
+
+               clone() {
+                       return new this.constructor(this._x, this._y, this._z, this._order);
+               }
+
+               copy(euler) {
+                       this._x = euler._x;
+                       this._y = euler._y;
+                       this._z = euler._z;
+                       this._order = euler._order;
+
+                       this._onChangeCallback();
+
+                       return this;
+               }
+
+               setFromRotationMatrix(m, order = this._order, update = true) {
+                       // assumes the upper 3x3 of m is a pure rotation matrix (i.e, unscaled)
+                       const te = m.elements;
+                       const m11 = te[0],
+                                               m12 = te[4],
+                                               m13 = te[8];
+                       const m21 = te[1],
+                                               m22 = te[5],
+                                               m23 = te[9];
+                       const m31 = te[2],
+                                               m32 = te[6],
+                                               m33 = te[10];
+
+                       switch (order) {
+                               case 'XYZ':
+                                       this._y = Math.asin(clamp(m13, -1, 1));
+
+                                       if (Math.abs(m13) < 0.9999999) {
+                                               this._x = Math.atan2(-m23, m33);
+                                               this._z = Math.atan2(-m12, m11);
+                                       } else {
+                                               this._x = Math.atan2(m32, m22);
+                                               this._z = 0;
+                                       }
+
+                                       break;
+
+                               case 'YXZ':
+                                       this._x = Math.asin(-clamp(m23, -1, 1));
+
+                                       if (Math.abs(m23) < 0.9999999) {
+                                               this._y = Math.atan2(m13, m33);
+                                               this._z = Math.atan2(m21, m22);
+                                       } else {
+                                               this._y = Math.atan2(-m31, m11);
+                                               this._z = 0;
+                                       }
+
+                                       break;
+
+                               case 'ZXY':
+                                       this._x = Math.asin(clamp(m32, -1, 1));
+
+                                       if (Math.abs(m32) < 0.9999999) {
+                                               this._y = Math.atan2(-m31, m33);
+                                               this._z = Math.atan2(-m12, m22);
+                                       } else {
+                                               this._y = 0;
+                                               this._z = Math.atan2(m21, m11);
+                                       }
+
+                                       break;
+
+                               case 'ZYX':
+                                       this._y = Math.asin(-clamp(m31, -1, 1));
+
+                                       if (Math.abs(m31) < 0.9999999) {
+                                               this._x = Math.atan2(m32, m33);
+                                               this._z = Math.atan2(m21, m11);
+                                       } else {
+                                               this._x = 0;
+                                               this._z = Math.atan2(-m12, m22);
+                                       }
+
+                                       break;
+
+                               case 'YZX':
+                                       this._z = Math.asin(clamp(m21, -1, 1));
+
+                                       if (Math.abs(m21) < 0.9999999) {
+                                               this._x = Math.atan2(-m23, m22);
+                                               this._y = Math.atan2(-m31, m11);
+                                       } else {
+                                               this._x = 0;
+                                               this._y = Math.atan2(m13, m33);
+                                       }
+
+                                       break;
+
+                               case 'XZY':
+                                       this._z = Math.asin(-clamp(m12, -1, 1));
+
+                                       if (Math.abs(m12) < 0.9999999) {
+                                               this._x = Math.atan2(m32, m22);
+                                               this._y = Math.atan2(m13, m11);
+                                       } else {
+                                               this._x = Math.atan2(-m23, m33);
+                                               this._y = 0;
+                                       }
+
+                                       break;
+
+                               default:
+                                       console.warn('THREE.Euler: .setFromRotationMatrix() encountered an unknown order: ' + order);
+                       }
+
+                       this._order = order;
+                       if (update === true) this._onChangeCallback();
+                       return this;
+               }
+
+               setFromQuaternion(q, order, update) {
+                       _matrix$1.makeRotationFromQuaternion(q);
+
+                       return this.setFromRotationMatrix(_matrix$1, order, update);
+               }
+
+               setFromVector3(v, order = this._order) {
+                       return this.set(v.x, v.y, v.z, order);
+               }
+
+               reorder(newOrder) {
+                       // WARNING: this discards revolution information -bhouston
+                       _quaternion$3.setFromEuler(this);
+
+                       return this.setFromQuaternion(_quaternion$3, newOrder);
+               }
+
+               equals(euler) {
+                       return euler._x === this._x && euler._y === this._y && euler._z === this._z && euler._order === this._order;
+               }
+
+               fromArray(array) {
+                       this._x = array[0];
+                       this._y = array[1];
+                       this._z = array[2];
+                       if (array[3] !== undefined) this._order = array[3];
+
+                       this._onChangeCallback();
+
+                       return this;
+               }
+
+               toArray(array = [], offset = 0) {
+                       array[offset] = this._x;
+                       array[offset + 1] = this._y;
+                       array[offset + 2] = this._z;
+                       array[offset + 3] = this._order;
+                       return array;
+               }
+
+               toVector3(optionalResult) {
+                       if (optionalResult) {
+                               return optionalResult.set(this._x, this._y, this._z);
+                       } else {
+                               return new Vector3(this._x, this._y, this._z);
+                       }
+               }
+
+               _onChange(callback) {
+                       this._onChangeCallback = callback;
+                       return this;
+               }
+
+               _onChangeCallback() {}
+
+       }
+
+       Euler.prototype.isEuler = true;
+       Euler.DefaultOrder = 'XYZ';
+       Euler.RotationOrders = ['XYZ', 'YZX', 'ZXY', 'XZY', 'YXZ', 'ZYX'];
+
+       class Layers {
+               constructor() {
+                       this.mask = 1 | 0;
+               }
+
+               set(channel) {
+                       this.mask = 1 << channel | 0;
+               }
+
+               enable(channel) {
+                       this.mask |= 1 << channel | 0;
+               }
+
+               enableAll() {
+                       this.mask = 0xffffffff | 0;
+               }
+
+               toggle(channel) {
+                       this.mask ^= 1 << channel | 0;
+               }
+
+               disable(channel) {
+                       this.mask &= ~(1 << channel | 0);
+               }
+
+               disableAll() {
+                       this.mask = 0;
+               }
+
+               test(layers) {
+                       return (this.mask & layers.mask) !== 0;
+               }
+
+       }
+
+       let _object3DId = 0;
+
+       const _v1$4 = /*@__PURE__*/new Vector3();
+
+       const _q1 = /*@__PURE__*/new Quaternion();
+
+       const _m1$1 = /*@__PURE__*/new Matrix4();
+
+       const _target = /*@__PURE__*/new Vector3();
+
+       const _position$3 = /*@__PURE__*/new Vector3();
+
+       const _scale$2 = /*@__PURE__*/new Vector3();
+
+       const _quaternion$2 = /*@__PURE__*/new Quaternion();
+
+       const _xAxis = /*@__PURE__*/new Vector3(1, 0, 0);
+
+       const _yAxis = /*@__PURE__*/new Vector3(0, 1, 0);
+
+       const _zAxis = /*@__PURE__*/new Vector3(0, 0, 1);
+
+       const _addedEvent = {
+               type: 'added'
+       };
+       const _removedEvent = {
+               type: 'removed'
+       };
+
+       class Object3D extends EventDispatcher {
+               constructor() {
+                       super();
+                       Object.defineProperty(this, 'id', {
+                               value: _object3DId++
+                       });
+                       this.uuid = generateUUID();
+                       this.name = '';
+                       this.type = 'Object3D';
+                       this.parent = null;
+                       this.children = [];
+                       this.up = Object3D.DefaultUp.clone();
+                       const position = new Vector3();
+                       const rotation = new Euler();
+                       const quaternion = new Quaternion();
+                       const scale = new Vector3(1, 1, 1);
+
+                       function onRotationChange() {
+                               quaternion.setFromEuler(rotation, false);
+                       }
+
+                       function onQuaternionChange() {
+                               rotation.setFromQuaternion(quaternion, undefined, false);
+                       }
+
+                       rotation._onChange(onRotationChange);
+
+                       quaternion._onChange(onQuaternionChange);
+
+                       Object.defineProperties(this, {
+                               position: {
+                                       configurable: true,
+                                       enumerable: true,
+                                       value: position
+                               },
+                               rotation: {
+                                       configurable: true,
+                                       enumerable: true,
+                                       value: rotation
+                               },
+                               quaternion: {
+                                       configurable: true,
+                                       enumerable: true,
+                                       value: quaternion
+                               },
+                               scale: {
+                                       configurable: true,
+                                       enumerable: true,
+                                       value: scale
+                               },
+                               modelViewMatrix: {
+                                       value: new Matrix4()
+                               },
+                               normalMatrix: {
+                                       value: new Matrix3()
+                               }
+                       });
+                       this.matrix = new Matrix4();
+                       this.matrixWorld = new Matrix4();
+                       this.matrixAutoUpdate = Object3D.DefaultMatrixAutoUpdate;
+                       this.matrixWorldNeedsUpdate = false;
+                       this.layers = new Layers();
+                       this.visible = true;
+                       this.castShadow = false;
+                       this.receiveShadow = false;
+                       this.frustumCulled = true;
+                       this.renderOrder = 0;
+                       this.animations = [];
+                       this.userData = {};
+               }
+
+               onBeforeRender() {}
+
+               onAfterRender() {}
+
+               applyMatrix4(matrix) {
+                       if (this.matrixAutoUpdate) this.updateMatrix();
+                       this.matrix.premultiply(matrix);
+                       this.matrix.decompose(this.position, this.quaternion, this.scale);
+               }
+
+               applyQuaternion(q) {
+                       this.quaternion.premultiply(q);
+                       return this;
+               }
+
+               setRotationFromAxisAngle(axis, angle) {
+                       // assumes axis is normalized
+                       this.quaternion.setFromAxisAngle(axis, angle);
+               }
+
+               setRotationFromEuler(euler) {
+                       this.quaternion.setFromEuler(euler, true);
+               }
+
+               setRotationFromMatrix(m) {
+                       // assumes the upper 3x3 of m is a pure rotation matrix (i.e, unscaled)
+                       this.quaternion.setFromRotationMatrix(m);
+               }
+
+               setRotationFromQuaternion(q) {
+                       // assumes q is normalized
+                       this.quaternion.copy(q);
+               }
+
+               rotateOnAxis(axis, angle) {
+                       // rotate object on axis in object space
+                       // axis is assumed to be normalized
+                       _q1.setFromAxisAngle(axis, angle);
+
+                       this.quaternion.multiply(_q1);
+                       return this;
+               }
+
+               rotateOnWorldAxis(axis, angle) {
+                       // rotate object on axis in world space
+                       // axis is assumed to be normalized
+                       // method assumes no rotated parent
+                       _q1.setFromAxisAngle(axis, angle);
+
+                       this.quaternion.premultiply(_q1);
+                       return this;
+               }
+
+               rotateX(angle) {
+                       return this.rotateOnAxis(_xAxis, angle);
+               }
+
+               rotateY(angle) {
+                       return this.rotateOnAxis(_yAxis, angle);
+               }
+
+               rotateZ(angle) {
+                       return this.rotateOnAxis(_zAxis, angle);
+               }
+
+               translateOnAxis(axis, distance) {
+                       // translate object by distance along axis in object space
+                       // axis is assumed to be normalized
+                       _v1$4.copy(axis).applyQuaternion(this.quaternion);
+
+                       this.position.add(_v1$4.multiplyScalar(distance));
+                       return this;
+               }
+
+               translateX(distance) {
+                       return this.translateOnAxis(_xAxis, distance);
+               }
+
+               translateY(distance) {
+                       return this.translateOnAxis(_yAxis, distance);
+               }
+
+               translateZ(distance) {
+                       return this.translateOnAxis(_zAxis, distance);
+               }
+
+               localToWorld(vector) {
+                       return vector.applyMatrix4(this.matrixWorld);
+               }
+
+               worldToLocal(vector) {
+                       return vector.applyMatrix4(_m1$1.copy(this.matrixWorld).invert());
+               }
+
+               lookAt(x, y, z) {
+                       // This method does not support objects having non-uniformly-scaled parent(s)
+                       if (x.isVector3) {
+                               _target.copy(x);
+                       } else {
+                               _target.set(x, y, z);
+                       }
+
+                       const parent = this.parent;
+                       this.updateWorldMatrix(true, false);
+
+                       _position$3.setFromMatrixPosition(this.matrixWorld);
+
+                       if (this.isCamera || this.isLight) {
+                               _m1$1.lookAt(_position$3, _target, this.up);
+                       } else {
+                               _m1$1.lookAt(_target, _position$3, this.up);
+                       }
+
+                       this.quaternion.setFromRotationMatrix(_m1$1);
+
+                       if (parent) {
+                               _m1$1.extractRotation(parent.matrixWorld);
+
+                               _q1.setFromRotationMatrix(_m1$1);
+
+                               this.quaternion.premultiply(_q1.invert());
+                       }
+               }
+
+               add(object) {
+                       if (arguments.length > 1) {
+                               for (let i = 0; i < arguments.length; i++) {
+                                       this.add(arguments[i]);
+                               }
+
+                               return this;
+                       }
+
+                       if (object === this) {
+                               console.error('THREE.Object3D.add: object can\'t be added as a child of itself.', object);
+                               return this;
+                       }
+
+                       if (object && object.isObject3D) {
+                               if (object.parent !== null) {
+                                       object.parent.remove(object);
+                               }
+
+                               object.parent = this;
+                               this.children.push(object);
+                               object.dispatchEvent(_addedEvent);
+                       } else {
+                               console.error('THREE.Object3D.add: object not an instance of THREE.Object3D.', object);
+                       }
+
+                       return this;
+               }
+
+               remove(object) {
+                       if (arguments.length > 1) {
+                               for (let i = 0; i < arguments.length; i++) {
+                                       this.remove(arguments[i]);
+                               }
+
+                               return this;
+                       }
+
+                       const index = this.children.indexOf(object);
+
+                       if (index !== -1) {
+                               object.parent = null;
+                               this.children.splice(index, 1);
+                               object.dispatchEvent(_removedEvent);
+                       }
+
+                       return this;
+               }
+
+               removeFromParent() {
+                       const parent = this.parent;
+
+                       if (parent !== null) {
+                               parent.remove(this);
+                       }
+
+                       return this;
+               }
+
+               clear() {
+                       for (let i = 0; i < this.children.length; i++) {
+                               const object = this.children[i];
+                               object.parent = null;
+                               object.dispatchEvent(_removedEvent);
+                       }
+
+                       this.children.length = 0;
+                       return this;
+               }
+
+               attach(object) {
+                       // adds object as a child of this, while maintaining the object's world transform
+                       this.updateWorldMatrix(true, false);
+
+                       _m1$1.copy(this.matrixWorld).invert();
+
+                       if (object.parent !== null) {
+                               object.parent.updateWorldMatrix(true, false);
+
+                               _m1$1.multiply(object.parent.matrixWorld);
+                       }
+
+                       object.applyMatrix4(_m1$1);
+                       this.add(object);
+                       object.updateWorldMatrix(false, true);
+                       return this;
+               }
+
+               getObjectById(id) {
+                       return this.getObjectByProperty('id', id);
+               }
+
+               getObjectByName(name) {
+                       return this.getObjectByProperty('name', name);
+               }
+
+               getObjectByProperty(name, value) {
+                       if (this[name] === value) return this;
+
+                       for (let i = 0, l = this.children.length; i < l; i++) {
+                               const child = this.children[i];
+                               const object = child.getObjectByProperty(name, value);
+
+                               if (object !== undefined) {
+                                       return object;
+                               }
+                       }
+
+                       return undefined;
+               }
+
+               getWorldPosition(target) {
+                       this.updateWorldMatrix(true, false);
+                       return target.setFromMatrixPosition(this.matrixWorld);
+               }
+
+               getWorldQuaternion(target) {
+                       this.updateWorldMatrix(true, false);
+                       this.matrixWorld.decompose(_position$3, target, _scale$2);
+                       return target;
+               }
+
+               getWorldScale(target) {
+                       this.updateWorldMatrix(true, false);
+                       this.matrixWorld.decompose(_position$3, _quaternion$2, target);
+                       return target;
+               }
+
+               getWorldDirection(target) {
+                       this.updateWorldMatrix(true, false);
+                       const e = this.matrixWorld.elements;
+                       return target.set(e[8], e[9], e[10]).normalize();
+               }
+
+               raycast() {}
+
+               traverse(callback) {
+                       callback(this);
+                       const children = this.children;
+
+                       for (let i = 0, l = children.length; i < l; i++) {
+                               children[i].traverse(callback);
+                       }
+               }
+
+               traverseVisible(callback) {
+                       if (this.visible === false) return;
+                       callback(this);
+                       const children = this.children;
+
+                       for (let i = 0, l = children.length; i < l; i++) {
+                               children[i].traverseVisible(callback);
+                       }
+               }
+
+               traverseAncestors(callback) {
+                       const parent = this.parent;
+
+                       if (parent !== null) {
+                               callback(parent);
+                               parent.traverseAncestors(callback);
+                       }
+               }
+
+               updateMatrix() {
+                       this.matrix.compose(this.position, this.quaternion, this.scale);
+                       this.matrixWorldNeedsUpdate = true;
+               }
+
+               updateMatrixWorld(force) {
+                       if (this.matrixAutoUpdate) this.updateMatrix();
+
+                       if (this.matrixWorldNeedsUpdate || force) {
+                               if (this.parent === null) {
+                                       this.matrixWorld.copy(this.matrix);
+                               } else {
+                                       this.matrixWorld.multiplyMatrices(this.parent.matrixWorld, this.matrix);
+                               }
+
+                               this.matrixWorldNeedsUpdate = false;
+                               force = true;
+                       } // update children
+
+
+                       const children = this.children;
+
+                       for (let i = 0, l = children.length; i < l; i++) {
+                               children[i].updateMatrixWorld(force);
+                       }
+               }
+
+               updateWorldMatrix(updateParents, updateChildren) {
+                       const parent = this.parent;
+
+                       if (updateParents === true && parent !== null) {
+                               parent.updateWorldMatrix(true, false);
+                       }
+
+                       if (this.matrixAutoUpdate) this.updateMatrix();
+
+                       if (this.parent === null) {
+                               this.matrixWorld.copy(this.matrix);
+                       } else {
+                               this.matrixWorld.multiplyMatrices(this.parent.matrixWorld, this.matrix);
+                       } // update children
+
+
+                       if (updateChildren === true) {
+                               const children = this.children;
+
+                               for (let i = 0, l = children.length; i < l; i++) {
+                                       children[i].updateWorldMatrix(false, true);
+                               }
+                       }
+               }
+
+               toJSON(meta) {
+                       // meta is a string when called from JSON.stringify
+                       const isRootObject = meta === undefined || typeof meta === 'string';
+                       const output = {}; // meta is a hash used to collect geometries, materials.
+                       // not providing it implies that this is the root object
+                       // being serialized.
+
+                       if (isRootObject) {
+                               // initialize meta obj
+                               meta = {
+                                       geometries: {},
+                                       materials: {},
+                                       textures: {},
+                                       images: {},
+                                       shapes: {},
+                                       skeletons: {},
+                                       animations: {}
+                               };
+                               output.metadata = {
+                                       version: 4.5,
+                                       type: 'Object',
+                                       generator: 'Object3D.toJSON'
+                               };
+                       } // standard Object3D serialization
+
+
+                       const object = {};
+                       object.uuid = this.uuid;
+                       object.type = this.type;
+                       if (this.name !== '') object.name = this.name;
+                       if (this.castShadow === true) object.castShadow = true;
+                       if (this.receiveShadow === true) object.receiveShadow = true;
+                       if (this.visible === false) object.visible = false;
+                       if (this.frustumCulled === false) object.frustumCulled = false;
+                       if (this.renderOrder !== 0) object.renderOrder = this.renderOrder;
+                       if (JSON.stringify(this.userData) !== '{}') object.userData = this.userData;
+                       object.layers = this.layers.mask;
+                       object.matrix = this.matrix.toArray();
+                       if (this.matrixAutoUpdate === false) object.matrixAutoUpdate = false; // object specific properties
+
+                       if (this.isInstancedMesh) {
+                               object.type = 'InstancedMesh';
+                               object.count = this.count;
+                               object.instanceMatrix = this.instanceMatrix.toJSON();
+                               if (this.instanceColor !== null) object.instanceColor = this.instanceColor.toJSON();
+                       } //
+
+
+                       function serialize(library, element) {
+                               if (library[element.uuid] === undefined) {
+                                       library[element.uuid] = element.toJSON(meta);
+                               }
+
+                               return element.uuid;
+                       }
+
+                       if (this.isScene) {
+                               if (this.background) {
+                                       if (this.background.isColor) {
+                                               object.background = this.background.toJSON();
+                                       } else if (this.background.isTexture) {
+                                               object.background = this.background.toJSON(meta).uuid;
+                                       }
+                               }
+
+                               if (this.environment && this.environment.isTexture) {
+                                       object.environment = this.environment.toJSON(meta).uuid;
+                               }
+                       } else if (this.isMesh || this.isLine || this.isPoints) {
+                               object.geometry = serialize(meta.geometries, this.geometry);
+                               const parameters = this.geometry.parameters;
+
+                               if (parameters !== undefined && parameters.shapes !== undefined) {
+                                       const shapes = parameters.shapes;
+
+                                       if (Array.isArray(shapes)) {
+                                               for (let i = 0, l = shapes.length; i < l; i++) {
+                                                       const shape = shapes[i];
+                                                       serialize(meta.shapes, shape);
+                                               }
+                                       } else {
+                                               serialize(meta.shapes, shapes);
+                                       }
+                               }
+                       }
+
+                       if (this.isSkinnedMesh) {
+                               object.bindMode = this.bindMode;
+                               object.bindMatrix = this.bindMatrix.toArray();
+
+                               if (this.skeleton !== undefined) {
+                                       serialize(meta.skeletons, this.skeleton);
+                                       object.skeleton = this.skeleton.uuid;
+                               }
+                       }
+
+                       if (this.material !== undefined) {
+                               if (Array.isArray(this.material)) {
+                                       const uuids = [];
+
+                                       for (let i = 0, l = this.material.length; i < l; i++) {
+                                               uuids.push(serialize(meta.materials, this.material[i]));
+                                       }
+
+                                       object.material = uuids;
+                               } else {
+                                       object.material = serialize(meta.materials, this.material);
+                               }
+                       } //
+
+
+                       if (this.children.length > 0) {
+                               object.children = [];
+
+                               for (let i = 0; i < this.children.length; i++) {
+                                       object.children.push(this.children[i].toJSON(meta).object);
+                               }
+                       } //
+
+
+                       if (this.animations.length > 0) {
+                               object.animations = [];
+
+                               for (let i = 0; i < this.animations.length; i++) {
+                                       const animation = this.animations[i];
+                                       object.animations.push(serialize(meta.animations, animation));
+                               }
+                       }
+
+                       if (isRootObject) {
+                               const geometries = extractFromCache(meta.geometries);
+                               const materials = extractFromCache(meta.materials);
+                               const textures = extractFromCache(meta.textures);
+                               const images = extractFromCache(meta.images);
+                               const shapes = extractFromCache(meta.shapes);
+                               const skeletons = extractFromCache(meta.skeletons);
+                               const animations = extractFromCache(meta.animations);
+                               if (geometries.length > 0) output.geometries = geometries;
+                               if (materials.length > 0) output.materials = materials;
+                               if (textures.length > 0) output.textures = textures;
+                               if (images.length > 0) output.images = images;
+                               if (shapes.length > 0) output.shapes = shapes;
+                               if (skeletons.length > 0) output.skeletons = skeletons;
+                               if (animations.length > 0) output.animations = animations;
+                       }
+
+                       output.object = object;
+                       return output; // extract data from the cache hash
+                       // remove metadata on each item
+                       // and return as array
+
+                       function extractFromCache(cache) {
+                               const values = [];
+
+                               for (const key in cache) {
+                                       const data = cache[key];
+                                       delete data.metadata;
+                                       values.push(data);
+                               }
+
+                               return values;
+                       }
+               }
+
+               clone(recursive) {
+                       return new this.constructor().copy(this, recursive);
+               }
+
+               copy(source, recursive = true) {
+                       this.name = source.name;
+                       this.up.copy(source.up);
+                       this.position.copy(source.position);
+                       this.rotation.order = source.rotation.order;
+                       this.quaternion.copy(source.quaternion);
+                       this.scale.copy(source.scale);
+                       this.matrix.copy(source.matrix);
+                       this.matrixWorld.copy(source.matrixWorld);
+                       this.matrixAutoUpdate = source.matrixAutoUpdate;
+                       this.matrixWorldNeedsUpdate = source.matrixWorldNeedsUpdate;
+                       this.layers.mask = source.layers.mask;
+                       this.visible = source.visible;
+                       this.castShadow = source.castShadow;
+                       this.receiveShadow = source.receiveShadow;
+                       this.frustumCulled = source.frustumCulled;
+                       this.renderOrder = source.renderOrder;
+                       this.userData = JSON.parse(JSON.stringify(source.userData));
+
+                       if (recursive === true) {
+                               for (let i = 0; i < source.children.length; i++) {
+                                       const child = source.children[i];
+                                       this.add(child.clone());
+                               }
+                       }
+
+                       return this;
+               }
+
+       }
+
+       Object3D.DefaultUp = new Vector3(0, 1, 0);
+       Object3D.DefaultMatrixAutoUpdate = true;
+       Object3D.prototype.isObject3D = true;
+
+       const _v0$1 = /*@__PURE__*/new Vector3();
+
+       const _v1$3 = /*@__PURE__*/new Vector3();
+
+       const _v2$2 = /*@__PURE__*/new Vector3();
+
+       const _v3$1 = /*@__PURE__*/new Vector3();
+
+       const _vab = /*@__PURE__*/new Vector3();
+
+       const _vac = /*@__PURE__*/new Vector3();
+
+       const _vbc = /*@__PURE__*/new Vector3();
+
+       const _vap = /*@__PURE__*/new Vector3();
+
+       const _vbp = /*@__PURE__*/new Vector3();
+
+       const _vcp = /*@__PURE__*/new Vector3();
+
+       class Triangle {
+               constructor(a = new Vector3(), b = new Vector3(), c = new Vector3()) {
+                       this.a = a;
+                       this.b = b;
+                       this.c = c;
+               }
+
+               static getNormal(a, b, c, target) {
+                       target.subVectors(c, b);
+
+                       _v0$1.subVectors(a, b);
+
+                       target.cross(_v0$1);
+                       const targetLengthSq = target.lengthSq();
+
+                       if (targetLengthSq > 0) {
+                               return target.multiplyScalar(1 / Math.sqrt(targetLengthSq));
+                       }
+
+                       return target.set(0, 0, 0);
+               } // static/instance method to calculate barycentric coordinates
+               // based on: http://www.blackpawn.com/texts/pointinpoly/default.html
+
+
+               static getBarycoord(point, a, b, c, target) {
+                       _v0$1.subVectors(c, a);
+
+                       _v1$3.subVectors(b, a);
+
+                       _v2$2.subVectors(point, a);
+
+                       const dot00 = _v0$1.dot(_v0$1);
+
+                       const dot01 = _v0$1.dot(_v1$3);
+
+                       const dot02 = _v0$1.dot(_v2$2);
+
+                       const dot11 = _v1$3.dot(_v1$3);
+
+                       const dot12 = _v1$3.dot(_v2$2);
+
+                       const denom = dot00 * dot11 - dot01 * dot01; // collinear or singular triangle
+
+                       if (denom === 0) {
+                               // arbitrary location outside of triangle?
+                               // not sure if this is the best idea, maybe should be returning undefined
+                               return target.set(-2, -1, -1);
+                       }
+
+                       const invDenom = 1 / denom;
+                       const u = (dot11 * dot02 - dot01 * dot12) * invDenom;
+                       const v = (dot00 * dot12 - dot01 * dot02) * invDenom; // barycentric coordinates must always sum to 1
+
+                       return target.set(1 - u - v, v, u);
+               }
+
+               static containsPoint(point, a, b, c) {
+                       this.getBarycoord(point, a, b, c, _v3$1);
+                       return _v3$1.x >= 0 && _v3$1.y >= 0 && _v3$1.x + _v3$1.y <= 1;
+               }
+
+               static getUV(point, p1, p2, p3, uv1, uv2, uv3, target) {
+                       this.getBarycoord(point, p1, p2, p3, _v3$1);
+                       target.set(0, 0);
+                       target.addScaledVector(uv1, _v3$1.x);
+                       target.addScaledVector(uv2, _v3$1.y);
+                       target.addScaledVector(uv3, _v3$1.z);
+                       return target;
+               }
+
+               static isFrontFacing(a, b, c, direction) {
+                       _v0$1.subVectors(c, b);
+
+                       _v1$3.subVectors(a, b); // strictly front facing
+
+
+                       return _v0$1.cross(_v1$3).dot(direction) < 0 ? true : false;
+               }
+
+               set(a, b, c) {
+                       this.a.copy(a);
+                       this.b.copy(b);
+                       this.c.copy(c);
+                       return this;
+               }
+
+               setFromPointsAndIndices(points, i0, i1, i2) {
+                       this.a.copy(points[i0]);
+                       this.b.copy(points[i1]);
+                       this.c.copy(points[i2]);
+                       return this;
+               }
+
+               clone() {
+                       return new this.constructor().copy(this);
+               }
+
+               copy(triangle) {
+                       this.a.copy(triangle.a);
+                       this.b.copy(triangle.b);
+                       this.c.copy(triangle.c);
+                       return this;
+               }
+
+               getArea() {
+                       _v0$1.subVectors(this.c, this.b);
+
+                       _v1$3.subVectors(this.a, this.b);
+
+                       return _v0$1.cross(_v1$3).length() * 0.5;
+               }
+
+               getMidpoint(target) {
+                       return target.addVectors(this.a, this.b).add(this.c).multiplyScalar(1 / 3);
+               }
+
+               getNormal(target) {
+                       return Triangle.getNormal(this.a, this.b, this.c, target);
+               }
+
+               getPlane(target) {
+                       return target.setFromCoplanarPoints(this.a, this.b, this.c);
+               }
+
+               getBarycoord(point, target) {
+                       return Triangle.getBarycoord(point, this.a, this.b, this.c, target);
+               }
+
+               getUV(point, uv1, uv2, uv3, target) {
+                       return Triangle.getUV(point, this.a, this.b, this.c, uv1, uv2, uv3, target);
+               }
+
+               containsPoint(point) {
+                       return Triangle.containsPoint(point, this.a, this.b, this.c);
+               }
+
+               isFrontFacing(direction) {
+                       return Triangle.isFrontFacing(this.a, this.b, this.c, direction);
+               }
+
+               intersectsBox(box) {
+                       return box.intersectsTriangle(this);
+               }
+
+               closestPointToPoint(p, target) {
+                       const a = this.a,
+                                               b = this.b,
+                                               c = this.c;
+                       let v, w; // algorithm thanks to Real-Time Collision Detection by Christer Ericson,
+                       // published by Morgan Kaufmann Publishers, (c) 2005 Elsevier Inc.,
+                       // under the accompanying license; see chapter 5.1.5 for detailed explanation.
+                       // basically, we're distinguishing which of the voronoi regions of the triangle
+                       // the point lies in with the minimum amount of redundant computation.
+
+                       _vab.subVectors(b, a);
+
+                       _vac.subVectors(c, a);
+
+                       _vap.subVectors(p, a);
+
+                       const d1 = _vab.dot(_vap);
+
+                       const d2 = _vac.dot(_vap);
+
+                       if (d1 <= 0 && d2 <= 0) {
+                               // vertex region of A; barycentric coords (1, 0, 0)
+                               return target.copy(a);
+                       }
+
+                       _vbp.subVectors(p, b);
+
+                       const d3 = _vab.dot(_vbp);
+
+                       const d4 = _vac.dot(_vbp);
+
+                       if (d3 >= 0 && d4 <= d3) {
+                               // vertex region of B; barycentric coords (0, 1, 0)
+                               return target.copy(b);
+                       }
+
+                       const vc = d1 * d4 - d3 * d2;
+
+                       if (vc <= 0 && d1 >= 0 && d3 <= 0) {
+                               v = d1 / (d1 - d3); // edge region of AB; barycentric coords (1-v, v, 0)
+
+                               return target.copy(a).addScaledVector(_vab, v);
+                       }
+
+                       _vcp.subVectors(p, c);
+
+                       const d5 = _vab.dot(_vcp);
+
+                       const d6 = _vac.dot(_vcp);
+
+                       if (d6 >= 0 && d5 <= d6) {
+                               // vertex region of C; barycentric coords (0, 0, 1)
+                               return target.copy(c);
+                       }
+
+                       const vb = d5 * d2 - d1 * d6;
+
+                       if (vb <= 0 && d2 >= 0 && d6 <= 0) {
+                               w = d2 / (d2 - d6); // edge region of AC; barycentric coords (1-w, 0, w)
+
+                               return target.copy(a).addScaledVector(_vac, w);
+                       }
+
+                       const va = d3 * d6 - d5 * d4;
+
+                       if (va <= 0 && d4 - d3 >= 0 && d5 - d6 >= 0) {
+                               _vbc.subVectors(c, b);
+
+                               w = (d4 - d3) / (d4 - d3 + (d5 - d6)); // edge region of BC; barycentric coords (0, 1-w, w)
+
+                               return target.copy(b).addScaledVector(_vbc, w); // edge region of BC
+                       } // face region
+
+
+                       const denom = 1 / (va + vb + vc); // u = va * denom
+
+                       v = vb * denom;
+                       w = vc * denom;
+                       return target.copy(a).addScaledVector(_vab, v).addScaledVector(_vac, w);
+               }
+
+               equals(triangle) {
+                       return triangle.a.equals(this.a) && triangle.b.equals(this.b) && triangle.c.equals(this.c);
+               }
+
+       }
+
+       let materialId = 0;
+
+       class Material extends EventDispatcher {
+               constructor() {
+                       super();
+                       Object.defineProperty(this, 'id', {
+                               value: materialId++
+                       });
+                       this.uuid = generateUUID();
+                       this.name = '';
+                       this.type = 'Material';
+                       this.fog = true;
+                       this.blending = NormalBlending;
+                       this.side = FrontSide;
+                       this.vertexColors = false;
+                       this.opacity = 1;
+                       this.format = RGBAFormat;
+                       this.transparent = false;
+                       this.blendSrc = SrcAlphaFactor;
+                       this.blendDst = OneMinusSrcAlphaFactor;
+                       this.blendEquation = AddEquation;
+                       this.blendSrcAlpha = null;
+                       this.blendDstAlpha = null;
+                       this.blendEquationAlpha = null;
+                       this.depthFunc = LessEqualDepth;
+                       this.depthTest = true;
+                       this.depthWrite = true;
+                       this.stencilWriteMask = 0xff;
+                       this.stencilFunc = AlwaysStencilFunc;
+                       this.stencilRef = 0;
+                       this.stencilFuncMask = 0xff;
+                       this.stencilFail = KeepStencilOp;
+                       this.stencilZFail = KeepStencilOp;
+                       this.stencilZPass = KeepStencilOp;
+                       this.stencilWrite = false;
+                       this.clippingPlanes = null;
+                       this.clipIntersection = false;
+                       this.clipShadows = false;
+                       this.shadowSide = null;
+                       this.colorWrite = true;
+                       this.precision = null; // override the renderer's default precision for this material
+
+                       this.polygonOffset = false;
+                       this.polygonOffsetFactor = 0;
+                       this.polygonOffsetUnits = 0;
+                       this.dithering = false;
+                       this.alphaToCoverage = false;
+                       this.premultipliedAlpha = false;
+                       this.visible = true;
+                       this.toneMapped = true;
+                       this.userData = {};
+                       this.version = 0;
+                       this._alphaTest = 0;
+               }
+
+               get alphaTest() {
+                       return this._alphaTest;
+               }
+
+               set alphaTest(value) {
+                       if (this._alphaTest > 0 !== value > 0) {
+                               this.version++;
+                       }
+
+                       this._alphaTest = value;
+               }
+
+               onBuild() {}
+
+               onBeforeCompile() {}
+
+               customProgramCacheKey() {
+                       return this.onBeforeCompile.toString();
+               }
+
+               setValues(values) {
+                       if (values === undefined) return;
+
+                       for (const key in values) {
+                               const newValue = values[key];
+
+                               if (newValue === undefined) {
+                                       console.warn('THREE.Material: \'' + key + '\' parameter is undefined.');
+                                       continue;
+                               } // for backward compatability if shading is set in the constructor
+
+
+                               if (key === 'shading') {
+                                       console.warn('THREE.' + this.type + ': .shading has been removed. Use the boolean .flatShading instead.');
+                                       this.flatShading = newValue === FlatShading ? true : false;
+                                       continue;
+                               }
+
+                               const currentValue = this[key];
+
+                               if (currentValue === undefined) {
+                                       console.warn('THREE.' + this.type + ': \'' + key + '\' is not a property of this material.');
+                                       continue;
+                               }
+
+                               if (currentValue && currentValue.isColor) {
+                                       currentValue.set(newValue);
+                               } else if (currentValue && currentValue.isVector3 && newValue && newValue.isVector3) {
+                                       currentValue.copy(newValue);
+                               } else {
+                                       this[key] = newValue;
+                               }
+                       }
+               }
+
+               toJSON(meta) {
+                       const isRoot = meta === undefined || typeof meta === 'string';
+
+                       if (isRoot) {
+                               meta = {
+                                       textures: {},
+                                       images: {}
+                               };
+                       }
+
+                       const data = {
+                               metadata: {
+                                       version: 4.5,
+                                       type: 'Material',
+                                       generator: 'Material.toJSON'
+                               }
+                       }; // standard Material serialization
+
+                       data.uuid = this.uuid;
+                       data.type = this.type;
+                       if (this.name !== '') data.name = this.name;
+                       if (this.color && this.color.isColor) data.color = this.color.getHex();
+                       if (this.roughness !== undefined) data.roughness = this.roughness;
+                       if (this.metalness !== undefined) data.metalness = this.metalness;
+                       if (this.sheenTint && this.sheenTint.isColor) data.sheenTint = this.sheenTint.getHex();
+                       if (this.emissive && this.emissive.isColor) data.emissive = this.emissive.getHex();
+                       if (this.emissiveIntensity && this.emissiveIntensity !== 1) data.emissiveIntensity = this.emissiveIntensity;
+                       if (this.specular && this.specular.isColor) data.specular = this.specular.getHex();
+                       if (this.specularIntensity !== undefined) data.specularIntensity = this.specularIntensity;
+                       if (this.specularTint && this.specularTint.isColor) data.specularTint = this.specularTint.getHex();
+                       if (this.shininess !== undefined) data.shininess = this.shininess;
+                       if (this.clearcoat !== undefined) data.clearcoat = this.clearcoat;
+                       if (this.clearcoatRoughness !== undefined) data.clearcoatRoughness = this.clearcoatRoughness;
+
+                       if (this.clearcoatMap && this.clearcoatMap.isTexture) {
+                               data.clearcoatMap = this.clearcoatMap.toJSON(meta).uuid;
+                       }
+
+                       if (this.clearcoatRoughnessMap && this.clearcoatRoughnessMap.isTexture) {
+                               data.clearcoatRoughnessMap = this.clearcoatRoughnessMap.toJSON(meta).uuid;
+                       }
+
+                       if (this.clearcoatNormalMap && this.clearcoatNormalMap.isTexture) {
+                               data.clearcoatNormalMap = this.clearcoatNormalMap.toJSON(meta).uuid;
+                               data.clearcoatNormalScale = this.clearcoatNormalScale.toArray();
+                       }
+
+                       if (this.map && this.map.isTexture) data.map = this.map.toJSON(meta).uuid;
+                       if (this.matcap && this.matcap.isTexture) data.matcap = this.matcap.toJSON(meta).uuid;
+                       if (this.alphaMap && this.alphaMap.isTexture) data.alphaMap = this.alphaMap.toJSON(meta).uuid;
+
+                       if (this.lightMap && this.lightMap.isTexture) {
+                               data.lightMap = this.lightMap.toJSON(meta).uuid;
+                               data.lightMapIntensity = this.lightMapIntensity;
+                       }
+
+                       if (this.aoMap && this.aoMap.isTexture) {
+                               data.aoMap = this.aoMap.toJSON(meta).uuid;
+                               data.aoMapIntensity = this.aoMapIntensity;
+                       }
+
+                       if (this.bumpMap && this.bumpMap.isTexture) {
+                               data.bumpMap = this.bumpMap.toJSON(meta).uuid;
+                               data.bumpScale = this.bumpScale;
+                       }
+
+                       if (this.normalMap && this.normalMap.isTexture) {
+                               data.normalMap = this.normalMap.toJSON(meta).uuid;
+                               data.normalMapType = this.normalMapType;
+                               data.normalScale = this.normalScale.toArray();
+                       }
+
+                       if (this.displacementMap && this.displacementMap.isTexture) {
+                               data.displacementMap = this.displacementMap.toJSON(meta).uuid;
+                               data.displacementScale = this.displacementScale;
+                               data.displacementBias = this.displacementBias;
+                       }
+
+                       if (this.roughnessMap && this.roughnessMap.isTexture) data.roughnessMap = this.roughnessMap.toJSON(meta).uuid;
+                       if (this.metalnessMap && this.metalnessMap.isTexture) data.metalnessMap = this.metalnessMap.toJSON(meta).uuid;
+                       if (this.emissiveMap && this.emissiveMap.isTexture) data.emissiveMap = this.emissiveMap.toJSON(meta).uuid;
+                       if (this.specularMap && this.specularMap.isTexture) data.specularMap = this.specularMap.toJSON(meta).uuid;
+                       if (this.specularIntensityMap && this.specularIntensityMap.isTexture) data.specularIntensityMap = this.specularIntensityMap.toJSON(meta).uuid;
+                       if (this.specularTintMap && this.specularTintMap.isTexture) data.specularTintMap = this.specularTintMap.toJSON(meta).uuid;
+
+                       if (this.envMap && this.envMap.isTexture) {
+                               data.envMap = this.envMap.toJSON(meta).uuid;
+                               if (this.combine !== undefined) data.combine = this.combine;
+                       }
+
+                       if (this.envMapIntensity !== undefined) data.envMapIntensity = this.envMapIntensity;
+                       if (this.reflectivity !== undefined) data.reflectivity = this.reflectivity;
+                       if (this.refractionRatio !== undefined) data.refractionRatio = this.refractionRatio;
+
+                       if (this.gradientMap && this.gradientMap.isTexture) {
+                               data.gradientMap = this.gradientMap.toJSON(meta).uuid;
+                       }
+
+                       if (this.transmission !== undefined) data.transmission = this.transmission;
+                       if (this.transmissionMap && this.transmissionMap.isTexture) data.transmissionMap = this.transmissionMap.toJSON(meta).uuid;
+                       if (this.thickness !== undefined) data.thickness = this.thickness;
+                       if (this.thicknessMap && this.thicknessMap.isTexture) data.thicknessMap = this.thicknessMap.toJSON(meta).uuid;
+                       if (this.attenuationDistance !== undefined) data.attenuationDistance = this.attenuationDistance;
+                       if (this.attenuationTint !== undefined) data.attenuationTint = this.attenuationTint.getHex();
+                       if (this.size !== undefined) data.size = this.size;
+                       if (this.shadowSide !== null) data.shadowSide = this.shadowSide;
+                       if (this.sizeAttenuation !== undefined) data.sizeAttenuation = this.sizeAttenuation;
+                       if (this.blending !== NormalBlending) data.blending = this.blending;
+                       if (this.side !== FrontSide) data.side = this.side;
+                       if (this.vertexColors) data.vertexColors = true;
+                       if (this.opacity < 1) data.opacity = this.opacity;
+                       if (this.format !== RGBAFormat) data.format = this.format;
+                       if (this.transparent === true) data.transparent = this.transparent;
+                       data.depthFunc = this.depthFunc;
+                       data.depthTest = this.depthTest;
+                       data.depthWrite = this.depthWrite;
+                       data.colorWrite = this.colorWrite;
+                       data.stencilWrite = this.stencilWrite;
+                       data.stencilWriteMask = this.stencilWriteMask;
+                       data.stencilFunc = this.stencilFunc;
+                       data.stencilRef = this.stencilRef;
+                       data.stencilFuncMask = this.stencilFuncMask;
+                       data.stencilFail = this.stencilFail;
+                       data.stencilZFail = this.stencilZFail;
+                       data.stencilZPass = this.stencilZPass; // rotation (SpriteMaterial)
+
+                       if (this.rotation && this.rotation !== 0) data.rotation = this.rotation;
+                       if (this.polygonOffset === true) data.polygonOffset = true;
+                       if (this.polygonOffsetFactor !== 0) data.polygonOffsetFactor = this.polygonOffsetFactor;
+                       if (this.polygonOffsetUnits !== 0) data.polygonOffsetUnits = this.polygonOffsetUnits;
+                       if (this.linewidth && this.linewidth !== 1) data.linewidth = this.linewidth;
+                       if (this.dashSize !== undefined) data.dashSize = this.dashSize;
+                       if (this.gapSize !== undefined) data.gapSize = this.gapSize;
+                       if (this.scale !== undefined) data.scale = this.scale;
+                       if (this.dithering === true) data.dithering = true;
+                       if (this.alphaTest > 0) data.alphaTest = this.alphaTest;
+                       if (this.alphaToCoverage === true) data.alphaToCoverage = this.alphaToCoverage;
+                       if (this.premultipliedAlpha === true) data.premultipliedAlpha = this.premultipliedAlpha;
+                       if (this.wireframe === true) data.wireframe = this.wireframe;
+                       if (this.wireframeLinewidth > 1) data.wireframeLinewidth = this.wireframeLinewidth;
+                       if (this.wireframeLinecap !== 'round') data.wireframeLinecap = this.wireframeLinecap;
+                       if (this.wireframeLinejoin !== 'round') data.wireframeLinejoin = this.wireframeLinejoin;
+                       if (this.flatShading === true) data.flatShading = this.flatShading;
+                       if (this.visible === false) data.visible = false;
+                       if (this.toneMapped === false) data.toneMapped = false;
+                       if (JSON.stringify(this.userData) !== '{}') data.userData = this.userData; // TODO: Copied from Object3D.toJSON
+
+                       function extractFromCache(cache) {
+                               const values = [];
+
+                               for (const key in cache) {
+                                       const data = cache[key];
+                                       delete data.metadata;
+                                       values.push(data);
+                               }
+
+                               return values;
+                       }
+
+                       if (isRoot) {
+                               const textures = extractFromCache(meta.textures);
+                               const images = extractFromCache(meta.images);
+                               if (textures.length > 0) data.textures = textures;
+                               if (images.length > 0) data.images = images;
+                       }
+
+                       return data;
+               }
+
+               clone() {
+                       return new this.constructor().copy(this);
+               }
+
+               copy(source) {
+                       this.name = source.name;
+                       this.fog = source.fog;
+                       this.blending = source.blending;
+                       this.side = source.side;
+                       this.vertexColors = source.vertexColors;
+                       this.opacity = source.opacity;
+                       this.format = source.format;
+                       this.transparent = source.transparent;
+                       this.blendSrc = source.blendSrc;
+                       this.blendDst = source.blendDst;
+                       this.blendEquation = source.blendEquation;
+                       this.blendSrcAlpha = source.blendSrcAlpha;
+                       this.blendDstAlpha = source.blendDstAlpha;
+                       this.blendEquationAlpha = source.blendEquationAlpha;
+                       this.depthFunc = source.depthFunc;
+                       this.depthTest = source.depthTest;
+                       this.depthWrite = source.depthWrite;
+                       this.stencilWriteMask = source.stencilWriteMask;
+                       this.stencilFunc = source.stencilFunc;
+                       this.stencilRef = source.stencilRef;
+                       this.stencilFuncMask = source.stencilFuncMask;
+                       this.stencilFail = source.stencilFail;
+                       this.stencilZFail = source.stencilZFail;
+                       this.stencilZPass = source.stencilZPass;
+                       this.stencilWrite = source.stencilWrite;
+                       const srcPlanes = source.clippingPlanes;
+                       let dstPlanes = null;
+
+                       if (srcPlanes !== null) {
+                               const n = srcPlanes.length;
+                               dstPlanes = new Array(n);
+
+                               for (let i = 0; i !== n; ++i) {
+                                       dstPlanes[i] = srcPlanes[i].clone();
+                               }
+                       }
+
+                       this.clippingPlanes = dstPlanes;
+                       this.clipIntersection = source.clipIntersection;
+                       this.clipShadows = source.clipShadows;
+                       this.shadowSide = source.shadowSide;
+                       this.colorWrite = source.colorWrite;
+                       this.precision = source.precision;
+                       this.polygonOffset = source.polygonOffset;
+                       this.polygonOffsetFactor = source.polygonOffsetFactor;
+                       this.polygonOffsetUnits = source.polygonOffsetUnits;
+                       this.dithering = source.dithering;
+                       this.alphaTest = source.alphaTest;
+                       this.alphaToCoverage = source.alphaToCoverage;
+                       this.premultipliedAlpha = source.premultipliedAlpha;
+                       this.visible = source.visible;
+                       this.toneMapped = source.toneMapped;
+                       this.userData = JSON.parse(JSON.stringify(source.userData));
+                       return this;
+               }
+
+               dispose() {
+                       this.dispatchEvent({
+                               type: 'dispose'
+                       });
+               }
+
+               set needsUpdate(value) {
+                       if (value === true) this.version++;
+               }
+
+       }
+
+       Material.prototype.isMaterial = true;
+
+       const _colorKeywords = {
+               'aliceblue': 0xF0F8FF,
+               'antiquewhite': 0xFAEBD7,
+               'aqua': 0x00FFFF,
+               'aquamarine': 0x7FFFD4,
+               'azure': 0xF0FFFF,
+               'beige': 0xF5F5DC,
+               'bisque': 0xFFE4C4,
+               'black': 0x000000,
+               'blanchedalmond': 0xFFEBCD,
+               'blue': 0x0000FF,
+               'blueviolet': 0x8A2BE2,
+               'brown': 0xA52A2A,
+               'burlywood': 0xDEB887,
+               'cadetblue': 0x5F9EA0,
+               'chartreuse': 0x7FFF00,
+               'chocolate': 0xD2691E,
+               'coral': 0xFF7F50,
+               'cornflowerblue': 0x6495ED,
+               'cornsilk': 0xFFF8DC,
+               'crimson': 0xDC143C,
+               'cyan': 0x00FFFF,
+               'darkblue': 0x00008B,
+               'darkcyan': 0x008B8B,
+               'darkgoldenrod': 0xB8860B,
+               'darkgray': 0xA9A9A9,
+               'darkgreen': 0x006400,
+               'darkgrey': 0xA9A9A9,
+               'darkkhaki': 0xBDB76B,
+               'darkmagenta': 0x8B008B,
+               'darkolivegreen': 0x556B2F,
+               'darkorange': 0xFF8C00,
+               'darkorchid': 0x9932CC,
+               'darkred': 0x8B0000,
+               'darksalmon': 0xE9967A,
+               'darkseagreen': 0x8FBC8F,
+               'darkslateblue': 0x483D8B,
+               'darkslategray': 0x2F4F4F,
+               'darkslategrey': 0x2F4F4F,
+               'darkturquoise': 0x00CED1,
+               'darkviolet': 0x9400D3,
+               'deeppink': 0xFF1493,
+               'deepskyblue': 0x00BFFF,
+               'dimgray': 0x696969,
+               'dimgrey': 0x696969,
+               'dodgerblue': 0x1E90FF,
+               'firebrick': 0xB22222,
+               'floralwhite': 0xFFFAF0,
+               'forestgreen': 0x228B22,
+               'fuchsia': 0xFF00FF,
+               'gainsboro': 0xDCDCDC,
+               'ghostwhite': 0xF8F8FF,
+               'gold': 0xFFD700,
+               'goldenrod': 0xDAA520,
+               'gray': 0x808080,
+               'green': 0x008000,
+               'greenyellow': 0xADFF2F,
+               'grey': 0x808080,
+               'honeydew': 0xF0FFF0,
+               'hotpink': 0xFF69B4,
+               'indianred': 0xCD5C5C,
+               'indigo': 0x4B0082,
+               'ivory': 0xFFFFF0,
+               'khaki': 0xF0E68C,
+               'lavender': 0xE6E6FA,
+               'lavenderblush': 0xFFF0F5,
+               'lawngreen': 0x7CFC00,
+               'lemonchiffon': 0xFFFACD,
+               'lightblue': 0xADD8E6,
+               'lightcoral': 0xF08080,
+               'lightcyan': 0xE0FFFF,
+               'lightgoldenrodyellow': 0xFAFAD2,
+               'lightgray': 0xD3D3D3,
+               'lightgreen': 0x90EE90,
+               'lightgrey': 0xD3D3D3,
+               'lightpink': 0xFFB6C1,
+               'lightsalmon': 0xFFA07A,
+               'lightseagreen': 0x20B2AA,
+               'lightskyblue': 0x87CEFA,
+               'lightslategray': 0x778899,
+               'lightslategrey': 0x778899,
+               'lightsteelblue': 0xB0C4DE,
+               'lightyellow': 0xFFFFE0,
+               'lime': 0x00FF00,
+               'limegreen': 0x32CD32,
+               'linen': 0xFAF0E6,
+               'magenta': 0xFF00FF,
+               'maroon': 0x800000,
+               'mediumaquamarine': 0x66CDAA,
+               'mediumblue': 0x0000CD,
+               'mediumorchid': 0xBA55D3,
+               'mediumpurple': 0x9370DB,
+               'mediumseagreen': 0x3CB371,
+               'mediumslateblue': 0x7B68EE,
+               'mediumspringgreen': 0x00FA9A,
+               'mediumturquoise': 0x48D1CC,
+               'mediumvioletred': 0xC71585,
+               'midnightblue': 0x191970,
+               'mintcream': 0xF5FFFA,
+               'mistyrose': 0xFFE4E1,
+               'moccasin': 0xFFE4B5,
+               'navajowhite': 0xFFDEAD,
+               'navy': 0x000080,
+               'oldlace': 0xFDF5E6,
+               'olive': 0x808000,
+               'olivedrab': 0x6B8E23,
+               'orange': 0xFFA500,
+               'orangered': 0xFF4500,
+               'orchid': 0xDA70D6,
+               'palegoldenrod': 0xEEE8AA,
+               'palegreen': 0x98FB98,
+               'paleturquoise': 0xAFEEEE,
+               'palevioletred': 0xDB7093,
+               'papayawhip': 0xFFEFD5,
+               'peachpuff': 0xFFDAB9,
+               'peru': 0xCD853F,
+               'pink': 0xFFC0CB,
+               'plum': 0xDDA0DD,
+               'powderblue': 0xB0E0E6,
+               'purple': 0x800080,
+               'rebeccapurple': 0x663399,
+               'red': 0xFF0000,
+               'rosybrown': 0xBC8F8F,
+               'royalblue': 0x4169E1,
+               'saddlebrown': 0x8B4513,
+               'salmon': 0xFA8072,
+               'sandybrown': 0xF4A460,
+               'seagreen': 0x2E8B57,
+               'seashell': 0xFFF5EE,
+               'sienna': 0xA0522D,
+               'silver': 0xC0C0C0,
+               'skyblue': 0x87CEEB,
+               'slateblue': 0x6A5ACD,
+               'slategray': 0x708090,
+               'slategrey': 0x708090,
+               'snow': 0xFFFAFA,
+               'springgreen': 0x00FF7F,
+               'steelblue': 0x4682B4,
+               'tan': 0xD2B48C,
+               'teal': 0x008080,
+               'thistle': 0xD8BFD8,
+               'tomato': 0xFF6347,
+               'turquoise': 0x40E0D0,
+               'violet': 0xEE82EE,
+               'wheat': 0xF5DEB3,
+               'white': 0xFFFFFF,
+               'whitesmoke': 0xF5F5F5,
+               'yellow': 0xFFFF00,
+               'yellowgreen': 0x9ACD32
+       };
+       const _hslA = {
+               h: 0,
+               s: 0,
+               l: 0
+       };
+       const _hslB = {
+               h: 0,
+               s: 0,
+               l: 0
+       };
+
+       function hue2rgb(p, q, t) {
+               if (t < 0) t += 1;
+               if (t > 1) t -= 1;
+               if (t < 1 / 6) return p + (q - p) * 6 * t;
+               if (t < 1 / 2) return q;
+               if (t < 2 / 3) return p + (q - p) * 6 * (2 / 3 - t);
+               return p;
+       }
+
+       function SRGBToLinear(c) {
+               return c < 0.04045 ? c * 0.0773993808 : Math.pow(c * 0.9478672986 + 0.0521327014, 2.4);
+       }
+
+       function LinearToSRGB(c) {
+               return c < 0.0031308 ? c * 12.92 : 1.055 * Math.pow(c, 0.41666) - 0.055;
+       }
+
+       class Color {
+               constructor(r, g, b) {
+                       if (g === undefined && b === undefined) {
+                               // r is THREE.Color, hex or string
+                               return this.set(r);
+                       }
+
+                       return this.setRGB(r, g, b);
+               }
+
+               set(value) {
+                       if (value && value.isColor) {
+                               this.copy(value);
+                       } else if (typeof value === 'number') {
+                               this.setHex(value);
+                       } else if (typeof value === 'string') {
+                               this.setStyle(value);
+                       }
+
+                       return this;
+               }
+
+               setScalar(scalar) {
+                       this.r = scalar;
+                       this.g = scalar;
+                       this.b = scalar;
+                       return this;
+               }
+
+               setHex(hex) {
+                       hex = Math.floor(hex);
+                       this.r = (hex >> 16 & 255) / 255;
+                       this.g = (hex >> 8 & 255) / 255;
+                       this.b = (hex & 255) / 255;
+                       return this;
+               }
+
+               setRGB(r, g, b) {
+                       this.r = r;
+                       this.g = g;
+                       this.b = b;
+                       return this;
+               }
+
+               setHSL(h, s, l) {
+                       // h,s,l ranges are in 0.0 - 1.0
+                       h = euclideanModulo(h, 1);
+                       s = clamp(s, 0, 1);
+                       l = clamp(l, 0, 1);
+
+                       if (s === 0) {
+                               this.r = this.g = this.b = l;
+                       } else {
+                               const p = l <= 0.5 ? l * (1 + s) : l + s - l * s;
+                               const q = 2 * l - p;
+                               this.r = hue2rgb(q, p, h + 1 / 3);
+                               this.g = hue2rgb(q, p, h);
+                               this.b = hue2rgb(q, p, h - 1 / 3);
+                       }
+
+                       return this;
+               }
+
+               setStyle(style) {
+                       function handleAlpha(string) {
+                               if (string === undefined) return;
+
+                               if (parseFloat(string) < 1) {
+                                       console.warn('THREE.Color: Alpha component of ' + style + ' will be ignored.');
+                               }
+                       }
+
+                       let m;
+
+                       if (m = /^((?:rgb|hsl)a?)\(([^\)]*)\)/.exec(style)) {
+                               // rgb / hsl
+                               let color;
+                               const name = m[1];
+                               const components = m[2];
+
+                               switch (name) {
+                                       case 'rgb':
+                                       case 'rgba':
+                                               if (color = /^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(components)) {
+                                                       // rgb(255,0,0) rgba(255,0,0,0.5)
+                                                       this.r = Math.min(255, parseInt(color[1], 10)) / 255;
+                                                       this.g = Math.min(255, parseInt(color[2], 10)) / 255;
+                                                       this.b = Math.min(255, parseInt(color[3], 10)) / 255;
+                                                       handleAlpha(color[4]);
+                                                       return this;
+                                               }
+
+                                               if (color = /^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(components)) {
+                                                       // rgb(100%,0%,0%) rgba(100%,0%,0%,0.5)
+                                                       this.r = Math.min(100, parseInt(color[1], 10)) / 100;
+                                                       this.g = Math.min(100, parseInt(color[2], 10)) / 100;
+                                                       this.b = Math.min(100, parseInt(color[3], 10)) / 100;
+                                                       handleAlpha(color[4]);
+                                                       return this;
+                                               }
+
+                                               break;
+
+                                       case 'hsl':
+                                       case 'hsla':
+                                               if (color = /^\s*(\d*\.?\d+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(components)) {
+                                                       // hsl(120,50%,50%) hsla(120,50%,50%,0.5)
+                                                       const h = parseFloat(color[1]) / 360;
+                                                       const s = parseInt(color[2], 10) / 100;
+                                                       const l = parseInt(color[3], 10) / 100;
+                                                       handleAlpha(color[4]);
+                                                       return this.setHSL(h, s, l);
+                                               }
+
+                                               break;
+                               }
+                       } else if (m = /^\#([A-Fa-f\d]+)$/.exec(style)) {
+                               // hex color
+                               const hex = m[1];
+                               const size = hex.length;
+
+                               if (size === 3) {
+                                       // #ff0
+                                       this.r = parseInt(hex.charAt(0) + hex.charAt(0), 16) / 255;
+                                       this.g = parseInt(hex.charAt(1) + hex.charAt(1), 16) / 255;
+                                       this.b = parseInt(hex.charAt(2) + hex.charAt(2), 16) / 255;
+                                       return this;
+                               } else if (size === 6) {
+                                       // #ff0000
+                                       this.r = parseInt(hex.charAt(0) + hex.charAt(1), 16) / 255;
+                                       this.g = parseInt(hex.charAt(2) + hex.charAt(3), 16) / 255;
+                                       this.b = parseInt(hex.charAt(4) + hex.charAt(5), 16) / 255;
+                                       return this;
+                               }
+                       }
+
+                       if (style && style.length > 0) {
+                               return this.setColorName(style);
+                       }
+
+                       return this;
+               }
+
+               setColorName(style) {
+                       // color keywords
+                       const hex = _colorKeywords[style.toLowerCase()];
+
+                       if (hex !== undefined) {
+                               // red
+                               this.setHex(hex);
+                       } else {
+                               // unknown color
+                               console.warn('THREE.Color: Unknown color ' + style);
+                       }
+
+                       return this;
+               }
+
+               clone() {
+                       return new this.constructor(this.r, this.g, this.b);
+               }
+
+               copy(color) {
+                       this.r = color.r;
+                       this.g = color.g;
+                       this.b = color.b;
+                       return this;
+               }
+
+               copyGammaToLinear(color, gammaFactor = 2.0) {
+                       this.r = Math.pow(color.r, gammaFactor);
+                       this.g = Math.pow(color.g, gammaFactor);
+                       this.b = Math.pow(color.b, gammaFactor);
+                       return this;
+               }
+
+               copyLinearToGamma(color, gammaFactor = 2.0) {
+                       const safeInverse = gammaFactor > 0 ? 1.0 / gammaFactor : 1.0;
+                       this.r = Math.pow(color.r, safeInverse);
+                       this.g = Math.pow(color.g, safeInverse);
+                       this.b = Math.pow(color.b, safeInverse);
+                       return this;
+               }
+
+               convertGammaToLinear(gammaFactor) {
+                       this.copyGammaToLinear(this, gammaFactor);
+                       return this;
+               }
+
+               convertLinearToGamma(gammaFactor) {
+                       this.copyLinearToGamma(this, gammaFactor);
+                       return this;
+               }
+
+               copySRGBToLinear(color) {
+                       this.r = SRGBToLinear(color.r);
+                       this.g = SRGBToLinear(color.g);
+                       this.b = SRGBToLinear(color.b);
+                       return this;
+               }
+
+               copyLinearToSRGB(color) {
+                       this.r = LinearToSRGB(color.r);
+                       this.g = LinearToSRGB(color.g);
+                       this.b = LinearToSRGB(color.b);
+                       return this;
+               }
+
+               convertSRGBToLinear() {
+                       this.copySRGBToLinear(this);
+                       return this;
+               }
+
+               convertLinearToSRGB() {
+                       this.copyLinearToSRGB(this);
+                       return this;
+               }
+
+               getHex() {
+                       return this.r * 255 << 16 ^ this.g * 255 << 8 ^ this.b * 255 << 0;
+               }
+
+               getHexString() {
+                       return ('000000' + this.getHex().toString(16)).slice(-6);
+               }
+
+               getHSL(target) {
+                       // h,s,l ranges are in 0.0 - 1.0
+                       const r = this.r,
+                                               g = this.g,
+                                               b = this.b;
+                       const max = Math.max(r, g, b);
+                       const min = Math.min(r, g, b);
+                       let hue, saturation;
+                       const lightness = (min + max) / 2.0;
+
+                       if (min === max) {
+                               hue = 0;
+                               saturation = 0;
+                       } else {
+                               const delta = max - min;
+                               saturation = lightness <= 0.5 ? delta / (max + min) : delta / (2 - max - min);
+
+                               switch (max) {
+                                       case r:
+                                               hue = (g - b) / delta + (g < b ? 6 : 0);
+                                               break;
+
+                                       case g:
+                                               hue = (b - r) / delta + 2;
+                                               break;
+
+                                       case b:
+                                               hue = (r - g) / delta + 4;
+                                               break;
+                               }
+
+                               hue /= 6;
+                       }
+
+                       target.h = hue;
+                       target.s = saturation;
+                       target.l = lightness;
+                       return target;
+               }
+
+               getStyle() {
+                       return 'rgb(' + (this.r * 255 | 0) + ',' + (this.g * 255 | 0) + ',' + (this.b * 255 | 0) + ')';
+               }
+
+               offsetHSL(h, s, l) {
+                       this.getHSL(_hslA);
+                       _hslA.h += h;
+                       _hslA.s += s;
+                       _hslA.l += l;
+                       this.setHSL(_hslA.h, _hslA.s, _hslA.l);
+                       return this;
+               }
+
+               add(color) {
+                       this.r += color.r;
+                       this.g += color.g;
+                       this.b += color.b;
+                       return this;
+               }
+
+               addColors(color1, color2) {
+                       this.r = color1.r + color2.r;
+                       this.g = color1.g + color2.g;
+                       this.b = color1.b + color2.b;
+                       return this;
+               }
+
+               addScalar(s) {
+                       this.r += s;
+                       this.g += s;
+                       this.b += s;
+                       return this;
+               }
+
+               sub(color) {
+                       this.r = Math.max(0, this.r - color.r);
+                       this.g = Math.max(0, this.g - color.g);
+                       this.b = Math.max(0, this.b - color.b);
+                       return this;
+               }
+
+               multiply(color) {
+                       this.r *= color.r;
+                       this.g *= color.g;
+                       this.b *= color.b;
+                       return this;
+               }
+
+               multiplyScalar(s) {
+                       this.r *= s;
+                       this.g *= s;
+                       this.b *= s;
+                       return this;
+               }
+
+               lerp(color, alpha) {
+                       this.r += (color.r - this.r) * alpha;
+                       this.g += (color.g - this.g) * alpha;
+                       this.b += (color.b - this.b) * alpha;
+                       return this;
+               }
+
+               lerpColors(color1, color2, alpha) {
+                       this.r = color1.r + (color2.r - color1.r) * alpha;
+                       this.g = color1.g + (color2.g - color1.g) * alpha;
+                       this.b = color1.b + (color2.b - color1.b) * alpha;
+                       return this;
+               }
+
+               lerpHSL(color, alpha) {
+                       this.getHSL(_hslA);
+                       color.getHSL(_hslB);
+                       const h = lerp(_hslA.h, _hslB.h, alpha);
+                       const s = lerp(_hslA.s, _hslB.s, alpha);
+                       const l = lerp(_hslA.l, _hslB.l, alpha);
+                       this.setHSL(h, s, l);
+                       return this;
+               }
+
+               equals(c) {
+                       return c.r === this.r && c.g === this.g && c.b === this.b;
+               }
+
+               fromArray(array, offset = 0) {
+                       this.r = array[offset];
+                       this.g = array[offset + 1];
+                       this.b = array[offset + 2];
+                       return this;
+               }
+
+               toArray(array = [], offset = 0) {
+                       array[offset] = this.r;
+                       array[offset + 1] = this.g;
+                       array[offset + 2] = this.b;
+                       return array;
+               }
+
+               fromBufferAttribute(attribute, index) {
+                       this.r = attribute.getX(index);
+                       this.g = attribute.getY(index);
+                       this.b = attribute.getZ(index);
+
+                       if (attribute.normalized === true) {
+                               // assuming Uint8Array
+                               this.r /= 255;
+                               this.g /= 255;
+                               this.b /= 255;
+                       }
+
+                       return this;
+               }
+
+               toJSON() {
+                       return this.getHex();
+               }
+
+       }
+
+       Color.NAMES = _colorKeywords;
+       Color.prototype.isColor = true;
+       Color.prototype.r = 1;
+       Color.prototype.g = 1;
+       Color.prototype.b = 1;
+
+       /**
+        * parameters = {
+        *      color: <hex>,
+        *      opacity: <float>,
+        *      map: new THREE.Texture( <Image> ),
+        *
+        *      lightMap: new THREE.Texture( <Image> ),
+        *      lightMapIntensity: <float>
+        *
+        *      aoMap: new THREE.Texture( <Image> ),
+        *      aoMapIntensity: <float>
+        *
+        *      specularMap: new THREE.Texture( <Image> ),
+        *
+        *      alphaMap: new THREE.Texture( <Image> ),
+        *
+        *      envMap: new THREE.CubeTexture( [posx, negx, posy, negy, posz, negz] ),
+        *      combine: THREE.Multiply,
+        *      reflectivity: <float>,
+        *      refractionRatio: <float>,
+        *
+        *      depthTest: <bool>,
+        *      depthWrite: <bool>,
+        *
+        *      wireframe: <boolean>,
+        *      wireframeLinewidth: <float>,
+        * }
+        */
+
+       class MeshBasicMaterial extends Material {
+               constructor(parameters) {
+                       super();
+                       this.type = 'MeshBasicMaterial';
+                       this.color = new Color(0xffffff); // emissive
+
+                       this.map = null;
+                       this.lightMap = null;
+                       this.lightMapIntensity = 1.0;
+                       this.aoMap = null;
+                       this.aoMapIntensity = 1.0;
+                       this.specularMap = null;
+                       this.alphaMap = null;
+                       this.envMap = null;
+                       this.combine = MultiplyOperation;
+                       this.reflectivity = 1;
+                       this.refractionRatio = 0.98;
+                       this.wireframe = false;
+                       this.wireframeLinewidth = 1;
+                       this.wireframeLinecap = 'round';
+                       this.wireframeLinejoin = 'round';
+                       this.setValues(parameters);
+               }
+
+               copy(source) {
+                       super.copy(source);
+                       this.color.copy(source.color);
+                       this.map = source.map;
+                       this.lightMap = source.lightMap;
+                       this.lightMapIntensity = source.lightMapIntensity;
+                       this.aoMap = source.aoMap;
+                       this.aoMapIntensity = source.aoMapIntensity;
+                       this.specularMap = source.specularMap;
+                       this.alphaMap = source.alphaMap;
+                       this.envMap = source.envMap;
+                       this.combine = source.combine;
+                       this.reflectivity = source.reflectivity;
+                       this.refractionRatio = source.refractionRatio;
+                       this.wireframe = source.wireframe;
+                       this.wireframeLinewidth = source.wireframeLinewidth;
+                       this.wireframeLinecap = source.wireframeLinecap;
+                       this.wireframeLinejoin = source.wireframeLinejoin;
+                       return this;
+               }
+
+       }
+
+       MeshBasicMaterial.prototype.isMeshBasicMaterial = true;
+
+       const _vector$9 = /*@__PURE__*/new Vector3();
+
+       const _vector2$1 = /*@__PURE__*/new Vector2();
+
+       class BufferAttribute {
+               constructor(array, itemSize, normalized) {
+                       if (Array.isArray(array)) {
+                               throw new TypeError('THREE.BufferAttribute: array should be a Typed Array.');
+                       }
+
+                       this.name = '';
+                       this.array = array;
+                       this.itemSize = itemSize;
+                       this.count = array !== undefined ? array.length / itemSize : 0;
+                       this.normalized = normalized === true;
+                       this.usage = StaticDrawUsage;
+                       this.updateRange = {
+                               offset: 0,
+                               count: -1
+                       };
+                       this.version = 0;
+               }
+
+               onUploadCallback() {}
+
+               set needsUpdate(value) {
+                       if (value === true) this.version++;
+               }
+
+               setUsage(value) {
+                       this.usage = value;
+                       return this;
+               }
+
+               copy(source) {
+                       this.name = source.name;
+                       this.array = new source.array.constructor(source.array);
+                       this.itemSize = source.itemSize;
+                       this.count = source.count;
+                       this.normalized = source.normalized;
+                       this.usage = source.usage;
+                       return this;
+               }
+
+               copyAt(index1, attribute, index2) {
+                       index1 *= this.itemSize;
+                       index2 *= attribute.itemSize;
+
+                       for (let i = 0, l = this.itemSize; i < l; i++) {
+                               this.array[index1 + i] = attribute.array[index2 + i];
+                       }
+
+                       return this;
+               }
+
+               copyArray(array) {
+                       this.array.set(array);
+                       return this;
+               }
+
+               copyColorsArray(colors) {
+                       const array = this.array;
+                       let offset = 0;
+
+                       for (let i = 0, l = colors.length; i < l; i++) {
+                               let color = colors[i];
+
+                               if (color === undefined) {
+                                       console.warn('THREE.BufferAttribute.copyColorsArray(): color is undefined', i);
+                                       color = new Color();
+                               }
+
+                               array[offset++] = color.r;
+                               array[offset++] = color.g;
+                               array[offset++] = color.b;
+                       }
+
+                       return this;
+               }
+
+               copyVector2sArray(vectors) {
+                       const array = this.array;
+                       let offset = 0;
+
+                       for (let i = 0, l = vectors.length; i < l; i++) {
+                               let vector = vectors[i];
+
+                               if (vector === undefined) {
+                                       console.warn('THREE.BufferAttribute.copyVector2sArray(): vector is undefined', i);
+                                       vector = new Vector2();
+                               }
+
+                               array[offset++] = vector.x;
+                               array[offset++] = vector.y;
+                       }
+
+                       return this;
+               }
+
+               copyVector3sArray(vectors) {
+                       const array = this.array;
+                       let offset = 0;
+
+                       for (let i = 0, l = vectors.length; i < l; i++) {
+                               let vector = vectors[i];
+
+                               if (vector === undefined) {
+                                       console.warn('THREE.BufferAttribute.copyVector3sArray(): vector is undefined', i);
+                                       vector = new Vector3();
+                               }
+
+                               array[offset++] = vector.x;
+                               array[offset++] = vector.y;
+                               array[offset++] = vector.z;
+                       }
+
+                       return this;
+               }
+
+               copyVector4sArray(vectors) {
+                       const array = this.array;
+                       let offset = 0;
+
+                       for (let i = 0, l = vectors.length; i < l; i++) {
+                               let vector = vectors[i];
+
+                               if (vector === undefined) {
+                                       console.warn('THREE.BufferAttribute.copyVector4sArray(): vector is undefined', i);
+                                       vector = new Vector4();
+                               }
+
+                               array[offset++] = vector.x;
+                               array[offset++] = vector.y;
+                               array[offset++] = vector.z;
+                               array[offset++] = vector.w;
+                       }
+
+                       return this;
+               }
+
+               applyMatrix3(m) {
+                       if (this.itemSize === 2) {
+                               for (let i = 0, l = this.count; i < l; i++) {
+                                       _vector2$1.fromBufferAttribute(this, i);
+
+                                       _vector2$1.applyMatrix3(m);
+
+                                       this.setXY(i, _vector2$1.x, _vector2$1.y);
+                               }
+                       } else if (this.itemSize === 3) {
+                               for (let i = 0, l = this.count; i < l; i++) {
+                                       _vector$9.fromBufferAttribute(this, i);
+
+                                       _vector$9.applyMatrix3(m);
+
+                                       this.setXYZ(i, _vector$9.x, _vector$9.y, _vector$9.z);
+                               }
+                       }
+
+                       return this;
+               }
+
+               applyMatrix4(m) {
+                       for (let i = 0, l = this.count; i < l; i++) {
+                               _vector$9.x = this.getX(i);
+                               _vector$9.y = this.getY(i);
+                               _vector$9.z = this.getZ(i);
+
+                               _vector$9.applyMatrix4(m);
+
+                               this.setXYZ(i, _vector$9.x, _vector$9.y, _vector$9.z);
+                       }
+
+                       return this;
+               }
+
+               applyNormalMatrix(m) {
+                       for (let i = 0, l = this.count; i < l; i++) {
+                               _vector$9.x = this.getX(i);
+                               _vector$9.y = this.getY(i);
+                               _vector$9.z = this.getZ(i);
+
+                               _vector$9.applyNormalMatrix(m);
+
+                               this.setXYZ(i, _vector$9.x, _vector$9.y, _vector$9.z);
+                       }
+
+                       return this;
+               }
+
+               transformDirection(m) {
+                       for (let i = 0, l = this.count; i < l; i++) {
+                               _vector$9.x = this.getX(i);
+                               _vector$9.y = this.getY(i);
+                               _vector$9.z = this.getZ(i);
+
+                               _vector$9.transformDirection(m);
+
+                               this.setXYZ(i, _vector$9.x, _vector$9.y, _vector$9.z);
+                       }
+
+                       return this;
+               }
+
+               set(value, offset = 0) {
+                       this.array.set(value, offset);
+                       return this;
+               }
+
+               getX(index) {
+                       return this.array[index * this.itemSize];
+               }
+
+               setX(index, x) {
+                       this.array[index * this.itemSize] = x;
+                       return this;
+               }
+
+               getY(index) {
+                       return this.array[index * this.itemSize + 1];
+               }
+
+               setY(index, y) {
+                       this.array[index * this.itemSize + 1] = y;
+                       return this;
+               }
+
+               getZ(index) {
+                       return this.array[index * this.itemSize + 2];
+               }
+
+               setZ(index, z) {
+                       this.array[index * this.itemSize + 2] = z;
+                       return this;
+               }
+
+               getW(index) {
+                       return this.array[index * this.itemSize + 3];
+               }
+
+               setW(index, w) {
+                       this.array[index * this.itemSize + 3] = w;
+                       return this;
+               }
+
+               setXY(index, x, y) {
+                       index *= this.itemSize;
+                       this.array[index + 0] = x;
+                       this.array[index + 1] = y;
+                       return this;
+               }
+
+               setXYZ(index, x, y, z) {
+                       index *= this.itemSize;
+                       this.array[index + 0] = x;
+                       this.array[index + 1] = y;
+                       this.array[index + 2] = z;
+                       return this;
+               }
+
+               setXYZW(index, x, y, z, w) {
+                       index *= this.itemSize;
+                       this.array[index + 0] = x;
+                       this.array[index + 1] = y;
+                       this.array[index + 2] = z;
+                       this.array[index + 3] = w;
+                       return this;
+               }
+
+               onUpload(callback) {
+                       this.onUploadCallback = callback;
+                       return this;
+               }
+
+               clone() {
+                       return new this.constructor(this.array, this.itemSize).copy(this);
+               }
+
+               toJSON() {
+                       const data = {
+                               itemSize: this.itemSize,
+                               type: this.array.constructor.name,
+                               array: Array.prototype.slice.call(this.array),
+                               normalized: this.normalized
+                       };
+                       if (this.name !== '') data.name = this.name;
+                       if (this.usage !== StaticDrawUsage) data.usage = this.usage;
+                       if (this.updateRange.offset !== 0 || this.updateRange.count !== -1) data.updateRange = this.updateRange;
+                       return data;
+               }
+
+       }
+
+       BufferAttribute.prototype.isBufferAttribute = true; //
+
+       class Int8BufferAttribute extends BufferAttribute {
+               constructor(array, itemSize, normalized) {
+                       super(new Int8Array(array), itemSize, normalized);
+               }
+
+       }
+
+       class Uint8BufferAttribute extends BufferAttribute {
+               constructor(array, itemSize, normalized) {
+                       super(new Uint8Array(array), itemSize, normalized);
+               }
+
+       }
+
+       class Uint8ClampedBufferAttribute extends BufferAttribute {
+               constructor(array, itemSize, normalized) {
+                       super(new Uint8ClampedArray(array), itemSize, normalized);
+               }
+
+       }
+
+       class Int16BufferAttribute extends BufferAttribute {
+               constructor(array, itemSize, normalized) {
+                       super(new Int16Array(array), itemSize, normalized);
+               }
+
+       }
+
+       class Uint16BufferAttribute extends BufferAttribute {
+               constructor(array, itemSize, normalized) {
+                       super(new Uint16Array(array), itemSize, normalized);
+               }
+
+       }
+
+       class Int32BufferAttribute extends BufferAttribute {
+               constructor(array, itemSize, normalized) {
+                       super(new Int32Array(array), itemSize, normalized);
+               }
+
+       }
+
+       class Uint32BufferAttribute extends BufferAttribute {
+               constructor(array, itemSize, normalized) {
+                       super(new Uint32Array(array), itemSize, normalized);
+               }
+
+       }
+
+       class Float16BufferAttribute extends BufferAttribute {
+               constructor(array, itemSize, normalized) {
+                       super(new Uint16Array(array), itemSize, normalized);
+               }
+
+       }
+
+       Float16BufferAttribute.prototype.isFloat16BufferAttribute = true;
+
+       class Float32BufferAttribute extends BufferAttribute {
+               constructor(array, itemSize, normalized) {
+                       super(new Float32Array(array), itemSize, normalized);
+               }
+
+       }
+
+       class Float64BufferAttribute extends BufferAttribute {
+               constructor(array, itemSize, normalized) {
+                       super(new Float64Array(array), itemSize, normalized);
+               }
+
+       } //
+
+       function arrayMax(array) {
+               if (array.length === 0) return -Infinity;
+               let max = array[0];
+
+               for (let i = 1, l = array.length; i < l; ++i) {
+                       if (array[i] > max) max = array[i];
+               }
+
+               return max;
+       }
+
+       const TYPED_ARRAYS = {
+               Int8Array: Int8Array,
+               Uint8Array: Uint8Array,
+               Uint8ClampedArray: Uint8ClampedArray,
+               Int16Array: Int16Array,
+               Uint16Array: Uint16Array,
+               Int32Array: Int32Array,
+               Uint32Array: Uint32Array,
+               Float32Array: Float32Array,
+               Float64Array: Float64Array
+       };
+
+       function getTypedArray(type, buffer) {
+               return new TYPED_ARRAYS[type](buffer);
+       }
+
+       let _id = 0;
+
+       const _m1 = /*@__PURE__*/new Matrix4();
+
+       const _obj = /*@__PURE__*/new Object3D();
+
+       const _offset = /*@__PURE__*/new Vector3();
+
+       const _box$1 = /*@__PURE__*/new Box3();
+
+       const _boxMorphTargets = /*@__PURE__*/new Box3();
+
+       const _vector$8 = /*@__PURE__*/new Vector3();
+
+       class BufferGeometry extends EventDispatcher {
+               constructor() {
+                       super();
+                       Object.defineProperty(this, 'id', {
+                               value: _id++
+                       });
+                       this.uuid = generateUUID();
+                       this.name = '';
+                       this.type = 'BufferGeometry';
+                       this.index = null;
+                       this.attributes = {};
+                       this.morphAttributes = {};
+                       this.morphTargetsRelative = false;
+                       this.groups = [];
+                       this.boundingBox = null;
+                       this.boundingSphere = null;
+                       this.drawRange = {
+                               start: 0,
+                               count: Infinity
+                       };
+                       this.userData = {};
+               }
+
+               getIndex() {
+                       return this.index;
+               }
+
+               setIndex(index) {
+                       if (Array.isArray(index)) {
+                               this.index = new (arrayMax(index) > 65535 ? Uint32BufferAttribute : Uint16BufferAttribute)(index, 1);
+                       } else {
+                               this.index = index;
+                       }
+
+                       return this;
+               }
+
+               getAttribute(name) {
+                       return this.attributes[name];
+               }
+
+               setAttribute(name, attribute) {
+                       this.attributes[name] = attribute;
+                       return this;
+               }
+
+               deleteAttribute(name) {
+                       delete this.attributes[name];
+                       return this;
+               }
+
+               hasAttribute(name) {
+                       return this.attributes[name] !== undefined;
+               }
+
+               addGroup(start, count, materialIndex = 0) {
+                       this.groups.push({
+                               start: start,
+                               count: count,
+                               materialIndex: materialIndex
+                       });
+               }
+
+               clearGroups() {
+                       this.groups = [];
+               }
+
+               setDrawRange(start, count) {
+                       this.drawRange.start = start;
+                       this.drawRange.count = count;
+               }
+
+               applyMatrix4(matrix) {
+                       const position = this.attributes.position;
+
+                       if (position !== undefined) {
+                               position.applyMatrix4(matrix);
+                               position.needsUpdate = true;
+                       }
+
+                       const normal = this.attributes.normal;
+
+                       if (normal !== undefined) {
+                               const normalMatrix = new Matrix3().getNormalMatrix(matrix);
+                               normal.applyNormalMatrix(normalMatrix);
+                               normal.needsUpdate = true;
+                       }
+
+                       const tangent = this.attributes.tangent;
+
+                       if (tangent !== undefined) {
+                               tangent.transformDirection(matrix);
+                               tangent.needsUpdate = true;
+                       }
+
+                       if (this.boundingBox !== null) {
+                               this.computeBoundingBox();
+                       }
+
+                       if (this.boundingSphere !== null) {
+                               this.computeBoundingSphere();
+                       }
+
+                       return this;
+               }
+
+               applyQuaternion(q) {
+                       _m1.makeRotationFromQuaternion(q);
+
+                       this.applyMatrix4(_m1);
+                       return this;
+               }
+
+               rotateX(angle) {
+                       // rotate geometry around world x-axis
+                       _m1.makeRotationX(angle);
+
+                       this.applyMatrix4(_m1);
+                       return this;
+               }
+
+               rotateY(angle) {
+                       // rotate geometry around world y-axis
+                       _m1.makeRotationY(angle);
+
+                       this.applyMatrix4(_m1);
+                       return this;
+               }
+
+               rotateZ(angle) {
+                       // rotate geometry around world z-axis
+                       _m1.makeRotationZ(angle);
+
+                       this.applyMatrix4(_m1);
+                       return this;
+               }
+
+               translate(x, y, z) {
+                       // translate geometry
+                       _m1.makeTranslation(x, y, z);
+
+                       this.applyMatrix4(_m1);
+                       return this;
+               }
+
+               scale(x, y, z) {
+                       // scale geometry
+                       _m1.makeScale(x, y, z);
+
+                       this.applyMatrix4(_m1);
+                       return this;
+               }
+
+               lookAt(vector) {
+                       _obj.lookAt(vector);
+
+                       _obj.updateMatrix();
+
+                       this.applyMatrix4(_obj.matrix);
+                       return this;
+               }
+
+               center() {
+                       this.computeBoundingBox();
+                       this.boundingBox.getCenter(_offset).negate();
+                       this.translate(_offset.x, _offset.y, _offset.z);
+                       return this;
+               }
+
+               setFromPoints(points) {
+                       const position = [];
+
+                       for (let i = 0, l = points.length; i < l; i++) {
+                               const point = points[i];
+                               position.push(point.x, point.y, point.z || 0);
+                       }
+
+                       this.setAttribute('position', new Float32BufferAttribute(position, 3));
+                       return this;
+               }
+
+               computeBoundingBox() {
+                       if (this.boundingBox === null) {
+                               this.boundingBox = new Box3();
+                       }
+
+                       const position = this.attributes.position;
+                       const morphAttributesPosition = this.morphAttributes.position;
+
+                       if (position && position.isGLBufferAttribute) {
+                               console.error('THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box. Alternatively set "mesh.frustumCulled" to "false".', this);
+                               this.boundingBox.set(new Vector3(-Infinity, -Infinity, -Infinity), new Vector3(+Infinity, +Infinity, +Infinity));
+                               return;
+                       }
+
+                       if (position !== undefined) {
+                               this.boundingBox.setFromBufferAttribute(position); // process morph attributes if present
+
+                               if (morphAttributesPosition) {
+                                       for (let i = 0, il = morphAttributesPosition.length; i < il; i++) {
+                                               const morphAttribute = morphAttributesPosition[i];
+
+                                               _box$1.setFromBufferAttribute(morphAttribute);
+
+                                               if (this.morphTargetsRelative) {
+                                                       _vector$8.addVectors(this.boundingBox.min, _box$1.min);
+
+                                                       this.boundingBox.expandByPoint(_vector$8);
+
+                                                       _vector$8.addVectors(this.boundingBox.max, _box$1.max);
+
+                                                       this.boundingBox.expandByPoint(_vector$8);
+                                               } else {
+                                                       this.boundingBox.expandByPoint(_box$1.min);
+                                                       this.boundingBox.expandByPoint(_box$1.max);
+                                               }
+                                       }
+                               }
+                       } else {
+                               this.boundingBox.makeEmpty();
+                       }
+
+                       if (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() {
+                       if (this.boundingSphere === null) {
+                               this.boundingSphere = new Sphere();
+                       }
+
+                       const position = this.attributes.position;
+                       const morphAttributesPosition = this.morphAttributes.position;
+
+                       if (position && position.isGLBufferAttribute) {
+                               console.error('THREE.BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere. Alternatively set "mesh.frustumCulled" to "false".', this);
+                               this.boundingSphere.set(new Vector3(), Infinity);
+                               return;
+                       }
+
+                       if (position) {
+                               // first, find the center of the bounding sphere
+                               const center = this.boundingSphere.center;
+
+                               _box$1.setFromBufferAttribute(position); // process morph attributes if present
+
+
+                               if (morphAttributesPosition) {
+                                       for (let i = 0, il = morphAttributesPosition.length; i < il; i++) {
+                                               const morphAttribute = morphAttributesPosition[i];
+
+                                               _boxMorphTargets.setFromBufferAttribute(morphAttribute);
+
+                                               if (this.morphTargetsRelative) {
+                                                       _vector$8.addVectors(_box$1.min, _boxMorphTargets.min);
+
+                                                       _box$1.expandByPoint(_vector$8);
+
+                                                       _vector$8.addVectors(_box$1.max, _boxMorphTargets.max);
+
+                                                       _box$1.expandByPoint(_vector$8);
+                                               } else {
+                                                       _box$1.expandByPoint(_boxMorphTargets.min);
+
+                                                       _box$1.expandByPoint(_boxMorphTargets.max);
+                                               }
+                                       }
+                               }
+
+                               _box$1.getCenter(center); // second, try to find a boundingSphere with a radius smaller than the
+                               // boundingSphere of the boundingBox: sqrt(3) smaller in the best case
+
+
+                               let maxRadiusSq = 0;
+
+                               for (let i = 0, il = position.count; i < il; i++) {
+                                       _vector$8.fromBufferAttribute(position, i);
+
+                                       maxRadiusSq = Math.max(maxRadiusSq, center.distanceToSquared(_vector$8));
+                               } // process morph attributes if present
+
+
+                               if (morphAttributesPosition) {
+                                       for (let i = 0, il = morphAttributesPosition.length; i < il; i++) {
+                                               const morphAttribute = morphAttributesPosition[i];
+                                               const morphTargetsRelative = this.morphTargetsRelative;
+
+                                               for (let j = 0, jl = morphAttribute.count; j < jl; j++) {
+                                                       _vector$8.fromBufferAttribute(morphAttribute, j);
+
+                                                       if (morphTargetsRelative) {
+                                                               _offset.fromBufferAttribute(position, j);
+
+                                                               _vector$8.add(_offset);
+                                                       }
+
+                                                       maxRadiusSq = Math.max(maxRadiusSq, center.distanceToSquared(_vector$8));
+                                               }
+                                       }
+                               }
+
+                               this.boundingSphere.radius = Math.sqrt(maxRadiusSq);
+
+                               if (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 index = this.index;
+                       const attributes = this.attributes; // based on http://www.terathon.com/code/tangent.html
+                       // (per vertex tangents)
+
+                       if (index === null || attributes.position === undefined || attributes.normal === undefined || attributes.uv === undefined) {
+                               console.error('THREE.BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)');
+                               return;
+                       }
+
+                       const indices = index.array;
+                       const positions = attributes.position.array;
+                       const normals = attributes.normal.array;
+                       const uvs = attributes.uv.array;
+                       const nVertices = positions.length / 3;
+
+                       if (attributes.tangent === undefined) {
+                               this.setAttribute('tangent', new BufferAttribute(new Float32Array(4 * nVertices), 4));
+                       }
+
+                       const tangents = attributes.tangent.array;
+                       const tan1 = [],
+                                               tan2 = [];
+
+                       for (let i = 0; i < nVertices; i++) {
+                               tan1[i] = new Vector3();
+                               tan2[i] = new Vector3();
+                       }
+
+                       const vA = new Vector3(),
+                                               vB = new Vector3(),
+                                               vC = new Vector3(),
+                                               uvA = new Vector2(),
+                                               uvB = new Vector2(),
+                                               uvC = new Vector2(),
+                                               sdir = new Vector3(),
+                                               tdir = new Vector3();
+
+                       function handleTriangle(a, b, c) {
+                               vA.fromArray(positions, a * 3);
+                               vB.fromArray(positions, b * 3);
+                               vC.fromArray(positions, c * 3);
+                               uvA.fromArray(uvs, a * 2);
+                               uvB.fromArray(uvs, b * 2);
+                               uvC.fromArray(uvs, c * 2);
+                               vB.sub(vA);
+                               vC.sub(vA);
+                               uvB.sub(uvA);
+                               uvC.sub(uvA);
+                               const r = 1.0 / (uvB.x * uvC.y - uvC.x * uvB.y); // silently ignore degenerate uv triangles having coincident or colinear vertices
+
+                               if (!isFinite(r)) return;
+                               sdir.copy(vB).multiplyScalar(uvC.y).addScaledVector(vC, -uvB.y).multiplyScalar(r);
+                               tdir.copy(vC).multiplyScalar(uvB.x).addScaledVector(vB, -uvC.x).multiplyScalar(r);
+                               tan1[a].add(sdir);
+                               tan1[b].add(sdir);
+                               tan1[c].add(sdir);
+                               tan2[a].add(tdir);
+                               tan2[b].add(tdir);
+                               tan2[c].add(tdir);
+                       }
+
+                       let groups = this.groups;
+
+                       if (groups.length === 0) {
+                               groups = [{
+                                       start: 0,
+                                       count: indices.length
+                               }];
+                       }
+
+                       for (let i = 0, il = groups.length; i < il; ++i) {
+                               const group = groups[i];
+                               const start = group.start;
+                               const count = group.count;
+
+                               for (let j = start, jl = start + count; j < jl; j += 3) {
+                                       handleTriangle(indices[j + 0], indices[j + 1], indices[j + 2]);
+                               }
+                       }
+
+                       const tmp = new Vector3(),
+                                               tmp2 = new Vector3();
+                       const n = new Vector3(),
+                                               n2 = new Vector3();
+
+                       function handleVertex(v) {
+                               n.fromArray(normals, v * 3);
+                               n2.copy(n);
+                               const t = tan1[v]; // Gram-Schmidt orthogonalize
+
+                               tmp.copy(t);
+                               tmp.sub(n.multiplyScalar(n.dot(t))).normalize(); // Calculate handedness
+
+                               tmp2.crossVectors(n2, t);
+                               const test = tmp2.dot(tan2[v]);
+                               const w = test < 0.0 ? -1.0 : 1.0;
+                               tangents[v * 4] = tmp.x;
+                               tangents[v * 4 + 1] = tmp.y;
+                               tangents[v * 4 + 2] = tmp.z;
+                               tangents[v * 4 + 3] = w;
+                       }
+
+                       for (let i = 0, il = groups.length; i < il; ++i) {
+                               const group = groups[i];
+                               const start = group.start;
+                               const count = group.count;
+
+                               for (let j = start, jl = start + count; j < jl; j += 3) {
+                                       handleVertex(indices[j + 0]);
+                                       handleVertex(indices[j + 1]);
+                                       handleVertex(indices[j + 2]);
+                               }
+                       }
+               }
+
+               computeVertexNormals() {
+                       const index = this.index;
+                       const positionAttribute = this.getAttribute('position');
+
+                       if (positionAttribute !== undefined) {
+                               let normalAttribute = this.getAttribute('normal');
+
+                               if (normalAttribute === undefined) {
+                                       normalAttribute = new BufferAttribute(new Float32Array(positionAttribute.count * 3), 3);
+                                       this.setAttribute('normal', normalAttribute);
+                               } else {
+                                       // reset existing normals to zero
+                                       for (let i = 0, il = normalAttribute.count; i < il; i++) {
+                                               normalAttribute.setXYZ(i, 0, 0, 0);
+                                       }
+                               }
+
+                               const pA = new Vector3(),
+                                                       pB = new Vector3(),
+                                                       pC = new Vector3();
+                               const nA = new Vector3(),
+                                                       nB = new Vector3(),
+                                                       nC = new Vector3();
+                               const cb = new Vector3(),
+                                                       ab = new Vector3(); // indexed elements
+
+                               if (index) {
+                                       for (let i = 0, il = index.count; i < il; i += 3) {
+                                               const vA = index.getX(i + 0);
+                                               const vB = index.getX(i + 1);
+                                               const vC = index.getX(i + 2);
+                                               pA.fromBufferAttribute(positionAttribute, vA);
+                                               pB.fromBufferAttribute(positionAttribute, vB);
+                                               pC.fromBufferAttribute(positionAttribute, vC);
+                                               cb.subVectors(pC, pB);
+                                               ab.subVectors(pA, pB);
+                                               cb.cross(ab);
+                                               nA.fromBufferAttribute(normalAttribute, vA);
+                                               nB.fromBufferAttribute(normalAttribute, vB);
+                                               nC.fromBufferAttribute(normalAttribute, vC);
+                                               nA.add(cb);
+                                               nB.add(cb);
+                                               nC.add(cb);
+                                               normalAttribute.setXYZ(vA, nA.x, nA.y, nA.z);
+                                               normalAttribute.setXYZ(vB, nB.x, nB.y, nB.z);
+                                               normalAttribute.setXYZ(vC, nC.x, nC.y, nC.z);
+                                       }
+                               } else {
+                                       // non-indexed elements (unconnected triangle soup)
+                                       for (let i = 0, il = positionAttribute.count; i < il; i += 3) {
+                                               pA.fromBufferAttribute(positionAttribute, i + 0);
+                                               pB.fromBufferAttribute(positionAttribute, i + 1);
+                                               pC.fromBufferAttribute(positionAttribute, i + 2);
+                                               cb.subVectors(pC, pB);
+                                               ab.subVectors(pA, pB);
+                                               cb.cross(ab);
+                                               normalAttribute.setXYZ(i + 0, cb.x, cb.y, cb.z);
+                                               normalAttribute.setXYZ(i + 1, cb.x, cb.y, cb.z);
+                                               normalAttribute.setXYZ(i + 2, cb.x, cb.y, cb.z);
+                                       }
+                               }
+
+                               this.normalizeNormals();
+                               normalAttribute.needsUpdate = true;
+                       }
+               }
+
+               merge(geometry, offset) {
+                       if (!(geometry && geometry.isBufferGeometry)) {
+                               console.error('THREE.BufferGeometry.merge(): geometry not an instance of THREE.BufferGeometry.', geometry);
+                               return;
+                       }
+
+                       if (offset === undefined) {
+                               offset = 0;
+                               console.warn('THREE.BufferGeometry.merge(): Overwriting original geometry, starting at offset=0. ' + 'Use BufferGeometryUtils.mergeBufferGeometries() for lossless merge.');
+                       }
+
+                       const attributes = this.attributes;
+
+                       for (const key in attributes) {
+                               if (geometry.attributes[key] === undefined) continue;
+                               const attribute1 = attributes[key];
+                               const attributeArray1 = attribute1.array;
+                               const attribute2 = geometry.attributes[key];
+                               const attributeArray2 = attribute2.array;
+                               const attributeOffset = attribute2.itemSize * offset;
+                               const length = Math.min(attributeArray2.length, attributeArray1.length - attributeOffset);
+
+                               for (let i = 0, j = attributeOffset; i < length; i++, j++) {
+                                       attributeArray1[j] = attributeArray2[i];
+                               }
+                       }
+
+                       return this;
+               }
+
+               normalizeNormals() {
+                       const normals = this.attributes.normal;
+
+                       for (let i = 0, il = normals.count; i < il; i++) {
+                               _vector$8.fromBufferAttribute(normals, i);
+
+                               _vector$8.normalize();
+
+                               normals.setXYZ(i, _vector$8.x, _vector$8.y, _vector$8.z);
+                       }
+               }
+
+               toNonIndexed() {
+                       function convertBufferAttribute(attribute, indices) {
+                               const array = attribute.array;
+                               const itemSize = attribute.itemSize;
+                               const normalized = attribute.normalized;
+                               const array2 = new array.constructor(indices.length * itemSize);
+                               let index = 0,
+                                               index2 = 0;
+
+                               for (let i = 0, l = indices.length; i < l; i++) {
+                                       if (attribute.isInterleavedBufferAttribute) {
+                                               index = indices[i] * attribute.data.stride + attribute.offset;
+                                       } else {
+                                               index = indices[i] * itemSize;
+                                       }
+
+                                       for (let j = 0; j < itemSize; j++) {
+                                               array2[index2++] = array[index++];
+                                       }
+                               }
+
+                               return new BufferAttribute(array2, itemSize, normalized);
+                       } //
+
+
+                       if (this.index === null) {
+                               console.warn('THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed.');
+                               return this;
+                       }
+
+                       const geometry2 = new BufferGeometry();
+                       const indices = this.index.array;
+                       const attributes = this.attributes; // attributes
+
+                       for (const name in attributes) {
+                               const attribute = attributes[name];
+                               const newAttribute = convertBufferAttribute(attribute, indices);
+                               geometry2.setAttribute(name, newAttribute);
+                       } // morph attributes
+
+
+                       const morphAttributes = this.morphAttributes;
+
+                       for (const name in morphAttributes) {
+                               const morphArray = [];
+                               const morphAttribute = morphAttributes[name]; // morphAttribute: array of Float32BufferAttributes
+
+                               for (let i = 0, il = morphAttribute.length; i < il; i++) {
+                                       const attribute = morphAttribute[i];
+                                       const newAttribute = convertBufferAttribute(attribute, indices);
+                                       morphArray.push(newAttribute);
+                               }
+
+                               geometry2.morphAttributes[name] = morphArray;
+                       }
+
+                       geometry2.morphTargetsRelative = this.morphTargetsRelative; // groups
+
+                       const groups = this.groups;
+
+                       for (let i = 0, l = groups.length; i < l; i++) {
+                               const group = groups[i];
+                               geometry2.addGroup(group.start, group.count, group.materialIndex);
+                       }
+
+                       return geometry2;
+               }
+
+               toJSON() {
+                       const data = {
+                               metadata: {
+                                       version: 4.5,
+                                       type: 'BufferGeometry',
+                                       generator: 'BufferGeometry.toJSON'
+                               }
+                       }; // standard BufferGeometry serialization
+
+                       data.uuid = this.uuid;
+                       data.type = this.type;
+                       if (this.name !== '') data.name = this.name;
+                       if (Object.keys(this.userData).length > 0) data.userData = this.userData;
+
+                       if (this.parameters !== undefined) {
+                               const parameters = this.parameters;
+
+                               for (const key in parameters) {
+                                       if (parameters[key] !== undefined) data[key] = parameters[key];
+                               }
+
+                               return data;
+                       } // for simplicity the code assumes attributes are not shared across geometries, see #15811
+
+
+                       data.data = {
+                               attributes: {}
+                       };
+                       const index = this.index;
+
+                       if (index !== null) {
+                               data.data.index = {
+                                       type: index.array.constructor.name,
+                                       array: Array.prototype.slice.call(index.array)
+                               };
+                       }
+
+                       const attributes = this.attributes;
+
+                       for (const key in attributes) {
+                               const attribute = attributes[key];
+                               data.data.attributes[key] = attribute.toJSON(data.data);
+                       }
+
+                       const morphAttributes = {};
+                       let hasMorphAttributes = false;
+
+                       for (const key in this.morphAttributes) {
+                               const attributeArray = this.morphAttributes[key];
+                               const array = [];
+
+                               for (let i = 0, il = attributeArray.length; i < il; i++) {
+                                       const attribute = attributeArray[i];
+                                       array.push(attribute.toJSON(data.data));
+                               }
+
+                               if (array.length > 0) {
+                                       morphAttributes[key] = array;
+                                       hasMorphAttributes = true;
+                               }
+                       }
+
+                       if (hasMorphAttributes) {
+                               data.data.morphAttributes = morphAttributes;
+                               data.data.morphTargetsRelative = this.morphTargetsRelative;
+                       }
+
+                       const groups = this.groups;
+
+                       if (groups.length > 0) {
+                               data.data.groups = JSON.parse(JSON.stringify(groups));
+                       }
+
+                       const boundingSphere = this.boundingSphere;
+
+                       if (boundingSphere !== null) {
+                               data.data.boundingSphere = {
+                                       center: boundingSphere.center.toArray(),
+                                       radius: boundingSphere.radius
+                               };
+                       }
+
+                       return data;
+               }
+
+               clone() {
+                       /*
+                        // Handle primitives
+                                const parameters = this.parameters;
+                                if ( parameters !== undefined ) {
+                                const values = [];
+                                for ( const key in parameters ) {
+                                values.push( parameters[ key ] );
+                                }
+                                const geometry = Object.create( this.constructor.prototype );
+                        this.constructor.apply( geometry, values );
+                        return geometry;
+                                }
+                                return new this.constructor().copy( this );
+                        */
+                       return new BufferGeometry().copy(this);
+               }
+
+               copy(source) {
+                       // reset
+                       this.index = null;
+                       this.attributes = {};
+                       this.morphAttributes = {};
+                       this.groups = [];
+                       this.boundingBox = null;
+                       this.boundingSphere = null; // used for storing cloned, shared data
+
+                       const data = {}; // name
+
+                       this.name = source.name; // index
+
+                       const index = source.index;
+
+                       if (index !== null) {
+                               this.setIndex(index.clone(data));
+                       } // attributes
+
+
+                       const attributes = source.attributes;
+
+                       for (const name in attributes) {
+                               const attribute = attributes[name];
+                               this.setAttribute(name, attribute.clone(data));
+                       } // morph attributes
+
+
+                       const morphAttributes = source.morphAttributes;
+
+                       for (const name in morphAttributes) {
+                               const array = [];
+                               const morphAttribute = morphAttributes[name]; // morphAttribute: array of Float32BufferAttributes
+
+                               for (let i = 0, l = morphAttribute.length; i < l; i++) {
+                                       array.push(morphAttribute[i].clone(data));
+                               }
+
+                               this.morphAttributes[name] = array;
+                       }
+
+                       this.morphTargetsRelative = source.morphTargetsRelative; // groups
+
+                       const groups = source.groups;
+
+                       for (let i = 0, l = groups.length; i < l; i++) {
+                               const group = groups[i];
+                               this.addGroup(group.start, group.count, group.materialIndex);
+                       } // bounding box
+
+
+                       const boundingBox = source.boundingBox;
+
+                       if (boundingBox !== null) {
+                               this.boundingBox = boundingBox.clone();
+                       } // bounding sphere
+
+
+                       const boundingSphere = source.boundingSphere;
+
+                       if (boundingSphere !== null) {
+                               this.boundingSphere = boundingSphere.clone();
+                       } // draw range
+
+
+                       this.drawRange.start = source.drawRange.start;
+                       this.drawRange.count = source.drawRange.count; // user data
+
+                       this.userData = source.userData;
+                       return this;
+               }
+
+               dispose() {
+                       this.dispatchEvent({
+                               type: 'dispose'
+                       });
+               }
+
+       }
+
+       BufferGeometry.prototype.isBufferGeometry = true;
+
+       const _inverseMatrix$2 = /*@__PURE__*/new Matrix4();
+
+       const _ray$2 = /*@__PURE__*/new Ray();
+
+       const _sphere$3 = /*@__PURE__*/new Sphere();
+
+       const _vA$1 = /*@__PURE__*/new Vector3();
+
+       const _vB$1 = /*@__PURE__*/new Vector3();
+
+       const _vC$1 = /*@__PURE__*/new Vector3();
+
+       const _tempA = /*@__PURE__*/new Vector3();
+
+       const _tempB = /*@__PURE__*/new Vector3();
+
+       const _tempC = /*@__PURE__*/new Vector3();
+
+       const _morphA = /*@__PURE__*/new Vector3();
+
+       const _morphB = /*@__PURE__*/new Vector3();
+
+       const _morphC = /*@__PURE__*/new Vector3();
+
+       const _uvA$1 = /*@__PURE__*/new Vector2();
+
+       const _uvB$1 = /*@__PURE__*/new Vector2();
+
+       const _uvC$1 = /*@__PURE__*/new Vector2();
+
+       const _intersectionPoint = /*@__PURE__*/new Vector3();
+
+       const _intersectionPointWorld = /*@__PURE__*/new Vector3();
+
+       class Mesh extends Object3D {
+               constructor(geometry = new BufferGeometry(), material = new MeshBasicMaterial()) {
+                       super();
+                       this.type = 'Mesh';
+                       this.geometry = geometry;
+                       this.material = material;
+                       this.updateMorphTargets();
+               }
+
+               copy(source) {
+                       super.copy(source);
+
+                       if (source.morphTargetInfluences !== undefined) {
+                               this.morphTargetInfluences = source.morphTargetInfluences.slice();
+                       }
+
+                       if (source.morphTargetDictionary !== undefined) {
+                               this.morphTargetDictionary = Object.assign({}, source.morphTargetDictionary);
+                       }
+
+                       this.material = source.material;
+                       this.geometry = source.geometry;
+                       return this;
+               }
+
+               updateMorphTargets() {
+                       const geometry = this.geometry;
+
+                       if (geometry.isBufferGeometry) {
+                               const morphAttributes = geometry.morphAttributes;
+                               const keys = Object.keys(morphAttributes);
+
+                               if (keys.length > 0) {
+                                       const morphAttribute = morphAttributes[keys[0]];
+
+                                       if (morphAttribute !== undefined) {
+                                               this.morphTargetInfluences = [];
+                                               this.morphTargetDictionary = {};
+
+                                               for (let m = 0, ml = morphAttribute.length; m < ml; m++) {
+                                                       const name = morphAttribute[m].name || String(m);
+                                                       this.morphTargetInfluences.push(0);
+                                                       this.morphTargetDictionary[name] = m;
+                                               }
+                                       }
+                               }
+                       } else {
+                               const morphTargets = geometry.morphTargets;
+
+                               if (morphTargets !== undefined && morphTargets.length > 0) {
+                                       console.error('THREE.Mesh.updateMorphTargets() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.');
+                               }
+                       }
+               }
+
+               raycast(raycaster, intersects) {
+                       const geometry = this.geometry;
+                       const material = this.material;
+                       const matrixWorld = this.matrixWorld;
+                       if (material === undefined) return; // Checking boundingSphere distance to ray
+
+                       if (geometry.boundingSphere === null) geometry.computeBoundingSphere();
+
+                       _sphere$3.copy(geometry.boundingSphere);
+
+                       _sphere$3.applyMatrix4(matrixWorld);
+
+                       if (raycaster.ray.intersectsSphere(_sphere$3) === false) return; //
+
+                       _inverseMatrix$2.copy(matrixWorld).invert();
+
+                       _ray$2.copy(raycaster.ray).applyMatrix4(_inverseMatrix$2); // Check boundingBox before continuing
+
+
+                       if (geometry.boundingBox !== null) {
+                               if (_ray$2.intersectsBox(geometry.boundingBox) === false) return;
+                       }
+
+                       let intersection;
+
+                       if (geometry.isBufferGeometry) {
+                               const index = geometry.index;
+                               const position = geometry.attributes.position;
+                               const morphPosition = geometry.morphAttributes.position;
+                               const morphTargetsRelative = geometry.morphTargetsRelative;
+                               const uv = geometry.attributes.uv;
+                               const uv2 = geometry.attributes.uv2;
+                               const groups = geometry.groups;
+                               const drawRange = geometry.drawRange;
+
+                               if (index !== null) {
+                                       // indexed buffer geometry
+                                       if (Array.isArray(material)) {
+                                               for (let i = 0, il = groups.length; i < il; i++) {
+                                                       const group = groups[i];
+                                                       const groupMaterial = material[group.materialIndex];
+                                                       const start = Math.max(group.start, drawRange.start);
+                                                       const end = Math.min(group.start + group.count, drawRange.start + drawRange.count);
+
+                                                       for (let j = start, jl = end; j < jl; j += 3) {
+                                                               const a = index.getX(j);
+                                                               const b = index.getX(j + 1);
+                                                               const c = index.getX(j + 2);
+                                                               intersection = checkBufferGeometryIntersection(this, groupMaterial, raycaster, _ray$2, position, morphPosition, morphTargetsRelative, uv, uv2, a, b, c);
+
+                                                               if (intersection) {
+                                                                       intersection.faceIndex = Math.floor(j / 3); // triangle number in indexed buffer semantics
+
+                                                                       intersection.face.materialIndex = group.materialIndex;
+                                                                       intersects.push(intersection);
+                                                               }
+                                                       }
+                                               }
+                                       } else {
+                                               const start = Math.max(0, drawRange.start);
+                                               const end = Math.min(index.count, drawRange.start + drawRange.count);
+
+                                               for (let i = start, il = end; i < il; i += 3) {
+                                                       const a = index.getX(i);
+                                                       const b = index.getX(i + 1);
+                                                       const c = index.getX(i + 2);
+                                                       intersection = checkBufferGeometryIntersection(this, material, raycaster, _ray$2, position, morphPosition, morphTargetsRelative, uv, uv2, a, b, c);
+
+                                                       if (intersection) {
+                                                               intersection.faceIndex = Math.floor(i / 3); // triangle number in indexed buffer semantics
+
+                                                               intersects.push(intersection);
+                                                       }
+                                               }
+                                       }
+                               } else if (position !== undefined) {
+                                       // non-indexed buffer geometry
+                                       if (Array.isArray(material)) {
+                                               for (let i = 0, il = groups.length; i < il; i++) {
+                                                       const group = groups[i];
+                                                       const groupMaterial = material[group.materialIndex];
+                                                       const start = Math.max(group.start, drawRange.start);
+                                                       const end = Math.min(group.start + group.count, drawRange.start + drawRange.count);
+
+                                                       for (let j = start, jl = end; j < jl; j += 3) {
+                                                               const a = j;
+                                                               const b = j + 1;
+                                                               const c = j + 2;
+                                                               intersection = checkBufferGeometryIntersection(this, groupMaterial, raycaster, _ray$2, position, morphPosition, morphTargetsRelative, uv, uv2, a, b, c);
+
+                                                               if (intersection) {
+                                                                       intersection.faceIndex = Math.floor(j / 3); // triangle number in non-indexed buffer semantics
+
+                                                                       intersection.face.materialIndex = group.materialIndex;
+                                                                       intersects.push(intersection);
+                                                               }
+                                                       }
+                                               }
+                                       } else {
+                                               const start = Math.max(0, drawRange.start);
+                                               const end = Math.min(position.count, drawRange.start + drawRange.count);
+
+                                               for (let i = start, il = end; i < il; i += 3) {
+                                                       const a = i;
+                                                       const b = i + 1;
+                                                       const c = i + 2;
+                                                       intersection = checkBufferGeometryIntersection(this, material, raycaster, _ray$2, position, morphPosition, morphTargetsRelative, uv, uv2, a, b, c);
+
+                                                       if (intersection) {
+                                                               intersection.faceIndex = Math.floor(i / 3); // triangle number in non-indexed buffer semantics
+
+                                                               intersects.push(intersection);
+                                                       }
+                                               }
+                                       }
+                               }
+                       } else if (geometry.isGeometry) {
+                               console.error('THREE.Mesh.raycast() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.');
+                       }
+               }
+
+       }
+
+       Mesh.prototype.isMesh = true;
+
+       function checkIntersection(object, material, raycaster, ray, pA, pB, pC, point) {
+               let intersect;
+
+               if (material.side === BackSide) {
+                       intersect = ray.intersectTriangle(pC, pB, pA, true, point);
+               } else {
+                       intersect = ray.intersectTriangle(pA, pB, pC, material.side !== DoubleSide, point);
+               }
+
+               if (intersect === null) return null;
+
+               _intersectionPointWorld.copy(point);
+
+               _intersectionPointWorld.applyMatrix4(object.matrixWorld);
+
+               const distance = raycaster.ray.origin.distanceTo(_intersectionPointWorld);
+               if (distance < raycaster.near || distance > raycaster.far) return null;
+               return {
+                       distance: distance,
+                       point: _intersectionPointWorld.clone(),
+                       object: object
+               };
+       }
+
+       function checkBufferGeometryIntersection(object, material, raycaster, ray, position, morphPosition, morphTargetsRelative, uv, uv2, a, b, c) {
+               _vA$1.fromBufferAttribute(position, a);
+
+               _vB$1.fromBufferAttribute(position, b);
+
+               _vC$1.fromBufferAttribute(position, c);
+
+               const morphInfluences = object.morphTargetInfluences;
+
+               if (morphPosition && morphInfluences) {
+                       _morphA.set(0, 0, 0);
+
+                       _morphB.set(0, 0, 0);
+
+                       _morphC.set(0, 0, 0);
+
+                       for (let i = 0, il = morphPosition.length; i < il; i++) {
+                               const influence = morphInfluences[i];
+                               const morphAttribute = morphPosition[i];
+                               if (influence === 0) continue;
+
+                               _tempA.fromBufferAttribute(morphAttribute, a);
+
+                               _tempB.fromBufferAttribute(morphAttribute, b);
+
+                               _tempC.fromBufferAttribute(morphAttribute, c);
+
+                               if (morphTargetsRelative) {
+                                       _morphA.addScaledVector(_tempA, influence);
+
+                                       _morphB.addScaledVector(_tempB, influence);
+
+                                       _morphC.addScaledVector(_tempC, influence);
+                               } else {
+                                       _morphA.addScaledVector(_tempA.sub(_vA$1), influence);
+
+                                       _morphB.addScaledVector(_tempB.sub(_vB$1), influence);
+
+                                       _morphC.addScaledVector(_tempC.sub(_vC$1), influence);
+                               }
+                       }
+
+                       _vA$1.add(_morphA);
+
+                       _vB$1.add(_morphB);
+
+                       _vC$1.add(_morphC);
+               }
+
+               if (object.isSkinnedMesh) {
+                       object.boneTransform(a, _vA$1);
+                       object.boneTransform(b, _vB$1);
+                       object.boneTransform(c, _vC$1);
+               }
+
+               const intersection = checkIntersection(object, material, raycaster, ray, _vA$1, _vB$1, _vC$1, _intersectionPoint);
+
+               if (intersection) {
+                       if (uv) {
+                               _uvA$1.fromBufferAttribute(uv, a);
+
+                               _uvB$1.fromBufferAttribute(uv, b);
+
+                               _uvC$1.fromBufferAttribute(uv, c);
+
+                               intersection.uv = Triangle.getUV(_intersectionPoint, _vA$1, _vB$1, _vC$1, _uvA$1, _uvB$1, _uvC$1, new Vector2());
+                       }
+
+                       if (uv2) {
+                               _uvA$1.fromBufferAttribute(uv2, a);
+
+                               _uvB$1.fromBufferAttribute(uv2, b);
+
+                               _uvC$1.fromBufferAttribute(uv2, c);
+
+                               intersection.uv2 = Triangle.getUV(_intersectionPoint, _vA$1, _vB$1, _vC$1, _uvA$1, _uvB$1, _uvC$1, new Vector2());
+                       }
+
+                       const face = {
+                               a: a,
+                               b: b,
+                               c: c,
+                               normal: new Vector3(),
+                               materialIndex: 0
+                       };
+                       Triangle.getNormal(_vA$1, _vB$1, _vC$1, face.normal);
+                       intersection.face = face;
+               }
+
+               return intersection;
+       }
+
+       class BoxGeometry extends BufferGeometry {
+               constructor(width = 1, height = 1, depth = 1, widthSegments = 1, heightSegments = 1, depthSegments = 1) {
+                       super();
+                       this.type = 'BoxGeometry';
+                       this.parameters = {
+                               width: width,
+                               height: height,
+                               depth: depth,
+                               widthSegments: widthSegments,
+                               heightSegments: heightSegments,
+                               depthSegments: depthSegments
+                       };
+                       const scope = this; // segments
+
+                       widthSegments = Math.floor(widthSegments);
+                       heightSegments = Math.floor(heightSegments);
+                       depthSegments = Math.floor(depthSegments); // buffers
+
+                       const indices = [];
+                       const vertices = [];
+                       const normals = [];
+                       const uvs = []; // helper variables
+
+                       let numberOfVertices = 0;
+                       let groupStart = 0; // build each side of the box geometry
+
+                       buildPlane('z', 'y', 'x', -1, -1, depth, height, width, depthSegments, heightSegments, 0); // px
+
+                       buildPlane('z', 'y', 'x', 1, -1, depth, height, -width, depthSegments, heightSegments, 1); // nx
+
+                       buildPlane('x', 'z', 'y', 1, 1, width, depth, height, widthSegments, depthSegments, 2); // py
+
+                       buildPlane('x', 'z', 'y', 1, -1, width, depth, -height, widthSegments, depthSegments, 3); // ny
+
+                       buildPlane('x', 'y', 'z', 1, -1, width, height, depth, widthSegments, heightSegments, 4); // pz
+
+                       buildPlane('x', 'y', 'z', -1, -1, width, height, -depth, widthSegments, heightSegments, 5); // nz
+                       // build geometry
+
+                       this.setIndex(indices);
+                       this.setAttribute('position', new Float32BufferAttribute(vertices, 3));
+                       this.setAttribute('normal', new Float32BufferAttribute(normals, 3));
+                       this.setAttribute('uv', new Float32BufferAttribute(uvs, 2));
+
+                       function buildPlane(u, v, w, udir, vdir, width, height, depth, gridX, gridY, materialIndex) {
+                               const segmentWidth = width / gridX;
+                               const segmentHeight = height / gridY;
+                               const widthHalf = width / 2;
+                               const heightHalf = height / 2;
+                               const depthHalf = depth / 2;
+                               const gridX1 = gridX + 1;
+                               const gridY1 = gridY + 1;
+                               let vertexCounter = 0;
+                               let groupCount = 0;
+                               const vector = new Vector3(); // generate vertices, normals and uvs
+
+                               for (let iy = 0; iy < gridY1; iy++) {
+                                       const y = iy * segmentHeight - heightHalf;
+
+                                       for (let ix = 0; ix < gridX1; ix++) {
+                                               const x = ix * segmentWidth - widthHalf; // set values to correct vector component
+
+                                               vector[u] = x * udir;
+                                               vector[v] = y * vdir;
+                                               vector[w] = depthHalf; // now apply vector to vertex buffer
+
+                                               vertices.push(vector.x, vector.y, vector.z); // set values to correct vector component
+
+                                               vector[u] = 0;
+                                               vector[v] = 0;
+                                               vector[w] = depth > 0 ? 1 : -1; // now apply vector to normal buffer
+
+                                               normals.push(vector.x, vector.y, vector.z); // uvs
+
+                                               uvs.push(ix / gridX);
+                                               uvs.push(1 - iy / gridY); // counters
+
+                                               vertexCounter += 1;
+                                       }
+                               } // indices
+                               // 1. you need three indices to draw a single face
+                               // 2. a single segment consists of two faces
+                               // 3. so we need to generate six (2*3) indices per segment
+
+
+                               for (let iy = 0; iy < gridY; iy++) {
+                                       for (let ix = 0; ix < gridX; ix++) {
+                                               const a = numberOfVertices + ix + gridX1 * iy;
+                                               const b = numberOfVertices + ix + gridX1 * (iy + 1);
+                                               const c = numberOfVertices + (ix + 1) + gridX1 * (iy + 1);
+                                               const d = numberOfVertices + (ix + 1) + gridX1 * iy; // faces
+
+                                               indices.push(a, b, d);
+                                               indices.push(b, c, d); // increase counter
+
+                                               groupCount += 6;
+                                       }
+                               } // add a group to the geometry. this will ensure multi material support
+
+
+                               scope.addGroup(groupStart, groupCount, materialIndex); // calculate new start value for groups
+
+                               groupStart += groupCount; // update total number of vertices
+
+                               numberOfVertices += vertexCounter;
+                       }
+               }
+
+               static fromJSON(data) {
+                       return new BoxGeometry(data.width, data.height, data.depth, data.widthSegments, data.heightSegments, data.depthSegments);
+               }
+
+       }
+
+       /**
+        * Uniform Utilities
+        */
+       function cloneUniforms(src) {
+               const dst = {};
+
+               for (const u in src) {
+                       dst[u] = {};
+
+                       for (const p in src[u]) {
+                               const property = src[u][p];
+
+                               if (property && (property.isColor || property.isMatrix3 || property.isMatrix4 || property.isVector2 || property.isVector3 || property.isVector4 || property.isTexture || property.isQuaternion)) {
+                                       dst[u][p] = property.clone();
+                               } else if (Array.isArray(property)) {
+                                       dst[u][p] = property.slice();
+                               } else {
+                                       dst[u][p] = property;
+                               }
+                       }
+               }
+
+               return dst;
+       }
+       function mergeUniforms(uniforms) {
+               const merged = {};
+
+               for (let u = 0; u < uniforms.length; u++) {
+                       const tmp = cloneUniforms(uniforms[u]);
+
+                       for (const p in tmp) {
+                               merged[p] = tmp[p];
+                       }
+               }
+
+               return merged;
+       } // Legacy
+
+       const UniformsUtils = {
+               clone: cloneUniforms,
+               merge: mergeUniforms
+       };
+
+       var default_vertex = "void main() {\n\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}";
+
+       var default_fragment = "void main() {\n\tgl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );\n}";
+
+       /**
+        * parameters = {
+        *      defines: { "label" : "value" },
+        *      uniforms: { "parameter1": { value: 1.0 }, "parameter2": { value2: 2 } },
+        *
+        *      fragmentShader: <string>,
+        *      vertexShader: <string>,
+        *
+        *      wireframe: <boolean>,
+        *      wireframeLinewidth: <float>,
+        *
+        *      lights: <bool>
+        * }
+        */
+
+       class ShaderMaterial extends Material {
+               constructor(parameters) {
+                       super();
+                       this.type = 'ShaderMaterial';
+                       this.defines = {};
+                       this.uniforms = {};
+                       this.vertexShader = default_vertex;
+                       this.fragmentShader = default_fragment;
+                       this.linewidth = 1;
+                       this.wireframe = false;
+                       this.wireframeLinewidth = 1;
+                       this.fog = false; // set to use scene fog
+
+                       this.lights = false; // set to use scene lights
+
+                       this.clipping = false; // set to use user-defined clipping planes
+
+                       this.extensions = {
+                               derivatives: false,
+                               // set to use derivatives
+                               fragDepth: false,
+                               // set to use fragment depth values
+                               drawBuffers: false,
+                               // set to use draw buffers
+                               shaderTextureLOD: false // set to use shader texture LOD
+
+                       }; // When rendered geometry doesn't include these attributes but the material does,
+                       // use these default values in WebGL. This avoids errors when buffer data is missing.
+
+                       this.defaultAttributeValues = {
+                               'color': [1, 1, 1],
+                               'uv': [0, 0],
+                               'uv2': [0, 0]
+                       };
+                       this.index0AttributeName = undefined;
+                       this.uniformsNeedUpdate = false;
+                       this.glslVersion = null;
+
+                       if (parameters !== undefined) {
+                               if (parameters.attributes !== undefined) {
+                                       console.error('THREE.ShaderMaterial: attributes should now be defined in THREE.BufferGeometry instead.');
+                               }
+
+                               this.setValues(parameters);
+                       }
+               }
+
+               copy(source) {
+                       super.copy(source);
+                       this.fragmentShader = source.fragmentShader;
+                       this.vertexShader = source.vertexShader;
+                       this.uniforms = cloneUniforms(source.uniforms);
+                       this.defines = Object.assign({}, source.defines);
+                       this.wireframe = source.wireframe;
+                       this.wireframeLinewidth = source.wireframeLinewidth;
+                       this.lights = source.lights;
+                       this.clipping = source.clipping;
+                       this.extensions = Object.assign({}, source.extensions);
+                       this.glslVersion = source.glslVersion;
+                       return this;
+               }
+
+               toJSON(meta) {
+                       const data = super.toJSON(meta);
+                       data.glslVersion = this.glslVersion;
+                       data.uniforms = {};
+
+                       for (const name in this.uniforms) {
+                               const uniform = this.uniforms[name];
+                               const value = uniform.value;
+
+                               if (value && value.isTexture) {
+                                       data.uniforms[name] = {
+                                               type: 't',
+                                               value: value.toJSON(meta).uuid
+                                       };
+                               } else if (value && value.isColor) {
+                                       data.uniforms[name] = {
+                                               type: 'c',
+                                               value: value.getHex()
+                                       };
+                               } else if (value && value.isVector2) {
+                                       data.uniforms[name] = {
+                                               type: 'v2',
+                                               value: value.toArray()
+                                       };
+                               } else if (value && value.isVector3) {
+                                       data.uniforms[name] = {
+                                               type: 'v3',
+                                               value: value.toArray()
+                                       };
+                               } else if (value && value.isVector4) {
+                                       data.uniforms[name] = {
+                                               type: 'v4',
+                                               value: value.toArray()
+                                       };
+                               } else if (value && value.isMatrix3) {
+                                       data.uniforms[name] = {
+                                               type: 'm3',
+                                               value: value.toArray()
+                                       };
+                               } else if (value && value.isMatrix4) {
+                                       data.uniforms[name] = {
+                                               type: 'm4',
+                                               value: value.toArray()
+                                       };
+                               } else {
+                                       data.uniforms[name] = {
+                                               value: value
+                                       }; // note: the array variants v2v, v3v, v4v, m4v and tv are not supported so far
+                               }
+                       }
+
+                       if (Object.keys(this.defines).length > 0) data.defines = this.defines;
+                       data.vertexShader = this.vertexShader;
+                       data.fragmentShader = this.fragmentShader;
+                       const extensions = {};
+
+                       for (const key in this.extensions) {
+                               if (this.extensions[key] === true) extensions[key] = true;
+                       }
+
+                       if (Object.keys(extensions).length > 0) data.extensions = extensions;
+                       return data;
+               }
+
+       }
+
+       ShaderMaterial.prototype.isShaderMaterial = true;
+
+       class Camera extends Object3D {
+               constructor() {
+                       super();
+                       this.type = 'Camera';
+                       this.matrixWorldInverse = new Matrix4();
+                       this.projectionMatrix = new Matrix4();
+                       this.projectionMatrixInverse = new Matrix4();
+               }
+
+               copy(source, recursive) {
+                       super.copy(source, recursive);
+                       this.matrixWorldInverse.copy(source.matrixWorldInverse);
+                       this.projectionMatrix.copy(source.projectionMatrix);
+                       this.projectionMatrixInverse.copy(source.projectionMatrixInverse);
+                       return this;
+               }
+
+               getWorldDirection(target) {
+                       this.updateWorldMatrix(true, false);
+                       const e = this.matrixWorld.elements;
+                       return target.set(-e[8], -e[9], -e[10]).normalize();
+               }
+
+               updateMatrixWorld(force) {
+                       super.updateMatrixWorld(force);
+                       this.matrixWorldInverse.copy(this.matrixWorld).invert();
+               }
+
+               updateWorldMatrix(updateParents, updateChildren) {
+                       super.updateWorldMatrix(updateParents, updateChildren);
+                       this.matrixWorldInverse.copy(this.matrixWorld).invert();
+               }
+
+               clone() {
+                       return new this.constructor().copy(this);
+               }
+
+       }
+
+       Camera.prototype.isCamera = true;
+
+       class PerspectiveCamera extends Camera {
+               constructor(fov = 50, aspect = 1, near = 0.1, far = 2000) {
+                       super();
+                       this.type = 'PerspectiveCamera';
+                       this.fov = fov;
+                       this.zoom = 1;
+                       this.near = near;
+                       this.far = far;
+                       this.focus = 10;
+                       this.aspect = aspect;
+                       this.view = null;
+                       this.filmGauge = 35; // width of the film (default in millimeters)
+
+                       this.filmOffset = 0; // horizontal film offset (same unit as gauge)
+
+                       this.updateProjectionMatrix();
+               }
+
+               copy(source, recursive) {
+                       super.copy(source, recursive);
+                       this.fov = source.fov;
+                       this.zoom = source.zoom;
+                       this.near = source.near;
+                       this.far = source.far;
+                       this.focus = source.focus;
+                       this.aspect = source.aspect;
+                       this.view = source.view === null ? null : Object.assign({}, source.view);
+                       this.filmGauge = source.filmGauge;
+                       this.filmOffset = source.filmOffset;
+                       return this;
+               }
+               /**
+                * Sets the FOV by focal length in respect to the current .filmGauge.
+                *
+                * The default film gauge is 35, so that the focal length can be specified for
+                * a 35mm (full frame) camera.
+                *
+                * Values for focal length and film gauge must have the same unit.
+                */
+
+
+               setFocalLength(focalLength) {
+                       /** see {@link http://www.bobatkins.com/photography/technical/field_of_view.html} */
+                       const vExtentSlope = 0.5 * this.getFilmHeight() / focalLength;
+                       this.fov = RAD2DEG * 2 * Math.atan(vExtentSlope);
+                       this.updateProjectionMatrix();
+               }
+               /**
+                * Calculates the focal length from the current .fov and .filmGauge.
+                */
+
+
+               getFocalLength() {
+                       const vExtentSlope = Math.tan(DEG2RAD * 0.5 * this.fov);
+                       return 0.5 * this.getFilmHeight() / vExtentSlope;
+               }
+
+               getEffectiveFOV() {
+                       return RAD2DEG * 2 * Math.atan(Math.tan(DEG2RAD * 0.5 * this.fov) / this.zoom);
+               }
+
+               getFilmWidth() {
+                       // film not completely covered in portrait format (aspect < 1)
+                       return this.filmGauge * Math.min(this.aspect, 1);
+               }
+
+               getFilmHeight() {
+                       // film not completely covered in landscape format (aspect > 1)
+                       return this.filmGauge / Math.max(this.aspect, 1);
+               }
+               /**
+                * Sets an offset in a larger frustum. This is useful for multi-window or
+                * multi-monitor/multi-machine setups.
+                *
+                * For example, if you have 3x2 monitors and each monitor is 1920x1080 and
+                * the monitors are in grid like this
+                *
+                *       +---+---+---+
+                *       | A | B | C |
+                *       +---+---+---+
+                *       | D | E | F |
+                *       +---+---+---+
+                *
+                * then for each monitor you would call it like this
+                *
+                *       const w = 1920;
+                *       const h = 1080;
+                *       const fullWidth = w * 3;
+                *       const fullHeight = h * 2;
+                *
+                *       --A--
+                *       camera.setViewOffset( fullWidth, fullHeight, w * 0, h * 0, w, h );
+                *       --B--
+                *       camera.setViewOffset( fullWidth, fullHeight, w * 1, h * 0, w, h );
+                *       --C--
+                *       camera.setViewOffset( fullWidth, fullHeight, w * 2, h * 0, w, h );
+                *       --D--
+                *       camera.setViewOffset( fullWidth, fullHeight, w * 0, h * 1, w, h );
+                *       --E--
+                *       camera.setViewOffset( fullWidth, fullHeight, w * 1, h * 1, w, h );
+                *       --F--
+                *       camera.setViewOffset( fullWidth, fullHeight, w * 2, h * 1, w, h );
+                *
+                *       Note there is no reason monitors have to be the same size or in a grid.
+                */
+
+
+               setViewOffset(fullWidth, fullHeight, x, y, width, height) {
+                       this.aspect = fullWidth / fullHeight;
+
+                       if (this.view === null) {
+                               this.view = {
+                                       enabled: true,
+                                       fullWidth: 1,
+                                       fullHeight: 1,
+                                       offsetX: 0,
+                                       offsetY: 0,
+                                       width: 1,
+                                       height: 1
+                               };
+                       }
+
+                       this.view.enabled = true;
+                       this.view.fullWidth = fullWidth;
+                       this.view.fullHeight = fullHeight;
+                       this.view.offsetX = x;
+                       this.view.offsetY = y;
+                       this.view.width = width;
+                       this.view.height = height;
+                       this.updateProjectionMatrix();
+               }
+
+               clearViewOffset() {
+                       if (this.view !== null) {
+                               this.view.enabled = false;
+                       }
+
+                       this.updateProjectionMatrix();
+               }
+
+               updateProjectionMatrix() {
+                       const near = this.near;
+                       let top = near * Math.tan(DEG2RAD * 0.5 * this.fov) / this.zoom;
+                       let height = 2 * top;
+                       let width = this.aspect * height;
+                       let left = -0.5 * width;
+                       const view = this.view;
+
+                       if (this.view !== null && this.view.enabled) {
+                               const fullWidth = view.fullWidth,
+                                                       fullHeight = view.fullHeight;
+                               left += view.offsetX * width / fullWidth;
+                               top -= view.offsetY * height / fullHeight;
+                               width *= view.width / fullWidth;
+                               height *= view.height / fullHeight;
+                       }
+
+                       const skew = this.filmOffset;
+                       if (skew !== 0) left += near * skew / this.getFilmWidth();
+                       this.projectionMatrix.makePerspective(left, left + width, top, top - height, near, this.far);
+                       this.projectionMatrixInverse.copy(this.projectionMatrix).invert();
+               }
+
+               toJSON(meta) {
+                       const data = super.toJSON(meta);
+                       data.object.fov = this.fov;
+                       data.object.zoom = this.zoom;
+                       data.object.near = this.near;
+                       data.object.far = this.far;
+                       data.object.focus = this.focus;
+                       data.object.aspect = this.aspect;
+                       if (this.view !== null) data.object.view = Object.assign({}, this.view);
+                       data.object.filmGauge = this.filmGauge;
+                       data.object.filmOffset = this.filmOffset;
+                       return data;
+               }
+
+       }
+
+       PerspectiveCamera.prototype.isPerspectiveCamera = true;
+
+       const fov = 90,
+                               aspect = 1;
+
+       class CubeCamera extends Object3D {
+               constructor(near, far, renderTarget) {
+                       super();
+                       this.type = 'CubeCamera';
+
+                       if (renderTarget.isWebGLCubeRenderTarget !== true) {
+                               console.error('THREE.CubeCamera: The constructor now expects an instance of WebGLCubeRenderTarget as third parameter.');
+                               return;
+                       }
+
+                       this.renderTarget = renderTarget;
+                       const cameraPX = new PerspectiveCamera(fov, aspect, near, far);
+                       cameraPX.layers = this.layers;
+                       cameraPX.up.set(0, -1, 0);
+                       cameraPX.lookAt(new Vector3(1, 0, 0));
+                       this.add(cameraPX);
+                       const cameraNX = new PerspectiveCamera(fov, aspect, near, far);
+                       cameraNX.layers = this.layers;
+                       cameraNX.up.set(0, -1, 0);
+                       cameraNX.lookAt(new Vector3(-1, 0, 0));
+                       this.add(cameraNX);
+                       const cameraPY = new PerspectiveCamera(fov, aspect, near, far);
+                       cameraPY.layers = this.layers;
+                       cameraPY.up.set(0, 0, 1);
+                       cameraPY.lookAt(new Vector3(0, 1, 0));
+                       this.add(cameraPY);
+                       const cameraNY = new PerspectiveCamera(fov, aspect, near, far);
+                       cameraNY.layers = this.layers;
+                       cameraNY.up.set(0, 0, -1);
+                       cameraNY.lookAt(new Vector3(0, -1, 0));
+                       this.add(cameraNY);
+                       const cameraPZ = new PerspectiveCamera(fov, aspect, near, far);
+                       cameraPZ.layers = this.layers;
+                       cameraPZ.up.set(0, -1, 0);
+                       cameraPZ.lookAt(new Vector3(0, 0, 1));
+                       this.add(cameraPZ);
+                       const cameraNZ = new PerspectiveCamera(fov, aspect, near, far);
+                       cameraNZ.layers = this.layers;
+                       cameraNZ.up.set(0, -1, 0);
+                       cameraNZ.lookAt(new Vector3(0, 0, -1));
+                       this.add(cameraNZ);
+               }
+
+               update(renderer, scene) {
+                       if (this.parent === null) this.updateMatrixWorld();
+                       const renderTarget = this.renderTarget;
+                       const [cameraPX, cameraNX, cameraPY, cameraNY, cameraPZ, cameraNZ] = this.children;
+                       const currentXrEnabled = renderer.xr.enabled;
+                       const currentRenderTarget = renderer.getRenderTarget();
+                       renderer.xr.enabled = false;
+                       const generateMipmaps = renderTarget.texture.generateMipmaps;
+                       renderTarget.texture.generateMipmaps = false;
+                       renderer.setRenderTarget(renderTarget, 0);
+                       renderer.render(scene, cameraPX);
+                       renderer.setRenderTarget(renderTarget, 1);
+                       renderer.render(scene, cameraNX);
+                       renderer.setRenderTarget(renderTarget, 2);
+                       renderer.render(scene, cameraPY);
+                       renderer.setRenderTarget(renderTarget, 3);
+                       renderer.render(scene, cameraNY);
+                       renderer.setRenderTarget(renderTarget, 4);
+                       renderer.render(scene, cameraPZ);
+                       renderTarget.texture.generateMipmaps = generateMipmaps;
+                       renderer.setRenderTarget(renderTarget, 5);
+                       renderer.render(scene, cameraNZ);
+                       renderer.setRenderTarget(currentRenderTarget);
+                       renderer.xr.enabled = currentXrEnabled;
+               }
+
+       }
+
+       class CubeTexture extends Texture {
+               constructor(images, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy, encoding) {
+                       images = images !== undefined ? images : [];
+                       mapping = mapping !== undefined ? mapping : CubeReflectionMapping;
+                       format = format !== undefined ? format : RGBFormat;
+                       super(images, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy, encoding);
+                       this.flipY = false;
+               }
+
+               get images() {
+                       return this.image;
+               }
+
+               set images(value) {
+                       this.image = value;
+               }
+
+       }
+
+       CubeTexture.prototype.isCubeTexture = true;
+
+       class WebGLCubeRenderTarget extends WebGLRenderTarget {
+               constructor(size, options, dummy) {
+                       if (Number.isInteger(options)) {
+                               console.warn('THREE.WebGLCubeRenderTarget: constructor signature is now WebGLCubeRenderTarget( size, options )');
+                               options = dummy;
+                       }
+
+                       super(size, size, options);
+                       options = options || {}; // By convention -- likely based on the RenderMan spec from the 1990's -- cube maps are specified by WebGL (and three.js)
+                       // in a coordinate system in which positive-x is to the right when looking up the positive-z axis -- in other words,
+                       // in a left-handed coordinate system. By continuing this convention, preexisting cube maps continued to render correctly.
+                       // three.js uses a right-handed coordinate system. So environment maps used in three.js appear to have px and nx swapped
+                       // and the flag isRenderTargetTexture controls this conversion. The flip is not required when using WebGLCubeRenderTarget.texture
+                       // as a cube texture (this is detected when isRenderTargetTexture is set to true for cube textures).
+
+                       this.texture = new CubeTexture(undefined, options.mapping, options.wrapS, options.wrapT, options.magFilter, options.minFilter, options.format, options.type, options.anisotropy, options.encoding);
+                       this.texture.isRenderTargetTexture = true;
+                       this.texture.generateMipmaps = options.generateMipmaps !== undefined ? options.generateMipmaps : false;
+                       this.texture.minFilter = options.minFilter !== undefined ? options.minFilter : LinearFilter;
+                       this.texture._needsFlipEnvMap = false;
+               }
+
+               fromEquirectangularTexture(renderer, texture) {
+                       this.texture.type = texture.type;
+                       this.texture.format = RGBAFormat; // see #18859
+
+                       this.texture.encoding = texture.encoding;
+                       this.texture.generateMipmaps = texture.generateMipmaps;
+                       this.texture.minFilter = texture.minFilter;
+                       this.texture.magFilter = texture.magFilter;
+                       const shader = {
+                               uniforms: {
+                                       tEquirect: {
+                                               value: null
+                                       }
+                               },
+                               vertexShader:
+                               /* glsl */
+                               `
+
+                               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:
+                               /* glsl */
+                               `
+
+                               uniform sampler2D tEquirect;
+
+                               varying vec3 vWorldDirection;
+
+                               #include <common>
+
+                               void main() {
+
+                                       vec3 direction = normalize( vWorldDirection );
+
+                                       vec2 sampleUV = equirectUv( direction );
+
+                                       gl_FragColor = texture2D( tEquirect, sampleUV );
+
+                               }
+                       `
+                       };
+                       const geometry = new BoxGeometry(5, 5, 5);
+                       const material = new ShaderMaterial({
+                               name: 'CubemapFromEquirect',
+                               uniforms: cloneUniforms(shader.uniforms),
+                               vertexShader: shader.vertexShader,
+                               fragmentShader: shader.fragmentShader,
+                               side: BackSide,
+                               blending: NoBlending
+                       });
+                       material.uniforms.tEquirect.value = texture;
+                       const mesh = new Mesh(geometry, material);
+                       const currentMinFilter = texture.minFilter; // Avoid blurred poles
+
+                       if (texture.minFilter === LinearMipmapLinearFilter) texture.minFilter = LinearFilter;
+                       const camera = new CubeCamera(1, 10, this);
+                       camera.update(renderer, mesh);
+                       texture.minFilter = currentMinFilter;
+                       mesh.geometry.dispose();
+                       mesh.material.dispose();
+                       return this;
+               }
+
+               clear(renderer, color, depth, stencil) {
+                       const currentRenderTarget = renderer.getRenderTarget();
+
+                       for (let i = 0; i < 6; i++) {
+                               renderer.setRenderTarget(this, i);
+                               renderer.clear(color, depth, stencil);
+                       }
+
+                       renderer.setRenderTarget(currentRenderTarget);
+               }
+
+       }
+
+       WebGLCubeRenderTarget.prototype.isWebGLCubeRenderTarget = true;
+
+       const _vector1 = /*@__PURE__*/new Vector3();
+
+       const _vector2 = /*@__PURE__*/new Vector3();
+
+       const _normalMatrix = /*@__PURE__*/new Matrix3();
+
+       class Plane {
+               constructor(normal = new Vector3(1, 0, 0), constant = 0) {
+                       // normal is assumed to be normalized
+                       this.normal = normal;
+                       this.constant = constant;
+               }
+
+               set(normal, constant) {
+                       this.normal.copy(normal);
+                       this.constant = constant;
+                       return this;
+               }
+
+               setComponents(x, y, z, w) {
+                       this.normal.set(x, y, z);
+                       this.constant = w;
+                       return this;
+               }
+
+               setFromNormalAndCoplanarPoint(normal, point) {
+                       this.normal.copy(normal);
+                       this.constant = -point.dot(this.normal);
+                       return this;
+               }
+
+               setFromCoplanarPoints(a, b, c) {
+                       const normal = _vector1.subVectors(c, b).cross(_vector2.subVectors(a, b)).normalize(); // Q: should an error be thrown if normal is zero (e.g. degenerate plane)?
+
+
+                       this.setFromNormalAndCoplanarPoint(normal, a);
+                       return this;
+               }
+
+               copy(plane) {
+                       this.normal.copy(plane.normal);
+                       this.constant = plane.constant;
+                       return this;
+               }
+
+               normalize() {
+                       // Note: will lead to a divide by zero if the plane is invalid.
+                       const inverseNormalLength = 1.0 / this.normal.length();
+                       this.normal.multiplyScalar(inverseNormalLength);
+                       this.constant *= inverseNormalLength;
+                       return this;
+               }
+
+               negate() {
+                       this.constant *= -1;
+                       this.normal.negate();
+                       return this;
+               }
+
+               distanceToPoint(point) {
+                       return this.normal.dot(point) + this.constant;
+               }
+
+               distanceToSphere(sphere) {
+                       return this.distanceToPoint(sphere.center) - sphere.radius;
+               }
+
+               projectPoint(point, target) {
+                       return target.copy(this.normal).multiplyScalar(-this.distanceToPoint(point)).add(point);
+               }
+
+               intersectLine(line, target) {
+                       const direction = line.delta(_vector1);
+                       const denominator = this.normal.dot(direction);
+
+                       if (denominator === 0) {
+                               // line is coplanar, return origin
+                               if (this.distanceToPoint(line.start) === 0) {
+                                       return target.copy(line.start);
+                               } // Unsure if this is the correct method to handle this case.
+
+
+                               return null;
+                       }
+
+                       const t = -(line.start.dot(this.normal) + this.constant) / denominator;
+
+                       if (t < 0 || t > 1) {
+                               return null;
+                       }
+
+                       return target.copy(direction).multiplyScalar(t).add(line.start);
+               }
+
+               intersectsLine(line) {
+                       // Note: this tests if a line intersects the plane, not whether it (or its end-points) are coplanar with it.
+                       const startSign = this.distanceToPoint(line.start);
+                       const endSign = this.distanceToPoint(line.end);
+                       return startSign < 0 && endSign > 0 || endSign < 0 && startSign > 0;
+               }
+
+               intersectsBox(box) {
+                       return box.intersectsPlane(this);
+               }
+
+               intersectsSphere(sphere) {
+                       return sphere.intersectsPlane(this);
+               }
+
+               coplanarPoint(target) {
+                       return target.copy(this.normal).multiplyScalar(-this.constant);
+               }
+
+               applyMatrix4(matrix, optionalNormalMatrix) {
+                       const normalMatrix = optionalNormalMatrix || _normalMatrix.getNormalMatrix(matrix);
+
+                       const referencePoint = this.coplanarPoint(_vector1).applyMatrix4(matrix);
+                       const normal = this.normal.applyMatrix3(normalMatrix).normalize();
+                       this.constant = -referencePoint.dot(normal);
+                       return this;
+               }
+
+               translate(offset) {
+                       this.constant -= offset.dot(this.normal);
+                       return this;
+               }
+
+               equals(plane) {
+                       return plane.normal.equals(this.normal) && plane.constant === this.constant;
+               }
+
+               clone() {
+                       return new this.constructor().copy(this);
+               }
+
+       }
+
+       Plane.prototype.isPlane = true;
+
+       const _sphere$2 = /*@__PURE__*/new Sphere();
+
+       const _vector$7 = /*@__PURE__*/new Vector3();
+
+       class Frustum {
+               constructor(p0 = new Plane(), p1 = new Plane(), p2 = new Plane(), p3 = new Plane(), p4 = new Plane(), p5 = new Plane()) {
+                       this.planes = [p0, p1, p2, p3, p4, p5];
+               }
+
+               set(p0, p1, p2, p3, p4, p5) {
+                       const planes = this.planes;
+                       planes[0].copy(p0);
+                       planes[1].copy(p1);
+                       planes[2].copy(p2);
+                       planes[3].copy(p3);
+                       planes[4].copy(p4);
+                       planes[5].copy(p5);
+                       return this;
+               }
+
+               copy(frustum) {
+                       const planes = this.planes;
+
+                       for (let i = 0; i < 6; i++) {
+                               planes[i].copy(frustum.planes[i]);
+                       }
+
+                       return this;
+               }
+
+               setFromProjectionMatrix(m) {
+                       const planes = this.planes;
+                       const me = m.elements;
+                       const me0 = me[0],
+                                               me1 = me[1],
+                                               me2 = me[2],
+                                               me3 = me[3];
+                       const me4 = me[4],
+                                               me5 = me[5],
+                                               me6 = me[6],
+                                               me7 = me[7];
+                       const me8 = me[8],
+                                               me9 = me[9],
+                                               me10 = me[10],
+                                               me11 = me[11];
+                       const me12 = me[12],
+                                               me13 = me[13],
+                                               me14 = me[14],
+                                               me15 = me[15];
+                       planes[0].setComponents(me3 - me0, me7 - me4, me11 - me8, me15 - me12).normalize();
+                       planes[1].setComponents(me3 + me0, me7 + me4, me11 + me8, me15 + me12).normalize();
+                       planes[2].setComponents(me3 + me1, me7 + me5, me11 + me9, me15 + me13).normalize();
+                       planes[3].setComponents(me3 - me1, me7 - me5, me11 - me9, me15 - me13).normalize();
+                       planes[4].setComponents(me3 - me2, me7 - me6, me11 - me10, me15 - me14).normalize();
+                       planes[5].setComponents(me3 + me2, me7 + me6, me11 + me10, me15 + me14).normalize();
+                       return this;
+               }
+
+               intersectsObject(object) {
+                       const geometry = object.geometry;
+                       if (geometry.boundingSphere === null) geometry.computeBoundingSphere();
+
+                       _sphere$2.copy(geometry.boundingSphere).applyMatrix4(object.matrixWorld);
+
+                       return this.intersectsSphere(_sphere$2);
+               }
+
+               intersectsSprite(sprite) {
+                       _sphere$2.center.set(0, 0, 0);
+
+                       _sphere$2.radius = 0.7071067811865476;
+
+                       _sphere$2.applyMatrix4(sprite.matrixWorld);
+
+                       return this.intersectsSphere(_sphere$2);
+               }
+
+               intersectsSphere(sphere) {
+                       const planes = this.planes;
+                       const center = sphere.center;
+                       const negRadius = -sphere.radius;
+
+                       for (let i = 0; i < 6; i++) {
+                               const distance = planes[i].distanceToPoint(center);
+
+                               if (distance < negRadius) {
+                                       return false;
+                               }
+                       }
+
+                       return true;
+               }
+
+               intersectsBox(box) {
+                       const planes = this.planes;
+
+                       for (let i = 0; i < 6; i++) {
+                               const plane = planes[i]; // corner at max distance
+
+                               _vector$7.x = plane.normal.x > 0 ? box.max.x : box.min.x;
+                               _vector$7.y = plane.normal.y > 0 ? box.max.y : box.min.y;
+                               _vector$7.z = plane.normal.z > 0 ? box.max.z : box.min.z;
+
+                               if (plane.distanceToPoint(_vector$7) < 0) {
+                                       return false;
+                               }
+                       }
+
+                       return true;
+               }
+
+               containsPoint(point) {
+                       const planes = this.planes;
+
+                       for (let i = 0; i < 6; i++) {
+                               if (planes[i].distanceToPoint(point) < 0) {
+                                       return false;
+                               }
+                       }
+
+                       return true;
+               }
+
+               clone() {
+                       return new this.constructor().copy(this);
+               }
+
+       }
+
+       function WebGLAnimation() {
+               let context = null;
+               let isAnimating = false;
+               let animationLoop = null;
+               let requestId = null;
+
+               function onAnimationFrame(time, frame) {
+                       animationLoop(time, frame);
+                       requestId = context.requestAnimationFrame(onAnimationFrame);
+               }
+
+               return {
+                       start: function () {
+                               if (isAnimating === true) return;
+                               if (animationLoop === null) return;
+                               requestId = context.requestAnimationFrame(onAnimationFrame);
+                               isAnimating = true;
+                       },
+                       stop: function () {
+                               context.cancelAnimationFrame(requestId);
+                               isAnimating = false;
+                       },
+                       setAnimationLoop: function (callback) {
+                               animationLoop = callback;
+                       },
+                       setContext: function (value) {
+                               context = value;
+                       }
+               };
+       }
+
+       function WebGLAttributes(gl, capabilities) {
+               const isWebGL2 = capabilities.isWebGL2;
+               const buffers = new WeakMap();
+
+               function createBuffer(attribute, bufferType) {
+                       const array = attribute.array;
+                       const usage = attribute.usage;
+                       const buffer = gl.createBuffer();
+                       gl.bindBuffer(bufferType, buffer);
+                       gl.bufferData(bufferType, array, usage);
+                       attribute.onUploadCallback();
+                       let type = gl.FLOAT;
+
+                       if (array instanceof Float32Array) {
+                               type = gl.FLOAT;
+                       } else if (array instanceof Float64Array) {
+                               console.warn('THREE.WebGLAttributes: Unsupported data buffer format: Float64Array.');
+                       } else if (array instanceof Uint16Array) {
+                               if (attribute.isFloat16BufferAttribute) {
+                                       if (isWebGL2) {
+                                               type = gl.HALF_FLOAT;
+                                       } else {
+                                               console.warn('THREE.WebGLAttributes: Usage of Float16BufferAttribute requires WebGL2.');
+                                       }
+                               } else {
+                                       type = gl.UNSIGNED_SHORT;
+                               }
+                       } else if (array instanceof Int16Array) {
+                               type = gl.SHORT;
+                       } else if (array instanceof Uint32Array) {
+                               type = gl.UNSIGNED_INT;
+                       } else if (array instanceof Int32Array) {
+                               type = gl.INT;
+                       } else if (array instanceof Int8Array) {
+                               type = gl.BYTE;
+                       } else if (array instanceof Uint8Array) {
+                               type = gl.UNSIGNED_BYTE;
+                       } else if (array instanceof Uint8ClampedArray) {
+                               type = gl.UNSIGNED_BYTE;
+                       }
+
+                       return {
+                               buffer: buffer,
+                               type: type,
+                               bytesPerElement: array.BYTES_PER_ELEMENT,
+                               version: attribute.version
+                       };
+               }
+
+               function updateBuffer(buffer, attribute, bufferType) {
+                       const array = attribute.array;
+                       const updateRange = attribute.updateRange;
+                       gl.bindBuffer(bufferType, buffer);
+
+                       if (updateRange.count === -1) {
+                               // Not using update ranges
+                               gl.bufferSubData(bufferType, 0, array);
+                       } else {
+                               if (isWebGL2) {
+                                       gl.bufferSubData(bufferType, updateRange.offset * array.BYTES_PER_ELEMENT, array, updateRange.offset, updateRange.count);
+                               } else {
+                                       gl.bufferSubData(bufferType, updateRange.offset * array.BYTES_PER_ELEMENT, array.subarray(updateRange.offset, updateRange.offset + updateRange.count));
+                               }
+
+                               updateRange.count = -1; // reset range
+                       }
+               } //
+
+
+               function get(attribute) {
+                       if (attribute.isInterleavedBufferAttribute) attribute = attribute.data;
+                       return buffers.get(attribute);
+               }
+
+               function remove(attribute) {
+                       if (attribute.isInterleavedBufferAttribute) attribute = attribute.data;
+                       const data = buffers.get(attribute);
+
+                       if (data) {
+                               gl.deleteBuffer(data.buffer);
+                               buffers.delete(attribute);
+                       }
+               }
+
+               function update(attribute, bufferType) {
+                       if (attribute.isGLBufferAttribute) {
+                               const cached = buffers.get(attribute);
+
+                               if (!cached || cached.version < attribute.version) {
+                                       buffers.set(attribute, {
+                                               buffer: attribute.buffer,
+                                               type: attribute.type,
+                                               bytesPerElement: attribute.elementSize,
+                                               version: attribute.version
+                                       });
+                               }
+
+                               return;
+                       }
+
+                       if (attribute.isInterleavedBufferAttribute) attribute = attribute.data;
+                       const data = buffers.get(attribute);
+
+                       if (data === undefined) {
+                               buffers.set(attribute, createBuffer(attribute, bufferType));
+                       } else if (data.version < attribute.version) {
+                               updateBuffer(data.buffer, attribute, bufferType);
+                               data.version = attribute.version;
+                       }
+               }
+
+               return {
+                       get: get,
+                       remove: remove,
+                       update: update
+               };
+       }
+
+       class PlaneGeometry extends BufferGeometry {
+               constructor(width = 1, height = 1, widthSegments = 1, heightSegments = 1) {
+                       super();
+                       this.type = 'PlaneGeometry';
+                       this.parameters = {
+                               width: width,
+                               height: height,
+                               widthSegments: widthSegments,
+                               heightSegments: heightSegments
+                       };
+                       const width_half = width / 2;
+                       const height_half = height / 2;
+                       const gridX = Math.floor(widthSegments);
+                       const gridY = Math.floor(heightSegments);
+                       const gridX1 = gridX + 1;
+                       const gridY1 = gridY + 1;
+                       const segment_width = width / gridX;
+                       const segment_height = height / gridY; //
+
+                       const indices = [];
+                       const vertices = [];
+                       const normals = [];
+                       const uvs = [];
+
+                       for (let iy = 0; iy < gridY1; iy++) {
+                               const y = iy * segment_height - height_half;
+
+                               for (let ix = 0; ix < gridX1; ix++) {
+                                       const x = ix * segment_width - width_half;
+                                       vertices.push(x, -y, 0);
+                                       normals.push(0, 0, 1);
+                                       uvs.push(ix / gridX);
+                                       uvs.push(1 - iy / gridY);
+                               }
+                       }
+
+                       for (let iy = 0; iy < gridY; iy++) {
+                               for (let ix = 0; ix < gridX; ix++) {
+                                       const a = ix + gridX1 * iy;
+                                       const b = ix + gridX1 * (iy + 1);
+                                       const c = ix + 1 + gridX1 * (iy + 1);
+                                       const d = ix + 1 + gridX1 * iy;
+                                       indices.push(a, b, d);
+                                       indices.push(b, c, d);
+                               }
+                       }
+
+                       this.setIndex(indices);
+                       this.setAttribute('position', new Float32BufferAttribute(vertices, 3));
+                       this.setAttribute('normal', new Float32BufferAttribute(normals, 3));
+                       this.setAttribute('uv', new Float32BufferAttribute(uvs, 2));
+               }
+
+               static fromJSON(data) {
+                       return new PlaneGeometry(data.width, data.height, data.widthSegments, data.heightSegments);
+               }
+
+       }
+
+       var alphamap_fragment = "#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, vUv ).g;\n#endif";
+
+       var alphamap_pars_fragment = "#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif";
+
+       var alphatest_fragment = "#ifdef USE_ALPHATEST\n\tif ( diffuseColor.a < alphaTest ) discard;\n#endif";
+
+       var alphatest_pars_fragment = "#ifdef USE_ALPHATEST\n\tuniform float alphaTest;\n#endif";
+
+       var aomap_fragment = "#ifdef USE_AOMAP\n\tfloat ambientOcclusion = ( texture2D( aoMap, vUv2 ).r - 1.0 ) * aoMapIntensity + 1.0;\n\treflectedLight.indirectDiffuse *= ambientOcclusion;\n\t#if defined( USE_ENVMAP ) && defined( STANDARD )\n\t\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\t\treflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness );\n\t#endif\n#endif";
+
+       var aomap_pars_fragment = "#ifdef USE_AOMAP\n\tuniform sampler2D aoMap;\n\tuniform float aoMapIntensity;\n#endif";
+
+       var begin_vertex = "vec3 transformed = vec3( position );";
+
+       var beginnormal_vertex = "vec3 objectNormal = vec3( normal );\n#ifdef USE_TANGENT\n\tvec3 objectTangent = vec3( tangent.xyz );\n#endif";
+
+       var bsdfs = "vec3 BRDF_Lambert( const in vec3 diffuseColor ) {\n\treturn RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {\n\tfloat fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\n\treturn f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\n}\nfloat V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\tfloat gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\treturn 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n\tfloat a2 = pow2( alpha );\n\tfloat denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n\treturn RECIPROCAL_PI * a2 / pow2( denom );\n}\nvec3 BRDF_GGX( const in IncidentLight incidentLight, const in vec3 viewDir, const in vec3 normal, const in vec3 f0, const in float f90, const in float roughness ) {\n\tfloat alpha = pow2( roughness );\n\tvec3 halfDir = normalize( incidentLight.direction + viewDir );\n\tfloat dotNL = saturate( dot( normal, incidentLight.direction ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\tvec3 F = F_Schlick( f0, f90, dotVH );\n\tfloat V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\tfloat D = D_GGX( alpha, dotNH );\n\treturn F * ( V * D );\n}\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\n\tconst float LUT_SIZE = 64.0;\n\tconst float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\n\tconst float LUT_BIAS = 0.5 / LUT_SIZE;\n\tfloat dotNV = saturate( dot( N, V ) );\n\tvec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );\n\tuv = uv * LUT_SCALE + LUT_BIAS;\n\treturn uv;\n}\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\n\tfloat l = length( f );\n\treturn max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\n}\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\n\tfloat x = dot( v1, v2 );\n\tfloat y = abs( x );\n\tfloat a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;\n\tfloat b = 3.4175940 + ( 4.1616724 + y ) * y;\n\tfloat v = a / b;\n\tfloat theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;\n\treturn cross( v1, v2 ) * theta_sintheta;\n}\nvec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {\n\tvec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\n\tvec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\n\tvec3 lightNormal = cross( v1, v2 );\n\tif( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\n\tvec3 T1, T2;\n\tT1 = normalize( V - N * dot( V, N ) );\n\tT2 = - cross( N, T1 );\n\tmat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );\n\tvec3 coords[ 4 ];\n\tcoords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\n\tcoords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\n\tcoords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\n\tcoords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\n\tcoords[ 0 ] = normalize( coords[ 0 ] );\n\tcoords[ 1 ] = normalize( coords[ 1 ] );\n\tcoords[ 2 ] = normalize( coords[ 2 ] );\n\tcoords[ 3 ] = normalize( coords[ 3 ] );\n\tvec3 vectorFormFactor = vec3( 0.0 );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\n\tfloat result = LTC_ClippedSphereFormFactor( vectorFormFactor );\n\treturn vec3( result );\n}\nfloat G_BlinnPhong_Implicit( ) {\n\treturn 0.25;\n}\nfloat D_BlinnPhong( const in float shininess, const in float dotNH ) {\n\treturn RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );\n}\nvec3 BRDF_BlinnPhong( const in IncidentLight incidentLight, const in GeometricContext geometry, const in vec3 specularColor, const in float shininess ) {\n\tvec3 halfDir = normalize( incidentLight.direction + geometry.viewDir );\n\tfloat dotNH = saturate( dot( geometry.normal, halfDir ) );\n\tfloat dotVH = saturate( dot( geometry.viewDir, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, 1.0, dotVH );\n\tfloat G = G_BlinnPhong_Implicit( );\n\tfloat D = D_BlinnPhong( shininess, dotNH );\n\treturn F * ( G * D );\n}\n#if defined( USE_SHEEN )\nfloat D_Charlie( float roughness, float NoH ) {\n\tfloat invAlpha = 1.0 / roughness;\n\tfloat cos2h = NoH * NoH;\n\tfloat sin2h = max( 1.0 - cos2h, 0.0078125 );\n\treturn ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );\n}\nfloat V_Neubelt( float NoV, float NoL ) {\n\treturn saturate( 1.0 / ( 4.0 * ( NoL + NoV - NoL * NoV ) ) );\n}\nvec3 BRDF_Sheen( const in float roughness, const in vec3 L, const in GeometricContext geometry, vec3 specularColor ) {\n\tvec3 N = geometry.normal;\n\tvec3 V = geometry.viewDir;\n\tvec3 H = normalize( V + L );\n\tfloat dotNH = saturate( dot( N, H ) );\n\treturn specularColor * D_Charlie( roughness, dotNH ) * V_Neubelt( dot(N, V), dot(N, L) );\n}\n#endif";
+
+       var bumpmap_pars_fragment = "#ifdef USE_BUMPMAP\n\tuniform sampler2D bumpMap;\n\tuniform float bumpScale;\n\tvec2 dHdxy_fwd() {\n\t\tvec2 dSTdx = dFdx( vUv );\n\t\tvec2 dSTdy = dFdy( vUv );\n\t\tfloat Hll = bumpScale * texture2D( bumpMap, vUv ).x;\n\t\tfloat dBx = bumpScale * texture2D( bumpMap, vUv + dSTdx ).x - Hll;\n\t\tfloat dBy = bumpScale * texture2D( bumpMap, vUv + dSTdy ).x - Hll;\n\t\treturn vec2( dBx, dBy );\n\t}\n\tvec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) {\n\t\tvec3 vSigmaX = vec3( dFdx( surf_pos.x ), dFdx( surf_pos.y ), dFdx( surf_pos.z ) );\n\t\tvec3 vSigmaY = vec3( dFdy( surf_pos.x ), dFdy( surf_pos.y ), dFdy( surf_pos.z ) );\n\t\tvec3 vN = surf_norm;\n\t\tvec3 R1 = cross( vSigmaY, vN );\n\t\tvec3 R2 = cross( vN, vSigmaX );\n\t\tfloat fDet = dot( vSigmaX, R1 ) * faceDirection;\n\t\tvec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n\t\treturn normalize( abs( fDet ) * surf_norm - vGrad );\n\t}\n#endif";
+
+       var clipping_planes_fragment = "#if NUM_CLIPPING_PLANES > 0\n\tvec4 plane;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n\t\tplane = clippingPlanes[ i ];\n\t\tif ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;\n\t}\n\t#pragma unroll_loop_end\n\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\t\tbool clipped = true;\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n\t\t\tplane = clippingPlanes[ i ];\n\t\t\tclipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t\tif ( clipped ) discard;\n\t#endif\n#endif";
+
+       var clipping_planes_pars_fragment = "#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n\tuniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif";
+
+       var clipping_planes_pars_vertex = "#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n#endif";
+
+       var clipping_planes_vertex = "#if NUM_CLIPPING_PLANES > 0\n\tvClipPosition = - mvPosition.xyz;\n#endif";
+
+       var color_fragment = "#if defined( USE_COLOR_ALPHA )\n\tdiffuseColor *= vColor;\n#elif defined( USE_COLOR )\n\tdiffuseColor.rgb *= vColor;\n#endif";
+
+       var color_pars_fragment = "#if defined( USE_COLOR_ALPHA )\n\tvarying vec4 vColor;\n#elif defined( USE_COLOR )\n\tvarying vec3 vColor;\n#endif";
+
+       var color_pars_vertex = "#if defined( USE_COLOR_ALPHA )\n\tvarying vec4 vColor;\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )\n\tvarying vec3 vColor;\n#endif";
+
+       var color_vertex = "#if defined( USE_COLOR_ALPHA )\n\tvColor = vec4( 1.0 );\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )\n\tvColor = vec3( 1.0 );\n#endif\n#ifdef USE_COLOR\n\tvColor *= color;\n#endif\n#ifdef USE_INSTANCING_COLOR\n\tvColor.xyz *= instanceColor.xyz;\n#endif";
+
+       var common = "#define PI 3.141592653589793\n#define PI2 6.283185307179586\n#define PI_HALF 1.5707963267948966\n#define RECIPROCAL_PI 0.3183098861837907\n#define RECIPROCAL_PI2 0.15915494309189535\n#define EPSILON 1e-6\n#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\n#define whiteComplement( a ) ( 1.0 - saturate( a ) )\nfloat pow2( const in float x ) { return x*x; }\nfloat pow3( const in float x ) { return x*x*x; }\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\nfloat max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); }\nfloat average( const in vec3 color ) { return dot( color, vec3( 0.3333 ) ); }\nhighp float rand( const in vec2 uv ) {\n\tconst highp float a = 12.9898, b = 78.233, c = 43758.5453;\n\thighp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n\treturn fract( sin( sn ) * c );\n}\n#ifdef HIGH_PRECISION\n\tfloat precisionSafeLength( vec3 v ) { return length( v ); }\n#else\n\tfloat precisionSafeLength( vec3 v ) {\n\t\tfloat maxComponent = max3( abs( v ) );\n\t\treturn length( v / maxComponent ) * maxComponent;\n\t}\n#endif\nstruct IncidentLight {\n\tvec3 color;\n\tvec3 direction;\n\tbool visible;\n};\nstruct ReflectedLight {\n\tvec3 directDiffuse;\n\tvec3 directSpecular;\n\tvec3 indirectDiffuse;\n\tvec3 indirectSpecular;\n};\nstruct GeometricContext {\n\tvec3 position;\n\tvec3 normal;\n\tvec3 viewDir;\n#ifdef USE_CLEARCOAT\n\tvec3 clearcoatNormal;\n#endif\n};\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n}\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\n}\nmat3 transposeMat3( const in mat3 m ) {\n\tmat3 tmp;\n\ttmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );\n\ttmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );\n\ttmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );\n\treturn tmp;\n}\nfloat linearToRelativeLuminance( const in vec3 color ) {\n\tvec3 weights = vec3( 0.2126, 0.7152, 0.0722 );\n\treturn dot( weights, color.rgb );\n}\nbool isPerspectiveMatrix( mat4 m ) {\n\treturn m[ 2 ][ 3 ] == - 1.0;\n}\nvec2 equirectUv( in vec3 dir ) {\n\tfloat u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;\n\tfloat v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\treturn vec2( u, v );\n}";
+
+       var cube_uv_reflection_fragment = "#ifdef ENVMAP_TYPE_CUBE_UV\n\t#define cubeUV_maxMipLevel 8.0\n\t#define cubeUV_minMipLevel 4.0\n\t#define cubeUV_maxTileSize 256.0\n\t#define cubeUV_minTileSize 16.0\n\tfloat getFace( vec3 direction ) {\n\t\tvec3 absDirection = abs( direction );\n\t\tfloat face = - 1.0;\n\t\tif ( absDirection.x > absDirection.z ) {\n\t\t\tif ( absDirection.x > absDirection.y )\n\t\t\t\tface = direction.x > 0.0 ? 0.0 : 3.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t} else {\n\t\t\tif ( absDirection.z > absDirection.y )\n\t\t\t\tface = direction.z > 0.0 ? 2.0 : 5.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t}\n\t\treturn face;\n\t}\n\tvec2 getUV( vec3 direction, float face ) {\n\t\tvec2 uv;\n\t\tif ( face == 0.0 ) {\n\t\t\tuv = vec2( direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 1.0 ) {\n\t\t\tuv = vec2( - direction.x, - direction.z ) / abs( direction.y );\n\t\t} else if ( face == 2.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.y ) / abs( direction.z );\n\t\t} else if ( face == 3.0 ) {\n\t\t\tuv = vec2( - direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 4.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.z ) / abs( direction.y );\n\t\t} else {\n\t\t\tuv = vec2( direction.x, direction.y ) / abs( direction.z );\n\t\t}\n\t\treturn 0.5 * ( uv + 1.0 );\n\t}\n\tvec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {\n\t\tfloat face = getFace( direction );\n\t\tfloat filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );\n\t\tmipInt = max( mipInt, cubeUV_minMipLevel );\n\t\tfloat faceSize = exp2( mipInt );\n\t\tfloat texelSize = 1.0 / ( 3.0 * cubeUV_maxTileSize );\n\t\tvec2 uv = getUV( direction, face ) * ( faceSize - 1.0 );\n\t\tvec2 f = fract( uv );\n\t\tuv += 0.5 - f;\n\t\tif ( face > 2.0 ) {\n\t\t\tuv.y += faceSize;\n\t\t\tface -= 3.0;\n\t\t}\n\t\tuv.x += face * faceSize;\n\t\tif ( mipInt < cubeUV_maxMipLevel ) {\n\t\t\tuv.y += 2.0 * cubeUV_maxTileSize;\n\t\t}\n\t\tuv.y += filterInt * 2.0 * cubeUV_minTileSize;\n\t\tuv.x += 3.0 * max( 0.0, cubeUV_maxTileSize - 2.0 * faceSize );\n\t\tuv *= texelSize;\n\t\tvec3 tl = envMapTexelToLinear( texture2D( envMap, uv ) ).rgb;\n\t\tuv.x += texelSize;\n\t\tvec3 tr = envMapTexelToLinear( texture2D( envMap, uv ) ).rgb;\n\t\tuv.y += texelSize;\n\t\tvec3 br = envMapTexelToLinear( texture2D( envMap, uv ) ).rgb;\n\t\tuv.x -= texelSize;\n\t\tvec3 bl = envMapTexelToLinear( texture2D( envMap, uv ) ).rgb;\n\t\tvec3 tm = mix( tl, tr, f.x );\n\t\tvec3 bm = mix( bl, br, f.x );\n\t\treturn mix( tm, bm, f.y );\n\t}\n\t#define r0 1.0\n\t#define v0 0.339\n\t#define m0 - 2.0\n\t#define r1 0.8\n\t#define v1 0.276\n\t#define m1 - 1.0\n\t#define r4 0.4\n\t#define v4 0.046\n\t#define m4 2.0\n\t#define r5 0.305\n\t#define v5 0.016\n\t#define m5 3.0\n\t#define r6 0.21\n\t#define v6 0.0038\n\t#define m6 4.0\n\tfloat roughnessToMip( float roughness ) {\n\t\tfloat mip = 0.0;\n\t\tif ( roughness >= r1 ) {\n\t\t\tmip = ( r0 - roughness ) * ( m1 - m0 ) / ( r0 - r1 ) + m0;\n\t\t} else if ( roughness >= r4 ) {\n\t\t\tmip = ( r1 - roughness ) * ( m4 - m1 ) / ( r1 - r4 ) + m1;\n\t\t} else if ( roughness >= r5 ) {\n\t\t\tmip = ( r4 - roughness ) * ( m5 - m4 ) / ( r4 - r5 ) + m4;\n\t\t} else if ( roughness >= r6 ) {\n\t\t\tmip = ( r5 - roughness ) * ( m6 - m5 ) / ( r5 - r6 ) + m5;\n\t\t} else {\n\t\t\tmip = - 2.0 * log2( 1.16 * roughness );\t\t}\n\t\treturn mip;\n\t}\n\tvec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {\n\t\tfloat mip = clamp( roughnessToMip( roughness ), m0, cubeUV_maxMipLevel );\n\t\tfloat mipF = fract( mip );\n\t\tfloat mipInt = floor( mip );\n\t\tvec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );\n\t\tif ( mipF == 0.0 ) {\n\t\t\treturn vec4( color0, 1.0 );\n\t\t} else {\n\t\t\tvec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );\n\t\t\treturn vec4( mix( color0, color1, mipF ), 1.0 );\n\t\t}\n\t}\n#endif";
+
+       var defaultnormal_vertex = "vec3 transformedNormal = objectNormal;\n#ifdef USE_INSTANCING\n\tmat3 m = mat3( instanceMatrix );\n\ttransformedNormal /= vec3( dot( m[ 0 ], m[ 0 ] ), dot( m[ 1 ], m[ 1 ] ), dot( m[ 2 ], m[ 2 ] ) );\n\ttransformedNormal = m * transformedNormal;\n#endif\ntransformedNormal = normalMatrix * transformedNormal;\n#ifdef FLIP_SIDED\n\ttransformedNormal = - transformedNormal;\n#endif\n#ifdef USE_TANGENT\n\tvec3 transformedTangent = ( modelViewMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n\t#ifdef FLIP_SIDED\n\t\ttransformedTangent = - transformedTangent;\n\t#endif\n#endif";
+
+       var displacementmap_pars_vertex = "#ifdef USE_DISPLACEMENTMAP\n\tuniform sampler2D displacementMap;\n\tuniform float displacementScale;\n\tuniform float displacementBias;\n#endif";
+
+       var displacementmap_vertex = "#ifdef USE_DISPLACEMENTMAP\n\ttransformed += normalize( objectNormal ) * ( texture2D( displacementMap, vUv ).x * displacementScale + displacementBias );\n#endif";
+
+       var emissivemap_fragment = "#ifdef USE_EMISSIVEMAP\n\tvec4 emissiveColor = texture2D( emissiveMap, vUv );\n\temissiveColor.rgb = emissiveMapTexelToLinear( emissiveColor ).rgb;\n\ttotalEmissiveRadiance *= emissiveColor.rgb;\n#endif";
+
+       var emissivemap_pars_fragment = "#ifdef USE_EMISSIVEMAP\n\tuniform sampler2D emissiveMap;\n#endif";
+
+       var encodings_fragment = "gl_FragColor = linearToOutputTexel( gl_FragColor );";
+
+       var encodings_pars_fragment = "\nvec4 LinearToLinear( in vec4 value ) {\n\treturn value;\n}\nvec4 GammaToLinear( in vec4 value, in float gammaFactor ) {\n\treturn vec4( pow( value.rgb, vec3( gammaFactor ) ), value.a );\n}\nvec4 LinearToGamma( in vec4 value, in float gammaFactor ) {\n\treturn vec4( pow( value.rgb, vec3( 1.0 / gammaFactor ) ), value.a );\n}\nvec4 sRGBToLinear( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.a );\n}\nvec4 LinearTosRGB( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a );\n}\nvec4 RGBEToLinear( in vec4 value ) {\n\treturn vec4( value.rgb * exp2( value.a * 255.0 - 128.0 ), 1.0 );\n}\nvec4 LinearToRGBE( in vec4 value ) {\n\tfloat maxComponent = max( max( value.r, value.g ), value.b );\n\tfloat fExp = clamp( ceil( log2( maxComponent ) ), -128.0, 127.0 );\n\treturn vec4( value.rgb / exp2( fExp ), ( fExp + 128.0 ) / 255.0 );\n}\nvec4 RGBMToLinear( in vec4 value, in float maxRange ) {\n\treturn vec4( value.rgb * value.a * maxRange, 1.0 );\n}\nvec4 LinearToRGBM( in vec4 value, in float maxRange ) {\n\tfloat maxRGB = max( value.r, max( value.g, value.b ) );\n\tfloat M = clamp( maxRGB / maxRange, 0.0, 1.0 );\n\tM = ceil( M * 255.0 ) / 255.0;\n\treturn vec4( value.rgb / ( M * maxRange ), M );\n}\nvec4 RGBDToLinear( in vec4 value, in float maxRange ) {\n\treturn vec4( value.rgb * ( ( maxRange / 255.0 ) / value.a ), 1.0 );\n}\nvec4 LinearToRGBD( in vec4 value, in float maxRange ) {\n\tfloat maxRGB = max( value.r, max( value.g, value.b ) );\n\tfloat D = max( maxRange / maxRGB, 1.0 );\n\tD = clamp( floor( D ) / 255.0, 0.0, 1.0 );\n\treturn vec4( value.rgb * ( D * ( 255.0 / maxRange ) ), D );\n}\nconst mat3 cLogLuvM = mat3( 0.2209, 0.3390, 0.4184, 0.1138, 0.6780, 0.7319, 0.0102, 0.1130, 0.2969 );\nvec4 LinearToLogLuv( in vec4 value ) {\n\tvec3 Xp_Y_XYZp = cLogLuvM * value.rgb;\n\tXp_Y_XYZp = max( Xp_Y_XYZp, vec3( 1e-6, 1e-6, 1e-6 ) );\n\tvec4 vResult;\n\tvResult.xy = Xp_Y_XYZp.xy / Xp_Y_XYZp.z;\n\tfloat Le = 2.0 * log2(Xp_Y_XYZp.y) + 127.0;\n\tvResult.w = fract( Le );\n\tvResult.z = ( Le - ( floor( vResult.w * 255.0 ) ) / 255.0 ) / 255.0;\n\treturn vResult;\n}\nconst mat3 cLogLuvInverseM = mat3( 6.0014, -2.7008, -1.7996, -1.3320, 3.1029, -5.7721, 0.3008, -1.0882, 5.6268 );\nvec4 LogLuvToLinear( in vec4 value ) {\n\tfloat Le = value.z * 255.0 + value.w;\n\tvec3 Xp_Y_XYZp;\n\tXp_Y_XYZp.y = exp2( ( Le - 127.0 ) / 2.0 );\n\tXp_Y_XYZp.z = Xp_Y_XYZp.y / value.y;\n\tXp_Y_XYZp.x = value.x * Xp_Y_XYZp.z;\n\tvec3 vRGB = cLogLuvInverseM * Xp_Y_XYZp.rgb;\n\treturn vec4( max( vRGB, 0.0 ), 1.0 );\n}";
+
+       var envmap_fragment = "#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvec3 cameraToFrag;\n\t\tif ( isOrthographic ) {\n\t\t\tcameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToFrag = normalize( vWorldPosition - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( cameraToFrag, worldNormal );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );\n\t\t#endif\n\t#else\n\t\tvec3 reflectVec = vReflect;\n\t#endif\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 envColor = textureCube( envMap, vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n\t\tenvColor = envMapTexelToLinear( envColor );\n\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\tvec4 envColor = textureCubeUV( envMap, reflectVec, 0.0 );\n\t#else\n\t\tvec4 envColor = vec4( 0.0 );\n\t#endif\n\t#ifdef ENVMAP_BLENDING_MULTIPLY\n\t\toutgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_MIX )\n\t\toutgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_ADD )\n\t\toutgoingLight += envColor.xyz * specularStrength * reflectivity;\n\t#endif\n#endif";
+
+       var envmap_common_pars_fragment = "#ifdef USE_ENVMAP\n\tuniform float envMapIntensity;\n\tuniform float flipEnvMap;\n\tuniform int maxMipLevel;\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tuniform samplerCube envMap;\n\t#else\n\t\tuniform sampler2D envMap;\n\t#endif\n\t\n#endif";
+
+       var envmap_pars_fragment = "#ifdef USE_ENVMAP\n\tuniform float reflectivity;\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\tvarying vec3 vWorldPosition;\n\t\tuniform float refractionRatio;\n\t#else\n\t\tvarying vec3 vReflect;\n\t#endif\n#endif";
+
+       var envmap_pars_vertex = "#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) ||defined( PHONG )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\t\n\t\tvarying vec3 vWorldPosition;\n\t#else\n\t\tvarying vec3 vReflect;\n\t\tuniform float refractionRatio;\n\t#endif\n#endif";
+
+       var envmap_vertex = "#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvWorldPosition = worldPosition.xyz;\n\t#else\n\t\tvec3 cameraToVertex;\n\t\tif ( isOrthographic ) {\n\t\t\tcameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvReflect = reflect( cameraToVertex, worldNormal );\n\t\t#else\n\t\t\tvReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n\t\t#endif\n\t#endif\n#endif";
+
+       var fog_vertex = "#ifdef USE_FOG\n\tvFogDepth = - mvPosition.z;\n#endif";
+
+       var fog_pars_vertex = "#ifdef USE_FOG\n\tvarying float vFogDepth;\n#endif";
+
+       var fog_fragment = "#ifdef USE_FOG\n\t#ifdef FOG_EXP2\n\t\tfloat fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );\n\t#else\n\t\tfloat fogFactor = smoothstep( fogNear, fogFar, vFogDepth );\n\t#endif\n\tgl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\n#endif";
+
+       var fog_pars_fragment = "#ifdef USE_FOG\n\tuniform vec3 fogColor;\n\tvarying float vFogDepth;\n\t#ifdef FOG_EXP2\n\t\tuniform float fogDensity;\n\t#else\n\t\tuniform float fogNear;\n\t\tuniform float fogFar;\n\t#endif\n#endif";
+
+       var gradientmap_pars_fragment = "#ifdef USE_GRADIENTMAP\n\tuniform sampler2D gradientMap;\n#endif\nvec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {\n\tfloat dotNL = dot( normal, lightDirection );\n\tvec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );\n\t#ifdef USE_GRADIENTMAP\n\t\treturn texture2D( gradientMap, coord ).rgb;\n\t#else\n\t\treturn ( coord.x < 0.7 ) ? vec3( 0.7 ) : vec3( 1.0 );\n\t#endif\n}";
+
+       var lightmap_fragment = "#ifdef USE_LIGHTMAP\n\tvec4 lightMapTexel = texture2D( lightMap, vUv2 );\n\tvec3 lightMapIrradiance = lightMapTexelToLinear( lightMapTexel ).rgb * lightMapIntensity;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tlightMapIrradiance *= PI;\n\t#endif\n\treflectedLight.indirectDiffuse += lightMapIrradiance;\n#endif";
+
+       var lightmap_pars_fragment = "#ifdef USE_LIGHTMAP\n\tuniform sampler2D lightMap;\n\tuniform float lightMapIntensity;\n#endif";
+
+       var lights_lambert_vertex = "vec3 diffuse = vec3( 1.0 );\nGeometricContext geometry;\ngeometry.position = mvPosition.xyz;\ngeometry.normal = normalize( transformedNormal );\ngeometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( -mvPosition.xyz );\nGeometricContext backGeometry;\nbackGeometry.position = geometry.position;\nbackGeometry.normal = -geometry.normal;\nbackGeometry.viewDir = geometry.viewDir;\nvLightFront = vec3( 0.0 );\nvIndirectFront = vec3( 0.0 );\n#ifdef DOUBLE_SIDED\n\tvLightBack = vec3( 0.0 );\n\tvIndirectBack = vec3( 0.0 );\n#endif\nIncidentLight directLight;\nfloat dotNL;\nvec3 directLightColor_Diffuse;\nvIndirectFront += getAmbientLightIrradiance( ambientLightColor );\nvIndirectFront += getLightProbeIrradiance( lightProbe, geometry );\n#ifdef DOUBLE_SIDED\n\tvIndirectBack += getAmbientLightIrradiance( ambientLightColor );\n\tvIndirectBack += getLightProbeIrradiance( lightProbe, backGeometry );\n#endif\n#if NUM_POINT_LIGHTS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tgetPointLightInfo( pointLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( - dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tgetSpotLightInfo( spotLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( - dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if NUM_DIR_LIGHTS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tgetDirectionalLightInfo( directionalLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( - dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\tvIndirectFront += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvIndirectBack += getHemisphereLightIrradiance( hemisphereLights[ i ], backGeometry );\n\t\t#endif\n\t}\n\t#pragma unroll_loop_end\n#endif";
+
+       var lights_pars_begin = "uniform bool receiveShadow;\nuniform vec3 ambientLightColor;\nuniform vec3 lightProbe[ 9 ];\nvec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {\n\tfloat x = normal.x, y = normal.y, z = normal.z;\n\tvec3 result = shCoefficients[ 0 ] * 0.886227;\n\tresult += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;\n\tresult += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;\n\tresult += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;\n\tresult += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;\n\tresult += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;\n\tresult += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );\n\tresult += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;\n\tresult += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );\n\treturn result;\n}\nvec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in GeometricContext geometry ) {\n\tvec3 worldNormal = inverseTransformDirection( geometry.normal, viewMatrix );\n\tvec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );\n\treturn irradiance;\n}\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n\tvec3 irradiance = ambientLightColor;\n\treturn irradiance;\n}\nfloat getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n\t#if defined ( PHYSICALLY_CORRECT_LIGHTS )\n\t\tfloat distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n\t\tif ( cutoffDistance > 0.0 ) {\n\t\t\tdistanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n\t\t}\n\t\treturn distanceFalloff;\n\t#else\n\t\tif ( cutoffDistance > 0.0 && decayExponent > 0.0 ) {\n\t\t\treturn pow( saturate( - lightDistance / cutoffDistance + 1.0 ), decayExponent );\n\t\t}\n\t\treturn 1.0;\n\t#endif\n}\nfloat getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) {\n\treturn smoothstep( coneCosine, penumbraCosine, angleCosine );\n}\n#if NUM_DIR_LIGHTS > 0\n\tstruct DirectionalLight {\n\t\tvec3 direction;\n\t\tvec3 color;\n\t};\n\tuniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n\tvoid getDirectionalLightInfo( const in DirectionalLight directionalLight, const in GeometricContext geometry, out IncidentLight light ) {\n\t\tlight.color = directionalLight.color;\n\t\tlight.direction = directionalLight.direction;\n\t\tlight.visible = true;\n\t}\n#endif\n#if NUM_POINT_LIGHTS > 0\n\tstruct PointLight {\n\t\tvec3 position;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t};\n\tuniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n\tvoid getPointLightInfo( const in PointLight pointLight, const in GeometricContext geometry, out IncidentLight light ) {\n\t\tvec3 lVector = pointLight.position - geometry.position;\n\t\tlight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tlight.color = pointLight.color;\n\t\tlight.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay );\n\t\tlight.visible = ( light.color != vec3( 0.0 ) );\n\t}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\tstruct SpotLight {\n\t\tvec3 position;\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tfloat coneCos;\n\t\tfloat penumbraCos;\n\t};\n\tuniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n\tvoid getSpotLightInfo( const in SpotLight spotLight, const in GeometricContext geometry, out IncidentLight light ) {\n\t\tvec3 lVector = spotLight.position - geometry.position;\n\t\tlight.direction = normalize( lVector );\n\t\tfloat angleCos = dot( light.direction, spotLight.direction );\n\t\tfloat spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n\t\tif ( spotAttenuation > 0.0 ) {\n\t\t\tfloat lightDistance = length( lVector );\n\t\t\tlight.color = spotLight.color * spotAttenuation;\n\t\t\tlight.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay );\n\t\t\tlight.visible = ( light.color != vec3( 0.0 ) );\n\t\t} else {\n\t\t\tlight.color = vec3( 0.0 );\n\t\t\tlight.visible = false;\n\t\t}\n\t}\n#endif\n#if NUM_RECT_AREA_LIGHTS > 0\n\tstruct RectAreaLight {\n\t\tvec3 color;\n\t\tvec3 position;\n\t\tvec3 halfWidth;\n\t\tvec3 halfHeight;\n\t};\n\tuniform sampler2D ltc_1;\tuniform sampler2D ltc_2;\n\tuniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\tstruct HemisphereLight {\n\t\tvec3 direction;\n\t\tvec3 skyColor;\n\t\tvec3 groundColor;\n\t};\n\tuniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n\tvec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in GeometricContext geometry ) {\n\t\tfloat dotNL = dot( geometry.normal, hemiLight.direction );\n\t\tfloat hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n\t\tvec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n\t\treturn irradiance;\n\t}\n#endif";
+
+       var envmap_physical_pars_fragment = "#if defined( USE_ENVMAP )\n\t#ifdef ENVMAP_MODE_REFRACTION\n\t\tuniform float refractionRatio;\n\t#endif\n\tvec3 getIBLIrradiance( const in GeometricContext geometry ) {\n\t\t#if defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec3 worldNormal = inverseTransformDirection( geometry.normal, viewMatrix );\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, worldNormal, 1.0 );\n\t\t\treturn PI * envMapColor.rgb * envMapIntensity;\n\t\t#else\n\t\t\treturn vec3( 0.0 );\n\t\t#endif\n\t}\n\tvec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {\n\t\t#if defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec3 reflectVec;\n\t\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\t\treflectVec = reflect( - viewDir, normal );\n\t\t\t\treflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );\n\t\t\t#else\n\t\t\t\treflectVec = refract( - viewDir, normal, refractionRatio );\n\t\t\t#endif\n\t\t\treflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, reflectVec, roughness );\n\t\t\treturn envMapColor.rgb * envMapIntensity;\n\t\t#else\n\t\t\treturn vec3( 0.0 );\n\t\t#endif\n\t}\n#endif";
+
+       var lights_toon_fragment = "ToonMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;";
+
+       var lights_toon_pars_fragment = "varying vec3 vViewPosition;\nstruct ToonMaterial {\n\tvec3 diffuseColor;\n};\nvoid RE_Direct_Toon( const in IncidentLight directLight, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\tvec3 irradiance = getGradientIrradiance( geometry.normal, directLight.direction ) * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_Toon\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Toon\n#define Material_LightProbeLOD( material )\t(0)";
+
+       var lights_phong_fragment = "BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;";
+
+       var lights_phong_pars_fragment = "varying vec3 vViewPosition;\nstruct BlinnPhongMaterial {\n\tvec3 diffuseColor;\n\tvec3 specularColor;\n\tfloat specularShininess;\n\tvec3 specularStrength;\n};\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n\treflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight, geometry, material.specularColor, material.specularShininess ) * material.specularStrength.rgb;\n}\nvoid RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_BlinnPhong\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_BlinnPhong\n#define Material_LightProbeLOD( material )\t(0)";
+
+       var lights_physical_fragment = "PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nvec3 dxy = max( abs( dFdx( geometryNormal ) ), abs( dFdy( geometryNormal ) ) );\nfloat geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );\nmaterial.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness;\nmaterial.roughness = min( material.roughness, 1.0 );\n#ifdef IOR\n\t#ifdef SPECULAR\n\t\tfloat specularIntensityFactor = specularIntensity;\n\t\tvec3 specularTintFactor = specularTint;\n\t\t#ifdef USE_SPECULARINTENSITYMAP\n\t\t\tspecularIntensityFactor *= texture2D( specularIntensityMap, vUv ).a;\n\t\t#endif\n\t\t#ifdef USE_SPECULARTINTMAP\n\t\t\tspecularTintFactor *= specularTintMapTexelToLinear( texture2D( specularTintMap, vUv ) ).rgb;\n\t\t#endif\n\t\tmaterial.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor );\n\t#else\n\t\tfloat specularIntensityFactor = 1.0;\n\t\tvec3 specularTintFactor = vec3( 1.0 );\n\t\tmaterial.specularF90 = 1.0;\n\t#endif\n\tmaterial.specularColor = mix( min( pow2( ( ior - 1.0 ) / ( ior + 1.0 ) ) * specularTintFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor );\n#else\n\tmaterial.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor );\n\tmaterial.specularF90 = 1.0;\n#endif\n#ifdef USE_CLEARCOAT\n\tmaterial.clearcoat = clearcoat;\n\tmaterial.clearcoatRoughness = clearcoatRoughness;\n\tmaterial.clearcoatF0 = vec3( 0.04 );\n\tmaterial.clearcoatF90 = 1.0;\n\t#ifdef USE_CLEARCOATMAP\n\t\tmaterial.clearcoat *= texture2D( clearcoatMap, vUv ).x;\n\t#endif\n\t#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\t\tmaterial.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vUv ).y;\n\t#endif\n\tmaterial.clearcoat = saturate( material.clearcoat );\tmaterial.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );\n\tmaterial.clearcoatRoughness += geometryRoughness;\n\tmaterial.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );\n#endif\n#ifdef USE_SHEEN\n\tmaterial.sheenTint = sheenTint;\n#endif";
+
+       var lights_physical_pars_fragment = "struct PhysicalMaterial {\n\tvec3 diffuseColor;\n\tfloat roughness;\n\tvec3 specularColor;\n\tfloat specularF90;\n\t#ifdef USE_CLEARCOAT\n\t\tfloat clearcoat;\n\t\tfloat clearcoatRoughness;\n\t\tvec3 clearcoatF0;\n\t\tfloat clearcoatF90;\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tvec3 sheenTint;\n\t#endif\n};\nvec3 clearcoatSpecular = vec3( 0.0 );\nvec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tconst vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\n\tconst vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\n\tvec4 r = roughness * c0 + c1;\n\tfloat a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\n\tvec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw;\n\treturn fab;\n}\nvec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {\n\tvec2 fab = DFGApprox( normal, viewDir, roughness );\n\treturn specularColor * fab.x + specularF90 * fab.y;\n}\nvoid 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 ) {\n\tvec2 fab = DFGApprox( normal, viewDir, roughness );\n\tvec3 FssEss = specularColor * fab.x + specularF90 * fab.y;\n\tfloat Ess = fab.x + fab.y;\n\tfloat Ems = 1.0 - Ess;\n\tvec3 Favg = specularColor + ( 1.0 - specularColor ) * 0.047619;\tvec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );\n\tsingleScatter += FssEss;\n\tmultiScatter += Fms * Ems;\n}\n#if NUM_RECT_AREA_LIGHTS > 0\n\tvoid RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t\tvec3 normal = geometry.normal;\n\t\tvec3 viewDir = geometry.viewDir;\n\t\tvec3 position = geometry.position;\n\t\tvec3 lightPos = rectAreaLight.position;\n\t\tvec3 halfWidth = rectAreaLight.halfWidth;\n\t\tvec3 halfHeight = rectAreaLight.halfHeight;\n\t\tvec3 lightColor = rectAreaLight.color;\n\t\tfloat roughness = material.roughness;\n\t\tvec3 rectCoords[ 4 ];\n\t\trectCoords[ 0 ] = lightPos + halfWidth - halfHeight;\t\trectCoords[ 1 ] = lightPos - halfWidth - halfHeight;\n\t\trectCoords[ 2 ] = lightPos - halfWidth + halfHeight;\n\t\trectCoords[ 3 ] = lightPos + halfWidth + halfHeight;\n\t\tvec2 uv = LTC_Uv( normal, viewDir, roughness );\n\t\tvec4 t1 = texture2D( ltc_1, uv );\n\t\tvec4 t2 = texture2D( ltc_2, uv );\n\t\tmat3 mInv = mat3(\n\t\t\tvec3( t1.x, 0, t1.y ),\n\t\t\tvec3(          0, 1,           0 ),\n\t\t\tvec3( t1.z, 0, t1.w )\n\t\t);\n\t\tvec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );\n\t\treflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n\t\treflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );\n\t}\n#endif\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifdef USE_CLEARCOAT\n\t\tfloat dotNLcc = saturate( dot( geometry.clearcoatNormal, directLight.direction ) );\n\t\tvec3 ccIrradiance = dotNLcc * directLight.color;\n\t\tclearcoatSpecular += ccIrradiance * BRDF_GGX( directLight, geometry.viewDir, geometry.clearcoatNormal, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );\n\t#endif\n\t#ifdef USE_SHEEN\n\t\treflectedLight.directSpecular += irradiance * BRDF_Sheen( material.roughness, directLight.direction, geometry, material.sheenTint );\n\t#else\n\t\treflectedLight.directSpecular += irradiance * BRDF_GGX( directLight, geometry.viewDir, geometry.normal, material.specularColor, material.specularF90, material.roughness );\n\t#endif\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\n\t#ifdef USE_CLEARCOAT\n\t\tclearcoatSpecular += clearcoatRadiance * EnvironmentBRDF( geometry.clearcoatNormal, geometry.viewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );\n\t#endif\n\tvec3 singleScattering = vec3( 0.0 );\n\tvec3 multiScattering = vec3( 0.0 );\n\tvec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n\tcomputeMultiscattering( geometry.normal, geometry.viewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering );\n\tvec3 diffuse = material.diffuseColor * ( 1.0 - ( singleScattering + multiScattering ) );\n\treflectedLight.indirectSpecular += radiance * singleScattering;\n\treflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;\n\treflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;\n}\n#define RE_Direct\t\t\t\tRE_Direct_Physical\n#define RE_Direct_RectArea\t\tRE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular\t\tRE_IndirectSpecular_Physical\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n\treturn saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n}";
+
+       var lights_fragment_begin = "\nGeometricContext geometry;\ngeometry.position = - vViewPosition;\ngeometry.normal = normal;\ngeometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );\n#ifdef USE_CLEARCOAT\n\tgeometry.clearcoatNormal = clearcoatNormal;\n#endif\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n\tPointLight pointLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tgetPointLightInfo( pointLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )\n\t\tpointLightShadow = pointLightShadows[ i ];\n\t\tdirectLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n\tSpotLight spotLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tgetSpotLightInfo( spotLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\tspotLightShadow = spotLightShadows[ i ];\n\t\tdirectLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n\tDirectionalLight directionalLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tgetDirectionalLightInfo( directionalLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\n\t\tdirectionalLightShadow = directionalLightShadows[ i ];\n\t\tdirectLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n\tRectAreaLight rectAreaLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n\t\trectAreaLight = rectAreaLights[ i ];\n\t\tRE_Direct_RectArea( rectAreaLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if defined( RE_IndirectDiffuse )\n\tvec3 iblIrradiance = vec3( 0.0 );\n\tvec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n\tirradiance += getLightProbeIrradiance( lightProbe, geometry );\n\t#if ( NUM_HEMI_LIGHTS > 0 )\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\t\tirradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#endif\n#endif\n#if defined( RE_IndirectSpecular )\n\tvec3 radiance = vec3( 0.0 );\n\tvec3 clearcoatRadiance = vec3( 0.0 );\n#endif";
+
+       var lights_fragment_maps = "#if defined( RE_IndirectDiffuse )\n\t#ifdef USE_LIGHTMAP\n\t\tvec4 lightMapTexel = texture2D( lightMap, vUv2 );\n\t\tvec3 lightMapIrradiance = lightMapTexelToLinear( lightMapTexel ).rgb * lightMapIntensity;\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tlightMapIrradiance *= PI;\n\t\t#endif\n\t\tirradiance += lightMapIrradiance;\n\t#endif\n\t#if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )\n\t\tiblIrradiance += getIBLIrradiance( geometry );\n\t#endif\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n\tradiance += getIBLRadiance( geometry.viewDir, geometry.normal, material.roughness );\n\t#ifdef USE_CLEARCOAT\n\t\tclearcoatRadiance += getIBLRadiance( geometry.viewDir, geometry.clearcoatNormal, material.clearcoatRoughness );\n\t#endif\n#endif";
+
+       var lights_fragment_end = "#if defined( RE_IndirectDiffuse )\n\tRE_IndirectDiffuse( irradiance, geometry, material, reflectedLight );\n#endif\n#if defined( RE_IndirectSpecular )\n\tRE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometry, material, reflectedLight );\n#endif";
+
+       var logdepthbuf_fragment = "#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n\tgl_FragDepthEXT = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\n#endif";
+
+       var logdepthbuf_pars_fragment = "#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n\tuniform float logDepthBufFC;\n\tvarying float vFragDepth;\n\tvarying float vIsPerspective;\n#endif";
+
+       var logdepthbuf_pars_vertex = "#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvarying float vFragDepth;\n\t\tvarying float vIsPerspective;\n\t#else\n\t\tuniform float logDepthBufFC;\n\t#endif\n#endif";
+
+       var logdepthbuf_vertex = "#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvFragDepth = 1.0 + gl_Position.w;\n\t\tvIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );\n\t#else\n\t\tif ( isPerspectiveMatrix( projectionMatrix ) ) {\n\t\t\tgl_Position.z = log2( max( EPSILON, gl_Position.w + 1.0 ) ) * logDepthBufFC - 1.0;\n\t\t\tgl_Position.z *= gl_Position.w;\n\t\t}\n\t#endif\n#endif";
+
+       var map_fragment = "#ifdef USE_MAP\n\tvec4 texelColor = texture2D( map, vUv );\n\ttexelColor = mapTexelToLinear( texelColor );\n\tdiffuseColor *= texelColor;\n#endif";
+
+       var map_pars_fragment = "#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif";
+
+       var map_particle_fragment = "#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\tvec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;\n#endif\n#ifdef USE_MAP\n\tvec4 mapTexel = texture2D( map, uv );\n\tdiffuseColor *= mapTexelToLinear( mapTexel );\n#endif\n#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, uv ).g;\n#endif";
+
+       var map_particle_pars_fragment = "#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\tuniform mat3 uvTransform;\n#endif\n#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif\n#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif";
+
+       var metalnessmap_fragment = "float metalnessFactor = metalness;\n#ifdef USE_METALNESSMAP\n\tvec4 texelMetalness = texture2D( metalnessMap, vUv );\n\tmetalnessFactor *= texelMetalness.b;\n#endif";
+
+       var metalnessmap_pars_fragment = "#ifdef USE_METALNESSMAP\n\tuniform sampler2D metalnessMap;\n#endif";
+
+       var morphnormal_vertex = "#ifdef USE_MORPHNORMALS\n\tobjectNormal *= morphTargetBaseInfluence;\n\tobjectNormal += morphNormal0 * morphTargetInfluences[ 0 ];\n\tobjectNormal += morphNormal1 * morphTargetInfluences[ 1 ];\n\tobjectNormal += morphNormal2 * morphTargetInfluences[ 2 ];\n\tobjectNormal += morphNormal3 * morphTargetInfluences[ 3 ];\n#endif";
+
+       var morphtarget_pars_vertex = "#ifdef USE_MORPHTARGETS\n\tuniform float morphTargetBaseInfluence;\n\t#ifndef USE_MORPHNORMALS\n\t\tuniform float morphTargetInfluences[ 8 ];\n\t#else\n\t\tuniform float morphTargetInfluences[ 4 ];\n\t#endif\n#endif";
+
+       var morphtarget_vertex = "#ifdef USE_MORPHTARGETS\n\ttransformed *= morphTargetBaseInfluence;\n\ttransformed += morphTarget0 * morphTargetInfluences[ 0 ];\n\ttransformed += morphTarget1 * morphTargetInfluences[ 1 ];\n\ttransformed += morphTarget2 * morphTargetInfluences[ 2 ];\n\ttransformed += morphTarget3 * morphTargetInfluences[ 3 ];\n\t#ifndef USE_MORPHNORMALS\n\t\ttransformed += morphTarget4 * morphTargetInfluences[ 4 ];\n\t\ttransformed += morphTarget5 * morphTargetInfluences[ 5 ];\n\t\ttransformed += morphTarget6 * morphTargetInfluences[ 6 ];\n\t\ttransformed += morphTarget7 * morphTargetInfluences[ 7 ];\n\t#endif\n#endif";
+
+       var normal_fragment_begin = "float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;\n#ifdef FLAT_SHADED\n\tvec3 fdx = vec3( dFdx( vViewPosition.x ), dFdx( vViewPosition.y ), dFdx( vViewPosition.z ) );\n\tvec3 fdy = vec3( dFdy( vViewPosition.x ), dFdy( vViewPosition.y ), dFdy( vViewPosition.z ) );\n\tvec3 normal = normalize( cross( fdx, fdy ) );\n#else\n\tvec3 normal = normalize( vNormal );\n\t#ifdef DOUBLE_SIDED\n\t\tnormal = normal * faceDirection;\n\t#endif\n\t#ifdef USE_TANGENT\n\t\tvec3 tangent = normalize( vTangent );\n\t\tvec3 bitangent = normalize( vBitangent );\n\t\t#ifdef DOUBLE_SIDED\n\t\t\ttangent = tangent * faceDirection;\n\t\t\tbitangent = bitangent * faceDirection;\n\t\t#endif\n\t\t#if defined( TANGENTSPACE_NORMALMAP ) || defined( USE_CLEARCOAT_NORMALMAP )\n\t\t\tmat3 vTBN = mat3( tangent, bitangent, normal );\n\t\t#endif\n\t#endif\n#endif\nvec3 geometryNormal = normal;";
+
+       var normal_fragment_maps = "#ifdef OBJECTSPACE_NORMALMAP\n\tnormal = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\t#ifdef FLIP_SIDED\n\t\tnormal = - normal;\n\t#endif\n\t#ifdef DOUBLE_SIDED\n\t\tnormal = normal * faceDirection;\n\t#endif\n\tnormal = normalize( normalMatrix * normal );\n#elif defined( TANGENTSPACE_NORMALMAP )\n\tvec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\tmapN.xy *= normalScale;\n\t#ifdef USE_TANGENT\n\t\tnormal = normalize( vTBN * mapN );\n\t#else\n\t\tnormal = perturbNormal2Arb( - vViewPosition, normal, mapN, faceDirection );\n\t#endif\n#elif defined( USE_BUMPMAP )\n\tnormal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );\n#endif";
+
+       var normal_pars_fragment = "#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif";
+
+       var normal_pars_vertex = "#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif";
+
+       var normal_vertex = "#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n\t#ifdef USE_TANGENT\n\t\tvTangent = normalize( transformedTangent );\n\t\tvBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );\n\t#endif\n#endif";
+
+       var normalmap_pars_fragment = "#ifdef USE_NORMALMAP\n\tuniform sampler2D normalMap;\n\tuniform vec2 normalScale;\n#endif\n#ifdef OBJECTSPACE_NORMALMAP\n\tuniform mat3 normalMatrix;\n#endif\n#if ! defined ( USE_TANGENT ) && ( defined ( TANGENTSPACE_NORMALMAP ) || defined ( USE_CLEARCOAT_NORMALMAP ) )\n\tvec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm, vec3 mapN, float faceDirection ) {\n\t\tvec3 q0 = vec3( dFdx( eye_pos.x ), dFdx( eye_pos.y ), dFdx( eye_pos.z ) );\n\t\tvec3 q1 = vec3( dFdy( eye_pos.x ), dFdy( eye_pos.y ), dFdy( eye_pos.z ) );\n\t\tvec2 st0 = dFdx( vUv.st );\n\t\tvec2 st1 = dFdy( vUv.st );\n\t\tvec3 N = surf_norm;\n\t\tvec3 q1perp = cross( q1, N );\n\t\tvec3 q0perp = cross( N, q0 );\n\t\tvec3 T = q1perp * st0.x + q0perp * st1.x;\n\t\tvec3 B = q1perp * st0.y + q0perp * st1.y;\n\t\tfloat det = max( dot( T, T ), dot( B, B ) );\n\t\tfloat scale = ( det == 0.0 ) ? 0.0 : faceDirection * inversesqrt( det );\n\t\treturn normalize( T * ( mapN.x * scale ) + B * ( mapN.y * scale ) + N * mapN.z );\n\t}\n#endif";
+
+       var clearcoat_normal_fragment_begin = "#ifdef USE_CLEARCOAT\n\tvec3 clearcoatNormal = geometryNormal;\n#endif";
+
+       var clearcoat_normal_fragment_maps = "#ifdef USE_CLEARCOAT_NORMALMAP\n\tvec3 clearcoatMapN = texture2D( clearcoatNormalMap, vUv ).xyz * 2.0 - 1.0;\n\tclearcoatMapN.xy *= clearcoatNormalScale;\n\t#ifdef USE_TANGENT\n\t\tclearcoatNormal = normalize( vTBN * clearcoatMapN );\n\t#else\n\t\tclearcoatNormal = perturbNormal2Arb( - vViewPosition, clearcoatNormal, clearcoatMapN, faceDirection );\n\t#endif\n#endif";
+
+       var clearcoat_pars_fragment = "#ifdef USE_CLEARCOATMAP\n\tuniform sampler2D clearcoatMap;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tuniform sampler2D clearcoatRoughnessMap;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tuniform sampler2D clearcoatNormalMap;\n\tuniform vec2 clearcoatNormalScale;\n#endif";
+
+       var output_fragment = "#ifdef OPAQUE\ndiffuseColor.a = 1.0;\n#endif\n#ifdef USE_TRANSMISSION\ndiffuseColor.a *= transmissionAlpha + 0.1;\n#endif\ngl_FragColor = vec4( outgoingLight, diffuseColor.a );";
+
+       var packing = "vec3 packNormalToRGB( const in vec3 normal ) {\n\treturn normalize( normal ) * 0.5 + 0.5;\n}\nvec3 unpackRGBToNormal( const in vec3 rgb ) {\n\treturn 2.0 * rgb.xyz - 1.0;\n}\nconst float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;\nconst vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );\nconst vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. );\nconst float ShiftRight8 = 1. / 256.;\nvec4 packDepthToRGBA( const in float v ) {\n\tvec4 r = vec4( fract( v * PackFactors ), v );\n\tr.yzw -= r.xyz * ShiftRight8;\treturn r * PackUpscale;\n}\nfloat unpackRGBAToDepth( const in vec4 v ) {\n\treturn dot( v, UnpackFactors );\n}\nvec4 pack2HalfToRGBA( vec2 v ) {\n\tvec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) );\n\treturn vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w );\n}\nvec2 unpackRGBATo2Half( vec4 v ) {\n\treturn vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );\n}\nfloat viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn ( viewZ + near ) / ( near - far );\n}\nfloat orthographicDepthToViewZ( const in float linearClipZ, const in float near, const in float far ) {\n\treturn linearClipZ * ( near - far ) - near;\n}\nfloat viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ );\n}\nfloat perspectiveDepthToViewZ( const in float invClipZ, const in float near, const in float far ) {\n\treturn ( near * far ) / ( ( far - near ) * invClipZ - far );\n}";
+
+       var premultiplied_alpha_fragment = "#ifdef PREMULTIPLIED_ALPHA\n\tgl_FragColor.rgb *= gl_FragColor.a;\n#endif";
+
+       var project_vertex = "vec4 mvPosition = vec4( transformed, 1.0 );\n#ifdef USE_INSTANCING\n\tmvPosition = instanceMatrix * mvPosition;\n#endif\nmvPosition = modelViewMatrix * mvPosition;\ngl_Position = projectionMatrix * mvPosition;";
+
+       var dithering_fragment = "#ifdef DITHERING\n\tgl_FragColor.rgb = dithering( gl_FragColor.rgb );\n#endif";
+
+       var dithering_pars_fragment = "#ifdef DITHERING\n\tvec3 dithering( vec3 color ) {\n\t\tfloat grid_position = rand( gl_FragCoord.xy );\n\t\tvec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );\n\t\tdither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );\n\t\treturn color + dither_shift_RGB;\n\t}\n#endif";
+
+       var roughnessmap_fragment = "float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\n\tvec4 texelRoughness = texture2D( roughnessMap, vUv );\n\troughnessFactor *= texelRoughness.g;\n#endif";
+
+       var roughnessmap_pars_fragment = "#ifdef USE_ROUGHNESSMAP\n\tuniform sampler2D roughnessMap;\n#endif";
+
+       var shadowmap_pars_fragment = "#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n\tfloat texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\n\t\treturn step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );\n\t}\n\tvec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {\n\t\treturn unpackRGBATo2Half( texture2D( shadow, uv ) );\n\t}\n\tfloat VSMShadow (sampler2D shadow, vec2 uv, float compare ){\n\t\tfloat occlusion = 1.0;\n\t\tvec2 distribution = texture2DDistribution( shadow, uv );\n\t\tfloat hard_shadow = step( compare , distribution.x );\n\t\tif (hard_shadow != 1.0 ) {\n\t\t\tfloat distance = compare - distribution.x ;\n\t\t\tfloat variance = max( 0.00000, distribution.y * distribution.y );\n\t\t\tfloat softness_probability = variance / (variance + distance * distance );\t\t\tsoftness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 );\t\t\tocclusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 );\n\t\t}\n\t\treturn occlusion;\n\t}\n\tfloat getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\t\tfloat shadow = 1.0;\n\t\tshadowCoord.xyz /= shadowCoord.w;\n\t\tshadowCoord.z += shadowBias;\n\t\tbvec4 inFrustumVec = bvec4 ( shadowCoord.x >= 0.0, shadowCoord.x <= 1.0, shadowCoord.y >= 0.0, shadowCoord.y <= 1.0 );\n\t\tbool inFrustum = all( inFrustumVec );\n\t\tbvec2 frustumTestVec = bvec2( inFrustum, shadowCoord.z <= 1.0 );\n\t\tbool frustumTest = all( frustumTestVec );\n\t\tif ( frustumTest ) {\n\t\t#if defined( SHADOWMAP_TYPE_PCF )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx0 = - texelSize.x * shadowRadius;\n\t\t\tfloat dy0 = - texelSize.y * shadowRadius;\n\t\t\tfloat dx1 = + texelSize.x * shadowRadius;\n\t\t\tfloat dy1 = + texelSize.y * shadowRadius;\n\t\t\tfloat dx2 = dx0 / 2.0;\n\t\t\tfloat dy2 = dy0 / 2.0;\n\t\t\tfloat dx3 = dx1 / 2.0;\n\t\t\tfloat dy3 = dy1 / 2.0;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n\t\t\t) * ( 1.0 / 17.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx = texelSize.x;\n\t\t\tfloat dy = texelSize.y;\n\t\t\tvec2 uv = shadowCoord.xy;\n\t\t\tvec2 f = fract( uv * shadowMapSize + 0.5 );\n\t\t\tuv -= f * texelSize;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, uv, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ), \n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ), \n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ), \n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ), \n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ), \n\t\t\t\t\t\t  texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t\t f.x ),\n\t\t\t\t\t mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ), \n\t\t\t\t\t\t        texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t\t    f.x ),\n\t\t\t\t\t f.y )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_VSM )\n\t\t\tshadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#else\n\t\t\tshadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#endif\n\t\t}\n\t\treturn shadow;\n\t}\n\tvec2 cubeToUV( vec3 v, float texelSizeY ) {\n\t\tvec3 absV = abs( v );\n\t\tfloat scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );\n\t\tabsV *= scaleToCube;\n\t\tv *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );\n\t\tvec2 planar = v.xy;\n\t\tfloat almostATexel = 1.5 * texelSizeY;\n\t\tfloat almostOne = 1.0 - almostATexel;\n\t\tif ( absV.z >= almostOne ) {\n\t\t\tif ( v.z > 0.0 )\n\t\t\t\tplanar.x = 4.0 - v.x;\n\t\t} else if ( absV.x >= almostOne ) {\n\t\t\tfloat signX = sign( v.x );\n\t\t\tplanar.x = v.z * signX + 2.0 * signX;\n\t\t} else if ( absV.y >= almostOne ) {\n\t\t\tfloat signY = sign( v.y );\n\t\t\tplanar.x = v.x + 2.0 * signY + 2.0;\n\t\t\tplanar.y = v.z * signY - 2.0;\n\t\t}\n\t\treturn vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );\n\t}\n\tfloat getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\n\t\tvec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );\n\t\tvec3 lightToPosition = shadowCoord.xyz;\n\t\tfloat dp = ( length( lightToPosition ) - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear );\t\tdp += shadowBias;\n\t\tvec3 bd3D = normalize( lightToPosition );\n\t\t#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )\n\t\t\tvec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;\n\t\t\treturn (\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#else\n\t\t\treturn texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );\n\t\t#endif\n\t}\n#endif";
+
+       var shadowmap_pars_vertex = "#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tuniform mat4 spotShadowMatrix[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n#endif";
+
+       var shadowmap_vertex = "#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0 || NUM_SPOT_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0\n\t\tvec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\t\tvec4 shadowWorldPosition;\n\t#endif\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );\n\t\tvDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias, 0 );\n\t\tvSpotShadowCoord[ i ] = spotShadowMatrix[ i ] * shadowWorldPosition;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );\n\t\tvPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n#endif";
+
+       var shadowmask_pars_fragment = "float getShadowMask() {\n\tfloat shadow = 1.0;\n\t#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\tdirectionalLight = directionalLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n\t\tspotLight = spotLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\tpointLight = pointLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#endif\n\treturn shadow;\n}";
+
+       var skinbase_vertex = "#ifdef USE_SKINNING\n\tmat4 boneMatX = getBoneMatrix( skinIndex.x );\n\tmat4 boneMatY = getBoneMatrix( skinIndex.y );\n\tmat4 boneMatZ = getBoneMatrix( skinIndex.z );\n\tmat4 boneMatW = getBoneMatrix( skinIndex.w );\n#endif";
+
+       var skinning_pars_vertex = "#ifdef USE_SKINNING\n\tuniform mat4 bindMatrix;\n\tuniform mat4 bindMatrixInverse;\n\t#ifdef BONE_TEXTURE\n\t\tuniform highp sampler2D boneTexture;\n\t\tuniform int boneTextureSize;\n\t\tmat4 getBoneMatrix( const in float i ) {\n\t\t\tfloat j = i * 4.0;\n\t\t\tfloat x = mod( j, float( boneTextureSize ) );\n\t\t\tfloat y = floor( j / float( boneTextureSize ) );\n\t\t\tfloat dx = 1.0 / float( boneTextureSize );\n\t\t\tfloat dy = 1.0 / float( boneTextureSize );\n\t\t\ty = dy * ( y + 0.5 );\n\t\t\tvec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) );\n\t\t\tvec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) );\n\t\t\tvec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) );\n\t\t\tvec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) );\n\t\t\tmat4 bone = mat4( v1, v2, v3, v4 );\n\t\t\treturn bone;\n\t\t}\n\t#else\n\t\tuniform mat4 boneMatrices[ MAX_BONES ];\n\t\tmat4 getBoneMatrix( const in float i ) {\n\t\t\tmat4 bone = boneMatrices[ int(i) ];\n\t\t\treturn bone;\n\t\t}\n\t#endif\n#endif";
+
+       var skinning_vertex = "#ifdef USE_SKINNING\n\tvec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );\n\tvec4 skinned = vec4( 0.0 );\n\tskinned += boneMatX * skinVertex * skinWeight.x;\n\tskinned += boneMatY * skinVertex * skinWeight.y;\n\tskinned += boneMatZ * skinVertex * skinWeight.z;\n\tskinned += boneMatW * skinVertex * skinWeight.w;\n\ttransformed = ( bindMatrixInverse * skinned ).xyz;\n#endif";
+
+       var skinnormal_vertex = "#ifdef USE_SKINNING\n\tmat4 skinMatrix = mat4( 0.0 );\n\tskinMatrix += skinWeight.x * boneMatX;\n\tskinMatrix += skinWeight.y * boneMatY;\n\tskinMatrix += skinWeight.z * boneMatZ;\n\tskinMatrix += skinWeight.w * boneMatW;\n\tskinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;\n\tobjectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;\n\t#ifdef USE_TANGENT\n\t\tobjectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n\t#endif\n#endif";
+
+       var specularmap_fragment = "vec3 specularStrength;\n#ifdef USE_SPECULARMAP\n\tvec4 texelSpecular = texture2D( specularMap, vUv );\n\tspecularStrength = texelSpecular.rgb;\n#else\n\tspecularStrength = vec3( 1.0, 1.0, 1.0 );\n#endif";
+
+       var specularmap_pars_fragment = "#ifdef USE_SPECULARMAP\n\tuniform sampler2D specularMap;\n#endif";
+
+       var tonemapping_fragment = "#if defined( TONE_MAPPING )\n\tgl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n#endif";
+
+       var tonemapping_pars_fragment = "#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\nuniform float toneMappingExposure;\nvec3 LinearToneMapping( vec3 color ) {\n\treturn toneMappingExposure * color;\n}\nvec3 ReinhardToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( color / ( vec3( 1.0 ) + color ) );\n}\nvec3 OptimizedCineonToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\tcolor = max( vec3( 0.0 ), color - 0.004 );\n\treturn pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n}\nvec3 RRTAndODTFit( vec3 v ) {\n\tvec3 a = v * ( v + 0.0245786 ) - 0.000090537;\n\tvec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;\n\treturn a / b;\n}\nvec3 ACESFilmicToneMapping( vec3 color ) {\n\tconst mat3 ACESInputMat = mat3(\n\t\tvec3( 0.59719, 0.07600, 0.02840 ),\t\tvec3( 0.35458, 0.90834, 0.13383 ),\n\t\tvec3( 0.04823, 0.01566, 0.83777 )\n\t);\n\tconst mat3 ACESOutputMat = mat3(\n\t\tvec3(   1.60475, -0.10208, -0.00327 ),\t\tvec3( -0.53108,       1.10813, -0.07276 ),\n\t\tvec3( -0.07367, -0.00605,     1.07602 )\n\t);\n\tcolor *= toneMappingExposure / 0.6;\n\tcolor = ACESInputMat * color;\n\tcolor = RRTAndODTFit( color );\n\tcolor = ACESOutputMat * color;\n\treturn saturate( color );\n}\nvec3 CustomToneMapping( vec3 color ) { return color; }";
+
+       var transmission_fragment = "#ifdef USE_TRANSMISSION\n\tfloat transmissionAlpha = 1.0;\n\tfloat transmissionFactor = transmission;\n\tfloat thicknessFactor = thickness;\n\t#ifdef USE_TRANSMISSIONMAP\n\t\ttransmissionFactor *= texture2D( transmissionMap, vUv ).r;\n\t#endif\n\t#ifdef USE_THICKNESSMAP\n\t\tthicknessFactor *= texture2D( thicknessMap, vUv ).g;\n\t#endif\n\tvec3 pos = vWorldPosition;\n\tvec3 v = normalize( cameraPosition - pos );\n\tvec3 n = inverseTransformDirection( normal, viewMatrix );\n\tvec4 transmission = getIBLVolumeRefraction(\n\t\tn, v, roughnessFactor, material.diffuseColor, material.specularColor, material.specularF90,\n\t\tpos, modelMatrix, viewMatrix, projectionMatrix, ior, thicknessFactor,\n\t\tattenuationTint, attenuationDistance );\n\ttotalDiffuse = mix( totalDiffuse, transmission.rgb, transmissionFactor );\n\ttransmissionAlpha = transmission.a;\n#endif";
+
+       var transmission_pars_fragment = "#ifdef USE_TRANSMISSION\n\tuniform float transmission;\n\tuniform float thickness;\n\tuniform float attenuationDistance;\n\tuniform vec3 attenuationTint;\n\t#ifdef USE_TRANSMISSIONMAP\n\t\tuniform sampler2D transmissionMap;\n\t#endif\n\t#ifdef USE_THICKNESSMAP\n\t\tuniform sampler2D thicknessMap;\n\t#endif\n\tuniform vec2 transmissionSamplerSize;\n\tuniform sampler2D transmissionSamplerMap;\n\tuniform mat4 modelMatrix;\n\tuniform mat4 projectionMatrix;\n\tvarying vec3 vWorldPosition;\n\tvec3 getVolumeTransmissionRay( vec3 n, vec3 v, float thickness, float ior, mat4 modelMatrix ) {\n\t\tvec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );\n\t\tvec3 modelScale;\n\t\tmodelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );\n\t\tmodelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );\n\t\tmodelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );\n\t\treturn normalize( refractionVector ) * thickness * modelScale;\n\t}\n\tfloat applyIorToRoughness( float roughness, float ior ) {\n\t\treturn roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );\n\t}\n\tvec4 getTransmissionSample( vec2 fragCoord, float roughness, float ior ) {\n\t\tfloat framebufferLod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );\n\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\treturn texture2DLodEXT( transmissionSamplerMap, fragCoord.xy, framebufferLod );\n\t\t#else\n\t\t\treturn texture2D( transmissionSamplerMap, fragCoord.xy, framebufferLod );\n\t\t#endif\n\t}\n\tvec3 applyVolumeAttenuation( vec3 radiance, float transmissionDistance, vec3 attenuationColor, float attenuationDistance ) {\n\t\tif ( attenuationDistance == 0.0 ) {\n\t\t\treturn radiance;\n\t\t} else {\n\t\t\tvec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;\n\t\t\tvec3 transmittance = exp( - attenuationCoefficient * transmissionDistance );\t\t\treturn transmittance * radiance;\n\t\t}\n\t}\n\tvec4 getIBLVolumeRefraction( vec3 n, vec3 v, float roughness, vec3 diffuseColor, vec3 specularColor, float specularF90,\n\t\tvec3 position, mat4 modelMatrix, mat4 viewMatrix, mat4 projMatrix, float ior, float thickness,\n\t\tvec3 attenuationColor, float attenuationDistance ) {\n\t\tvec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );\n\t\tvec3 refractedRayExit = position + transmissionRay;\n\t\tvec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );\n\t\tvec2 refractionCoords = ndcPos.xy / ndcPos.w;\n\t\trefractionCoords += 1.0;\n\t\trefractionCoords /= 2.0;\n\t\tvec4 transmittedLight = getTransmissionSample( refractionCoords, roughness, ior );\n\t\tvec3 attenuatedColor = applyVolumeAttenuation( transmittedLight.rgb, length( transmissionRay ), attenuationColor, attenuationDistance );\n\t\tvec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );\n\t\treturn vec4( ( 1.0 - F ) * attenuatedColor * diffuseColor, transmittedLight.a );\n\t}\n#endif";
+
+       var uv_pars_fragment = "#if ( defined( USE_UV ) && ! defined( UVS_VERTEX_ONLY ) )\n\tvarying vec2 vUv;\n#endif";
+
+       var uv_pars_vertex = "#ifdef USE_UV\n\t#ifdef UVS_VERTEX_ONLY\n\t\tvec2 vUv;\n\t#else\n\t\tvarying vec2 vUv;\n\t#endif\n\tuniform mat3 uvTransform;\n#endif";
+
+       var uv_vertex = "#ifdef USE_UV\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n#endif";
+
+       var uv2_pars_fragment = "#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvarying vec2 vUv2;\n#endif";
+
+       var uv2_pars_vertex = "#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tattribute vec2 uv2;\n\tvarying vec2 vUv2;\n\tuniform mat3 uv2Transform;\n#endif";
+
+       var uv2_vertex = "#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvUv2 = ( uv2Transform * vec3( uv2, 1 ) ).xy;\n#endif";
+
+       var worldpos_vertex = "#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION )\n\tvec4 worldPosition = vec4( transformed, 1.0 );\n\t#ifdef USE_INSTANCING\n\t\tworldPosition = instanceMatrix * worldPosition;\n\t#endif\n\tworldPosition = modelMatrix * worldPosition;\n#endif";
+
+       var background_frag = "uniform sampler2D t2D;\nvarying vec2 vUv;\nvoid main() {\n\tvec4 texColor = texture2D( t2D, vUv );\n\tgl_FragColor = mapTexelToLinear( texColor );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n}";
+
+       var background_vert = "varying vec2 vUv;\nuniform mat3 uvTransform;\nvoid main() {\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n\tgl_Position = vec4( position.xy, 1.0, 1.0 );\n}";
+
+       var cube_frag = "#include <envmap_common_pars_fragment>\nuniform float opacity;\nvarying vec3 vWorldDirection;\n#include <cube_uv_reflection_fragment>\nvoid main() {\n\tvec3 vReflect = vWorldDirection;\n\t#include <envmap_fragment>\n\tgl_FragColor = envColor;\n\tgl_FragColor.a *= opacity;\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n}";
+
+       var cube_vert = "varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n\tgl_Position.z = gl_Position.w;\n}";
+
+       var depth_frag = "#if DEPTH_PACKING == 3200\n\tuniform float opacity;\n#endif\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#if DEPTH_PACKING == 3200\n\t\tdiffuseColor.a = opacity;\n\t#endif\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <logdepthbuf_fragment>\n\tfloat fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;\n\t#if DEPTH_PACKING == 3200\n\t\tgl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );\n\t#elif DEPTH_PACKING == 3201\n\t\tgl_FragColor = packDepthToRGBA( fragCoordZ );\n\t#endif\n}";
+
+       var depth_vert = "#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\t#include <uv_vertex>\n\t#include <skinbase_vertex>\n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvHighPrecisionZW = gl_Position.zw;\n}";
+
+       var distanceRGBA_frag = "#define DISTANCE\nuniform vec3 referencePosition;\nuniform float nearDistance;\nuniform float farDistance;\nvarying vec3 vWorldPosition;\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main () {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\tfloat dist = length( vWorldPosition - referencePosition );\n\tdist = ( dist - nearDistance ) / ( farDistance - nearDistance );\n\tdist = saturate( dist );\n\tgl_FragColor = packDepthToRGBA( dist );\n}";
+
+       var distanceRGBA_vert = "#define DISTANCE\nvarying vec3 vWorldPosition;\n#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <skinbase_vertex>\n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <worldpos_vertex>\n\t#include <clipping_planes_vertex>\n\tvWorldPosition = worldPosition.xyz;\n}";
+
+       var equirect_frag = "uniform sampler2D tEquirect;\nvarying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvec3 direction = normalize( vWorldDirection );\n\tvec2 sampleUV = equirectUv( direction );\n\tvec4 texColor = texture2D( tEquirect, sampleUV );\n\tgl_FragColor = mapTexelToLinear( texColor );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n}";
+
+       var equirect_vert = "varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n}";
+
+       var linedashed_frag = "uniform vec3 diffuse;\nuniform float opacity;\nuniform float dashSize;\nuniform float totalSize;\nvarying float vLineDistance;\n#include <common>\n#include <color_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tif ( mod( vLineDistance, totalSize ) > dashSize ) {\n\t\tdiscard;\n\t}\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <color_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\t#include <output_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n}";
+
+       var linedashed_vert = "uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\n#include <common>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\tvLineDistance = scale * lineDistance;\n\t#include <color_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n}";
+
+       var meshbasic_frag = "uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <cube_uv_reflection_fragment>\n#include <fog_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\t#ifdef USE_LIGHTMAP\n\t\tvec4 lightMapTexel= texture2D( lightMap, vUv2 );\n\t\treflectedLight.indirectDiffuse += lightMapTexelToLinear( lightMapTexel ).rgb * lightMapIntensity;\n\t#else\n\t\treflectedLight.indirectDiffuse += vec3( 1.0 );\n\t#endif\n\t#include <aomap_fragment>\n\treflectedLight.indirectDiffuse *= diffuseColor.rgb;\n\tvec3 outgoingLight = reflectedLight.indirectDiffuse;\n\t#include <envmap_fragment>\n\t#include <output_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}";
+
+       var meshbasic_vert = "#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinbase_vertex>\n\t\t#include <skinnormal_vertex>\n\t\t#include <defaultnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <fog_vertex>\n}";
+
+       var meshlambert_frag = "uniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\nvarying vec3 vLightFront;\nvarying vec3 vIndirectFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n\tvarying vec3 vIndirectBack;\n#endif\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <cube_uv_reflection_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <fog_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <shadowmask_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\t#include <emissivemap_fragment>\n\t#ifdef DOUBLE_SIDED\n\t\treflectedLight.indirectDiffuse += ( gl_FrontFacing ) ? vIndirectFront : vIndirectBack;\n\t#else\n\t\treflectedLight.indirectDiffuse += vIndirectFront;\n\t#endif\n\t#include <lightmap_fragment>\n\treflectedLight.indirectDiffuse *= BRDF_Lambert( diffuseColor.rgb );\n\t#ifdef DOUBLE_SIDED\n\t\treflectedLight.directDiffuse = ( gl_FrontFacing ) ? vLightFront : vLightBack;\n\t#else\n\t\treflectedLight.directDiffuse = vLightFront;\n\t#endif\n\treflectedLight.directDiffuse *= BRDF_Lambert( diffuseColor.rgb ) * getShadowMask();\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include <envmap_fragment>\n\t#include <output_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}";
+
+       var meshlambert_vert = "#define LAMBERT\nvarying vec3 vLightFront;\nvarying vec3 vIndirectFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n\tvarying vec3 vIndirectBack;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <envmap_pars_vertex>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <lights_lambert_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}";
+
+       var meshmatcap_frag = "#define MATCAP\nuniform vec3 diffuse;\nuniform float opacity;\nuniform sampler2D matcap;\nvarying vec3 vViewPosition;\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <fog_pars_fragment>\n#include <normal_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\tvec3 viewDir = normalize( vViewPosition );\n\tvec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );\n\tvec3 y = cross( viewDir, x );\n\tvec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;\n\t#ifdef USE_MATCAP\n\t\tvec4 matcapColor = texture2D( matcap, uv );\n\t\tmatcapColor = matcapTexelToLinear( matcapColor );\n\t#else\n\t\tvec4 matcapColor = vec4( 1.0 );\n\t#endif\n\tvec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;\n\t#include <output_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}";
+
+       var meshmatcap_vert = "#define MATCAP\nvarying vec3 vViewPosition;\n#include <common>\n#include <uv_pars_vertex>\n#include <color_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n\tvViewPosition = - mvPosition.xyz;\n}";
+
+       var meshnormal_frag = "#define NORMAL\nuniform float opacity;\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\tvarying vec3 vViewPosition;\n#endif\n#include <packing>\n#include <uv_pars_fragment>\n#include <normal_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\t#include <logdepthbuf_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\tgl_FragColor = vec4( packNormalToRGB( normal ), opacity );\n}";
+
+       var meshnormal_vert = "#define NORMAL\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\tvarying vec3 vViewPosition;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\tvViewPosition = - mvPosition.xyz;\n#endif\n}";
+
+       var meshphong_frag = "#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <cube_uv_reflection_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_phong_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_phong_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\t#include <envmap_fragment>\n\t#include <output_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}";
+
+       var meshphong_vert = "#define PHONG\nvarying vec3 vViewPosition;\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}";
+
+       var meshphysical_frag = "#define STANDARD\n#ifdef PHYSICAL\n\t#define IOR\n\t#define SPECULAR\n#endif\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifdef IOR\n\tuniform float ior;\n#endif\n#ifdef SPECULAR\n\tuniform float specularIntensity;\n\tuniform vec3 specularTint;\n\t#ifdef USE_SPECULARINTENSITYMAP\n\t\tuniform sampler2D specularIntensityMap;\n\t#endif\n\t#ifdef USE_SPECULARTINTMAP\n\t\tuniform sampler2D specularTintMap;\n\t#endif\n#endif\n#ifdef USE_CLEARCOAT\n\tuniform float clearcoat;\n\tuniform float clearcoatRoughness;\n#endif\n#ifdef USE_SHEEN\n\tuniform vec3 sheenTint;\n#endif\nvarying vec3 vViewPosition;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <bsdfs>\n#include <cube_uv_reflection_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_physical_pars_fragment>\n#include <fog_pars_fragment>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_physical_pars_fragment>\n#include <transmission_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <clearcoat_pars_fragment>\n#include <roughnessmap_pars_fragment>\n#include <metalnessmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <roughnessmap_fragment>\n\t#include <metalnessmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <clearcoat_normal_fragment_begin>\n\t#include <clearcoat_normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_physical_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;\n\tvec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;\n\t#include <transmission_fragment>\n\tvec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;\n\t#ifdef USE_CLEARCOAT\n\t\tfloat dotNVcc = saturate( dot( geometry.clearcoatNormal, geometry.viewDir ) );\n\t\tvec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );\n\t\toutgoingLight = outgoingLight * ( 1.0 - clearcoat * Fcc ) + clearcoatSpecular * clearcoat;\n\t#endif\n\t#include <output_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}";
+
+       var meshphysical_vert = "#define STANDARD\nvarying vec3 vViewPosition;\n#ifdef USE_TRANSMISSION\n\tvarying vec3 vWorldPosition;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n#ifdef USE_TRANSMISSION\n\tvWorldPosition = worldPosition.xyz;\n#endif\n}";
+
+       var meshtoon_frag = "#define TOON\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <gradientmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_toon_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_toon_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include <output_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}";
+
+       var meshtoon_vert = "#define TOON\nvarying vec3 vViewPosition;\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}";
+
+       var points_frag = "uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <color_pars_fragment>\n#include <map_particle_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_particle_fragment>\n\t#include <color_fragment>\n\t#include <alphatest_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\t#include <output_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n}";
+
+       var points_vert = "uniform float size;\nuniform float scale;\n#include <common>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <color_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <project_vertex>\n\tgl_PointSize = size;\n\t#ifdef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );\n\t#endif\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <fog_vertex>\n}";
+
+       var shadow_frag = "uniform vec3 color;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <shadowmap_pars_fragment>\n#include <shadowmask_pars_fragment>\nvoid main() {\n\tgl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n}";
+
+       var shadow_vert = "#include <common>\n#include <fog_pars_vertex>\n#include <shadowmap_pars_vertex>\nvoid main() {\n\t#include <begin_vertex>\n\t#include <project_vertex>\n\t#include <worldpos_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}";
+
+       var sprite_frag = "uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\t#include <output_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n}";
+
+       var sprite_vert = "uniform float rotation;\nuniform vec2 center;\n#include <common>\n#include <uv_pars_vertex>\n#include <fog_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\tvec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );\n\tvec2 scale;\n\tscale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) );\n\tscale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) );\n\t#ifndef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) scale *= - mvPosition.z;\n\t#endif\n\tvec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;\n\tvec2 rotatedPosition;\n\trotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\n\trotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\n\tmvPosition.xy += rotatedPosition;\n\tgl_Position = projectionMatrix * mvPosition;\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n}";
+
+       const ShaderChunk = {
+               alphamap_fragment: alphamap_fragment,
+               alphamap_pars_fragment: alphamap_pars_fragment,
+               alphatest_fragment: alphatest_fragment,
+               alphatest_pars_fragment: alphatest_pars_fragment,
+               aomap_fragment: aomap_fragment,
+               aomap_pars_fragment: aomap_pars_fragment,
+               begin_vertex: begin_vertex,
+               beginnormal_vertex: beginnormal_vertex,
+               bsdfs: bsdfs,
+               bumpmap_pars_fragment: bumpmap_pars_fragment,
+               clipping_planes_fragment: clipping_planes_fragment,
+               clipping_planes_pars_fragment: clipping_planes_pars_fragment,
+               clipping_planes_pars_vertex: clipping_planes_pars_vertex,
+               clipping_planes_vertex: clipping_planes_vertex,
+               color_fragment: color_fragment,
+               color_pars_fragment: color_pars_fragment,
+               color_pars_vertex: color_pars_vertex,
+               color_vertex: color_vertex,
+               common: common,
+               cube_uv_reflection_fragment: cube_uv_reflection_fragment,
+               defaultnormal_vertex: defaultnormal_vertex,
+               displacementmap_pars_vertex: displacementmap_pars_vertex,
+               displacementmap_vertex: displacementmap_vertex,
+               emissivemap_fragment: emissivemap_fragment,
+               emissivemap_pars_fragment: emissivemap_pars_fragment,
+               encodings_fragment: encodings_fragment,
+               encodings_pars_fragment: encodings_pars_fragment,
+               envmap_fragment: envmap_fragment,
+               envmap_common_pars_fragment: envmap_common_pars_fragment,
+               envmap_pars_fragment: envmap_pars_fragment,
+               envmap_pars_vertex: envmap_pars_vertex,
+               envmap_physical_pars_fragment: envmap_physical_pars_fragment,
+               envmap_vertex: envmap_vertex,
+               fog_vertex: fog_vertex,
+               fog_pars_vertex: fog_pars_vertex,
+               fog_fragment: fog_fragment,
+               fog_pars_fragment: fog_pars_fragment,
+               gradientmap_pars_fragment: gradientmap_pars_fragment,
+               lightmap_fragment: lightmap_fragment,
+               lightmap_pars_fragment: lightmap_pars_fragment,
+               lights_lambert_vertex: lights_lambert_vertex,
+               lights_pars_begin: lights_pars_begin,
+               lights_toon_fragment: lights_toon_fragment,
+               lights_toon_pars_fragment: lights_toon_pars_fragment,
+               lights_phong_fragment: lights_phong_fragment,
+               lights_phong_pars_fragment: lights_phong_pars_fragment,
+               lights_physical_fragment: lights_physical_fragment,
+               lights_physical_pars_fragment: lights_physical_pars_fragment,
+               lights_fragment_begin: lights_fragment_begin,
+               lights_fragment_maps: lights_fragment_maps,
+               lights_fragment_end: lights_fragment_end,
+               logdepthbuf_fragment: logdepthbuf_fragment,
+               logdepthbuf_pars_fragment: logdepthbuf_pars_fragment,
+               logdepthbuf_pars_vertex: logdepthbuf_pars_vertex,
+               logdepthbuf_vertex: logdepthbuf_vertex,
+               map_fragment: map_fragment,
+               map_pars_fragment: map_pars_fragment,
+               map_particle_fragment: map_particle_fragment,
+               map_particle_pars_fragment: map_particle_pars_fragment,
+               metalnessmap_fragment: metalnessmap_fragment,
+               metalnessmap_pars_fragment: metalnessmap_pars_fragment,
+               morphnormal_vertex: morphnormal_vertex,
+               morphtarget_pars_vertex: morphtarget_pars_vertex,
+               morphtarget_vertex: morphtarget_vertex,
+               normal_fragment_begin: normal_fragment_begin,
+               normal_fragment_maps: normal_fragment_maps,
+               normal_pars_fragment: normal_pars_fragment,
+               normal_pars_vertex: normal_pars_vertex,
+               normal_vertex: normal_vertex,
+               normalmap_pars_fragment: normalmap_pars_fragment,
+               clearcoat_normal_fragment_begin: clearcoat_normal_fragment_begin,
+               clearcoat_normal_fragment_maps: clearcoat_normal_fragment_maps,
+               clearcoat_pars_fragment: clearcoat_pars_fragment,
+               output_fragment: output_fragment,
+               packing: packing,
+               premultiplied_alpha_fragment: premultiplied_alpha_fragment,
+               project_vertex: project_vertex,
+               dithering_fragment: dithering_fragment,
+               dithering_pars_fragment: dithering_pars_fragment,
+               roughnessmap_fragment: roughnessmap_fragment,
+               roughnessmap_pars_fragment: roughnessmap_pars_fragment,
+               shadowmap_pars_fragment: shadowmap_pars_fragment,
+               shadowmap_pars_vertex: shadowmap_pars_vertex,
+               shadowmap_vertex: shadowmap_vertex,
+               shadowmask_pars_fragment: shadowmask_pars_fragment,
+               skinbase_vertex: skinbase_vertex,
+               skinning_pars_vertex: skinning_pars_vertex,
+               skinning_vertex: skinning_vertex,
+               skinnormal_vertex: skinnormal_vertex,
+               specularmap_fragment: specularmap_fragment,
+               specularmap_pars_fragment: specularmap_pars_fragment,
+               tonemapping_fragment: tonemapping_fragment,
+               tonemapping_pars_fragment: tonemapping_pars_fragment,
+               transmission_fragment: transmission_fragment,
+               transmission_pars_fragment: transmission_pars_fragment,
+               uv_pars_fragment: uv_pars_fragment,
+               uv_pars_vertex: uv_pars_vertex,
+               uv_vertex: uv_vertex,
+               uv2_pars_fragment: uv2_pars_fragment,
+               uv2_pars_vertex: uv2_pars_vertex,
+               uv2_vertex: uv2_vertex,
+               worldpos_vertex: worldpos_vertex,
+               background_frag: background_frag,
+               background_vert: background_vert,
+               cube_frag: cube_frag,
+               cube_vert: cube_vert,
+               depth_frag: depth_frag,
+               depth_vert: depth_vert,
+               distanceRGBA_frag: distanceRGBA_frag,
+               distanceRGBA_vert: distanceRGBA_vert,
+               equirect_frag: equirect_frag,
+               equirect_vert: equirect_vert,
+               linedashed_frag: linedashed_frag,
+               linedashed_vert: linedashed_vert,
+               meshbasic_frag: meshbasic_frag,
+               meshbasic_vert: meshbasic_vert,
+               meshlambert_frag: meshlambert_frag,
+               meshlambert_vert: meshlambert_vert,
+               meshmatcap_frag: meshmatcap_frag,
+               meshmatcap_vert: meshmatcap_vert,
+               meshnormal_frag: meshnormal_frag,
+               meshnormal_vert: meshnormal_vert,
+               meshphong_frag: meshphong_frag,
+               meshphong_vert: meshphong_vert,
+               meshphysical_frag: meshphysical_frag,
+               meshphysical_vert: meshphysical_vert,
+               meshtoon_frag: meshtoon_frag,
+               meshtoon_vert: meshtoon_vert,
+               points_frag: points_frag,
+               points_vert: points_vert,
+               shadow_frag: shadow_frag,
+               shadow_vert: shadow_vert,
+               sprite_frag: sprite_frag,
+               sprite_vert: sprite_vert
+       };
+
+       /**
+        * Uniforms library for shared webgl shaders
+        */
+
+       const UniformsLib = {
+               common: {
+                       diffuse: {
+                               value: new Color(0xffffff)
+                       },
+                       opacity: {
+                               value: 1.0
+                       },
+                       map: {
+                               value: null
+                       },
+                       uvTransform: {
+                               value: new Matrix3()
+                       },
+                       uv2Transform: {
+                               value: new Matrix3()
+                       },
+                       alphaMap: {
+                               value: null
+                       },
+                       alphaTest: {
+                               value: 0
+                       }
+               },
+               specularmap: {
+                       specularMap: {
+                               value: null
+                       }
+               },
+               envmap: {
+                       envMap: {
+                               value: null
+                       },
+                       flipEnvMap: {
+                               value: -1
+                       },
+                       reflectivity: {
+                               value: 1.0
+                       },
+                       // basic, lambert, phong
+                       ior: {
+                               value: 1.5
+                       },
+                       // standard, physical
+                       refractionRatio: {
+                               value: 0.98
+                       },
+                       maxMipLevel: {
+                               value: 0
+                       }
+               },
+               aomap: {
+                       aoMap: {
+                               value: null
+                       },
+                       aoMapIntensity: {
+                               value: 1
+                       }
+               },
+               lightmap: {
+                       lightMap: {
+                               value: null
+                       },
+                       lightMapIntensity: {
+                               value: 1
+                       }
+               },
+               emissivemap: {
+                       emissiveMap: {
+                               value: null
+                       }
+               },
+               bumpmap: {
+                       bumpMap: {
+                               value: null
+                       },
+                       bumpScale: {
+                               value: 1
+                       }
+               },
+               normalmap: {
+                       normalMap: {
+                               value: null
+                       },
+                       normalScale: {
+                               value: new Vector2(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: 0.00025
+                       },
+                       fogNear: {
+                               value: 1
+                       },
+                       fogFar: {
+                               value: 2000
+                       },
+                       fogColor: {
+                               value: new Color(0xffffff)
+                       }
+               },
+               lights: {
+                       ambientLightColor: {
+                               value: []
+                       },
+                       lightProbe: {
+                               value: []
+                       },
+                       directionalLights: {
+                               value: [],
+                               properties: {
+                                       direction: {},
+                                       color: {}
+                               }
+                       },
+                       directionalLightShadows: {
+                               value: [],
+                               properties: {
+                                       shadowBias: {},
+                                       shadowNormalBias: {},
+                                       shadowRadius: {},
+                                       shadowMapSize: {}
+                               }
+                       },
+                       directionalShadowMap: {
+                               value: []
+                       },
+                       directionalShadowMatrix: {
+                               value: []
+                       },
+                       spotLights: {
+                               value: [],
+                               properties: {
+                                       color: {},
+                                       position: {},
+                                       direction: {},
+                                       distance: {},
+                                       coneCos: {},
+                                       penumbraCos: {},
+                                       decay: {}
+                               }
+                       },
+                       spotLightShadows: {
+                               value: [],
+                               properties: {
+                                       shadowBias: {},
+                                       shadowNormalBias: {},
+                                       shadowRadius: {},
+                                       shadowMapSize: {}
+                               }
+                       },
+                       spotShadowMap: {
+                               value: []
+                       },
+                       spotShadowMatrix: {
+                               value: []
+                       },
+                       pointLights: {
+                               value: [],
+                               properties: {
+                                       color: {},
+                                       position: {},
+                                       decay: {},
+                                       distance: {}
+                               }
+                       },
+                       pointLightShadows: {
+                               value: [],
+                               properties: {
+                                       shadowBias: {},
+                                       shadowNormalBias: {},
+                                       shadowRadius: {},
+                                       shadowMapSize: {},
+                                       shadowCameraNear: {},
+                                       shadowCameraFar: {}
+                               }
+                       },
+                       pointShadowMap: {
+                               value: []
+                       },
+                       pointShadowMatrix: {
+                               value: []
+                       },
+                       hemisphereLights: {
+                               value: [],
+                               properties: {
+                                       direction: {},
+                                       skyColor: {},
+                                       groundColor: {}
+                               }
+                       },
+                       // TODO (abelnation): RectAreaLight BRDF data needs to be moved from example to main src
+                       rectAreaLights: {
+                               value: [],
+                               properties: {
+                                       color: {},
+                                       position: {},
+                                       width: {},
+                                       height: {}
+                               }
+                       },
+                       ltc_1: {
+                               value: null
+                       },
+                       ltc_2: {
+                               value: null
+                       }
+               },
+               points: {
+                       diffuse: {
+                               value: new Color(0xffffff)
+                       },
+                       opacity: {
+                               value: 1.0
+                       },
+                       size: {
+                               value: 1.0
+                       },
+                       scale: {
+                               value: 1.0
+                       },
+                       map: {
+                               value: null
+                       },
+                       alphaMap: {
+                               value: null
+                       },
+                       alphaTest: {
+                               value: 0
+                       },
+                       uvTransform: {
+                               value: new Matrix3()
+                       }
+               },
+               sprite: {
+                       diffuse: {
+                               value: new Color(0xffffff)
+                       },
+                       opacity: {
+                               value: 1.0
+                       },
+                       center: {
+                               value: new Vector2(0.5, 0.5)
+                       },
+                       rotation: {
+                               value: 0.0
+                       },
+                       map: {
+                               value: null
+                       },
+                       alphaMap: {
+                               value: null
+                       },
+                       alphaTest: {
+                               value: 0
+                       },
+                       uvTransform: {
+                               value: new Matrix3()
+                       }
+               }
+       };
+
+       const ShaderLib = {
+               basic: {
+                       uniforms: mergeUniforms([UniformsLib.common, UniformsLib.specularmap, UniformsLib.envmap, UniformsLib.aomap, UniformsLib.lightmap, UniformsLib.fog]),
+                       vertexShader: ShaderChunk.meshbasic_vert,
+                       fragmentShader: ShaderChunk.meshbasic_frag
+               },
+               lambert: {
+                       uniforms: mergeUniforms([UniformsLib.common, UniformsLib.specularmap, UniformsLib.envmap, UniformsLib.aomap, UniformsLib.lightmap, UniformsLib.emissivemap, UniformsLib.fog, UniformsLib.lights, {
+                               emissive: {
+                                       value: new Color(0x000000)
+                               }
+                       }]),
+                       vertexShader: ShaderChunk.meshlambert_vert,
+                       fragmentShader: ShaderChunk.meshlambert_frag
+               },
+               phong: {
+                       uniforms: mergeUniforms([UniformsLib.common, UniformsLib.specularmap, UniformsLib.envmap, UniformsLib.aomap, UniformsLib.lightmap, UniformsLib.emissivemap, UniformsLib.bumpmap, UniformsLib.normalmap, UniformsLib.displacementmap, UniformsLib.fog, UniformsLib.lights, {
+                               emissive: {
+                                       value: new Color(0x000000)
+                               },
+                               specular: {
+                                       value: new Color(0x111111)
+                               },
+                               shininess: {
+                                       value: 30
+                               }
+                       }]),
+                       vertexShader: ShaderChunk.meshphong_vert,
+                       fragmentShader: ShaderChunk.meshphong_frag
+               },
+               standard: {
+                       uniforms: mergeUniforms([UniformsLib.common, UniformsLib.envmap, UniformsLib.aomap, UniformsLib.lightmap, UniformsLib.emissivemap, UniformsLib.bumpmap, UniformsLib.normalmap, UniformsLib.displacementmap, UniformsLib.roughnessmap, UniformsLib.metalnessmap, UniformsLib.fog, UniformsLib.lights, {
+                               emissive: {
+                                       value: new Color(0x000000)
+                               },
+                               roughness: {
+                                       value: 1.0
+                               },
+                               metalness: {
+                                       value: 0.0
+                               },
+                               envMapIntensity: {
+                                       value: 1
+                               } // temporary
+
+                       }]),
+                       vertexShader: ShaderChunk.meshphysical_vert,
+                       fragmentShader: ShaderChunk.meshphysical_frag
+               },
+               toon: {
+                       uniforms: mergeUniforms([UniformsLib.common, UniformsLib.aomap, UniformsLib.lightmap, UniformsLib.emissivemap, UniformsLib.bumpmap, UniformsLib.normalmap, UniformsLib.displacementmap, UniformsLib.gradientmap, UniformsLib.fog, UniformsLib.lights, {
+                               emissive: {
+                                       value: new Color(0x000000)
+                               }
+                       }]),
+                       vertexShader: ShaderChunk.meshtoon_vert,
+                       fragmentShader: ShaderChunk.meshtoon_frag
+               },
+               matcap: {
+                       uniforms: mergeUniforms([UniformsLib.common, UniformsLib.bumpmap, UniformsLib.normalmap, UniformsLib.displacementmap, UniformsLib.fog, {
+                               matcap: {
+                                       value: null
+                               }
+                       }]),
+                       vertexShader: ShaderChunk.meshmatcap_vert,
+                       fragmentShader: ShaderChunk.meshmatcap_frag
+               },
+               points: {
+                       uniforms: mergeUniforms([UniformsLib.points, UniformsLib.fog]),
+                       vertexShader: ShaderChunk.points_vert,
+                       fragmentShader: ShaderChunk.points_frag
+               },
+               dashed: {
+                       uniforms: mergeUniforms([UniformsLib.common, UniformsLib.fog, {
+                               scale: {
+                                       value: 1
+                               },
+                               dashSize: {
+                                       value: 1
+                               },
+                               totalSize: {
+                                       value: 2
+                               }
+                       }]),
+                       vertexShader: ShaderChunk.linedashed_vert,
+                       fragmentShader: ShaderChunk.linedashed_frag
+               },
+               depth: {
+                       uniforms: mergeUniforms([UniformsLib.common, UniformsLib.displacementmap]),
+                       vertexShader: ShaderChunk.depth_vert,
+                       fragmentShader: ShaderChunk.depth_frag
+               },
+               normal: {
+                       uniforms: mergeUniforms([UniformsLib.common, UniformsLib.bumpmap, UniformsLib.normalmap, UniformsLib.displacementmap, {
+                               opacity: {
+                                       value: 1.0
+                               }
+                       }]),
+                       vertexShader: ShaderChunk.meshnormal_vert,
+                       fragmentShader: ShaderChunk.meshnormal_frag
+               },
+               sprite: {
+                       uniforms: mergeUniforms([UniformsLib.sprite, UniformsLib.fog]),
+                       vertexShader: ShaderChunk.sprite_vert,
+                       fragmentShader: ShaderChunk.sprite_frag
+               },
+               background: {
+                       uniforms: {
+                               uvTransform: {
+                                       value: new Matrix3()
+                               },
+                               t2D: {
+                                       value: null
+                               }
+                       },
+                       vertexShader: ShaderChunk.background_vert,
+                       fragmentShader: ShaderChunk.background_frag
+               },
+
+               /* -------------------------------------------------------------------------
+               //      Cube map shader
+                ------------------------------------------------------------------------- */
+               cube: {
+                       uniforms: mergeUniforms([UniformsLib.envmap, {
+                               opacity: {
+                                       value: 1.0
+                               }
+                       }]),
+                       vertexShader: ShaderChunk.cube_vert,
+                       fragmentShader: ShaderChunk.cube_frag
+               },
+               equirect: {
+                       uniforms: {
+                               tEquirect: {
+                                       value: null
+                               }
+                       },
+                       vertexShader: ShaderChunk.equirect_vert,
+                       fragmentShader: ShaderChunk.equirect_frag
+               },
+               distanceRGBA: {
+                       uniforms: mergeUniforms([UniformsLib.common, UniformsLib.displacementmap, {
+                               referencePosition: {
+                                       value: new Vector3()
+                               },
+                               nearDistance: {
+                                       value: 1
+                               },
+                               farDistance: {
+                                       value: 1000
+                               }
+                       }]),
+                       vertexShader: ShaderChunk.distanceRGBA_vert,
+                       fragmentShader: ShaderChunk.distanceRGBA_frag
+               },
+               shadow: {
+                       uniforms: mergeUniforms([UniformsLib.lights, UniformsLib.fog, {
+                               color: {
+                                       value: new Color(0x00000)
+                               },
+                               opacity: {
+                                       value: 1.0
+                               }
+                       }]),
+                       vertexShader: ShaderChunk.shadow_vert,
+                       fragmentShader: ShaderChunk.shadow_frag
+               }
+       };
+       ShaderLib.physical = {
+               uniforms: mergeUniforms([ShaderLib.standard.uniforms, {
+                       clearcoat: {
+                               value: 0
+                       },
+                       clearcoatMap: {
+                               value: null
+                       },
+                       clearcoatRoughness: {
+                               value: 0
+                       },
+                       clearcoatRoughnessMap: {
+                               value: null
+                       },
+                       clearcoatNormalScale: {
+                               value: new Vector2(1, 1)
+                       },
+                       clearcoatNormalMap: {
+                               value: null
+                       },
+                       sheenTint: {
+                               value: new Color(0x000000)
+                       },
+                       transmission: {
+                               value: 0
+                       },
+                       transmissionMap: {
+                               value: null
+                       },
+                       transmissionSamplerSize: {
+                               value: new Vector2()
+                       },
+                       transmissionSamplerMap: {
+                               value: null
+                       },
+                       thickness: {
+                               value: 0
+                       },
+                       thicknessMap: {
+                               value: null
+                       },
+                       attenuationDistance: {
+                               value: 0
+                       },
+                       attenuationTint: {
+                               value: new Color(0x000000)
+                       },
+                       specularIntensity: {
+                               value: 0
+                       },
+                       specularIntensityMap: {
+                               value: null
+                       },
+                       specularTint: {
+                               value: new Color(1, 1, 1)
+                       },
+                       specularTintMap: {
+                               value: null
+                       }
+               }]),
+               vertexShader: ShaderChunk.meshphysical_vert,
+               fragmentShader: ShaderChunk.meshphysical_frag
+       };
+
+       function WebGLBackground(renderer, cubemaps, state, objects, premultipliedAlpha) {
+               const clearColor = new Color(0x000000);
+               let clearAlpha = 0;
+               let planeMesh;
+               let boxMesh;
+               let currentBackground = null;
+               let currentBackgroundVersion = 0;
+               let currentTonemapping = null;
+
+               function render(renderList, scene) {
+                       let forceClear = false;
+                       let background = scene.isScene === true ? scene.background : null;
+
+                       if (background && background.isTexture) {
+                               background = cubemaps.get(background);
+                       } // Ignore background in AR
+                       // TODO: Reconsider this.
+
+
+                       const xr = renderer.xr;
+                       const session = xr.getSession && xr.getSession();
+
+                       if (session && session.environmentBlendMode === 'additive') {
+                               background = null;
+                       }
+
+                       if (background === null) {
+                               setClear(clearColor, clearAlpha);
+                       } else if (background && background.isColor) {
+                               setClear(background, 1);
+                               forceClear = true;
+                       }
+
+                       if (renderer.autoClear || forceClear) {
+                               renderer.clear(renderer.autoClearColor, renderer.autoClearDepth, renderer.autoClearStencil);
+                       }
+
+                       if (background && (background.isCubeTexture || background.mapping === CubeUVReflectionMapping)) {
+                               if (boxMesh === undefined) {
+                                       boxMesh = new Mesh(new BoxGeometry(1, 1, 1), new ShaderMaterial({
+                                               name: 'BackgroundCubeMaterial',
+                                               uniforms: cloneUniforms(ShaderLib.cube.uniforms),
+                                               vertexShader: ShaderLib.cube.vertexShader,
+                                               fragmentShader: ShaderLib.cube.fragmentShader,
+                                               side: BackSide,
+                                               depthTest: false,
+                                               depthWrite: false,
+                                               fog: false
+                                       }));
+                                       boxMesh.geometry.deleteAttribute('normal');
+                                       boxMesh.geometry.deleteAttribute('uv');
+
+                                       boxMesh.onBeforeRender = function (renderer, scene, camera) {
+                                               this.matrixWorld.copyPosition(camera.matrixWorld);
+                                       }; // enable code injection for non-built-in material
+
+
+                                       Object.defineProperty(boxMesh.material, 'envMap', {
+                                               get: function () {
+                                                       return this.uniforms.envMap.value;
+                                               }
+                                       });
+                                       objects.update(boxMesh);
+                               }
+
+                               boxMesh.material.uniforms.envMap.value = background;
+                               boxMesh.material.uniforms.flipEnvMap.value = background.isCubeTexture && background.isRenderTargetTexture === false ? -1 : 1;
+
+                               if (currentBackground !== background || currentBackgroundVersion !== background.version || currentTonemapping !== renderer.toneMapping) {
+                                       boxMesh.material.needsUpdate = true;
+                                       currentBackground = background;
+                                       currentBackgroundVersion = background.version;
+                                       currentTonemapping = renderer.toneMapping;
+                               } // push to the pre-sorted opaque render list
+
+
+                               renderList.unshift(boxMesh, boxMesh.geometry, boxMesh.material, 0, 0, null);
+                       } else if (background && background.isTexture) {
+                               if (planeMesh === undefined) {
+                                       planeMesh = new Mesh(new PlaneGeometry(2, 2), new ShaderMaterial({
+                                               name: 'BackgroundMaterial',
+                                               uniforms: cloneUniforms(ShaderLib.background.uniforms),
+                                               vertexShader: ShaderLib.background.vertexShader,
+                                               fragmentShader: ShaderLib.background.fragmentShader,
+                                               side: FrontSide,
+                                               depthTest: false,
+                                               depthWrite: false,
+                                               fog: false
+                                       }));
+                                       planeMesh.geometry.deleteAttribute('normal'); // enable code injection for non-built-in material
+
+                                       Object.defineProperty(planeMesh.material, 'map', {
+                                               get: function () {
+                                                       return this.uniforms.t2D.value;
+                                               }
+                                       });
+                                       objects.update(planeMesh);
+                               }
+
+                               planeMesh.material.uniforms.t2D.value = background;
+
+                               if (background.matrixAutoUpdate === true) {
+                                       background.updateMatrix();
+                               }
+
+                               planeMesh.material.uniforms.uvTransform.value.copy(background.matrix);
+
+                               if (currentBackground !== background || currentBackgroundVersion !== background.version || currentTonemapping !== renderer.toneMapping) {
+                                       planeMesh.material.needsUpdate = true;
+                                       currentBackground = background;
+                                       currentBackgroundVersion = background.version;
+                                       currentTonemapping = renderer.toneMapping;
+                               } // push to the pre-sorted opaque render list
+
+
+                               renderList.unshift(planeMesh, planeMesh.geometry, planeMesh.material, 0, 0, null);
+                       }
+               }
+
+               function setClear(color, alpha) {
+                       state.buffers.color.setClear(color.r, color.g, color.b, alpha, premultipliedAlpha);
+               }
+
+               return {
+                       getClearColor: function () {
+                               return clearColor;
+                       },
+                       setClearColor: function (color, alpha = 1) {
+                               clearColor.set(color);
+                               clearAlpha = alpha;
+                               setClear(clearColor, clearAlpha);
+                       },
+                       getClearAlpha: function () {
+                               return clearAlpha;
+                       },
+                       setClearAlpha: function (alpha) {
+                               clearAlpha = alpha;
+                               setClear(clearColor, clearAlpha);
+                       },
+                       render: render
+               };
+       }
+
+       function WebGLBindingStates(gl, extensions, attributes, capabilities) {
+               const maxVertexAttributes = gl.getParameter(gl.MAX_VERTEX_ATTRIBS);
+               const extension = capabilities.isWebGL2 ? null : extensions.get('OES_vertex_array_object');
+               const vaoAvailable = capabilities.isWebGL2 || extension !== null;
+               const bindingStates = {};
+               const defaultState = createBindingState(null);
+               let currentState = defaultState;
+
+               function setup(object, material, program, geometry, index) {
+                       let updateBuffers = false;
+
+                       if (vaoAvailable) {
+                               const state = getBindingState(geometry, program, material);
+
+                               if (currentState !== state) {
+                                       currentState = state;
+                                       bindVertexArrayObject(currentState.object);
+                               }
+
+                               updateBuffers = needsUpdate(geometry, index);
+                               if (updateBuffers) saveCache(geometry, index);
+                       } else {
+                               const wireframe = material.wireframe === true;
+
+                               if (currentState.geometry !== geometry.id || currentState.program !== program.id || currentState.wireframe !== wireframe) {
+                                       currentState.geometry = geometry.id;
+                                       currentState.program = program.id;
+                                       currentState.wireframe = wireframe;
+                                       updateBuffers = true;
+                               }
+                       }
+
+                       if (object.isInstancedMesh === true) {
+                               updateBuffers = true;
+                       }
+
+                       if (index !== null) {
+                               attributes.update(index, gl.ELEMENT_ARRAY_BUFFER);
+                       }
+
+                       if (updateBuffers) {
+                               setupVertexAttributes(object, material, program, geometry);
+
+                               if (index !== null) {
+                                       gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, attributes.get(index).buffer);
+                               }
+                       }
+               }
+
+               function createVertexArrayObject() {
+                       if (capabilities.isWebGL2) return gl.createVertexArray();
+                       return extension.createVertexArrayOES();
+               }
+
+               function bindVertexArrayObject(vao) {
+                       if (capabilities.isWebGL2) return gl.bindVertexArray(vao);
+                       return extension.bindVertexArrayOES(vao);
+               }
+
+               function deleteVertexArrayObject(vao) {
+                       if (capabilities.isWebGL2) return gl.deleteVertexArray(vao);
+                       return extension.deleteVertexArrayOES(vao);
+               }
+
+               function getBindingState(geometry, program, material) {
+                       const wireframe = material.wireframe === true;
+                       let programMap = bindingStates[geometry.id];
+
+                       if (programMap === undefined) {
+                               programMap = {};
+                               bindingStates[geometry.id] = programMap;
+                       }
+
+                       let stateMap = programMap[program.id];
+
+                       if (stateMap === undefined) {
+                               stateMap = {};
+                               programMap[program.id] = stateMap;
+                       }
+
+                       let state = stateMap[wireframe];
+
+                       if (state === undefined) {
+                               state = createBindingState(createVertexArrayObject());
+                               stateMap[wireframe] = state;
+                       }
+
+                       return state;
+               }
+
+               function createBindingState(vao) {
+                       const newAttributes = [];
+                       const enabledAttributes = [];
+                       const attributeDivisors = [];
+
+                       for (let i = 0; i < maxVertexAttributes; i++) {
+                               newAttributes[i] = 0;
+                               enabledAttributes[i] = 0;
+                               attributeDivisors[i] = 0;
+                       }
+
+                       return {
+                               // for backward compatibility on non-VAO support browser
+                               geometry: null,
+                               program: null,
+                               wireframe: false,
+                               newAttributes: newAttributes,
+                               enabledAttributes: enabledAttributes,
+                               attributeDivisors: attributeDivisors,
+                               object: vao,
+                               attributes: {},
+                               index: null
+                       };
+               }
+
+               function needsUpdate(geometry, index) {
+                       const cachedAttributes = currentState.attributes;
+                       const geometryAttributes = geometry.attributes;
+                       let attributesNum = 0;
+
+                       for (const key in geometryAttributes) {
+                               const cachedAttribute = cachedAttributes[key];
+                               const geometryAttribute = geometryAttributes[key];
+                               if (cachedAttribute === undefined) return true;
+                               if (cachedAttribute.attribute !== geometryAttribute) return true;
+                               if (cachedAttribute.data !== geometryAttribute.data) return true;
+                               attributesNum++;
+                       }
+
+                       if (currentState.attributesNum !== attributesNum) return true;
+                       if (currentState.index !== index) return true;
+                       return false;
+               }
+
+               function saveCache(geometry, index) {
+                       const cache = {};
+                       const attributes = geometry.attributes;
+                       let attributesNum = 0;
+
+                       for (const key in attributes) {
+                               const attribute = attributes[key];
+                               const data = {};
+                               data.attribute = attribute;
+
+                               if (attribute.data) {
+                                       data.data = attribute.data;
+                               }
+
+                               cache[key] = data;
+                               attributesNum++;
+                       }
+
+                       currentState.attributes = cache;
+                       currentState.attributesNum = attributesNum;
+                       currentState.index = index;
+               }
+
+               function initAttributes() {
+                       const newAttributes = currentState.newAttributes;
+
+                       for (let i = 0, il = newAttributes.length; i < il; i++) {
+                               newAttributes[i] = 0;
+                       }
+               }
+
+               function enableAttribute(attribute) {
+                       enableAttributeAndDivisor(attribute, 0);
+               }
+
+               function enableAttributeAndDivisor(attribute, meshPerAttribute) {
+                       const newAttributes = currentState.newAttributes;
+                       const enabledAttributes = currentState.enabledAttributes;
+                       const attributeDivisors = currentState.attributeDivisors;
+                       newAttributes[attribute] = 1;
+
+                       if (enabledAttributes[attribute] === 0) {
+                               gl.enableVertexAttribArray(attribute);
+                               enabledAttributes[attribute] = 1;
+                       }
+
+                       if (attributeDivisors[attribute] !== meshPerAttribute) {
+                               const extension = capabilities.isWebGL2 ? gl : extensions.get('ANGLE_instanced_arrays');
+                               extension[capabilities.isWebGL2 ? 'vertexAttribDivisor' : 'vertexAttribDivisorANGLE'](attribute, meshPerAttribute);
+                               attributeDivisors[attribute] = meshPerAttribute;
+                       }
+               }
+
+               function disableUnusedAttributes() {
+                       const newAttributes = currentState.newAttributes;
+                       const enabledAttributes = currentState.enabledAttributes;
+
+                       for (let i = 0, il = enabledAttributes.length; i < il; i++) {
+                               if (enabledAttributes[i] !== newAttributes[i]) {
+                                       gl.disableVertexAttribArray(i);
+                                       enabledAttributes[i] = 0;
+                               }
+                       }
+               }
+
+               function vertexAttribPointer(index, size, type, normalized, stride, offset) {
+                       if (capabilities.isWebGL2 === true && (type === gl.INT || type === gl.UNSIGNED_INT)) {
+                               gl.vertexAttribIPointer(index, size, type, stride, offset);
+                       } else {
+                               gl.vertexAttribPointer(index, size, type, normalized, stride, offset);
+                       }
+               }
+
+               function setupVertexAttributes(object, material, program, geometry) {
+                       if (capabilities.isWebGL2 === false && (object.isInstancedMesh || geometry.isInstancedBufferGeometry)) {
+                               if (extensions.get('ANGLE_instanced_arrays') === null) return;
+                       }
+
+                       initAttributes();
+                       const geometryAttributes = geometry.attributes;
+                       const programAttributes = program.getAttributes();
+                       const materialDefaultAttributeValues = material.defaultAttributeValues;
+
+                       for (const name in programAttributes) {
+                               const programAttribute = programAttributes[name];
+
+                               if (programAttribute.location >= 0) {
+                                       let geometryAttribute = geometryAttributes[name];
+
+                                       if (geometryAttribute === undefined) {
+                                               if (name === 'instanceMatrix' && object.instanceMatrix) geometryAttribute = object.instanceMatrix;
+                                               if (name === 'instanceColor' && object.instanceColor) geometryAttribute = object.instanceColor;
+                                       }
+
+                                       if (geometryAttribute !== undefined) {
+                                               const normalized = geometryAttribute.normalized;
+                                               const size = geometryAttribute.itemSize;
+                                               const attribute = attributes.get(geometryAttribute); // TODO Attribute may not be available on context restore
+
+                                               if (attribute === undefined) continue;
+                                               const buffer = attribute.buffer;
+                                               const type = attribute.type;
+                                               const bytesPerElement = attribute.bytesPerElement;
+
+                                               if (geometryAttribute.isInterleavedBufferAttribute) {
+                                                       const data = geometryAttribute.data;
+                                                       const stride = data.stride;
+                                                       const offset = geometryAttribute.offset;
+
+                                                       if (data && data.isInstancedInterleavedBuffer) {
+                                                               for (let i = 0; i < programAttribute.locationSize; i++) {
+                                                                       enableAttributeAndDivisor(programAttribute.location + i, data.meshPerAttribute);
+                                                               }
+
+                                                               if (object.isInstancedMesh !== true && geometry._maxInstanceCount === undefined) {
+                                                                       geometry._maxInstanceCount = data.meshPerAttribute * data.count;
+                                                               }
+                                                       } else {
+                                                               for (let i = 0; i < programAttribute.locationSize; i++) {
+                                                                       enableAttribute(programAttribute.location + i);
+                                                               }
+                                                       }
+
+                                                       gl.bindBuffer(gl.ARRAY_BUFFER, buffer);
+
+                                                       for (let i = 0; i < programAttribute.locationSize; i++) {
+                                                               vertexAttribPointer(programAttribute.location + i, size / programAttribute.locationSize, type, normalized, stride * bytesPerElement, (offset + size / programAttribute.locationSize * i) * bytesPerElement);
+                                                       }
+                                               } else {
+                                                       if (geometryAttribute.isInstancedBufferAttribute) {
+                                                               for (let i = 0; i < programAttribute.locationSize; i++) {
+                                                                       enableAttributeAndDivisor(programAttribute.location + i, geometryAttribute.meshPerAttribute);
+                                                               }
+
+                                                               if (object.isInstancedMesh !== true && geometry._maxInstanceCount === undefined) {
+                                                                       geometry._maxInstanceCount = geometryAttribute.meshPerAttribute * geometryAttribute.count;
+                                                               }
+                                                       } else {
+                                                               for (let i = 0; i < programAttribute.locationSize; i++) {
+                                                                       enableAttribute(programAttribute.location + i);
+                                                               }
+                                                       }
+
+                                                       gl.bindBuffer(gl.ARRAY_BUFFER, buffer);
+
+                                                       for (let i = 0; i < programAttribute.locationSize; i++) {
+                                                               vertexAttribPointer(programAttribute.location + i, size / programAttribute.locationSize, type, normalized, size * bytesPerElement, size / programAttribute.locationSize * i * bytesPerElement);
+                                                       }
+                                               }
+                                       } else if (materialDefaultAttributeValues !== undefined) {
+                                               const value = materialDefaultAttributeValues[name];
+
+                                               if (value !== undefined) {
+                                                       switch (value.length) {
+                                                               case 2:
+                                                                       gl.vertexAttrib2fv(programAttribute.location, value);
+                                                                       break;
+
+                                                               case 3:
+                                                                       gl.vertexAttrib3fv(programAttribute.location, value);
+                                                                       break;
+
+                                                               case 4:
+                                                                       gl.vertexAttrib4fv(programAttribute.location, value);
+                                                                       break;
+
+                                                               default:
+                                                                       gl.vertexAttrib1fv(programAttribute.location, value);
+                                                       }
+                                               }
+                                       }
+                               }
+                       }
+
+                       disableUnusedAttributes();
+               }
+
+               function dispose() {
+                       reset();
+
+                       for (const geometryId in bindingStates) {
+                               const programMap = bindingStates[geometryId];
+
+                               for (const programId in programMap) {
+                                       const stateMap = programMap[programId];
+
+                                       for (const wireframe in stateMap) {
+                                               deleteVertexArrayObject(stateMap[wireframe].object);
+                                               delete stateMap[wireframe];
+                                       }
+
+                                       delete programMap[programId];
+                               }
+
+                               delete bindingStates[geometryId];
+                       }
+               }
+
+               function releaseStatesOfGeometry(geometry) {
+                       if (bindingStates[geometry.id] === undefined) return;
+                       const programMap = bindingStates[geometry.id];
+
+                       for (const programId in programMap) {
+                               const stateMap = programMap[programId];
+
+                               for (const wireframe in stateMap) {
+                                       deleteVertexArrayObject(stateMap[wireframe].object);
+                                       delete stateMap[wireframe];
+                               }
+
+                               delete programMap[programId];
+                       }
+
+                       delete bindingStates[geometry.id];
+               }
+
+               function releaseStatesOfProgram(program) {
+                       for (const geometryId in bindingStates) {
+                               const programMap = bindingStates[geometryId];
+                               if (programMap[program.id] === undefined) continue;
+                               const stateMap = programMap[program.id];
+
+                               for (const wireframe in stateMap) {
+                                       deleteVertexArrayObject(stateMap[wireframe].object);
+                                       delete stateMap[wireframe];
+                               }
+
+                               delete programMap[program.id];
+                       }
+               }
+
+               function reset() {
+                       resetDefaultState();
+                       if (currentState === defaultState) return;
+                       currentState = defaultState;
+                       bindVertexArrayObject(currentState.object);
+               } // for backward-compatilibity
+
+
+               function resetDefaultState() {
+                       defaultState.geometry = null;
+                       defaultState.program = null;
+                       defaultState.wireframe = false;
+               }
+
+               return {
+                       setup: setup,
+                       reset: reset,
+                       resetDefaultState: resetDefaultState,
+                       dispose: dispose,
+                       releaseStatesOfGeometry: releaseStatesOfGeometry,
+                       releaseStatesOfProgram: releaseStatesOfProgram,
+                       initAttributes: initAttributes,
+                       enableAttribute: enableAttribute,
+                       disableUnusedAttributes: disableUnusedAttributes
+               };
+       }
+
+       function WebGLBufferRenderer(gl, extensions, info, capabilities) {
+               const isWebGL2 = capabilities.isWebGL2;
+               let mode;
+
+               function setMode(value) {
+                       mode = value;
+               }
+
+               function render(start, count) {
+                       gl.drawArrays(mode, start, count);
+                       info.update(count, mode, 1);
+               }
+
+               function renderInstances(start, count, primcount) {
+                       if (primcount === 0) return;
+                       let extension, methodName;
+
+                       if (isWebGL2) {
+                               extension = gl;
+                               methodName = 'drawArraysInstanced';
+                       } else {
+                               extension = extensions.get('ANGLE_instanced_arrays');
+                               methodName = 'drawArraysInstancedANGLE';
+
+                               if (extension === null) {
+                                       console.error('THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.');
+                                       return;
+                               }
+                       }
+
+                       extension[methodName](mode, start, count, primcount);
+                       info.update(count, mode, primcount);
+               } //
+
+
+               this.setMode = setMode;
+               this.render = render;
+               this.renderInstances = renderInstances;
+       }
+
+       function WebGLCapabilities(gl, extensions, parameters) {
+               let maxAnisotropy;
+
+               function getMaxAnisotropy() {
+                       if (maxAnisotropy !== undefined) return maxAnisotropy;
+
+                       if (extensions.has('EXT_texture_filter_anisotropic') === true) {
+                               const extension = extensions.get('EXT_texture_filter_anisotropic');
+                               maxAnisotropy = gl.getParameter(extension.MAX_TEXTURE_MAX_ANISOTROPY_EXT);
+                       } else {
+                               maxAnisotropy = 0;
+                       }
+
+                       return maxAnisotropy;
+               }
+
+               function getMaxPrecision(precision) {
+                       if (precision === 'highp') {
+                               if (gl.getShaderPrecisionFormat(gl.VERTEX_SHADER, gl.HIGH_FLOAT).precision > 0 && gl.getShaderPrecisionFormat(gl.FRAGMENT_SHADER, gl.HIGH_FLOAT).precision > 0) {
+                                       return 'highp';
+                               }
+
+                               precision = 'mediump';
+                       }
+
+                       if (precision === 'mediump') {
+                               if (gl.getShaderPrecisionFormat(gl.VERTEX_SHADER, gl.MEDIUM_FLOAT).precision > 0 && gl.getShaderPrecisionFormat(gl.FRAGMENT_SHADER, gl.MEDIUM_FLOAT).precision > 0) {
+                                       return 'mediump';
+                               }
+                       }
+
+                       return 'lowp';
+               }
+               /* eslint-disable no-undef */
+
+
+               const isWebGL2 = typeof WebGL2RenderingContext !== 'undefined' && gl instanceof WebGL2RenderingContext || typeof WebGL2ComputeRenderingContext !== 'undefined' && gl instanceof WebGL2ComputeRenderingContext;
+               /* eslint-enable no-undef */
+
+               let precision = parameters.precision !== undefined ? parameters.precision : 'highp';
+               const maxPrecision = getMaxPrecision(precision);
+
+               if (maxPrecision !== precision) {
+                       console.warn('THREE.WebGLRenderer:', precision, 'not supported, using', maxPrecision, 'instead.');
+                       precision = maxPrecision;
+               }
+
+               const drawBuffers = isWebGL2 || extensions.has('WEBGL_draw_buffers');
+               const logarithmicDepthBuffer = parameters.logarithmicDepthBuffer === true;
+               const maxTextures = gl.getParameter(gl.MAX_TEXTURE_IMAGE_UNITS);
+               const maxVertexTextures = gl.getParameter(gl.MAX_VERTEX_TEXTURE_IMAGE_UNITS);
+               const maxTextureSize = gl.getParameter(gl.MAX_TEXTURE_SIZE);
+               const maxCubemapSize = gl.getParameter(gl.MAX_CUBE_MAP_TEXTURE_SIZE);
+               const maxAttributes = gl.getParameter(gl.MAX_VERTEX_ATTRIBS);
+               const maxVertexUniforms = gl.getParameter(gl.MAX_VERTEX_UNIFORM_VECTORS);
+               const maxVaryings = gl.getParameter(gl.MAX_VARYING_VECTORS);
+               const maxFragmentUniforms = gl.getParameter(gl.MAX_FRAGMENT_UNIFORM_VECTORS);
+               const vertexTextures = maxVertexTextures > 0;
+               const floatFragmentTextures = isWebGL2 || extensions.has('OES_texture_float');
+               const floatVertexTextures = vertexTextures && floatFragmentTextures;
+               const maxSamples = isWebGL2 ? gl.getParameter(gl.MAX_SAMPLES) : 0;
+               return {
+                       isWebGL2: isWebGL2,
+                       drawBuffers: drawBuffers,
+                       getMaxAnisotropy: getMaxAnisotropy,
+                       getMaxPrecision: getMaxPrecision,
+                       precision: precision,
+                       logarithmicDepthBuffer: logarithmicDepthBuffer,
+                       maxTextures: maxTextures,
+                       maxVertexTextures: maxVertexTextures,
+                       maxTextureSize: maxTextureSize,
+                       maxCubemapSize: maxCubemapSize,
+                       maxAttributes: maxAttributes,
+                       maxVertexUniforms: maxVertexUniforms,
+                       maxVaryings: maxVaryings,
+                       maxFragmentUniforms: maxFragmentUniforms,
+                       vertexTextures: vertexTextures,
+                       floatFragmentTextures: floatFragmentTextures,
+                       floatVertexTextures: floatVertexTextures,
+                       maxSamples: maxSamples
+               };
+       }
+
+       function WebGLClipping(properties) {
+               const scope = this;
+               let globalState = null,
+                               numGlobalPlanes = 0,
+                               localClippingEnabled = false,
+                               renderingShadows = false;
+               const plane = new Plane(),
+                                       viewNormalMatrix = new Matrix3(),
+                                       uniform = {
+                       value: null,
+                       needsUpdate: false
+               };
+               this.uniform = uniform;
+               this.numPlanes = 0;
+               this.numIntersection = 0;
+
+               this.init = function (planes, enableLocalClipping, camera) {
+                       const enabled = planes.length !== 0 || enableLocalClipping || // enable state of previous frame - the clipping code has to
+                       // run another frame in order to reset the state:
+                       numGlobalPlanes !== 0 || localClippingEnabled;
+                       localClippingEnabled = enableLocalClipping;
+                       globalState = projectPlanes(planes, camera, 0);
+                       numGlobalPlanes = planes.length;
+                       return enabled;
+               };
+
+               this.beginShadows = function () {
+                       renderingShadows = true;
+                       projectPlanes(null);
+               };
+
+               this.endShadows = function () {
+                       renderingShadows = false;
+                       resetGlobalState();
+               };
+
+               this.setState = function (material, camera, useCache) {
+                       const planes = material.clippingPlanes,
+                                               clipIntersection = material.clipIntersection,
+                                               clipShadows = material.clipShadows;
+                       const materialProperties = properties.get(material);
+
+                       if (!localClippingEnabled || planes === null || planes.length === 0 || renderingShadows && !clipShadows) {
+                               // there's no local clipping
+                               if (renderingShadows) {
+                                       // there's no global clipping
+                                       projectPlanes(null);
+                               } else {
+                                       resetGlobalState();
+                               }
+                       } else {
+                               const nGlobal = renderingShadows ? 0 : numGlobalPlanes,
+                                                       lGlobal = nGlobal * 4;
+                               let dstArray = materialProperties.clippingState || null;
+                               uniform.value = dstArray; // ensure unique state
+
+                               dstArray = projectPlanes(planes, camera, lGlobal, useCache);
+
+                               for (let i = 0; i !== lGlobal; ++i) {
+                                       dstArray[i] = globalState[i];
+                               }
+
+                               materialProperties.clippingState = dstArray;
+                               this.numIntersection = clipIntersection ? this.numPlanes : 0;
+                               this.numPlanes += nGlobal;
+                       }
+               };
+
+               function resetGlobalState() {
+                       if (uniform.value !== globalState) {
+                               uniform.value = globalState;
+                               uniform.needsUpdate = numGlobalPlanes > 0;
+                       }
+
+                       scope.numPlanes = numGlobalPlanes;
+                       scope.numIntersection = 0;
+               }
+
+               function projectPlanes(planes, camera, dstOffset, skipTransform) {
+                       const nPlanes = planes !== null ? planes.length : 0;
+                       let dstArray = null;
+
+                       if (nPlanes !== 0) {
+                               dstArray = uniform.value;
+
+                               if (skipTransform !== true || dstArray === null) {
+                                       const flatSize = dstOffset + nPlanes * 4,
+                                                               viewMatrix = camera.matrixWorldInverse;
+                                       viewNormalMatrix.getNormalMatrix(viewMatrix);
+
+                                       if (dstArray === null || dstArray.length < flatSize) {
+                                               dstArray = new Float32Array(flatSize);
+                                       }
+
+                                       for (let i = 0, i4 = dstOffset; i !== nPlanes; ++i, i4 += 4) {
+                                               plane.copy(planes[i]).applyMatrix4(viewMatrix, viewNormalMatrix);
+                                               plane.normal.toArray(dstArray, i4);
+                                               dstArray[i4 + 3] = plane.constant;
+                                       }
+                               }
+
+                               uniform.value = dstArray;
+                               uniform.needsUpdate = true;
+                       }
+
+                       scope.numPlanes = nPlanes;
+                       scope.numIntersection = 0;
+                       return dstArray;
+               }
+       }
+
+       function WebGLCubeMaps(renderer) {
+               let cubemaps = new WeakMap();
+
+               function mapTextureMapping(texture, mapping) {
+                       if (mapping === EquirectangularReflectionMapping) {
+                               texture.mapping = CubeReflectionMapping;
+                       } else if (mapping === EquirectangularRefractionMapping) {
+                               texture.mapping = CubeRefractionMapping;
+                       }
+
+                       return texture;
+               }
+
+               function get(texture) {
+                       if (texture && texture.isTexture && texture.isRenderTargetTexture === false) {
+                               const mapping = texture.mapping;
+
+                               if (mapping === EquirectangularReflectionMapping || mapping === EquirectangularRefractionMapping) {
+                                       if (cubemaps.has(texture)) {
+                                               const cubemap = cubemaps.get(texture).texture;
+                                               return mapTextureMapping(cubemap, texture.mapping);
+                                       } else {
+                                               const image = texture.image;
+
+                                               if (image && image.height > 0) {
+                                                       const currentRenderTarget = renderer.getRenderTarget();
+                                                       const renderTarget = new WebGLCubeRenderTarget(image.height / 2);
+                                                       renderTarget.fromEquirectangularTexture(renderer, texture);
+                                                       cubemaps.set(texture, renderTarget);
+                                                       renderer.setRenderTarget(currentRenderTarget);
+                                                       texture.addEventListener('dispose', onTextureDispose);
+                                                       return mapTextureMapping(renderTarget.texture, texture.mapping);
+                                               } else {
+                                                       // image not yet ready. try the conversion next frame
+                                                       return null;
+                                               }
+                                       }
+                               }
+                       }
+
+                       return texture;
+               }
+
+               function onTextureDispose(event) {
+                       const texture = event.target;
+                       texture.removeEventListener('dispose', onTextureDispose);
+                       const cubemap = cubemaps.get(texture);
+
+                       if (cubemap !== undefined) {
+                               cubemaps.delete(texture);
+                               cubemap.dispose();
+                       }
+               }
+
+               function dispose() {
+                       cubemaps = new WeakMap();
+               }
+
+               return {
+                       get: get,
+                       dispose: dispose
+               };
+       }
+
+       class OrthographicCamera extends Camera {
+               constructor(left = -1, right = 1, top = 1, bottom = -1, near = 0.1, far = 2000) {
+                       super();
+                       this.type = 'OrthographicCamera';
+                       this.zoom = 1;
+                       this.view = null;
+                       this.left = left;
+                       this.right = right;
+                       this.top = top;
+                       this.bottom = bottom;
+                       this.near = near;
+                       this.far = far;
+                       this.updateProjectionMatrix();
+               }
+
+               copy(source, recursive) {
+                       super.copy(source, recursive);
+                       this.left = source.left;
+                       this.right = source.right;
+                       this.top = source.top;
+                       this.bottom = source.bottom;
+                       this.near = source.near;
+                       this.far = source.far;
+                       this.zoom = source.zoom;
+                       this.view = source.view === null ? null : Object.assign({}, source.view);
+                       return this;
+               }
+
+               setViewOffset(fullWidth, fullHeight, x, y, width, height) {
+                       if (this.view === null) {
+                               this.view = {
+                                       enabled: true,
+                                       fullWidth: 1,
+                                       fullHeight: 1,
+                                       offsetX: 0,
+                                       offsetY: 0,
+                                       width: 1,
+                                       height: 1
+                               };
+                       }
+
+                       this.view.enabled = true;
+                       this.view.fullWidth = fullWidth;
+                       this.view.fullHeight = fullHeight;
+                       this.view.offsetX = x;
+                       this.view.offsetY = y;
+                       this.view.width = width;
+                       this.view.height = height;
+                       this.updateProjectionMatrix();
+               }
+
+               clearViewOffset() {
+                       if (this.view !== null) {
+                               this.view.enabled = false;
+                       }
+
+                       this.updateProjectionMatrix();
+               }
+
+               updateProjectionMatrix() {
+                       const dx = (this.right - this.left) / (2 * this.zoom);
+                       const dy = (this.top - this.bottom) / (2 * this.zoom);
+                       const cx = (this.right + this.left) / 2;
+                       const cy = (this.top + this.bottom) / 2;
+                       let left = cx - dx;
+                       let right = cx + dx;
+                       let top = cy + dy;
+                       let bottom = cy - dy;
+
+                       if (this.view !== null && this.view.enabled) {
+                               const scaleW = (this.right - this.left) / this.view.fullWidth / this.zoom;
+                               const scaleH = (this.top - this.bottom) / this.view.fullHeight / this.zoom;
+                               left += scaleW * this.view.offsetX;
+                               right = left + scaleW * this.view.width;
+                               top -= scaleH * this.view.offsetY;
+                               bottom = top - scaleH * this.view.height;
+                       }
+
+                       this.projectionMatrix.makeOrthographic(left, right, top, bottom, this.near, this.far);
+                       this.projectionMatrixInverse.copy(this.projectionMatrix).invert();
+               }
+
+               toJSON(meta) {
+                       const data = super.toJSON(meta);
+                       data.object.zoom = this.zoom;
+                       data.object.left = this.left;
+                       data.object.right = this.right;
+                       data.object.top = this.top;
+                       data.object.bottom = this.bottom;
+                       data.object.near = this.near;
+                       data.object.far = this.far;
+                       if (this.view !== null) data.object.view = Object.assign({}, this.view);
+                       return data;
+               }
+
+       }
+
+       OrthographicCamera.prototype.isOrthographicCamera = true;
+
+       class RawShaderMaterial extends ShaderMaterial {
+               constructor(parameters) {
+                       super(parameters);
+                       this.type = 'RawShaderMaterial';
+               }
+
+       }
+
+       RawShaderMaterial.prototype.isRawShaderMaterial = true;
+
+       const LOD_MIN = 4;
+       const LOD_MAX = 8;
+       const SIZE_MAX = Math.pow(2, LOD_MAX); // The standard deviations (radians) associated with the extra mips. These are
+       // chosen to approximate a Trowbridge-Reitz distribution function times the
+       // geometric shadowing function. These sigma values squared must match the
+       // variance #defines in cube_uv_reflection_fragment.glsl.js.
+
+       const EXTRA_LOD_SIGMA = [0.125, 0.215, 0.35, 0.446, 0.526, 0.582];
+       const TOTAL_LODS = LOD_MAX - LOD_MIN + 1 + EXTRA_LOD_SIGMA.length; // The maximum length of the blur for loop. Smaller sigmas will use fewer
+       // samples and exit early, but not recompile the shader.
+
+       const MAX_SAMPLES = 20;
+       const ENCODINGS = {
+               [LinearEncoding]: 0,
+               [sRGBEncoding]: 1,
+               [RGBEEncoding]: 2,
+               [RGBM7Encoding]: 3,
+               [RGBM16Encoding]: 4,
+               [RGBDEncoding]: 5,
+               [GammaEncoding]: 6
+       };
+
+       const _flatCamera = /*@__PURE__*/new OrthographicCamera();
+
+       const {
+               _lodPlanes,
+               _sizeLods,
+               _sigmas
+       } = /*@__PURE__*/_createPlanes();
+
+       const _clearColor = /*@__PURE__*/new Color();
+
+       let _oldTarget = null; // Golden Ratio
+
+       const PHI = (1 + Math.sqrt(5)) / 2;
+       const INV_PHI = 1 / PHI; // Vertices of a dodecahedron (except the opposites, which represent the
+       // same axis), used as axis directions evenly spread on a sphere.
+
+       const _axisDirections = [/*@__PURE__*/new Vector3(1, 1, 1), /*@__PURE__*/new Vector3(-1, 1, 1), /*@__PURE__*/new Vector3(1, 1, -1), /*@__PURE__*/new Vector3(-1, 1, -1), /*@__PURE__*/new Vector3(0, PHI, INV_PHI), /*@__PURE__*/new Vector3(0, PHI, -INV_PHI), /*@__PURE__*/new Vector3(INV_PHI, 0, PHI), /*@__PURE__*/new Vector3(-INV_PHI, 0, PHI), /*@__PURE__*/new Vector3(PHI, INV_PHI, 0), /*@__PURE__*/new Vector3(-PHI, INV_PHI, 0)];
+       /**
+        * This class generates a Prefiltered, Mipmapped Radiance Environment Map
+        * (PMREM) from a cubeMap environment texture. This allows different levels of
+        * blur to be quickly accessed based on material roughness. It is packed into a
+        * special CubeUV format that allows us to perform custom interpolation so that
+        * we can support nonlinear formats such as RGBE. Unlike a traditional mipmap
+        * chain, it only goes down to the LOD_MIN level (above), and then creates extra
+        * even more filtered 'mips' at the same LOD_MIN resolution, associated with
+        * higher roughness levels. In this way we maintain resolution to smoothly
+        * interpolate diffuse lighting while limiting sampling computation.
+        *
+        * Paper: Fast, Accurate Image-Based Lighting
+        * https://drive.google.com/file/d/15y8r_UpKlU9SvV4ILb0C3qCPecS8pvLz/view
+       */
+
+       class PMREMGenerator {
+               constructor(renderer) {
+                       this._renderer = renderer;
+                       this._pingPongRenderTarget = null;
+                       this._blurMaterial = _getBlurShader(MAX_SAMPLES);
+                       this._equirectShader = null;
+                       this._cubemapShader = null;
+
+                       this._compileMaterial(this._blurMaterial);
+               }
+               /**
+                * Generates a PMREM from a supplied Scene, which can be faster than using an
+                * image if networking bandwidth is low. Optional sigma specifies a blur radius
+                * in radians to be applied to the scene before PMREM generation. Optional near
+                * and far planes ensure the scene is rendered in its entirety (the cubeCamera
+                * is placed at the origin).
+                */
+
+
+               fromScene(scene, sigma = 0, near = 0.1, far = 100) {
+                       _oldTarget = this._renderer.getRenderTarget();
+
+                       const cubeUVRenderTarget = this._allocateTargets();
+
+                       this._sceneToCubeUV(scene, near, far, cubeUVRenderTarget);
+
+                       if (sigma > 0) {
+                               this._blur(cubeUVRenderTarget, 0, 0, sigma);
+                       }
+
+                       this._applyPMREM(cubeUVRenderTarget);
+
+                       this._cleanup(cubeUVRenderTarget);
+
+                       return cubeUVRenderTarget;
+               }
+               /**
+                * Generates a PMREM from an equirectangular texture, which can be either LDR
+                * (RGBFormat) or HDR (RGBEFormat). The ideal input image size is 1k (1024 x 512),
+                * as this matches best with the 256 x 256 cubemap output.
+                */
+
+
+               fromEquirectangular(equirectangular) {
+                       return this._fromTexture(equirectangular);
+               }
+               /**
+                * Generates a PMREM from an cubemap texture, which can be either LDR
+                * (RGBFormat) or HDR (RGBEFormat). The ideal input cube size is 256 x 256,
+                * as this matches best with the 256 x 256 cubemap output.
+                */
+
+
+               fromCubemap(cubemap) {
+                       return this._fromTexture(cubemap);
+               }
+               /**
+                * Pre-compiles the cubemap shader. You can get faster start-up by invoking this method during
+                * your texture's network fetch for increased concurrency.
+                */
+
+
+               compileCubemapShader() {
+                       if (this._cubemapShader === null) {
+                               this._cubemapShader = _getCubemapShader();
+
+                               this._compileMaterial(this._cubemapShader);
+                       }
+               }
+               /**
+                * Pre-compiles the equirectangular shader. You can get faster start-up by invoking this method during
+                * your texture's network fetch for increased concurrency.
+                */
+
+
+               compileEquirectangularShader() {
+                       if (this._equirectShader === null) {
+                               this._equirectShader = _getEquirectShader();
+
+                               this._compileMaterial(this._equirectShader);
+                       }
+               }
+               /**
+                * Disposes of the PMREMGenerator's internal memory. Note that PMREMGenerator is a static class,
+                * so you should not need more than one PMREMGenerator object. If you do, calling dispose() on
+                * one of them will cause any others to also become unusable.
+                */
+
+
+               dispose() {
+                       this._blurMaterial.dispose();
+
+                       if (this._cubemapShader !== null) this._cubemapShader.dispose();
+                       if (this._equirectShader !== null) this._equirectShader.dispose();
+
+                       for (let i = 0; i < _lodPlanes.length; i++) {
+                               _lodPlanes[i].dispose();
+                       }
+               } // private interface
+
+
+               _cleanup(outputTarget) {
+                       this._pingPongRenderTarget.dispose();
+
+                       this._renderer.setRenderTarget(_oldTarget);
+
+                       outputTarget.scissorTest = false;
+
+                       _setViewport(outputTarget, 0, 0, outputTarget.width, outputTarget.height);
+               }
+
+               _fromTexture(texture) {
+                       _oldTarget = this._renderer.getRenderTarget();
+
+                       const cubeUVRenderTarget = this._allocateTargets(texture);
+
+                       this._textureToCubeUV(texture, cubeUVRenderTarget);
+
+                       this._applyPMREM(cubeUVRenderTarget);
+
+                       this._cleanup(cubeUVRenderTarget);
+
+                       return cubeUVRenderTarget;
+               }
+
+               _allocateTargets(texture) {
+                       // warning: null texture is valid
+                       const params = {
+                               magFilter: NearestFilter,
+                               minFilter: NearestFilter,
+                               generateMipmaps: false,
+                               type: UnsignedByteType,
+                               format: RGBEFormat,
+                               encoding: _isLDR(texture) ? texture.encoding : RGBEEncoding,
+                               depthBuffer: false
+                       };
+
+                       const cubeUVRenderTarget = _createRenderTarget(params);
+
+                       cubeUVRenderTarget.depthBuffer = texture ? false : true;
+                       this._pingPongRenderTarget = _createRenderTarget(params);
+                       return cubeUVRenderTarget;
+               }
+
+               _compileMaterial(material) {
+                       const tmpMesh = new Mesh(_lodPlanes[0], material);
+
+                       this._renderer.compile(tmpMesh, _flatCamera);
+               }
+
+               _sceneToCubeUV(scene, near, far, cubeUVRenderTarget) {
+                       const fov = 90;
+                       const aspect = 1;
+                       const cubeCamera = new PerspectiveCamera(fov, aspect, near, far);
+                       const upSign = [1, -1, 1, 1, 1, 1];
+                       const forwardSign = [1, 1, 1, -1, -1, -1];
+                       const renderer = this._renderer;
+                       const originalAutoClear = renderer.autoClear;
+                       const outputEncoding = renderer.outputEncoding;
+                       const toneMapping = renderer.toneMapping;
+                       renderer.getClearColor(_clearColor);
+                       renderer.toneMapping = NoToneMapping;
+                       renderer.outputEncoding = LinearEncoding;
+                       renderer.autoClear = false;
+                       const backgroundMaterial = new MeshBasicMaterial({
+                               name: 'PMREM.Background',
+                               side: BackSide,
+                               depthWrite: false,
+                               depthTest: false
+                       });
+                       const backgroundBox = new Mesh(new BoxGeometry(), backgroundMaterial);
+                       let useSolidColor = false;
+                       const background = scene.background;
+
+                       if (background) {
+                               if (background.isColor) {
+                                       backgroundMaterial.color.copy(background);
+                                       scene.background = null;
+                                       useSolidColor = true;
+                               }
+                       } else {
+                               backgroundMaterial.color.copy(_clearColor);
+                               useSolidColor = true;
+                       }
+
+                       for (let i = 0; i < 6; i++) {
+                               const col = i % 3;
+
+                               if (col == 0) {
+                                       cubeCamera.up.set(0, upSign[i], 0);
+                                       cubeCamera.lookAt(forwardSign[i], 0, 0);
+                               } else if (col == 1) {
+                                       cubeCamera.up.set(0, 0, upSign[i]);
+                                       cubeCamera.lookAt(0, forwardSign[i], 0);
+                               } else {
+                                       cubeCamera.up.set(0, upSign[i], 0);
+                                       cubeCamera.lookAt(0, 0, forwardSign[i]);
+                               }
+
+                               _setViewport(cubeUVRenderTarget, col * SIZE_MAX, i > 2 ? SIZE_MAX : 0, SIZE_MAX, SIZE_MAX);
+
+                               renderer.setRenderTarget(cubeUVRenderTarget);
+
+                               if (useSolidColor) {
+                                       renderer.render(backgroundBox, cubeCamera);
+                               }
+
+                               renderer.render(scene, cubeCamera);
+                       }
+
+                       backgroundBox.geometry.dispose();
+                       backgroundBox.material.dispose();
+                       renderer.toneMapping = toneMapping;
+                       renderer.outputEncoding = outputEncoding;
+                       renderer.autoClear = originalAutoClear;
+                       scene.background = background;
+               }
+
+               _textureToCubeUV(texture, cubeUVRenderTarget) {
+                       const renderer = this._renderer;
+
+                       if (texture.isCubeTexture) {
+                               if (this._cubemapShader == null) {
+                                       this._cubemapShader = _getCubemapShader();
+                               }
+                       } else {
+                               if (this._equirectShader == null) {
+                                       this._equirectShader = _getEquirectShader();
+                               }
+                       }
+
+                       const material = texture.isCubeTexture ? this._cubemapShader : this._equirectShader;
+                       const mesh = new Mesh(_lodPlanes[0], material);
+                       const uniforms = material.uniforms;
+                       uniforms['envMap'].value = texture;
+
+                       if (!texture.isCubeTexture) {
+                               uniforms['texelSize'].value.set(1.0 / texture.image.width, 1.0 / texture.image.height);
+                       }
+
+                       uniforms['inputEncoding'].value = ENCODINGS[texture.encoding];
+                       uniforms['outputEncoding'].value = ENCODINGS[cubeUVRenderTarget.texture.encoding];
+
+                       _setViewport(cubeUVRenderTarget, 0, 0, 3 * SIZE_MAX, 2 * SIZE_MAX);
+
+                       renderer.setRenderTarget(cubeUVRenderTarget);
+                       renderer.render(mesh, _flatCamera);
+               }
+
+               _applyPMREM(cubeUVRenderTarget) {
+                       const renderer = this._renderer;
+                       const autoClear = renderer.autoClear;
+                       renderer.autoClear = false;
+
+                       for (let i = 1; i < TOTAL_LODS; i++) {
+                               const sigma = Math.sqrt(_sigmas[i] * _sigmas[i] - _sigmas[i - 1] * _sigmas[i - 1]);
+                               const poleAxis = _axisDirections[(i - 1) % _axisDirections.length];
+
+                               this._blur(cubeUVRenderTarget, i - 1, i, sigma, poleAxis);
+                       }
+
+                       renderer.autoClear = autoClear;
+               }
+               /**
+                * This is a two-pass Gaussian blur for a cubemap. Normally this is done
+                * vertically and horizontally, but this breaks down on a cube. Here we apply
+                * the blur latitudinally (around the poles), and then longitudinally (towards
+                * the poles) to approximate the orthogonally-separable blur. It is least
+                * accurate at the poles, but still does a decent job.
+                */
+
+
+               _blur(cubeUVRenderTarget, lodIn, lodOut, sigma, poleAxis) {
+                       const pingPongRenderTarget = this._pingPongRenderTarget;
+
+                       this._halfBlur(cubeUVRenderTarget, pingPongRenderTarget, lodIn, lodOut, sigma, 'latitudinal', poleAxis);
+
+                       this._halfBlur(pingPongRenderTarget, cubeUVRenderTarget, lodOut, lodOut, sigma, 'longitudinal', poleAxis);
+               }
+
+               _halfBlur(targetIn, targetOut, lodIn, lodOut, sigmaRadians, direction, poleAxis) {
+                       const renderer = this._renderer;
+                       const blurMaterial = this._blurMaterial;
+
+                       if (direction !== 'latitudinal' && direction !== 'longitudinal') {
+                               console.error('blur direction must be either latitudinal or longitudinal!');
+                       } // Number of standard deviations at which to cut off the discrete approximation.
+
+
+                       const STANDARD_DEVIATIONS = 3;
+                       const blurMesh = new Mesh(_lodPlanes[lodOut], blurMaterial);
+                       const blurUniforms = blurMaterial.uniforms;
+                       const pixels = _sizeLods[lodIn] - 1;
+                       const radiansPerPixel = isFinite(sigmaRadians) ? Math.PI / (2 * pixels) : 2 * Math.PI / (2 * MAX_SAMPLES - 1);
+                       const sigmaPixels = sigmaRadians / radiansPerPixel;
+                       const samples = isFinite(sigmaRadians) ? 1 + Math.floor(STANDARD_DEVIATIONS * sigmaPixels) : MAX_SAMPLES;
+
+                       if (samples > MAX_SAMPLES) {
+                               console.warn(`sigmaRadians, ${sigmaRadians}, is too large and will clip, as it requested ${samples} samples when the maximum is set to ${MAX_SAMPLES}`);
+                       }
+
+                       const weights = [];
+                       let sum = 0;
+
+                       for (let i = 0; i < MAX_SAMPLES; ++i) {
+                               const x = i / sigmaPixels;
+                               const weight = Math.exp(-x * x / 2);
+                               weights.push(weight);
+
+                               if (i == 0) {
+                                       sum += weight;
+                               } else if (i < samples) {
+                                       sum += 2 * weight;
+                               }
+                       }
+
+                       for (let i = 0; i < weights.length; i++) {
+                               weights[i] = weights[i] / sum;
+                       }
+
+                       blurUniforms['envMap'].value = targetIn.texture;
+                       blurUniforms['samples'].value = samples;
+                       blurUniforms['weights'].value = weights;
+                       blurUniforms['latitudinal'].value = direction === 'latitudinal';
+
+                       if (poleAxis) {
+                               blurUniforms['poleAxis'].value = poleAxis;
+                       }
+
+                       blurUniforms['dTheta'].value = radiansPerPixel;
+                       blurUniforms['mipInt'].value = LOD_MAX - lodIn;
+                       blurUniforms['inputEncoding'].value = ENCODINGS[targetIn.texture.encoding];
+                       blurUniforms['outputEncoding'].value = ENCODINGS[targetIn.texture.encoding];
+                       const outputSize = _sizeLods[lodOut];
+                       const x = 3 * Math.max(0, SIZE_MAX - 2 * outputSize);
+                       const y = (lodOut === 0 ? 0 : 2 * SIZE_MAX) + 2 * outputSize * (lodOut > LOD_MAX - LOD_MIN ? lodOut - LOD_MAX + LOD_MIN : 0);
+
+                       _setViewport(targetOut, x, y, 3 * outputSize, 2 * outputSize);
+
+                       renderer.setRenderTarget(targetOut);
+                       renderer.render(blurMesh, _flatCamera);
+               }
+
+       }
+
+       function _isLDR(texture) {
+               if (texture === undefined || texture.type !== UnsignedByteType) return false;
+               return texture.encoding === LinearEncoding || texture.encoding === sRGBEncoding || texture.encoding === GammaEncoding;
+       }
+
+       function _createPlanes() {
+               const _lodPlanes = [];
+               const _sizeLods = [];
+               const _sigmas = [];
+               let lod = LOD_MAX;
+
+               for (let i = 0; i < TOTAL_LODS; i++) {
+                       const sizeLod = Math.pow(2, lod);
+
+                       _sizeLods.push(sizeLod);
+
+                       let sigma = 1.0 / sizeLod;
+
+                       if (i > LOD_MAX - LOD_MIN) {
+                               sigma = EXTRA_LOD_SIGMA[i - LOD_MAX + LOD_MIN - 1];
+                       } else if (i == 0) {
+                               sigma = 0;
+                       }
+
+                       _sigmas.push(sigma);
+
+                       const texelSize = 1.0 / (sizeLod - 1);
+                       const min = -texelSize / 2;
+                       const max = 1 + texelSize / 2;
+                       const uv1 = [min, min, max, min, max, max, min, min, max, max, min, max];
+                       const cubeFaces = 6;
+                       const vertices = 6;
+                       const positionSize = 3;
+                       const uvSize = 2;
+                       const faceIndexSize = 1;
+                       const position = new Float32Array(positionSize * vertices * cubeFaces);
+                       const uv = new Float32Array(uvSize * vertices * cubeFaces);
+                       const faceIndex = new Float32Array(faceIndexSize * vertices * cubeFaces);
+
+                       for (let face = 0; face < cubeFaces; face++) {
+                               const x = face % 3 * 2 / 3 - 1;
+                               const y = face > 2 ? 0 : -1;
+                               const coordinates = [x, y, 0, x + 2 / 3, y, 0, x + 2 / 3, y + 1, 0, x, y, 0, x + 2 / 3, y + 1, 0, x, y + 1, 0];
+                               position.set(coordinates, positionSize * vertices * face);
+                               uv.set(uv1, uvSize * vertices * face);
+                               const fill = [face, face, face, face, face, face];
+                               faceIndex.set(fill, faceIndexSize * vertices * face);
+                       }
+
+                       const planes = new BufferGeometry();
+                       planes.setAttribute('position', new BufferAttribute(position, positionSize));
+                       planes.setAttribute('uv', new BufferAttribute(uv, uvSize));
+                       planes.setAttribute('faceIndex', new BufferAttribute(faceIndex, faceIndexSize));
+
+                       _lodPlanes.push(planes);
+
+                       if (lod > LOD_MIN) {
+                               lod--;
+                       }
+               }
+
+               return {
+                       _lodPlanes,
+                       _sizeLods,
+                       _sigmas
+               };
+       }
+
+       function _createRenderTarget(params) {
+               const cubeUVRenderTarget = new WebGLRenderTarget(3 * SIZE_MAX, 3 * SIZE_MAX, params);
+               cubeUVRenderTarget.texture.mapping = CubeUVReflectionMapping;
+               cubeUVRenderTarget.texture.name = 'PMREM.cubeUv';
+               cubeUVRenderTarget.scissorTest = true;
+               return cubeUVRenderTarget;
+       }
+
+       function _setViewport(target, x, y, width, height) {
+               target.viewport.set(x, y, width, height);
+               target.scissor.set(x, y, width, height);
+       }
+
+       function _getBlurShader(maxSamples) {
+               const weights = new Float32Array(maxSamples);
+               const poleAxis = new Vector3(0, 1, 0);
+               const shaderMaterial = new RawShaderMaterial({
+                       name: 'SphericalGaussianBlur',
+                       defines: {
+                               'n': maxSamples
+                       },
+                       uniforms: {
+                               'envMap': {
+                                       value: null
+                               },
+                               'samples': {
+                                       value: 1
+                               },
+                               'weights': {
+                                       value: weights
+                               },
+                               'latitudinal': {
+                                       value: false
+                               },
+                               'dTheta': {
+                                       value: 0
+                               },
+                               'mipInt': {
+                                       value: 0
+                               },
+                               'poleAxis': {
+                                       value: poleAxis
+                               },
+                               'inputEncoding': {
+                                       value: ENCODINGS[LinearEncoding]
+                               },
+                               'outputEncoding': {
+                                       value: ENCODINGS[LinearEncoding]
+                               }
+                       },
+                       vertexShader: _getCommonVertexShader(),
+                       fragmentShader:
+                       /* glsl */
+                       `
+
+                       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;
+
+                       ${_getEncodings()}
+
+                       #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 );
+
+                               }
+
+                               gl_FragColor = linearToOutputTexel( gl_FragColor );
+
+                       }
+               `,
+                       blending: NoBlending,
+                       depthTest: false,
+                       depthWrite: false
+               });
+               return shaderMaterial;
+       }
+
+       function _getEquirectShader() {
+               const texelSize = new Vector2(1, 1);
+               const shaderMaterial = new RawShaderMaterial({
+                       name: 'EquirectangularToCubeUV',
+                       uniforms: {
+                               'envMap': {
+                                       value: null
+                               },
+                               'texelSize': {
+                                       value: texelSize
+                               },
+                               'inputEncoding': {
+                                       value: ENCODINGS[LinearEncoding]
+                               },
+                               'outputEncoding': {
+                                       value: ENCODINGS[LinearEncoding]
+                               }
+                       },
+                       vertexShader: _getCommonVertexShader(),
+                       fragmentShader:
+                       /* glsl */
+                       `
+
+                       precision mediump float;
+                       precision mediump int;
+
+                       varying vec3 vOutputDirection;
+
+                       uniform sampler2D envMap;
+                       uniform vec2 texelSize;
+
+                       ${_getEncodings()}
+
+                       #include <common>
+
+                       void main() {
+
+                               gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );
+
+                               vec3 outputDirection = normalize( vOutputDirection );
+                               vec2 uv = equirectUv( outputDirection );
+
+                               vec2 f = fract( uv / texelSize - 0.5 );
+                               uv -= f * texelSize;
+                               vec3 tl = envMapTexelToLinear( texture2D ( envMap, uv ) ).rgb;
+                               uv.x += texelSize.x;
+                               vec3 tr = envMapTexelToLinear( texture2D ( envMap, uv ) ).rgb;
+                               uv.y += texelSize.y;
+                               vec3 br = envMapTexelToLinear( texture2D ( envMap, uv ) ).rgb;
+                               uv.x -= texelSize.x;
+                               vec3 bl = envMapTexelToLinear( texture2D ( envMap, uv ) ).rgb;
+
+                               vec3 tm = mix( tl, tr, f.x );
+                               vec3 bm = mix( bl, br, f.x );
+                               gl_FragColor.rgb = mix( tm, bm, f.y );
+
+                               gl_FragColor = linearToOutputTexel( gl_FragColor );
+
+                       }
+               `,
+                       blending: NoBlending,
+                       depthTest: false,
+                       depthWrite: false
+               });
+               return shaderMaterial;
+       }
+
+       function _getCubemapShader() {
+               const shaderMaterial = new RawShaderMaterial({
+                       name: 'CubemapToCubeUV',
+                       uniforms: {
+                               'envMap': {
+                                       value: null
+                               },
+                               'inputEncoding': {
+                                       value: ENCODINGS[LinearEncoding]
+                               },
+                               'outputEncoding': {
+                                       value: ENCODINGS[LinearEncoding]
+                               }
+                       },
+                       vertexShader: _getCommonVertexShader(),
+                       fragmentShader:
+                       /* glsl */
+                       `
+
+                       precision mediump float;
+                       precision mediump int;
+
+                       varying vec3 vOutputDirection;
+
+                       uniform samplerCube envMap;
+
+                       ${_getEncodings()}
+
+                       void main() {
+
+                               gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );
+                               gl_FragColor.rgb = envMapTexelToLinear( textureCube( envMap, vec3( - vOutputDirection.x, vOutputDirection.yz ) ) ).rgb;
+                               gl_FragColor = linearToOutputTexel( gl_FragColor );
+
+                       }
+               `,
+                       blending: NoBlending,
+                       depthTest: false,
+                       depthWrite: false
+               });
+               return shaderMaterial;
+       }
+
+       function _getCommonVertexShader() {
+               return (
+                       /* glsl */
+                       `
+
+               precision mediump float;
+               precision mediump int;
+
+               attribute vec3 position;
+               attribute vec2 uv;
+               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 _getEncodings() {
+               return (
+                       /* glsl */
+                       `
+
+               uniform int inputEncoding;
+               uniform int outputEncoding;
+
+               #include <encodings_pars_fragment>
+
+               vec4 inputTexelToLinear( vec4 value ) {
+
+                       if ( inputEncoding == 0 ) {
+
+                               return value;
+
+                       } else if ( inputEncoding == 1 ) {
+
+                               return sRGBToLinear( value );
+
+                       } else if ( inputEncoding == 2 ) {
+
+                               return RGBEToLinear( value );
+
+                       } else if ( inputEncoding == 3 ) {
+
+                               return RGBMToLinear( value, 7.0 );
+
+                       } else if ( inputEncoding == 4 ) {
+
+                               return RGBMToLinear( value, 16.0 );
+
+                       } else if ( inputEncoding == 5 ) {
+
+                               return RGBDToLinear( value, 256.0 );
+
+                       } else {
+
+                               return GammaToLinear( value, 2.2 );
+
+                       }
+
+               }
+
+               vec4 linearToOutputTexel( vec4 value ) {
+
+                       if ( outputEncoding == 0 ) {
+
+                               return value;
+
+                       } else if ( outputEncoding == 1 ) {
+
+                               return LinearTosRGB( value );
+
+                       } else if ( outputEncoding == 2 ) {
+
+                               return LinearToRGBE( value );
+
+                       } else if ( outputEncoding == 3 ) {
+
+                               return LinearToRGBM( value, 7.0 );
+
+                       } else if ( outputEncoding == 4 ) {
+
+                               return LinearToRGBM( value, 16.0 );
+
+                       } else if ( outputEncoding == 5 ) {
+
+                               return LinearToRGBD( value, 256.0 );
+
+                       } else {
+
+                               return LinearToGamma( value, 2.2 );
+
+                       }
+
+               }
+
+               vec4 envMapTexelToLinear( vec4 color ) {
+
+                       return inputTexelToLinear( color );
+
+               }
+       `
+               );
+       }
+
+       function WebGLCubeUVMaps(renderer) {
+               let cubeUVmaps = new WeakMap();
+               let pmremGenerator = null;
+
+               function get(texture) {
+                       if (texture && texture.isTexture && texture.isRenderTargetTexture === false) {
+                               const mapping = texture.mapping;
+                               const isEquirectMap = mapping === EquirectangularReflectionMapping || mapping === EquirectangularRefractionMapping;
+                               const isCubeMap = mapping === CubeReflectionMapping || mapping === CubeRefractionMapping;
+
+                               if (isEquirectMap || isCubeMap) {
+                                       // equirect/cube map to cubeUV conversion
+                                       if (cubeUVmaps.has(texture)) {
+                                               return cubeUVmaps.get(texture).texture;
+                                       } else {
+                                               const image = texture.image;
+
+                                               if (isEquirectMap && image && image.height > 0 || isCubeMap && image && isCubeTextureComplete(image)) {
+                                                       const currentRenderTarget = renderer.getRenderTarget();
+                                                       if (pmremGenerator === null) pmremGenerator = new PMREMGenerator(renderer);
+                                                       const renderTarget = isEquirectMap ? pmremGenerator.fromEquirectangular(texture) : pmremGenerator.fromCubemap(texture);
+                                                       cubeUVmaps.set(texture, renderTarget);
+                                                       renderer.setRenderTarget(currentRenderTarget);
+                                                       texture.addEventListener('dispose', onTextureDispose);
+                                                       return renderTarget.texture;
+                                               } else {
+                                                       // image not yet ready. try the conversion next frame
+                                                       return null;
+                                               }
+                                       }
+                               }
+                       }
+
+                       return texture;
+               }
+
+               function isCubeTextureComplete(image) {
+                       let count = 0;
+                       const length = 6;
+
+                       for (let i = 0; i < length; i++) {
+                               if (image[i] !== undefined) count++;
+                       }
+
+                       return count === length;
+               }
+
+               function onTextureDispose(event) {
+                       const texture = event.target;
+                       texture.removeEventListener('dispose', onTextureDispose);
+                       const cubemapUV = cubeUVmaps.get(texture);
+
+                       if (cubemapUV !== undefined) {
+                               cubeUVmaps.delete(texture);
+                               cubemapUV.dispose();
+                       }
+               }
+
+               function dispose() {
+                       cubeUVmaps = new WeakMap();
+
+                       if (pmremGenerator !== null) {
+                               pmremGenerator.dispose();
+                               pmremGenerator = null;
+                       }
+               }
+
+               return {
+                       get: get,
+                       dispose: dispose
+               };
+       }
+
+       function WebGLExtensions(gl) {
+               const extensions = {};
+
+               function getExtension(name) {
+                       if (extensions[name] !== undefined) {
+                               return extensions[name];
+                       }
+
+                       let extension;
+
+                       switch (name) {
+                               case 'WEBGL_depth_texture':
+                                       extension = gl.getExtension('WEBGL_depth_texture') || gl.getExtension('MOZ_WEBGL_depth_texture') || gl.getExtension('WEBKIT_WEBGL_depth_texture');
+                                       break;
+
+                               case 'EXT_texture_filter_anisotropic':
+                                       extension = gl.getExtension('EXT_texture_filter_anisotropic') || gl.getExtension('MOZ_EXT_texture_filter_anisotropic') || gl.getExtension('WEBKIT_EXT_texture_filter_anisotropic');
+                                       break;
+
+                               case 'WEBGL_compressed_texture_s3tc':
+                                       extension = gl.getExtension('WEBGL_compressed_texture_s3tc') || gl.getExtension('MOZ_WEBGL_compressed_texture_s3tc') || gl.getExtension('WEBKIT_WEBGL_compressed_texture_s3tc');
+                                       break;
+
+                               case 'WEBGL_compressed_texture_pvrtc':
+                                       extension = gl.getExtension('WEBGL_compressed_texture_pvrtc') || gl.getExtension('WEBKIT_WEBGL_compressed_texture_pvrtc');
+                                       break;
+
+                               default:
+                                       extension = gl.getExtension(name);
+                       }
+
+                       extensions[name] = extension;
+                       return extension;
+               }
+
+               return {
+                       has: function (name) {
+                               return getExtension(name) !== null;
+                       },
+                       init: function (capabilities) {
+                               if (capabilities.isWebGL2) {
+                                       getExtension('EXT_color_buffer_float');
+                               } else {
+                                       getExtension('WEBGL_depth_texture');
+                                       getExtension('OES_texture_float');
+                                       getExtension('OES_texture_half_float');
+                                       getExtension('OES_texture_half_float_linear');
+                                       getExtension('OES_standard_derivatives');
+                                       getExtension('OES_element_index_uint');
+                                       getExtension('OES_vertex_array_object');
+                                       getExtension('ANGLE_instanced_arrays');
+                               }
+
+                               getExtension('OES_texture_float_linear');
+                               getExtension('EXT_color_buffer_half_float');
+                       },
+                       get: function (name) {
+                               const extension = getExtension(name);
+
+                               if (extension === null) {
+                                       console.warn('THREE.WebGLRenderer: ' + name + ' extension not supported.');
+                               }
+
+                               return extension;
+                       }
+               };
+       }
+
+       function WebGLGeometries(gl, attributes, info, bindingStates) {
+               const geometries = {};
+               const wireframeAttributes = new WeakMap();
+
+               function onGeometryDispose(event) {
+                       const geometry = event.target;
+
+                       if (geometry.index !== null) {
+                               attributes.remove(geometry.index);
+                       }
+
+                       for (const name in geometry.attributes) {
+                               attributes.remove(geometry.attributes[name]);
+                       }
+
+                       geometry.removeEventListener('dispose', onGeometryDispose);
+                       delete geometries[geometry.id];
+                       const attribute = wireframeAttributes.get(geometry);
+
+                       if (attribute) {
+                               attributes.remove(attribute);
+                               wireframeAttributes.delete(geometry);
+                       }
+
+                       bindingStates.releaseStatesOfGeometry(geometry);
+
+                       if (geometry.isInstancedBufferGeometry === true) {
+                               delete geometry._maxInstanceCount;
+                       } //
+
+
+                       info.memory.geometries--;
+               }
+
+               function get(object, geometry) {
+                       if (geometries[geometry.id] === true) return geometry;
+                       geometry.addEventListener('dispose', onGeometryDispose);
+                       geometries[geometry.id] = true;
+                       info.memory.geometries++;
+                       return geometry;
+               }
+
+               function update(geometry) {
+                       const geometryAttributes = geometry.attributes; // Updating index buffer in VAO now. See WebGLBindingStates.
+
+                       for (const name in geometryAttributes) {
+                               attributes.update(geometryAttributes[name], gl.ARRAY_BUFFER);
+                       } // morph targets
+
+
+                       const morphAttributes = geometry.morphAttributes;
+
+                       for (const name in morphAttributes) {
+                               const array = morphAttributes[name];
+
+                               for (let i = 0, l = array.length; i < l; i++) {
+                                       attributes.update(array[i], gl.ARRAY_BUFFER);
+                               }
+                       }
+               }
+
+               function updateWireframeAttribute(geometry) {
+                       const indices = [];
+                       const geometryIndex = geometry.index;
+                       const geometryPosition = geometry.attributes.position;
+                       let version = 0;
+
+                       if (geometryIndex !== null) {
+                               const array = geometryIndex.array;
+                               version = geometryIndex.version;
+
+                               for (let i = 0, l = array.length; i < l; i += 3) {
+                                       const a = array[i + 0];
+                                       const b = array[i + 1];
+                                       const c = array[i + 2];
+                                       indices.push(a, b, b, c, c, a);
+                               }
+                       } else {
+                               const array = geometryPosition.array;
+                               version = geometryPosition.version;
+
+                               for (let i = 0, l = array.length / 3 - 1; i < l; i += 3) {
+                                       const a = i + 0;
+                                       const b = i + 1;
+                                       const c = i + 2;
+                                       indices.push(a, b, b, c, c, a);
+                               }
+                       }
+
+                       const attribute = new (arrayMax(indices) > 65535 ? Uint32BufferAttribute : Uint16BufferAttribute)(indices, 1);
+                       attribute.version = version; // Updating index buffer in VAO now. See WebGLBindingStates
+                       //
+
+                       const previousAttribute = wireframeAttributes.get(geometry);
+                       if (previousAttribute) attributes.remove(previousAttribute); //
+
+                       wireframeAttributes.set(geometry, attribute);
+               }
+
+               function getWireframeAttribute(geometry) {
+                       const currentAttribute = wireframeAttributes.get(geometry);
+
+                       if (currentAttribute) {
+                               const geometryIndex = geometry.index;
+
+                               if (geometryIndex !== null) {
+                                       // if the attribute is obsolete, create a new one
+                                       if (currentAttribute.version < geometryIndex.version) {
+                                               updateWireframeAttribute(geometry);
+                                       }
+                               }
+                       } else {
+                               updateWireframeAttribute(geometry);
+                       }
+
+                       return wireframeAttributes.get(geometry);
+               }
+
+               return {
+                       get: get,
+                       update: update,
+                       getWireframeAttribute: getWireframeAttribute
+               };
+       }
+
+       function WebGLIndexedBufferRenderer(gl, extensions, info, capabilities) {
+               const isWebGL2 = capabilities.isWebGL2;
+               let mode;
+
+               function setMode(value) {
+                       mode = value;
+               }
+
+               let type, bytesPerElement;
+
+               function setIndex(value) {
+                       type = value.type;
+                       bytesPerElement = value.bytesPerElement;
+               }
+
+               function render(start, count) {
+                       gl.drawElements(mode, count, type, start * bytesPerElement);
+                       info.update(count, mode, 1);
+               }
+
+               function renderInstances(start, count, primcount) {
+                       if (primcount === 0) return;
+                       let extension, methodName;
+
+                       if (isWebGL2) {
+                               extension = gl;
+                               methodName = 'drawElementsInstanced';
+                       } else {
+                               extension = extensions.get('ANGLE_instanced_arrays');
+                               methodName = 'drawElementsInstancedANGLE';
+
+                               if (extension === null) {
+                                       console.error('THREE.WebGLIndexedBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.');
+                                       return;
+                               }
+                       }
+
+                       extension[methodName](mode, count, type, start * bytesPerElement, primcount);
+                       info.update(count, mode, primcount);
+               } //
+
+
+               this.setMode = setMode;
+               this.setIndex = setIndex;
+               this.render = render;
+               this.renderInstances = renderInstances;
+       }
+
+       function WebGLInfo(gl) {
+               const memory = {
+                       geometries: 0,
+                       textures: 0
+               };
+               const render = {
+                       frame: 0,
+                       calls: 0,
+                       triangles: 0,
+                       points: 0,
+                       lines: 0
+               };
+
+               function update(count, mode, instanceCount) {
+                       render.calls++;
+
+                       switch (mode) {
+                               case gl.TRIANGLES:
+                                       render.triangles += instanceCount * (count / 3);
+                                       break;
+
+                               case gl.LINES:
+                                       render.lines += instanceCount * (count / 2);
+                                       break;
+
+                               case gl.LINE_STRIP:
+                                       render.lines += instanceCount * (count - 1);
+                                       break;
+
+                               case gl.LINE_LOOP:
+                                       render.lines += instanceCount * count;
+                                       break;
+
+                               case gl.POINTS:
+                                       render.points += instanceCount * count;
+                                       break;
+
+                               default:
+                                       console.error('THREE.WebGLInfo: Unknown draw mode:', mode);
+                                       break;
+                       }
+               }
+
+               function reset() {
+                       render.frame++;
+                       render.calls = 0;
+                       render.triangles = 0;
+                       render.points = 0;
+                       render.lines = 0;
+               }
+
+               return {
+                       memory: memory,
+                       render: render,
+                       programs: null,
+                       autoReset: true,
+                       reset: reset,
+                       update: update
+               };
+       }
+
+       function numericalSort(a, b) {
+               return a[0] - b[0];
+       }
+
+       function absNumericalSort(a, b) {
+               return Math.abs(b[1]) - Math.abs(a[1]);
+       }
+
+       function WebGLMorphtargets(gl) {
+               const influencesList = {};
+               const morphInfluences = new Float32Array(8);
+               const workInfluences = [];
+
+               for (let i = 0; i < 8; i++) {
+                       workInfluences[i] = [i, 0];
+               }
+
+               function update(object, geometry, material, program) {
+                       const objectInfluences = object.morphTargetInfluences; // When object doesn't have morph target influences defined, we treat it as a 0-length array
+                       // This is important to make sure we set up morphTargetBaseInfluence / morphTargetInfluences
+
+                       const length = objectInfluences === undefined ? 0 : objectInfluences.length;
+                       let influences = influencesList[geometry.id];
+
+                       if (influences === undefined || influences.length !== length) {
+                               // initialise list
+                               influences = [];
+
+                               for (let i = 0; i < length; i++) {
+                                       influences[i] = [i, 0];
+                               }
+
+                               influencesList[geometry.id] = influences;
+                       } // Collect influences
+
+
+                       for (let i = 0; i < length; i++) {
+                               const influence = influences[i];
+                               influence[0] = i;
+                               influence[1] = objectInfluences[i];
+                       }
+
+                       influences.sort(absNumericalSort);
+
+                       for (let i = 0; i < 8; i++) {
+                               if (i < length && influences[i][1]) {
+                                       workInfluences[i][0] = influences[i][0];
+                                       workInfluences[i][1] = influences[i][1];
+                               } else {
+                                       workInfluences[i][0] = Number.MAX_SAFE_INTEGER;
+                                       workInfluences[i][1] = 0;
+                               }
+                       }
+
+                       workInfluences.sort(numericalSort);
+                       const morphTargets = geometry.morphAttributes.position;
+                       const morphNormals = geometry.morphAttributes.normal;
+                       let morphInfluencesSum = 0;
+
+                       for (let i = 0; i < 8; i++) {
+                               const influence = workInfluences[i];
+                               const index = influence[0];
+                               const value = influence[1];
+
+                               if (index !== Number.MAX_SAFE_INTEGER && value) {
+                                       if (morphTargets && geometry.getAttribute('morphTarget' + i) !== morphTargets[index]) {
+                                               geometry.setAttribute('morphTarget' + i, morphTargets[index]);
+                                       }
+
+                                       if (morphNormals && geometry.getAttribute('morphNormal' + i) !== morphNormals[index]) {
+                                               geometry.setAttribute('morphNormal' + i, morphNormals[index]);
+                                       }
+
+                                       morphInfluences[i] = value;
+                                       morphInfluencesSum += value;
+                               } else {
+                                       if (morphTargets && geometry.hasAttribute('morphTarget' + i) === true) {
+                                               geometry.deleteAttribute('morphTarget' + i);
+                                       }
+
+                                       if (morphNormals && geometry.hasAttribute('morphNormal' + i) === true) {
+                                               geometry.deleteAttribute('morphNormal' + i);
+                                       }
+
+                                       morphInfluences[i] = 0;
+                               }
+                       } // GLSL shader uses formula baseinfluence * base + sum(target * influence)
+                       // This allows us to switch between absolute morphs and relative morphs without changing shader code
+                       // When baseinfluence = 1 - sum(influence), the above is equivalent to sum((target - base) * influence)
+
+
+                       const morphBaseInfluence = geometry.morphTargetsRelative ? 1 : 1 - morphInfluencesSum;
+                       program.getUniforms().setValue(gl, 'morphTargetBaseInfluence', morphBaseInfluence);
+                       program.getUniforms().setValue(gl, 'morphTargetInfluences', morphInfluences);
+               }
+
+               return {
+                       update: update
+               };
+       }
+
+       function WebGLObjects(gl, geometries, attributes, info) {
+               let updateMap = new WeakMap();
+
+               function update(object) {
+                       const frame = info.render.frame;
+                       const geometry = object.geometry;
+                       const buffergeometry = geometries.get(object, geometry); // Update once per frame
+
+                       if (updateMap.get(buffergeometry) !== frame) {
+                               geometries.update(buffergeometry);
+                               updateMap.set(buffergeometry, frame);
+                       }
+
+                       if (object.isInstancedMesh) {
+                               if (object.hasEventListener('dispose', onInstancedMeshDispose) === false) {
+                                       object.addEventListener('dispose', onInstancedMeshDispose);
+                               }
+
+                               attributes.update(object.instanceMatrix, gl.ARRAY_BUFFER);
+
+                               if (object.instanceColor !== null) {
+                                       attributes.update(object.instanceColor, gl.ARRAY_BUFFER);
+                               }
+                       }
+
+                       return buffergeometry;
+               }
+
+               function dispose() {
+                       updateMap = new WeakMap();
+               }
+
+               function onInstancedMeshDispose(event) {
+                       const instancedMesh = event.target;
+                       instancedMesh.removeEventListener('dispose', onInstancedMeshDispose);
+                       attributes.remove(instancedMesh.instanceMatrix);
+                       if (instancedMesh.instanceColor !== null) attributes.remove(instancedMesh.instanceColor);
+               }
+
+               return {
+                       update: update,
+                       dispose: dispose
+               };
+       }
+
+       class DataTexture2DArray extends Texture {
+               constructor(data = null, width = 1, height = 1, depth = 1) {
+                       super(null);
+                       this.image = {
+                               data,
+                               width,
+                               height,
+                               depth
+                       };
+                       this.magFilter = NearestFilter;
+                       this.minFilter = NearestFilter;
+                       this.wrapR = ClampToEdgeWrapping;
+                       this.generateMipmaps = false;
+                       this.flipY = false;
+                       this.unpackAlignment = 1;
+                       this.needsUpdate = true;
+               }
+
+       }
+
+       DataTexture2DArray.prototype.isDataTexture2DArray = true;
+
+       class DataTexture3D extends Texture {
+               constructor(data = null, width = 1, height = 1, depth = 1) {
+                       // We're going to add .setXXX() methods for setting properties later.
+                       // Users can still set in DataTexture3D directly.
+                       //
+                       //      const texture = new THREE.DataTexture3D( data, width, height, depth );
+                       //      texture.anisotropy = 16;
+                       //
+                       // See #14839
+                       super(null);
+                       this.image = {
+                               data,
+                               width,
+                               height,
+                               depth
+                       };
+                       this.magFilter = NearestFilter;
+                       this.minFilter = NearestFilter;
+                       this.wrapR = ClampToEdgeWrapping;
+                       this.generateMipmaps = false;
+                       this.flipY = false;
+                       this.unpackAlignment = 1;
+                       this.needsUpdate = true;
+               }
+
+       }
+
+       DataTexture3D.prototype.isDataTexture3D = true;
+
+       /**
+        * Uniforms of a program.
+        * Those form a tree structure with a special top-level container for the root,
+        * which you get by calling 'new WebGLUniforms( gl, program )'.
+        *
+        *
+        * Properties of inner nodes including the top-level container:
+        *
+        * .seq - array of nested uniforms
+        * .map - nested uniforms by name
+        *
+        *
+        * Methods of all nodes except the top-level container:
+        *
+        * .setValue( gl, value, [textures] )
+        *
+        *              uploads a uniform value(s)
+        *              the 'textures' parameter is needed for sampler uniforms
+        *
+        *
+        * Static methods of the top-level container (textures factorizations):
+        *
+        * .upload( gl, seq, values, textures )
+        *
+        *              sets uniforms in 'seq' to 'values[id].value'
+        *
+        * .seqWithValue( seq, values ) : filteredSeq
+        *
+        *              filters 'seq' entries with corresponding entry in values
+        *
+        *
+        * Methods of the top-level container (textures factorizations):
+        *
+        * .setValue( gl, name, value, textures )
+        *
+        *              sets uniform with       name 'name' to 'value'
+        *
+        * .setOptional( gl, obj, prop )
+        *
+        *              like .set for an optional property of the object
+        *
+        */
+       const emptyTexture = new Texture();
+       const emptyTexture2dArray = new DataTexture2DArray();
+       const emptyTexture3d = new DataTexture3D();
+       const emptyCubeTexture = new CubeTexture(); // --- Utilities ---
+       // Array Caches (provide typed arrays for temporary by size)
+
+       const arrayCacheF32 = [];
+       const arrayCacheI32 = []; // Float32Array caches used for uploading Matrix uniforms
+
+       const mat4array = new Float32Array(16);
+       const mat3array = new Float32Array(9);
+       const mat2array = new Float32Array(4); // Flattening for arrays of vectors and matrices
+
+       function flatten(array, nBlocks, blockSize) {
+               const firstElem = array[0];
+               if (firstElem <= 0 || firstElem > 0) return array; // unoptimized: ! isNaN( firstElem )
+               // see http://jacksondunstan.com/articles/983
+
+               const n = nBlocks * blockSize;
+               let r = arrayCacheF32[n];
+
+               if (r === undefined) {
+                       r = new Float32Array(n);
+                       arrayCacheF32[n] = r;
+               }
+
+               if (nBlocks !== 0) {
+                       firstElem.toArray(r, 0);
+
+                       for (let i = 1, offset = 0; i !== nBlocks; ++i) {
+                               offset += blockSize;
+                               array[i].toArray(r, offset);
+                       }
+               }
+
+               return r;
+       }
+
+       function arraysEqual(a, b) {
+               if (a.length !== b.length) return false;
+
+               for (let i = 0, l = a.length; i < l; i++) {
+                       if (a[i] !== b[i]) return false;
+               }
+
+               return true;
+       }
+
+       function copyArray(a, b) {
+               for (let i = 0, l = b.length; i < l; i++) {
+                       a[i] = b[i];
+               }
+       } // Texture unit allocation
+
+
+       function allocTexUnits(textures, n) {
+               let r = arrayCacheI32[n];
+
+               if (r === undefined) {
+                       r = new Int32Array(n);
+                       arrayCacheI32[n] = r;
+               }
+
+               for (let i = 0; i !== n; ++i) {
+                       r[i] = textures.allocateTextureUnit();
+               }
+
+               return r;
+       } // --- Setters ---
+       // Note: Defining these methods externally, because they come in a bunch
+       // and this way their names minify.
+       // Single scalar
+
+
+       function setValueV1f(gl, v) {
+               const cache = this.cache;
+               if (cache[0] === v) return;
+               gl.uniform1f(this.addr, v);
+               cache[0] = v;
+       } // Single float vector (from flat array or THREE.VectorN)
+
+
+       function setValueV2f(gl, v) {
+               const cache = this.cache;
+
+               if (v.x !== undefined) {
+                       if (cache[0] !== v.x || cache[1] !== v.y) {
+                               gl.uniform2f(this.addr, v.x, v.y);
+                               cache[0] = v.x;
+                               cache[1] = v.y;
+                       }
+               } else {
+                       if (arraysEqual(cache, v)) return;
+                       gl.uniform2fv(this.addr, v);
+                       copyArray(cache, v);
+               }
+       }
+
+       function setValueV3f(gl, v) {
+               const cache = this.cache;
+
+               if (v.x !== undefined) {
+                       if (cache[0] !== v.x || cache[1] !== v.y || cache[2] !== v.z) {
+                               gl.uniform3f(this.addr, v.x, v.y, v.z);
+                               cache[0] = v.x;
+                               cache[1] = v.y;
+                               cache[2] = v.z;
+                       }
+               } else if (v.r !== undefined) {
+                       if (cache[0] !== v.r || cache[1] !== v.g || cache[2] !== v.b) {
+                               gl.uniform3f(this.addr, v.r, v.g, v.b);
+                               cache[0] = v.r;
+                               cache[1] = v.g;
+                               cache[2] = v.b;
+                       }
+               } else {
+                       if (arraysEqual(cache, v)) return;
+                       gl.uniform3fv(this.addr, v);
+                       copyArray(cache, v);
+               }
+       }
+
+       function setValueV4f(gl, v) {
+               const cache = this.cache;
+
+               if (v.x !== undefined) {
+                       if (cache[0] !== v.x || cache[1] !== v.y || cache[2] !== v.z || cache[3] !== v.w) {
+                               gl.uniform4f(this.addr, v.x, v.y, v.z, v.w);
+                               cache[0] = v.x;
+                               cache[1] = v.y;
+                               cache[2] = v.z;
+                               cache[3] = v.w;
+                       }
+               } else {
+                       if (arraysEqual(cache, v)) return;
+                       gl.uniform4fv(this.addr, v);
+                       copyArray(cache, v);
+               }
+       } // Single matrix (from flat array or THREE.MatrixN)
+
+
+       function setValueM2(gl, v) {
+               const cache = this.cache;
+               const elements = v.elements;
+
+               if (elements === undefined) {
+                       if (arraysEqual(cache, v)) return;
+                       gl.uniformMatrix2fv(this.addr, false, v);
+                       copyArray(cache, v);
+               } else {
+                       if (arraysEqual(cache, elements)) return;
+                       mat2array.set(elements);
+                       gl.uniformMatrix2fv(this.addr, false, mat2array);
+                       copyArray(cache, elements);
+               }
+       }
+
+       function setValueM3(gl, v) {
+               const cache = this.cache;
+               const elements = v.elements;
+
+               if (elements === undefined) {
+                       if (arraysEqual(cache, v)) return;
+                       gl.uniformMatrix3fv(this.addr, false, v);
+                       copyArray(cache, v);
+               } else {
+                       if (arraysEqual(cache, elements)) return;
+                       mat3array.set(elements);
+                       gl.uniformMatrix3fv(this.addr, false, mat3array);
+                       copyArray(cache, elements);
+               }
+       }
+
+       function setValueM4(gl, v) {
+               const cache = this.cache;
+               const elements = v.elements;
+
+               if (elements === undefined) {
+                       if (arraysEqual(cache, v)) return;
+                       gl.uniformMatrix4fv(this.addr, false, v);
+                       copyArray(cache, v);
+               } else {
+                       if (arraysEqual(cache, elements)) return;
+                       mat4array.set(elements);
+                       gl.uniformMatrix4fv(this.addr, false, mat4array);
+                       copyArray(cache, elements);
+               }
+       } // Single integer / boolean
+
+
+       function setValueV1i(gl, v) {
+               const cache = this.cache;
+               if (cache[0] === v) return;
+               gl.uniform1i(this.addr, v);
+               cache[0] = v;
+       } // Single integer / boolean vector (from flat array)
+
+
+       function setValueV2i(gl, v) {
+               const cache = this.cache;
+               if (arraysEqual(cache, v)) return;
+               gl.uniform2iv(this.addr, v);
+               copyArray(cache, v);
+       }
+
+       function setValueV3i(gl, v) {
+               const cache = this.cache;
+               if (arraysEqual(cache, v)) return;
+               gl.uniform3iv(this.addr, v);
+               copyArray(cache, v);
+       }
+
+       function setValueV4i(gl, v) {
+               const cache = this.cache;
+               if (arraysEqual(cache, v)) return;
+               gl.uniform4iv(this.addr, v);
+               copyArray(cache, v);
+       } // Single unsigned integer
+
+
+       function setValueV1ui(gl, v) {
+               const cache = this.cache;
+               if (cache[0] === v) return;
+               gl.uniform1ui(this.addr, v);
+               cache[0] = v;
+       } // Single unsigned integer vector (from flat array)
+
+
+       function setValueV2ui(gl, v) {
+               const cache = this.cache;
+               if (arraysEqual(cache, v)) return;
+               gl.uniform2uiv(this.addr, v);
+               copyArray(cache, v);
+       }
+
+       function setValueV3ui(gl, v) {
+               const cache = this.cache;
+               if (arraysEqual(cache, v)) return;
+               gl.uniform3uiv(this.addr, v);
+               copyArray(cache, v);
+       }
+
+       function setValueV4ui(gl, v) {
+               const cache = this.cache;
+               if (arraysEqual(cache, v)) return;
+               gl.uniform4uiv(this.addr, v);
+               copyArray(cache, v);
+       } // Single texture (2D / Cube)
+
+
+       function setValueT1(gl, v, textures) {
+               const cache = this.cache;
+               const unit = textures.allocateTextureUnit();
+
+               if (cache[0] !== unit) {
+                       gl.uniform1i(this.addr, unit);
+                       cache[0] = unit;
+               }
+
+               textures.safeSetTexture2D(v || emptyTexture, unit);
+       }
+
+       function setValueT3D1(gl, v, textures) {
+               const cache = this.cache;
+               const unit = textures.allocateTextureUnit();
+
+               if (cache[0] !== unit) {
+                       gl.uniform1i(this.addr, unit);
+                       cache[0] = unit;
+               }
+
+               textures.setTexture3D(v || emptyTexture3d, unit);
+       }
+
+       function setValueT6(gl, v, textures) {
+               const cache = this.cache;
+               const unit = textures.allocateTextureUnit();
+
+               if (cache[0] !== unit) {
+                       gl.uniform1i(this.addr, unit);
+                       cache[0] = unit;
+               }
+
+               textures.safeSetTextureCube(v || emptyCubeTexture, unit);
+       }
+
+       function setValueT2DArray1(gl, v, textures) {
+               const cache = this.cache;
+               const unit = textures.allocateTextureUnit();
+
+               if (cache[0] !== unit) {
+                       gl.uniform1i(this.addr, unit);
+                       cache[0] = unit;
+               }
+
+               textures.setTexture2DArray(v || emptyTexture2dArray, unit);
+       } // Helper to pick the right setter for the singular case
+
+
+       function getSingularSetter(type) {
+               switch (type) {
+                       case 0x1406:
+                               return setValueV1f;
+                       // FLOAT
+
+                       case 0x8b50:
+                               return setValueV2f;
+                       // _VEC2
+
+                       case 0x8b51:
+                               return setValueV3f;
+                       // _VEC3
+
+                       case 0x8b52:
+                               return setValueV4f;
+                       // _VEC4
+
+                       case 0x8b5a:
+                               return setValueM2;
+                       // _MAT2
+
+                       case 0x8b5b:
+                               return setValueM3;
+                       // _MAT3
+
+                       case 0x8b5c:
+                               return setValueM4;
+                       // _MAT4
+
+                       case 0x1404:
+                       case 0x8b56:
+                               return setValueV1i;
+                       // INT, BOOL
+
+                       case 0x8b53:
+                       case 0x8b57:
+                               return setValueV2i;
+                       // _VEC2
+
+                       case 0x8b54:
+                       case 0x8b58:
+                               return setValueV3i;
+                       // _VEC3
+
+                       case 0x8b55:
+                       case 0x8b59:
+                               return setValueV4i;
+                       // _VEC4
+
+                       case 0x1405:
+                               return setValueV1ui;
+                       // UINT
+
+                       case 0x8dc6:
+                               return setValueV2ui;
+                       // _VEC2
+
+                       case 0x8dc7:
+                               return setValueV3ui;
+                       // _VEC3
+
+                       case 0x8dc8:
+                               return setValueV4ui;
+                       // _VEC4
+
+                       case 0x8b5e: // SAMPLER_2D
+
+                       case 0x8d66: // SAMPLER_EXTERNAL_OES
+
+                       case 0x8dca: // INT_SAMPLER_2D
+
+                       case 0x8dd2: // UNSIGNED_INT_SAMPLER_2D
+
+                       case 0x8b62:
+                               // SAMPLER_2D_SHADOW
+                               return setValueT1;
+
+                       case 0x8b5f: // SAMPLER_3D
+
+                       case 0x8dcb: // INT_SAMPLER_3D
+
+                       case 0x8dd3:
+                               // UNSIGNED_INT_SAMPLER_3D
+                               return setValueT3D1;
+
+                       case 0x8b60: // SAMPLER_CUBE
+
+                       case 0x8dcc: // INT_SAMPLER_CUBE
+
+                       case 0x8dd4: // UNSIGNED_INT_SAMPLER_CUBE
+
+                       case 0x8dc5:
+                               // SAMPLER_CUBE_SHADOW
+                               return setValueT6;
+
+                       case 0x8dc1: // SAMPLER_2D_ARRAY
+
+                       case 0x8dcf: // INT_SAMPLER_2D_ARRAY
+
+                       case 0x8dd7: // UNSIGNED_INT_SAMPLER_2D_ARRAY
+
+                       case 0x8dc4:
+                               // SAMPLER_2D_ARRAY_SHADOW
+                               return setValueT2DArray1;
+               }
+       } // Array of scalars
+
+
+       function setValueV1fArray(gl, v) {
+               gl.uniform1fv(this.addr, v);
+       } // Array of vectors (from flat array or array of THREE.VectorN)
+
+
+       function setValueV2fArray(gl, v) {
+               const data = flatten(v, this.size, 2);
+               gl.uniform2fv(this.addr, data);
+       }
+
+       function setValueV3fArray(gl, v) {
+               const data = flatten(v, this.size, 3);
+               gl.uniform3fv(this.addr, data);
+       }
+
+       function setValueV4fArray(gl, v) {
+               const data = flatten(v, this.size, 4);
+               gl.uniform4fv(this.addr, data);
+       } // Array of matrices (from flat array or array of THREE.MatrixN)
+
+
+       function setValueM2Array(gl, v) {
+               const data = flatten(v, this.size, 4);
+               gl.uniformMatrix2fv(this.addr, false, data);
+       }
+
+       function setValueM3Array(gl, v) {
+               const data = flatten(v, this.size, 9);
+               gl.uniformMatrix3fv(this.addr, false, data);
+       }
+
+       function setValueM4Array(gl, v) {
+               const data = flatten(v, this.size, 16);
+               gl.uniformMatrix4fv(this.addr, false, data);
+       } // Array of integer / boolean
+
+
+       function setValueV1iArray(gl, v) {
+               gl.uniform1iv(this.addr, v);
+       } // Array of integer / boolean vectors (from flat array)
+
+
+       function setValueV2iArray(gl, v) {
+               gl.uniform2iv(this.addr, v);
+       }
+
+       function setValueV3iArray(gl, v) {
+               gl.uniform3iv(this.addr, v);
+       }
+
+       function setValueV4iArray(gl, v) {
+               gl.uniform4iv(this.addr, v);
+       } // Array of unsigned integer
+
+
+       function setValueV1uiArray(gl, v) {
+               gl.uniform1uiv(this.addr, v);
+       } // Array of unsigned integer vectors (from flat array)
+
+
+       function setValueV2uiArray(gl, v) {
+               gl.uniform2uiv(this.addr, v);
+       }
+
+       function setValueV3uiArray(gl, v) {
+               gl.uniform3uiv(this.addr, v);
+       }
+
+       function setValueV4uiArray(gl, v) {
+               gl.uniform4uiv(this.addr, v);
+       } // Array of textures (2D / Cube)
+
+
+       function setValueT1Array(gl, v, textures) {
+               const n = v.length;
+               const units = allocTexUnits(textures, n);
+               gl.uniform1iv(this.addr, units);
+
+               for (let i = 0; i !== n; ++i) {
+                       textures.safeSetTexture2D(v[i] || emptyTexture, units[i]);
+               }
+       }
+
+       function setValueT6Array(gl, v, textures) {
+               const n = v.length;
+               const units = allocTexUnits(textures, n);
+               gl.uniform1iv(this.addr, units);
+
+               for (let i = 0; i !== n; ++i) {
+                       textures.safeSetTextureCube(v[i] || emptyCubeTexture, units[i]);
+               }
+       } // Helper to pick the right setter for a pure (bottom-level) array
+
+
+       function getPureArraySetter(type) {
+               switch (type) {
+                       case 0x1406:
+                               return setValueV1fArray;
+                       // FLOAT
+
+                       case 0x8b50:
+                               return setValueV2fArray;
+                       // _VEC2
+
+                       case 0x8b51:
+                               return setValueV3fArray;
+                       // _VEC3
+
+                       case 0x8b52:
+                               return setValueV4fArray;
+                       // _VEC4
+
+                       case 0x8b5a:
+                               return setValueM2Array;
+                       // _MAT2
+
+                       case 0x8b5b:
+                               return setValueM3Array;
+                       // _MAT3
+
+                       case 0x8b5c:
+                               return setValueM4Array;
+                       // _MAT4
+
+                       case 0x1404:
+                       case 0x8b56:
+                               return setValueV1iArray;
+                       // INT, BOOL
+
+                       case 0x8b53:
+                       case 0x8b57:
+                               return setValueV2iArray;
+                       // _VEC2
+
+                       case 0x8b54:
+                       case 0x8b58:
+                               return setValueV3iArray;
+                       // _VEC3
+
+                       case 0x8b55:
+                       case 0x8b59:
+                               return setValueV4iArray;
+                       // _VEC4
+
+                       case 0x1405:
+                               return setValueV1uiArray;
+                       // UINT
+
+                       case 0x8dc6:
+                               return setValueV2uiArray;
+                       // _VEC2
+
+                       case 0x8dc7:
+                               return setValueV3uiArray;
+                       // _VEC3
+
+                       case 0x8dc8:
+                               return setValueV4uiArray;
+                       // _VEC4
+
+                       case 0x8b5e: // SAMPLER_2D
+
+                       case 0x8d66: // SAMPLER_EXTERNAL_OES
+
+                       case 0x8dca: // INT_SAMPLER_2D
+
+                       case 0x8dd2: // UNSIGNED_INT_SAMPLER_2D
+
+                       case 0x8b62:
+                               // SAMPLER_2D_SHADOW
+                               return setValueT1Array;
+
+                       case 0x8b60: // SAMPLER_CUBE
+
+                       case 0x8dcc: // INT_SAMPLER_CUBE
+
+                       case 0x8dd4: // UNSIGNED_INT_SAMPLER_CUBE
+
+                       case 0x8dc5:
+                               // SAMPLER_CUBE_SHADOW
+                               return setValueT6Array;
+               }
+       } // --- Uniform Classes ---
+
+
+       function SingleUniform(id, activeInfo, addr) {
+               this.id = id;
+               this.addr = addr;
+               this.cache = [];
+               this.setValue = getSingularSetter(activeInfo.type); // this.path = activeInfo.name; // DEBUG
+       }
+
+       function PureArrayUniform(id, activeInfo, addr) {
+               this.id = id;
+               this.addr = addr;
+               this.cache = [];
+               this.size = activeInfo.size;
+               this.setValue = getPureArraySetter(activeInfo.type); // this.path = activeInfo.name; // DEBUG
+       }
+
+       PureArrayUniform.prototype.updateCache = function (data) {
+               const cache = this.cache;
+
+               if (data instanceof Float32Array && cache.length !== data.length) {
+                       this.cache = new Float32Array(data.length);
+               }
+
+               copyArray(cache, data);
+       };
+
+       function StructuredUniform(id) {
+               this.id = id;
+               this.seq = [];
+               this.map = {};
+       }
+
+       StructuredUniform.prototype.setValue = function (gl, value, textures) {
+               const seq = this.seq;
+
+               for (let i = 0, n = seq.length; i !== n; ++i) {
+                       const u = seq[i];
+                       u.setValue(gl, value[u.id], textures);
+               }
+       }; // --- Top-level ---
+       // Parser - builds up the property tree from the path strings
+
+
+       const RePathPart = /(\w+)(\])?(\[|\.)?/g; // extracts
+       //      - the identifier (member name or array index)
+       //      - followed by an optional right bracket (found when array index)
+       //      - followed by an optional left bracket or dot (type of subscript)
+       //
+       // Note: These portions can be read in a non-overlapping fashion and
+       // allow straightforward parsing of the hierarchy that WebGL encodes
+       // in the uniform names.
+
+       function addUniform(container, uniformObject) {
+               container.seq.push(uniformObject);
+               container.map[uniformObject.id] = uniformObject;
+       }
+
+       function parseUniform(activeInfo, addr, container) {
+               const path = activeInfo.name,
+                                       pathLength = path.length; // reset RegExp object, because of the early exit of a previous run
+
+               RePathPart.lastIndex = 0;
+
+               while (true) {
+                       const match = RePathPart.exec(path),
+                                               matchEnd = RePathPart.lastIndex;
+                       let id = match[1];
+                       const idIsIndex = match[2] === ']',
+                                               subscript = match[3];
+                       if (idIsIndex) id = id | 0; // convert to integer
+
+                       if (subscript === undefined || subscript === '[' && matchEnd + 2 === pathLength) {
+                               // bare name or "pure" bottom-level array "[0]" suffix
+                               addUniform(container, subscript === undefined ? new SingleUniform(id, activeInfo, addr) : new PureArrayUniform(id, activeInfo, addr));
+                               break;
+                       } else {
+                               // step into inner node / create it in case it doesn't exist
+                               const map = container.map;
+                               let next = map[id];
+
+                               if (next === undefined) {
+                                       next = new StructuredUniform(id);
+                                       addUniform(container, next);
+                               }
+
+                               container = next;
+                       }
+               }
+       } // Root Container
+
+
+       function WebGLUniforms(gl, program) {
+               this.seq = [];
+               this.map = {};
+               const n = gl.getProgramParameter(program, gl.ACTIVE_UNIFORMS);
+
+               for (let i = 0; i < n; ++i) {
+                       const info = gl.getActiveUniform(program, i),
+                                               addr = gl.getUniformLocation(program, info.name);
+                       parseUniform(info, addr, this);
+               }
+       }
+
+       WebGLUniforms.prototype.setValue = function (gl, name, value, textures) {
+               const u = this.map[name];
+               if (u !== undefined) u.setValue(gl, value, textures);
+       };
+
+       WebGLUniforms.prototype.setOptional = function (gl, object, name) {
+               const v = object[name];
+               if (v !== undefined) this.setValue(gl, name, v);
+       }; // Static interface
+
+
+       WebGLUniforms.upload = function (gl, seq, values, textures) {
+               for (let i = 0, n = seq.length; i !== n; ++i) {
+                       const u = seq[i],
+                                               v = values[u.id];
+
+                       if (v.needsUpdate !== false) {
+                               // note: always updating when .needsUpdate is undefined
+                               u.setValue(gl, v.value, textures);
+                       }
+               }
+       };
+
+       WebGLUniforms.seqWithValue = function (seq, values) {
+               const r = [];
+
+               for (let i = 0, n = seq.length; i !== n; ++i) {
+                       const u = seq[i];
+                       if (u.id in values) r.push(u);
+               }
+
+               return r;
+       };
+
+       function WebGLShader(gl, type, string) {
+               const shader = gl.createShader(type);
+               gl.shaderSource(shader, string);
+               gl.compileShader(shader);
+               return shader;
+       }
+
+       let programIdCount = 0;
+
+       function addLineNumbers(string) {
+               const lines = string.split('\n');
+
+               for (let i = 0; i < lines.length; i++) {
+                       lines[i] = i + 1 + ': ' + lines[i];
+               }
+
+               return lines.join('\n');
+       }
+
+       function getEncodingComponents(encoding) {
+               switch (encoding) {
+                       case LinearEncoding:
+                               return ['Linear', '( value )'];
+
+                       case sRGBEncoding:
+                               return ['sRGB', '( value )'];
+
+                       case RGBEEncoding:
+                               return ['RGBE', '( value )'];
+
+                       case RGBM7Encoding:
+                               return ['RGBM', '( value, 7.0 )'];
+
+                       case RGBM16Encoding:
+                               return ['RGBM', '( value, 16.0 )'];
+
+                       case RGBDEncoding:
+                               return ['RGBD', '( value, 256.0 )'];
+
+                       case GammaEncoding:
+                               return ['Gamma', '( value, float( GAMMA_FACTOR ) )'];
+
+                       case LogLuvEncoding:
+                               return ['LogLuv', '( value )'];
+
+                       default:
+                               console.warn('THREE.WebGLProgram: Unsupported encoding:', encoding);
+                               return ['Linear', '( value )'];
+               }
+       }
+
+       function getShaderErrors(gl, shader, type) {
+               const status = gl.getShaderParameter(shader, gl.COMPILE_STATUS);
+               const errors = gl.getShaderInfoLog(shader).trim();
+               if (status && errors === '') return ''; // --enable-privileged-webgl-extension
+               // console.log( '**' + type + '**', gl.getExtension( 'WEBGL_debug_shaders' ).getTranslatedShaderSource( shader ) );
+
+               return type.toUpperCase() + '\n\n' + errors + '\n\n' + addLineNumbers(gl.getShaderSource(shader));
+       }
+
+       function getTexelDecodingFunction(functionName, encoding) {
+               const components = getEncodingComponents(encoding);
+               return 'vec4 ' + functionName + '( vec4 value ) { return ' + components[0] + 'ToLinear' + components[1] + '; }';
+       }
+
+       function getTexelEncodingFunction(functionName, encoding) {
+               const components = getEncodingComponents(encoding);
+               return 'vec4 ' + functionName + '( vec4 value ) { return LinearTo' + components[0] + components[1] + '; }';
+       }
+
+       function getToneMappingFunction(functionName, toneMapping) {
+               let toneMappingName;
+
+               switch (toneMapping) {
+                       case LinearToneMapping:
+                               toneMappingName = 'Linear';
+                               break;
+
+                       case ReinhardToneMapping:
+                               toneMappingName = 'Reinhard';
+                               break;
+
+                       case CineonToneMapping:
+                               toneMappingName = 'OptimizedCineon';
+                               break;
+
+                       case ACESFilmicToneMapping:
+                               toneMappingName = 'ACESFilmic';
+                               break;
+
+                       case CustomToneMapping:
+                               toneMappingName = 'Custom';
+                               break;
+
+                       default:
+                               console.warn('THREE.WebGLProgram: Unsupported toneMapping:', toneMapping);
+                               toneMappingName = 'Linear';
+               }
+
+               return 'vec3 ' + functionName + '( vec3 color ) { return ' + toneMappingName + 'ToneMapping( color ); }';
+       }
+
+       function generateExtensions(parameters) {
+               const chunks = [parameters.extensionDerivatives || parameters.envMapCubeUV || parameters.bumpMap || parameters.tangentSpaceNormalMap || parameters.clearcoatNormalMap || parameters.flatShading || parameters.shaderID === 'physical' ? '#extension GL_OES_standard_derivatives : enable' : '', (parameters.extensionFragDepth || parameters.logarithmicDepthBuffer) && parameters.rendererExtensionFragDepth ? '#extension GL_EXT_frag_depth : enable' : '', parameters.extensionDrawBuffers && parameters.rendererExtensionDrawBuffers ? '#extension GL_EXT_draw_buffers : require' : '', (parameters.extensionShaderTextureLOD || parameters.envMap || parameters.transmission) && parameters.rendererExtensionShaderTextureLod ? '#extension GL_EXT_shader_texture_lod : enable' : ''];
+               return chunks.filter(filterEmptyLine).join('\n');
+       }
+
+       function generateDefines(defines) {
+               const chunks = [];
+
+               for (const name in defines) {
+                       const value = defines[name];
+                       if (value === false) continue;
+                       chunks.push('#define ' + name + ' ' + value);
+               }
+
+               return chunks.join('\n');
+       }
+
+       function fetchAttributeLocations(gl, program) {
+               const attributes = {};
+               const n = gl.getProgramParameter(program, gl.ACTIVE_ATTRIBUTES);
+
+               for (let i = 0; i < n; i++) {
+                       const info = gl.getActiveAttrib(program, i);
+                       const name = info.name;
+                       let locationSize = 1;
+                       if (info.type === gl.FLOAT_MAT2) locationSize = 2;
+                       if (info.type === gl.FLOAT_MAT3) locationSize = 3;
+                       if (info.type === gl.FLOAT_MAT4) locationSize = 4; // console.log( 'THREE.WebGLProgram: ACTIVE VERTEX ATTRIBUTE:', name, i );
+
+                       attributes[name] = {
+                               type: info.type,
+                               location: gl.getAttribLocation(program, name),
+                               locationSize: locationSize
+                       };
+               }
+
+               return attributes;
+       }
+
+       function filterEmptyLine(string) {
+               return string !== '';
+       }
+
+       function replaceLightNums(string, parameters) {
+               return string.replace(/NUM_DIR_LIGHTS/g, parameters.numDirLights).replace(/NUM_SPOT_LIGHTS/g, parameters.numSpotLights).replace(/NUM_RECT_AREA_LIGHTS/g, parameters.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g, parameters.numPointLights).replace(/NUM_HEMI_LIGHTS/g, parameters.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g, parameters.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS/g, parameters.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g, parameters.numPointLightShadows);
+       }
+
+       function replaceClippingPlaneNums(string, parameters) {
+               return string.replace(/NUM_CLIPPING_PLANES/g, parameters.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g, parameters.numClippingPlanes - parameters.numClipIntersection);
+       } // Resolve Includes
+
+
+       const includePattern = /^[ \t]*#include +<([\w\d./]+)>/gm;
+
+       function resolveIncludes(string) {
+               return string.replace(includePattern, includeReplacer);
+       }
+
+       function includeReplacer(match, include) {
+               const string = ShaderChunk[include];
+
+               if (string === undefined) {
+                       throw new Error('Can not resolve #include <' + include + '>');
+               }
+
+               return resolveIncludes(string);
+       } // Unroll Loops
+
+
+       const deprecatedUnrollLoopPattern = /#pragma unroll_loop[\s]+?for \( int i \= (\d+)\; i < (\d+)\; i \+\+ \) \{([\s\S]+?)(?=\})\}/g;
+       const unrollLoopPattern = /#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 unrollLoops(string) {
+               return string.replace(unrollLoopPattern, loopReplacer).replace(deprecatedUnrollLoopPattern, deprecatedLoopReplacer);
+       }
+
+       function deprecatedLoopReplacer(match, start, end, snippet) {
+               console.warn('WebGLProgram: #pragma unroll_loop shader syntax is deprecated. Please use #pragma unroll_loop_start syntax instead.');
+               return loopReplacer(match, start, end, snippet);
+       }
+
+       function loopReplacer(match, start, end, snippet) {
+               let string = '';
+
+               for (let i = parseInt(start); i < parseInt(end); i++) {
+                       string += snippet.replace(/\[\s*i\s*\]/g, '[ ' + i + ' ]').replace(/UNROLLED_LOOP_INDEX/g, i);
+               }
+
+               return string;
+       } //
+
+
+       function generatePrecision(parameters) {
+               let precisionstring = 'precision ' + parameters.precision + ' float;\nprecision ' + parameters.precision + ' int;';
+
+               if (parameters.precision === 'highp') {
+                       precisionstring += '\n#define HIGH_PRECISION';
+               } else if (parameters.precision === 'mediump') {
+                       precisionstring += '\n#define MEDIUM_PRECISION';
+               } else if (parameters.precision === 'lowp') {
+                       precisionstring += '\n#define LOW_PRECISION';
+               }
+
+               return precisionstring;
+       }
+
+       function generateShadowMapTypeDefine(parameters) {
+               let shadowMapTypeDefine = 'SHADOWMAP_TYPE_BASIC';
+
+               if (parameters.shadowMapType === PCFShadowMap) {
+                       shadowMapTypeDefine = 'SHADOWMAP_TYPE_PCF';
+               } else if (parameters.shadowMapType === PCFSoftShadowMap) {
+                       shadowMapTypeDefine = 'SHADOWMAP_TYPE_PCF_SOFT';
+               } else if (parameters.shadowMapType === VSMShadowMap) {
+                       shadowMapTypeDefine = 'SHADOWMAP_TYPE_VSM';
+               }
+
+               return shadowMapTypeDefine;
+       }
+
+       function generateEnvMapTypeDefine(parameters) {
+               let envMapTypeDefine = 'ENVMAP_TYPE_CUBE';
+
+               if (parameters.envMap) {
+                       switch (parameters.envMapMode) {
+                               case CubeReflectionMapping:
+                               case CubeRefractionMapping:
+                                       envMapTypeDefine = 'ENVMAP_TYPE_CUBE';
+                                       break;
+
+                               case CubeUVReflectionMapping:
+                               case CubeUVRefractionMapping:
+                                       envMapTypeDefine = 'ENVMAP_TYPE_CUBE_UV';
+                                       break;
+                       }
+               }
+
+               return envMapTypeDefine;
+       }
+
+       function generateEnvMapModeDefine(parameters) {
+               let envMapModeDefine = 'ENVMAP_MODE_REFLECTION';
+
+               if (parameters.envMap) {
+                       switch (parameters.envMapMode) {
+                               case CubeRefractionMapping:
+                               case CubeUVRefractionMapping:
+                                       envMapModeDefine = 'ENVMAP_MODE_REFRACTION';
+                                       break;
+                       }
+               }
+
+               return envMapModeDefine;
+       }
+
+       function generateEnvMapBlendingDefine(parameters) {
+               let envMapBlendingDefine = 'ENVMAP_BLENDING_NONE';
+
+               if (parameters.envMap) {
+                       switch (parameters.combine) {
+                               case MultiplyOperation:
+                                       envMapBlendingDefine = 'ENVMAP_BLENDING_MULTIPLY';
+                                       break;
+
+                               case MixOperation:
+                                       envMapBlendingDefine = 'ENVMAP_BLENDING_MIX';
+                                       break;
+
+                               case AddOperation:
+                                       envMapBlendingDefine = 'ENVMAP_BLENDING_ADD';
+                                       break;
+                       }
+               }
+
+               return envMapBlendingDefine;
+       }
+
+       function WebGLProgram(renderer, cacheKey, parameters, bindingStates) {
+               // TODO Send this event to Three.js DevTools
+               // console.log( 'WebGLProgram', cacheKey );
+               const gl = renderer.getContext();
+               const defines = parameters.defines;
+               let vertexShader = parameters.vertexShader;
+               let fragmentShader = parameters.fragmentShader;
+               const shadowMapTypeDefine = generateShadowMapTypeDefine(parameters);
+               const envMapTypeDefine = generateEnvMapTypeDefine(parameters);
+               const envMapModeDefine = generateEnvMapModeDefine(parameters);
+               const envMapBlendingDefine = generateEnvMapBlendingDefine(parameters);
+               const gammaFactorDefine = renderer.gammaFactor > 0 ? renderer.gammaFactor : 1.0;
+               const customExtensions = parameters.isWebGL2 ? '' : generateExtensions(parameters);
+               const customDefines = generateDefines(defines);
+               const program = gl.createProgram();
+               let prefixVertex, prefixFragment;
+               let versionString = parameters.glslVersion ? '#version ' + parameters.glslVersion + '\n' : '';
+
+               if (parameters.isRawShaderMaterial) {
+                       prefixVertex = [customDefines].filter(filterEmptyLine).join('\n');
+
+                       if (prefixVertex.length > 0) {
+                               prefixVertex += '\n';
+                       }
+
+                       prefixFragment = [customExtensions, customDefines].filter(filterEmptyLine).join('\n');
+
+                       if (prefixFragment.length > 0) {
+                               prefixFragment += '\n';
+                       }
+               } else {
+                       prefixVertex = [generatePrecision(parameters), '#define SHADER_NAME ' + parameters.shaderName, customDefines, parameters.instancing ? '#define USE_INSTANCING' : '', parameters.instancingColor ? '#define USE_INSTANCING_COLOR' : '', parameters.supportsVertexTextures ? '#define VERTEX_TEXTURES' : '', '#define GAMMA_FACTOR ' + gammaFactorDefine, '#define MAX_BONES ' + parameters.maxBones, parameters.useFog && parameters.fog ? '#define USE_FOG' : '', parameters.useFog && parameters.fogExp2 ? '#define FOG_EXP2' : '', parameters.map ? '#define USE_MAP' : '', parameters.envMap ? '#define USE_ENVMAP' : '', parameters.envMap ? '#define ' + envMapModeDefine : '', parameters.lightMap ? '#define USE_LIGHTMAP' : '', parameters.aoMap ? '#define USE_AOMAP' : '', parameters.emissiveMap ? '#define USE_EMISSIVEMAP' : '', parameters.bumpMap ? '#define USE_BUMPMAP' : '', parameters.normalMap ? '#define USE_NORMALMAP' : '', parameters.normalMap && parameters.objectSpaceNormalMap ? '#define OBJECTSPACE_NORMALMAP' : '', parameters.normalMap && parameters.tangentSpaceNormalMap ? '#define TANGENTSPACE_NORMALMAP' : '', parameters.clearcoatMap ? '#define USE_CLEARCOATMAP' : '', parameters.clearcoatRoughnessMap ? '#define USE_CLEARCOAT_ROUGHNESSMAP' : '', parameters.clearcoatNormalMap ? '#define USE_CLEARCOAT_NORMALMAP' : '', parameters.displacementMap && parameters.supportsVertexTextures ? '#define USE_DISPLACEMENTMAP' : '', parameters.specularMap ? '#define USE_SPECULARMAP' : '', parameters.specularIntensityMap ? '#define USE_SPECULARINTENSITYMAP' : '', parameters.specularTintMap ? '#define USE_SPECULARTINTMAP' : '', parameters.roughnessMap ? '#define USE_ROUGHNESSMAP' : '', parameters.metalnessMap ? '#define USE_METALNESSMAP' : '', parameters.alphaMap ? '#define USE_ALPHAMAP' : '', parameters.transmission ? '#define USE_TRANSMISSION' : '', parameters.transmissionMap ? '#define USE_TRANSMISSIONMAP' : '', parameters.thicknessMap ? '#define USE_THICKNESSMAP' : '', parameters.vertexTangents ? '#define USE_TANGENT' : '', parameters.vertexColors ? '#define USE_COLOR' : '', parameters.vertexAlphas ? '#define USE_COLOR_ALPHA' : '', parameters.vertexUvs ? '#define USE_UV' : '', parameters.uvsVertexOnly ? '#define UVS_VERTEX_ONLY' : '', parameters.flatShading ? '#define FLAT_SHADED' : '', parameters.skinning ? '#define USE_SKINNING' : '', parameters.useVertexTexture ? '#define BONE_TEXTURE' : '', parameters.morphTargets ? '#define USE_MORPHTARGETS' : '', parameters.morphNormals && parameters.flatShading === false ? '#define USE_MORPHNORMALS' : '', parameters.doubleSided ? '#define DOUBLE_SIDED' : '', parameters.flipSided ? '#define FLIP_SIDED' : '', parameters.shadowMapEnabled ? '#define USE_SHADOWMAP' : '', parameters.shadowMapEnabled ? '#define ' + shadowMapTypeDefine : '', parameters.sizeAttenuation ? '#define USE_SIZEATTENUATION' : '', parameters.logarithmicDepthBuffer ? '#define USE_LOGDEPTHBUF' : '', parameters.logarithmicDepthBuffer && parameters.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', '#ifdef USE_MORPHTARGETS', '  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', '\n'].filter(filterEmptyLine).join('\n');
+                       prefixFragment = [customExtensions, generatePrecision(parameters), '#define SHADER_NAME ' + parameters.shaderName, customDefines, '#define GAMMA_FACTOR ' + gammaFactorDefine, parameters.useFog && parameters.fog ? '#define USE_FOG' : '', parameters.useFog && parameters.fogExp2 ? '#define FOG_EXP2' : '', parameters.map ? '#define USE_MAP' : '', parameters.matcap ? '#define USE_MATCAP' : '', parameters.envMap ? '#define USE_ENVMAP' : '', parameters.envMap ? '#define ' + envMapTypeDefine : '', parameters.envMap ? '#define ' + envMapModeDefine : '', parameters.envMap ? '#define ' + envMapBlendingDefine : '', parameters.lightMap ? '#define USE_LIGHTMAP' : '', parameters.aoMap ? '#define USE_AOMAP' : '', parameters.emissiveMap ? '#define USE_EMISSIVEMAP' : '', parameters.bumpMap ? '#define USE_BUMPMAP' : '', parameters.normalMap ? '#define USE_NORMALMAP' : '', parameters.normalMap && parameters.objectSpaceNormalMap ? '#define OBJECTSPACE_NORMALMAP' : '', parameters.normalMap && parameters.tangentSpaceNormalMap ? '#define TANGENTSPACE_NORMALMAP' : '', parameters.clearcoat ? '#define USE_CLEARCOAT' : '', parameters.clearcoatMap ? '#define USE_CLEARCOATMAP' : '', parameters.clearcoatRoughnessMap ? '#define USE_CLEARCOAT_ROUGHNESSMAP' : '', parameters.clearcoatNormalMap ? '#define USE_CLEARCOAT_NORMALMAP' : '', parameters.specularMap ? '#define USE_SPECULARMAP' : '', parameters.specularIntensityMap ? '#define USE_SPECULARINTENSITYMAP' : '', parameters.specularTintMap ? '#define USE_SPECULARTINTMAP' : '', parameters.roughnessMap ? '#define USE_ROUGHNESSMAP' : '', parameters.metalnessMap ? '#define USE_METALNESSMAP' : '', parameters.alphaMap ? '#define USE_ALPHAMAP' : '', parameters.alphaTest ? '#define USE_ALPHATEST' : '', parameters.sheenTint ? '#define USE_SHEEN' : '', parameters.transmission ? '#define USE_TRANSMISSION' : '', parameters.transmissionMap ? '#define USE_TRANSMISSIONMAP' : '', parameters.thicknessMap ? '#define USE_THICKNESSMAP' : '', parameters.vertexTangents ? '#define USE_TANGENT' : '', parameters.vertexColors || parameters.instancingColor ? '#define USE_COLOR' : '', parameters.vertexAlphas ? '#define USE_COLOR_ALPHA' : '', parameters.vertexUvs ? '#define USE_UV' : '', parameters.uvsVertexOnly ? '#define UVS_VERTEX_ONLY' : '', parameters.gradientMap ? '#define USE_GRADIENTMAP' : '', parameters.flatShading ? '#define FLAT_SHADED' : '', parameters.doubleSided ? '#define DOUBLE_SIDED' : '', parameters.flipSided ? '#define FLIP_SIDED' : '', parameters.shadowMapEnabled ? '#define USE_SHADOWMAP' : '', parameters.shadowMapEnabled ? '#define ' + shadowMapTypeDefine : '', parameters.premultipliedAlpha ? '#define PREMULTIPLIED_ALPHA' : '', parameters.physicallyCorrectLights ? '#define PHYSICALLY_CORRECT_LIGHTS' : '', parameters.logarithmicDepthBuffer ? '#define USE_LOGDEPTHBUF' : '', parameters.logarithmicDepthBuffer && parameters.rendererExtensionFragDepth ? '#define USE_LOGDEPTHBUF_EXT' : '', (parameters.extensionShaderTextureLOD || parameters.envMap) && parameters.rendererExtensionShaderTextureLod ? '#define TEXTURE_LOD_EXT' : '', 'uniform mat4 viewMatrix;', 'uniform vec3 cameraPosition;', 'uniform bool isOrthographic;', parameters.toneMapping !== NoToneMapping ? '#define TONE_MAPPING' : '', parameters.toneMapping !== NoToneMapping ? ShaderChunk['tonemapping_pars_fragment'] : '', // this code is required here because it is used by the toneMapping() function defined below
+                       parameters.toneMapping !== NoToneMapping ? getToneMappingFunction('toneMapping', parameters.toneMapping) : '', parameters.dithering ? '#define DITHERING' : '', parameters.format === RGBFormat ? '#define OPAQUE' : '', ShaderChunk['encodings_pars_fragment'], // this code is required here because it is used by the various encoding/decoding function defined below
+                       parameters.map ? getTexelDecodingFunction('mapTexelToLinear', parameters.mapEncoding) : '', parameters.matcap ? getTexelDecodingFunction('matcapTexelToLinear', parameters.matcapEncoding) : '', parameters.envMap ? getTexelDecodingFunction('envMapTexelToLinear', parameters.envMapEncoding) : '', parameters.emissiveMap ? getTexelDecodingFunction('emissiveMapTexelToLinear', parameters.emissiveMapEncoding) : '', parameters.specularTintMap ? getTexelDecodingFunction('specularTintMapTexelToLinear', parameters.specularTintMapEncoding) : '', parameters.lightMap ? getTexelDecodingFunction('lightMapTexelToLinear', parameters.lightMapEncoding) : '', getTexelEncodingFunction('linearToOutputTexel', parameters.outputEncoding), parameters.depthPacking ? '#define DEPTH_PACKING ' + parameters.depthPacking : '', '\n'].filter(filterEmptyLine).join('\n');
+               }
+
+               vertexShader = resolveIncludes(vertexShader);
+               vertexShader = replaceLightNums(vertexShader, parameters);
+               vertexShader = replaceClippingPlaneNums(vertexShader, parameters);
+               fragmentShader = resolveIncludes(fragmentShader);
+               fragmentShader = replaceLightNums(fragmentShader, parameters);
+               fragmentShader = replaceClippingPlaneNums(fragmentShader, parameters);
+               vertexShader = unrollLoops(vertexShader);
+               fragmentShader = unrollLoops(fragmentShader);
+
+               if (parameters.isWebGL2 && parameters.isRawShaderMaterial !== true) {
+                       // GLSL 3.0 conversion for built-in materials and ShaderMaterial
+                       versionString = '#version 300 es\n';
+                       prefixVertex = ['#define attribute in', '#define varying out', '#define texture2D texture'].join('\n') + '\n' + prefixVertex;
+                       prefixFragment = ['#define varying in', parameters.glslVersion === GLSL3 ? '' : 'out highp vec4 pc_fragColor;', parameters.glslVersion === GLSL3 ? '' : '#define gl_FragColor pc_fragColor', '#define gl_FragDepthEXT gl_FragDepth', '#define texture2D texture', '#define textureCube texture', '#define texture2DProj textureProj', '#define texture2DLodEXT textureLod', '#define texture2DProjLodEXT textureProjLod', '#define textureCubeLodEXT textureLod', '#define texture2DGradEXT textureGrad', '#define texture2DProjGradEXT textureProjGrad', '#define textureCubeGradEXT textureGrad'].join('\n') + '\n' + prefixFragment;
+               }
+
+               const vertexGlsl = versionString + prefixVertex + vertexShader;
+               const fragmentGlsl = versionString + prefixFragment + fragmentShader; // console.log( '*VERTEX*', vertexGlsl );
+               // console.log( '*FRAGMENT*', fragmentGlsl );
+
+               const glVertexShader = WebGLShader(gl, gl.VERTEX_SHADER, vertexGlsl);
+               const glFragmentShader = WebGLShader(gl, gl.FRAGMENT_SHADER, fragmentGlsl);
+               gl.attachShader(program, glVertexShader);
+               gl.attachShader(program, glFragmentShader); // Force a particular attribute to index 0.
+
+               if (parameters.index0AttributeName !== undefined) {
+                       gl.bindAttribLocation(program, 0, parameters.index0AttributeName);
+               } else if (parameters.morphTargets === true) {
+                       // programs with morphTargets displace position out of attribute 0
+                       gl.bindAttribLocation(program, 0, 'position');
+               }
+
+               gl.linkProgram(program); // check for link errors
+
+               if (renderer.debug.checkShaderErrors) {
+                       const programLog = gl.getProgramInfoLog(program).trim();
+                       const vertexLog = gl.getShaderInfoLog(glVertexShader).trim();
+                       const fragmentLog = gl.getShaderInfoLog(glFragmentShader).trim();
+                       let runnable = true;
+                       let haveDiagnostics = true;
+
+                       if (gl.getProgramParameter(program, gl.LINK_STATUS) === false) {
+                               runnable = false;
+                               const vertexErrors = getShaderErrors(gl, glVertexShader, 'vertex');
+                               const fragmentErrors = getShaderErrors(gl, glFragmentShader, 'fragment');
+                               console.error('THREE.WebGLProgram: Shader Error ' + gl.getError() + ' - ' + 'VALIDATE_STATUS ' + gl.getProgramParameter(program, gl.VALIDATE_STATUS) + '\n\n' + 'Program Info Log: ' + programLog + '\n' + vertexErrors + '\n' + fragmentErrors);
+                       } else if (programLog !== '') {
+                               console.warn('THREE.WebGLProgram: Program Info Log:', programLog);
+                       } else if (vertexLog === '' || fragmentLog === '') {
+                               haveDiagnostics = false;
+                       }
+
+                       if (haveDiagnostics) {
+                               this.diagnostics = {
+                                       runnable: runnable,
+                                       programLog: programLog,
+                                       vertexShader: {
+                                               log: vertexLog,
+                                               prefix: prefixVertex
+                                       },
+                                       fragmentShader: {
+                                               log: fragmentLog,
+                                               prefix: prefixFragment
+                                       }
+                               };
+                       }
+               } // Clean up
+               // Crashes in iOS9 and iOS10. #18402
+               // gl.detachShader( program, glVertexShader );
+               // gl.detachShader( program, glFragmentShader );
+
+
+               gl.deleteShader(glVertexShader);
+               gl.deleteShader(glFragmentShader); // set up caching for uniform locations
+
+               let cachedUniforms;
+
+               this.getUniforms = function () {
+                       if (cachedUniforms === undefined) {
+                               cachedUniforms = new WebGLUniforms(gl, program);
+                       }
+
+                       return cachedUniforms;
+               }; // set up caching for attribute locations
+
+
+               let cachedAttributes;
+
+               this.getAttributes = function () {
+                       if (cachedAttributes === undefined) {
+                               cachedAttributes = fetchAttributeLocations(gl, program);
+                       }
+
+                       return cachedAttributes;
+               }; // free resource
+
+
+               this.destroy = function () {
+                       bindingStates.releaseStatesOfProgram(this);
+                       gl.deleteProgram(program);
+                       this.program = undefined;
+               }; //
+
+
+               this.name = parameters.shaderName;
+               this.id = programIdCount++;
+               this.cacheKey = cacheKey;
+               this.usedTimes = 1;
+               this.program = program;
+               this.vertexShader = glVertexShader;
+               this.fragmentShader = glFragmentShader;
+               return this;
+       }
+
+       function WebGLPrograms(renderer, cubemaps, cubeuvmaps, extensions, capabilities, bindingStates, clipping) {
+               const programs = [];
+               const isWebGL2 = capabilities.isWebGL2;
+               const logarithmicDepthBuffer = capabilities.logarithmicDepthBuffer;
+               const floatVertexTextures = capabilities.floatVertexTextures;
+               const maxVertexUniforms = capabilities.maxVertexUniforms;
+               const vertexTextures = capabilities.vertexTextures;
+               let precision = capabilities.precision;
+               const shaderIDs = {
+                       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'
+               };
+               const parameterNames = ['precision', 'isWebGL2', 'supportsVertexTextures', 'outputEncoding', 'instancing', 'instancingColor', 'map', 'mapEncoding', 'matcap', 'matcapEncoding', 'envMap', 'envMapMode', 'envMapEncoding', 'envMapCubeUV', 'lightMap', 'lightMapEncoding', 'aoMap', 'emissiveMap', 'emissiveMapEncoding', 'bumpMap', 'normalMap', 'objectSpaceNormalMap', 'tangentSpaceNormalMap', 'clearcoat', 'clearcoatMap', 'clearcoatRoughnessMap', 'clearcoatNormalMap', 'displacementMap', 'specularMap', 'specularIntensityMap', 'specularTintMap', 'specularTintMapEncoding', 'roughnessMap', 'metalnessMap', 'gradientMap', 'alphaMap', 'alphaTest', 'combine', 'vertexColors', 'vertexAlphas', 'vertexTangents', 'vertexUvs', 'uvsVertexOnly', 'fog', 'useFog', 'fogExp2', 'flatShading', 'sizeAttenuation', 'logarithmicDepthBuffer', 'skinning', 'maxBones', 'useVertexTexture', 'morphTargets', 'morphNormals', 'premultipliedAlpha', 'numDirLights', 'numPointLights', 'numSpotLights', 'numHemiLights', 'numRectAreaLights', 'numDirLightShadows', 'numPointLightShadows', 'numSpotLightShadows', 'shadowMapEnabled', 'shadowMapType', 'toneMapping', 'physicallyCorrectLights', 'doubleSided', 'flipSided', 'numClippingPlanes', 'numClipIntersection', 'depthPacking', 'dithering', 'format', 'sheenTint', 'transmission', 'transmissionMap', 'thicknessMap'];
+
+               function getMaxBones(object) {
+                       const skeleton = object.skeleton;
+                       const bones = skeleton.bones;
+
+                       if (floatVertexTextures) {
+                               return 1024;
+                       } else {
+                               // default for when object is not specified
+                               // ( for example when prebuilding shader to be used with multiple objects )
+                               //
+                               //      - leave some extra space for other uniforms
+                               //      - limit here is ANGLE's 254 max uniform vectors
+                               //              (up to 54 should be safe)
+                               const nVertexUniforms = maxVertexUniforms;
+                               const nVertexMatrices = Math.floor((nVertexUniforms - 20) / 4);
+                               const maxBones = Math.min(nVertexMatrices, bones.length);
+
+                               if (maxBones < bones.length) {
+                                       console.warn('THREE.WebGLRenderer: Skeleton has ' + bones.length + ' bones. This GPU supports ' + maxBones + '.');
+                                       return 0;
+                               }
+
+                               return maxBones;
+                       }
+               }
+
+               function getTextureEncodingFromMap(map) {
+                       let encoding;
+
+                       if (map && map.isTexture) {
+                               encoding = map.encoding;
+                       } else if (map && map.isWebGLRenderTarget) {
+                               console.warn('THREE.WebGLPrograms.getTextureEncodingFromMap: don\'t use render targets as textures. Use their .texture property instead.');
+                               encoding = map.texture.encoding;
+                       } else {
+                               encoding = LinearEncoding;
+                       }
+
+                       return encoding;
+               }
+
+               function getParameters(material, lights, shadows, scene, object) {
+                       const fog = scene.fog;
+                       const environment = material.isMeshStandardMaterial ? scene.environment : null;
+                       const envMap = (material.isMeshStandardMaterial ? cubeuvmaps : cubemaps).get(material.envMap || environment);
+                       const shaderID = shaderIDs[material.type]; // heuristics to create shader parameters according to lights in the scene
+                       // (not to blow over maxLights budget)
+
+                       const maxBones = object.isSkinnedMesh ? getMaxBones(object) : 0;
+
+                       if (material.precision !== null) {
+                               precision = capabilities.getMaxPrecision(material.precision);
+
+                               if (precision !== material.precision) {
+                                       console.warn('THREE.WebGLProgram.getParameters:', material.precision, 'not supported, using', precision, 'instead.');
+                               }
+                       }
+
+                       let vertexShader, fragmentShader;
+
+                       if (shaderID) {
+                               const shader = ShaderLib[shaderID];
+                               vertexShader = shader.vertexShader;
+                               fragmentShader = shader.fragmentShader;
+                       } else {
+                               vertexShader = material.vertexShader;
+                               fragmentShader = material.fragmentShader;
+                       }
+
+                       const currentRenderTarget = renderer.getRenderTarget();
+                       const useAlphaTest = material.alphaTest > 0;
+                       const useClearcoat = material.clearcoat > 0;
+                       const parameters = {
+                               isWebGL2: isWebGL2,
+                               shaderID: shaderID,
+                               shaderName: material.type,
+                               vertexShader: vertexShader,
+                               fragmentShader: fragmentShader,
+                               defines: material.defines,
+                               isRawShaderMaterial: material.isRawShaderMaterial === true,
+                               glslVersion: material.glslVersion,
+                               precision: precision,
+                               instancing: object.isInstancedMesh === true,
+                               instancingColor: object.isInstancedMesh === true && object.instanceColor !== null,
+                               supportsVertexTextures: vertexTextures,
+                               outputEncoding: currentRenderTarget !== null ? getTextureEncodingFromMap(currentRenderTarget.texture) : renderer.outputEncoding,
+                               map: !!material.map,
+                               mapEncoding: getTextureEncodingFromMap(material.map),
+                               matcap: !!material.matcap,
+                               matcapEncoding: getTextureEncodingFromMap(material.matcap),
+                               envMap: !!envMap,
+                               envMapMode: envMap && envMap.mapping,
+                               envMapEncoding: getTextureEncodingFromMap(envMap),
+                               envMapCubeUV: !!envMap && (envMap.mapping === CubeUVReflectionMapping || envMap.mapping === CubeUVRefractionMapping),
+                               lightMap: !!material.lightMap,
+                               lightMapEncoding: getTextureEncodingFromMap(material.lightMap),
+                               aoMap: !!material.aoMap,
+                               emissiveMap: !!material.emissiveMap,
+                               emissiveMapEncoding: getTextureEncodingFromMap(material.emissiveMap),
+                               bumpMap: !!material.bumpMap,
+                               normalMap: !!material.normalMap,
+                               objectSpaceNormalMap: material.normalMapType === ObjectSpaceNormalMap,
+                               tangentSpaceNormalMap: material.normalMapType === TangentSpaceNormalMap,
+                               clearcoat: useClearcoat,
+                               clearcoatMap: useClearcoat && !!material.clearcoatMap,
+                               clearcoatRoughnessMap: useClearcoat && !!material.clearcoatRoughnessMap,
+                               clearcoatNormalMap: useClearcoat && !!material.clearcoatNormalMap,
+                               displacementMap: !!material.displacementMap,
+                               roughnessMap: !!material.roughnessMap,
+                               metalnessMap: !!material.metalnessMap,
+                               specularMap: !!material.specularMap,
+                               specularIntensityMap: !!material.specularIntensityMap,
+                               specularTintMap: !!material.specularTintMap,
+                               specularTintMapEncoding: getTextureEncodingFromMap(material.specularTintMap),
+                               alphaMap: !!material.alphaMap,
+                               alphaTest: useAlphaTest,
+                               gradientMap: !!material.gradientMap,
+                               sheenTint: !!material.sheenTint && (material.sheenTint.r > 0 || material.sheenTint.g > 0 || material.sheenTint.b > 0),
+                               transmission: material.transmission > 0,
+                               transmissionMap: !!material.transmissionMap,
+                               thicknessMap: !!material.thicknessMap,
+                               combine: material.combine,
+                               vertexTangents: !!material.normalMap && !!object.geometry && !!object.geometry.attributes.tangent,
+                               vertexColors: material.vertexColors,
+                               vertexAlphas: material.vertexColors === true && !!object.geometry && !!object.geometry.attributes.color && object.geometry.attributes.color.itemSize === 4,
+                               vertexUvs: !!material.map || !!material.bumpMap || !!material.normalMap || !!material.specularMap || !!material.alphaMap || !!material.emissiveMap || !!material.roughnessMap || !!material.metalnessMap || !!material.clearcoatMap || !!material.clearcoatRoughnessMap || !!material.clearcoatNormalMap || !!material.displacementMap || !!material.transmissionMap || !!material.thicknessMap || !!material.specularIntensityMap || !!material.specularTintMap,
+                               uvsVertexOnly: !(!!material.map || !!material.bumpMap || !!material.normalMap || !!material.specularMap || !!material.alphaMap || !!material.emissiveMap || !!material.roughnessMap || !!material.metalnessMap || !!material.clearcoatNormalMap || material.transmission > 0 || !!material.transmissionMap || !!material.thicknessMap || !!material.specularIntensityMap || !!material.specularTintMap) && !!material.displacementMap,
+                               fog: !!fog,
+                               useFog: material.fog,
+                               fogExp2: fog && fog.isFogExp2,
+                               flatShading: !!material.flatShading,
+                               sizeAttenuation: material.sizeAttenuation,
+                               logarithmicDepthBuffer: logarithmicDepthBuffer,
+                               skinning: object.isSkinnedMesh === true && maxBones > 0,
+                               maxBones: maxBones,
+                               useVertexTexture: floatVertexTextures,
+                               morphTargets: !!object.geometry && !!object.geometry.morphAttributes.position,
+                               morphNormals: !!object.geometry && !!object.geometry.morphAttributes.normal,
+                               numDirLights: lights.directional.length,
+                               numPointLights: lights.point.length,
+                               numSpotLights: lights.spot.length,
+                               numRectAreaLights: lights.rectArea.length,
+                               numHemiLights: lights.hemi.length,
+                               numDirLightShadows: lights.directionalShadowMap.length,
+                               numPointLightShadows: lights.pointShadowMap.length,
+                               numSpotLightShadows: lights.spotShadowMap.length,
+                               numClippingPlanes: clipping.numPlanes,
+                               numClipIntersection: clipping.numIntersection,
+                               format: material.format,
+                               dithering: material.dithering,
+                               shadowMapEnabled: renderer.shadowMap.enabled && shadows.length > 0,
+                               shadowMapType: renderer.shadowMap.type,
+                               toneMapping: material.toneMapped ? renderer.toneMapping : NoToneMapping,
+                               physicallyCorrectLights: renderer.physicallyCorrectLights,
+                               premultipliedAlpha: material.premultipliedAlpha,
+                               doubleSided: material.side === DoubleSide,
+                               flipSided: material.side === BackSide,
+                               depthPacking: material.depthPacking !== undefined ? material.depthPacking : false,
+                               index0AttributeName: material.index0AttributeName,
+                               extensionDerivatives: material.extensions && material.extensions.derivatives,
+                               extensionFragDepth: material.extensions && material.extensions.fragDepth,
+                               extensionDrawBuffers: material.extensions && material.extensions.drawBuffers,
+                               extensionShaderTextureLOD: material.extensions && material.extensions.shaderTextureLOD,
+                               rendererExtensionFragDepth: isWebGL2 || extensions.has('EXT_frag_depth'),
+                               rendererExtensionDrawBuffers: isWebGL2 || extensions.has('WEBGL_draw_buffers'),
+                               rendererExtensionShaderTextureLod: isWebGL2 || extensions.has('EXT_shader_texture_lod'),
+                               customProgramCacheKey: material.customProgramCacheKey()
+                       };
+                       return parameters;
+               }
+
+               function getProgramCacheKey(parameters) {
+                       const array = [];
+
+                       if (parameters.shaderID) {
+                               array.push(parameters.shaderID);
+                       } else {
+                               array.push(parameters.fragmentShader);
+                               array.push(parameters.vertexShader);
+                       }
+
+                       if (parameters.defines !== undefined) {
+                               for (const name in parameters.defines) {
+                                       array.push(name);
+                                       array.push(parameters.defines[name]);
+                               }
+                       }
+
+                       if (parameters.isRawShaderMaterial === false) {
+                               for (let i = 0; i < parameterNames.length; i++) {
+                                       array.push(parameters[parameterNames[i]]);
+                               }
+
+                               array.push(renderer.outputEncoding);
+                               array.push(renderer.gammaFactor);
+                       }
+
+                       array.push(parameters.customProgramCacheKey);
+                       return array.join();
+               }
+
+               function getUniforms(material) {
+                       const shaderID = shaderIDs[material.type];
+                       let uniforms;
+
+                       if (shaderID) {
+                               const shader = ShaderLib[shaderID];
+                               uniforms = UniformsUtils.clone(shader.uniforms);
+                       } else {
+                               uniforms = material.uniforms;
+                       }
+
+                       return uniforms;
+               }
+
+               function acquireProgram(parameters, cacheKey) {
+                       let program; // Check if code has been already compiled
+
+                       for (let p = 0, pl = programs.length; p < pl; p++) {
+                               const preexistingProgram = programs[p];
+
+                               if (preexistingProgram.cacheKey === cacheKey) {
+                                       program = preexistingProgram;
+                                       ++program.usedTimes;
+                                       break;
+                               }
+                       }
+
+                       if (program === undefined) {
+                               program = new WebGLProgram(renderer, cacheKey, parameters, bindingStates);
+                               programs.push(program);
+                       }
+
+                       return program;
+               }
+
+               function releaseProgram(program) {
+                       if (--program.usedTimes === 0) {
+                               // Remove from unordered set
+                               const i = programs.indexOf(program);
+                               programs[i] = programs[programs.length - 1];
+                               programs.pop(); // Free WebGL resources
+
+                               program.destroy();
+                       }
+               }
+
+               return {
+                       getParameters: getParameters,
+                       getProgramCacheKey: getProgramCacheKey,
+                       getUniforms: getUniforms,
+                       acquireProgram: acquireProgram,
+                       releaseProgram: releaseProgram,
+                       // Exposed for resource monitoring & error feedback via renderer.info:
+                       programs: programs
+               };
+       }
+
+       function WebGLProperties() {
+               let properties = new WeakMap();
+
+               function get(object) {
+                       let map = properties.get(object);
+
+                       if (map === undefined) {
+                               map = {};
+                               properties.set(object, map);
+                       }
+
+                       return map;
+               }
+
+               function remove(object) {
+                       properties.delete(object);
+               }
+
+               function update(object, key, value) {
+                       properties.get(object)[key] = value;
+               }
+
+               function dispose() {
+                       properties = new WeakMap();
+               }
+
+               return {
+                       get: get,
+                       remove: remove,
+                       update: update,
+                       dispose: dispose
+               };
+       }
+
+       function painterSortStable(a, b) {
+               if (a.groupOrder !== b.groupOrder) {
+                       return a.groupOrder - b.groupOrder;
+               } else if (a.renderOrder !== b.renderOrder) {
+                       return a.renderOrder - b.renderOrder;
+               } else if (a.program !== b.program) {
+                       return a.program.id - b.program.id;
+               } else if (a.material.id !== b.material.id) {
+                       return a.material.id - b.material.id;
+               } else if (a.z !== b.z) {
+                       return a.z - b.z;
+               } else {
+                       return a.id - b.id;
+               }
+       }
+
+       function reversePainterSortStable(a, b) {
+               if (a.groupOrder !== b.groupOrder) {
+                       return a.groupOrder - b.groupOrder;
+               } else if (a.renderOrder !== b.renderOrder) {
+                       return a.renderOrder - b.renderOrder;
+               } else if (a.z !== b.z) {
+                       return b.z - a.z;
+               } else {
+                       return a.id - b.id;
+               }
+       }
+
+       function WebGLRenderList(properties) {
+               const renderItems = [];
+               let renderItemsIndex = 0;
+               const opaque = [];
+               const transmissive = [];
+               const transparent = [];
+               const defaultProgram = {
+                       id: -1
+               };
+
+               function init() {
+                       renderItemsIndex = 0;
+                       opaque.length = 0;
+                       transmissive.length = 0;
+                       transparent.length = 0;
+               }
+
+               function getNextRenderItem(object, geometry, material, groupOrder, z, group) {
+                       let renderItem = renderItems[renderItemsIndex];
+                       const materialProperties = properties.get(material);
+
+                       if (renderItem === undefined) {
+                               renderItem = {
+                                       id: object.id,
+                                       object: object,
+                                       geometry: geometry,
+                                       material: material,
+                                       program: materialProperties.program || defaultProgram,
+                                       groupOrder: groupOrder,
+                                       renderOrder: object.renderOrder,
+                                       z: z,
+                                       group: group
+                               };
+                               renderItems[renderItemsIndex] = renderItem;
+                       } else {
+                               renderItem.id = object.id;
+                               renderItem.object = object;
+                               renderItem.geometry = geometry;
+                               renderItem.material = material;
+                               renderItem.program = materialProperties.program || defaultProgram;
+                               renderItem.groupOrder = groupOrder;
+                               renderItem.renderOrder = object.renderOrder;
+                               renderItem.z = z;
+                               renderItem.group = group;
+                       }
+
+                       renderItemsIndex++;
+                       return renderItem;
+               }
+
+               function push(object, geometry, material, groupOrder, z, group) {
+                       const renderItem = getNextRenderItem(object, geometry, material, groupOrder, z, group);
+
+                       if (material.transmission > 0.0) {
+                               transmissive.push(renderItem);
+                       } else if (material.transparent === true) {
+                               transparent.push(renderItem);
+                       } else {
+                               opaque.push(renderItem);
+                       }
+               }
+
+               function unshift(object, geometry, material, groupOrder, z, group) {
+                       const renderItem = getNextRenderItem(object, geometry, material, groupOrder, z, group);
+
+                       if (material.transmission > 0.0) {
+                               transmissive.unshift(renderItem);
+                       } else if (material.transparent === true) {
+                               transparent.unshift(renderItem);
+                       } else {
+                               opaque.unshift(renderItem);
+                       }
+               }
+
+               function sort(customOpaqueSort, customTransparentSort) {
+                       if (opaque.length > 1) opaque.sort(customOpaqueSort || painterSortStable);
+                       if (transmissive.length > 1) transmissive.sort(customTransparentSort || reversePainterSortStable);
+                       if (transparent.length > 1) transparent.sort(customTransparentSort || reversePainterSortStable);
+               }
+
+               function finish() {
+                       // Clear references from inactive renderItems in the list
+                       for (let i = renderItemsIndex, il = renderItems.length; i < il; i++) {
+                               const renderItem = renderItems[i];
+                               if (renderItem.id === null) break;
+                               renderItem.id = null;
+                               renderItem.object = null;
+                               renderItem.geometry = null;
+                               renderItem.material = null;
+                               renderItem.program = null;
+                               renderItem.group = null;
+                       }
+               }
+
+               return {
+                       opaque: opaque,
+                       transmissive: transmissive,
+                       transparent: transparent,
+                       init: init,
+                       push: push,
+                       unshift: unshift,
+                       finish: finish,
+                       sort: sort
+               };
+       }
+
+       function WebGLRenderLists(properties) {
+               let lists = new WeakMap();
+
+               function get(scene, renderCallDepth) {
+                       let list;
+
+                       if (lists.has(scene) === false) {
+                               list = new WebGLRenderList(properties);
+                               lists.set(scene, [list]);
+                       } else {
+                               if (renderCallDepth >= lists.get(scene).length) {
+                                       list = new WebGLRenderList(properties);
+                                       lists.get(scene).push(list);
+                               } else {
+                                       list = lists.get(scene)[renderCallDepth];
+                               }
+                       }
+
+                       return list;
+               }
+
+               function dispose() {
+                       lists = new WeakMap();
+               }
+
+               return {
+                       get: get,
+                       dispose: dispose
+               };
+       }
+
+       function UniformsCache() {
+               const lights = {};
+               return {
+                       get: function (light) {
+                               if (lights[light.id] !== undefined) {
+                                       return lights[light.id];
+                               }
+
+                               let uniforms;
+
+                               switch (light.type) {
+                                       case 'DirectionalLight':
+                                               uniforms = {
+                                                       direction: new Vector3(),
+                                                       color: new Color()
+                                               };
+                                               break;
+
+                                       case 'SpotLight':
+                                               uniforms = {
+                                                       position: new Vector3(),
+                                                       direction: new Vector3(),
+                                                       color: new Color(),
+                                                       distance: 0,
+                                                       coneCos: 0,
+                                                       penumbraCos: 0,
+                                                       decay: 0
+                                               };
+                                               break;
+
+                                       case 'PointLight':
+                                               uniforms = {
+                                                       position: new Vector3(),
+                                                       color: new Color(),
+                                                       distance: 0,
+                                                       decay: 0
+                                               };
+                                               break;
+
+                                       case 'HemisphereLight':
+                                               uniforms = {
+                                                       direction: new Vector3(),
+                                                       skyColor: new Color(),
+                                                       groundColor: new Color()
+                                               };
+                                               break;
+
+                                       case 'RectAreaLight':
+                                               uniforms = {
+                                                       color: new Color(),
+                                                       position: new Vector3(),
+                                                       halfWidth: new Vector3(),
+                                                       halfHeight: new Vector3()
+                                               };
+                                               break;
+                               }
+
+                               lights[light.id] = uniforms;
+                               return uniforms;
+                       }
+               };
+       }
+
+       function ShadowUniformsCache() {
+               const lights = {};
+               return {
+                       get: function (light) {
+                               if (lights[light.id] !== undefined) {
+                                       return lights[light.id];
+                               }
+
+                               let uniforms;
+
+                               switch (light.type) {
+                                       case 'DirectionalLight':
+                                               uniforms = {
+                                                       shadowBias: 0,
+                                                       shadowNormalBias: 0,
+                                                       shadowRadius: 1,
+                                                       shadowMapSize: new Vector2()
+                                               };
+                                               break;
+
+                                       case 'SpotLight':
+                                               uniforms = {
+                                                       shadowBias: 0,
+                                                       shadowNormalBias: 0,
+                                                       shadowRadius: 1,
+                                                       shadowMapSize: new Vector2()
+                                               };
+                                               break;
+
+                                       case 'PointLight':
+                                               uniforms = {
+                                                       shadowBias: 0,
+                                                       shadowNormalBias: 0,
+                                                       shadowRadius: 1,
+                                                       shadowMapSize: new Vector2(),
+                                                       shadowCameraNear: 1,
+                                                       shadowCameraFar: 1000
+                                               };
+                                               break;
+                                       // TODO (abelnation): set RectAreaLight shadow uniforms
+                               }
+
+                               lights[light.id] = uniforms;
+                               return uniforms;
+                       }
+               };
+       }
+
+       let nextVersion = 0;
+
+       function shadowCastingLightsFirst(lightA, lightB) {
+               return (lightB.castShadow ? 1 : 0) - (lightA.castShadow ? 1 : 0);
+       }
+
+       function WebGLLights(extensions, capabilities) {
+               const cache = new UniformsCache();
+               const shadowCache = ShadowUniformsCache();
+               const state = {
+                       version: 0,
+                       hash: {
+                               directionalLength: -1,
+                               pointLength: -1,
+                               spotLength: -1,
+                               rectAreaLength: -1,
+                               hemiLength: -1,
+                               numDirectionalShadows: -1,
+                               numPointShadows: -1,
+                               numSpotShadows: -1
+                       },
+                       ambient: [0, 0, 0],
+                       probe: [],
+                       directional: [],
+                       directionalShadow: [],
+                       directionalShadowMap: [],
+                       directionalShadowMatrix: [],
+                       spot: [],
+                       spotShadow: [],
+                       spotShadowMap: [],
+                       spotShadowMatrix: [],
+                       rectArea: [],
+                       rectAreaLTC1: null,
+                       rectAreaLTC2: null,
+                       point: [],
+                       pointShadow: [],
+                       pointShadowMap: [],
+                       pointShadowMatrix: [],
+                       hemi: []
+               };
+
+               for (let i = 0; i < 9; i++) state.probe.push(new Vector3());
+
+               const vector3 = new Vector3();
+               const matrix4 = new Matrix4();
+               const matrix42 = new Matrix4();
+
+               function setup(lights, physicallyCorrectLights) {
+                       let r = 0,
+                                       g = 0,
+                                       b = 0;
+
+                       for (let i = 0; i < 9; i++) state.probe[i].set(0, 0, 0);
+
+                       let directionalLength = 0;
+                       let pointLength = 0;
+                       let spotLength = 0;
+                       let rectAreaLength = 0;
+                       let hemiLength = 0;
+                       let numDirectionalShadows = 0;
+                       let numPointShadows = 0;
+                       let numSpotShadows = 0;
+                       lights.sort(shadowCastingLightsFirst); // artist-friendly light intensity scaling factor
+
+                       const scaleFactor = physicallyCorrectLights !== true ? Math.PI : 1;
+
+                       for (let i = 0, l = lights.length; i < l; i++) {
+                               const light = lights[i];
+                               const color = light.color;
+                               const intensity = light.intensity;
+                               const distance = light.distance;
+                               const shadowMap = light.shadow && light.shadow.map ? light.shadow.map.texture : null;
+
+                               if (light.isAmbientLight) {
+                                       r += color.r * intensity * scaleFactor;
+                                       g += color.g * intensity * scaleFactor;
+                                       b += color.b * intensity * scaleFactor;
+                               } else if (light.isLightProbe) {
+                                       for (let j = 0; j < 9; j++) {
+                                               state.probe[j].addScaledVector(light.sh.coefficients[j], intensity);
+                                       }
+                               } else if (light.isDirectionalLight) {
+                                       const uniforms = cache.get(light);
+                                       uniforms.color.copy(light.color).multiplyScalar(light.intensity * scaleFactor);
+
+                                       if (light.castShadow) {
+                                               const shadow = light.shadow;
+                                               const shadowUniforms = shadowCache.get(light);
+                                               shadowUniforms.shadowBias = shadow.bias;
+                                               shadowUniforms.shadowNormalBias = shadow.normalBias;
+                                               shadowUniforms.shadowRadius = shadow.radius;
+                                               shadowUniforms.shadowMapSize = shadow.mapSize;
+                                               state.directionalShadow[directionalLength] = shadowUniforms;
+                                               state.directionalShadowMap[directionalLength] = shadowMap;
+                                               state.directionalShadowMatrix[directionalLength] = light.shadow.matrix;
+                                               numDirectionalShadows++;
+                                       }
+
+                                       state.directional[directionalLength] = uniforms;
+                                       directionalLength++;
+                               } else if (light.isSpotLight) {
+                                       const uniforms = cache.get(light);
+                                       uniforms.position.setFromMatrixPosition(light.matrixWorld);
+                                       uniforms.color.copy(color).multiplyScalar(intensity * scaleFactor);
+                                       uniforms.distance = distance;
+                                       uniforms.coneCos = Math.cos(light.angle);
+                                       uniforms.penumbraCos = Math.cos(light.angle * (1 - light.penumbra));
+                                       uniforms.decay = light.decay;
+
+                                       if (light.castShadow) {
+                                               const shadow = light.shadow;
+                                               const shadowUniforms = shadowCache.get(light);
+                                               shadowUniforms.shadowBias = shadow.bias;
+                                               shadowUniforms.shadowNormalBias = shadow.normalBias;
+                                               shadowUniforms.shadowRadius = shadow.radius;
+                                               shadowUniforms.shadowMapSize = shadow.mapSize;
+                                               state.spotShadow[spotLength] = shadowUniforms;
+                                               state.spotShadowMap[spotLength] = shadowMap;
+                                               state.spotShadowMatrix[spotLength] = light.shadow.matrix;
+                                               numSpotShadows++;
+                                       }
+
+                                       state.spot[spotLength] = uniforms;
+                                       spotLength++;
+                               } else if (light.isRectAreaLight) {
+                                       const uniforms = cache.get(light); // (a) intensity is the total visible light emitted
+                                       //uniforms.color.copy( color ).multiplyScalar( intensity / ( light.width * light.height * Math.PI ) );
+                                       // (b) intensity is the brightness of the light
+
+                                       uniforms.color.copy(color).multiplyScalar(intensity);
+                                       uniforms.halfWidth.set(light.width * 0.5, 0.0, 0.0);
+                                       uniforms.halfHeight.set(0.0, light.height * 0.5, 0.0);
+                                       state.rectArea[rectAreaLength] = uniforms;
+                                       rectAreaLength++;
+                               } else if (light.isPointLight) {
+                                       const uniforms = cache.get(light);
+                                       uniforms.color.copy(light.color).multiplyScalar(light.intensity * scaleFactor);
+                                       uniforms.distance = light.distance;
+                                       uniforms.decay = light.decay;
+
+                                       if (light.castShadow) {
+                                               const shadow = light.shadow;
+                                               const shadowUniforms = shadowCache.get(light);
+                                               shadowUniforms.shadowBias = shadow.bias;
+                                               shadowUniforms.shadowNormalBias = shadow.normalBias;
+                                               shadowUniforms.shadowRadius = shadow.radius;
+                                               shadowUniforms.shadowMapSize = shadow.mapSize;
+                                               shadowUniforms.shadowCameraNear = shadow.camera.near;
+                                               shadowUniforms.shadowCameraFar = shadow.camera.far;
+                                               state.pointShadow[pointLength] = shadowUniforms;
+                                               state.pointShadowMap[pointLength] = shadowMap;
+                                               state.pointShadowMatrix[pointLength] = light.shadow.matrix;
+                                               numPointShadows++;
+                                       }
+
+                                       state.point[pointLength] = uniforms;
+                                       pointLength++;
+                               } else if (light.isHemisphereLight) {
+                                       const uniforms = cache.get(light);
+                                       uniforms.skyColor.copy(light.color).multiplyScalar(intensity * scaleFactor);
+                                       uniforms.groundColor.copy(light.groundColor).multiplyScalar(intensity * scaleFactor);
+                                       state.hemi[hemiLength] = uniforms;
+                                       hemiLength++;
+                               }
+                       }
+
+                       if (rectAreaLength > 0) {
+                               if (capabilities.isWebGL2) {
+                                       // WebGL 2
+                                       state.rectAreaLTC1 = UniformsLib.LTC_FLOAT_1;
+                                       state.rectAreaLTC2 = UniformsLib.LTC_FLOAT_2;
+                               } else {
+                                       // WebGL 1
+                                       if (extensions.has('OES_texture_float_linear') === true) {
+                                               state.rectAreaLTC1 = UniformsLib.LTC_FLOAT_1;
+                                               state.rectAreaLTC2 = UniformsLib.LTC_FLOAT_2;
+                                       } else if (extensions.has('OES_texture_half_float_linear') === true) {
+                                               state.rectAreaLTC1 = UniformsLib.LTC_HALF_1;
+                                               state.rectAreaLTC2 = UniformsLib.LTC_HALF_2;
+                                       } else {
+                                               console.error('THREE.WebGLRenderer: Unable to use RectAreaLight. Missing WebGL extensions.');
+                                       }
+                               }
+                       }
+
+                       state.ambient[0] = r;
+                       state.ambient[1] = g;
+                       state.ambient[2] = b;
+                       const hash = state.hash;
+
+                       if (hash.directionalLength !== directionalLength || hash.pointLength !== pointLength || hash.spotLength !== spotLength || hash.rectAreaLength !== rectAreaLength || hash.hemiLength !== hemiLength || hash.numDirectionalShadows !== numDirectionalShadows || hash.numPointShadows !== numPointShadows || hash.numSpotShadows !== numSpotShadows) {
+                               state.directional.length = directionalLength;
+                               state.spot.length = spotLength;
+                               state.rectArea.length = rectAreaLength;
+                               state.point.length = pointLength;
+                               state.hemi.length = hemiLength;
+                               state.directionalShadow.length = numDirectionalShadows;
+                               state.directionalShadowMap.length = numDirectionalShadows;
+                               state.pointShadow.length = numPointShadows;
+                               state.pointShadowMap.length = numPointShadows;
+                               state.spotShadow.length = numSpotShadows;
+                               state.spotShadowMap.length = numSpotShadows;
+                               state.directionalShadowMatrix.length = numDirectionalShadows;
+                               state.pointShadowMatrix.length = numPointShadows;
+                               state.spotShadowMatrix.length = numSpotShadows;
+                               hash.directionalLength = directionalLength;
+                               hash.pointLength = pointLength;
+                               hash.spotLength = spotLength;
+                               hash.rectAreaLength = rectAreaLength;
+                               hash.hemiLength = hemiLength;
+                               hash.numDirectionalShadows = numDirectionalShadows;
+                               hash.numPointShadows = numPointShadows;
+                               hash.numSpotShadows = numSpotShadows;
+                               state.version = nextVersion++;
+                       }
+               }
+
+               function setupView(lights, camera) {
+                       let directionalLength = 0;
+                       let pointLength = 0;
+                       let spotLength = 0;
+                       let rectAreaLength = 0;
+                       let hemiLength = 0;
+                       const viewMatrix = camera.matrixWorldInverse;
+
+                       for (let i = 0, l = lights.length; i < l; i++) {
+                               const light = lights[i];
+
+                               if (light.isDirectionalLight) {
+                                       const uniforms = state.directional[directionalLength];
+                                       uniforms.direction.setFromMatrixPosition(light.matrixWorld);
+                                       vector3.setFromMatrixPosition(light.target.matrixWorld);
+                                       uniforms.direction.sub(vector3);
+                                       uniforms.direction.transformDirection(viewMatrix);
+                                       directionalLength++;
+                               } else if (light.isSpotLight) {
+                                       const uniforms = state.spot[spotLength];
+                                       uniforms.position.setFromMatrixPosition(light.matrixWorld);
+                                       uniforms.position.applyMatrix4(viewMatrix);
+                                       uniforms.direction.setFromMatrixPosition(light.matrixWorld);
+                                       vector3.setFromMatrixPosition(light.target.matrixWorld);
+                                       uniforms.direction.sub(vector3);
+                                       uniforms.direction.transformDirection(viewMatrix);
+                                       spotLength++;
+                               } else if (light.isRectAreaLight) {
+                                       const uniforms = state.rectArea[rectAreaLength];
+                                       uniforms.position.setFromMatrixPosition(light.matrixWorld);
+                                       uniforms.position.applyMatrix4(viewMatrix); // extract local rotation of light to derive width/height half vectors
+
+                                       matrix42.identity();
+                                       matrix4.copy(light.matrixWorld);
+                                       matrix4.premultiply(viewMatrix);
+                                       matrix42.extractRotation(matrix4);
+                                       uniforms.halfWidth.set(light.width * 0.5, 0.0, 0.0);
+                                       uniforms.halfHeight.set(0.0, light.height * 0.5, 0.0);
+                                       uniforms.halfWidth.applyMatrix4(matrix42);
+                                       uniforms.halfHeight.applyMatrix4(matrix42);
+                                       rectAreaLength++;
+                               } else if (light.isPointLight) {
+                                       const uniforms = state.point[pointLength];
+                                       uniforms.position.setFromMatrixPosition(light.matrixWorld);
+                                       uniforms.position.applyMatrix4(viewMatrix);
+                                       pointLength++;
+                               } else if (light.isHemisphereLight) {
+                                       const uniforms = state.hemi[hemiLength];
+                                       uniforms.direction.setFromMatrixPosition(light.matrixWorld);
+                                       uniforms.direction.transformDirection(viewMatrix);
+                                       uniforms.direction.normalize();
+                                       hemiLength++;
+                               }
+                       }
+               }
+
+               return {
+                       setup: setup,
+                       setupView: setupView,
+                       state: state
+               };
+       }
+
+       function WebGLRenderState(extensions, capabilities) {
+               const lights = new WebGLLights(extensions, capabilities);
+               const lightsArray = [];
+               const shadowsArray = [];
+
+               function init() {
+                       lightsArray.length = 0;
+                       shadowsArray.length = 0;
+               }
+
+               function pushLight(light) {
+                       lightsArray.push(light);
+               }
+
+               function pushShadow(shadowLight) {
+                       shadowsArray.push(shadowLight);
+               }
+
+               function setupLights(physicallyCorrectLights) {
+                       lights.setup(lightsArray, physicallyCorrectLights);
+               }
+
+               function setupLightsView(camera) {
+                       lights.setupView(lightsArray, camera);
+               }
+
+               const state = {
+                       lightsArray: lightsArray,
+                       shadowsArray: shadowsArray,
+                       lights: lights
+               };
+               return {
+                       init: init,
+                       state: state,
+                       setupLights: setupLights,
+                       setupLightsView: setupLightsView,
+                       pushLight: pushLight,
+                       pushShadow: pushShadow
+               };
+       }
+
+       function WebGLRenderStates(extensions, capabilities) {
+               let renderStates = new WeakMap();
+
+               function get(scene, renderCallDepth = 0) {
+                       let renderState;
+
+                       if (renderStates.has(scene) === false) {
+                               renderState = new WebGLRenderState(extensions, capabilities);
+                               renderStates.set(scene, [renderState]);
+                       } else {
+                               if (renderCallDepth >= renderStates.get(scene).length) {
+                                       renderState = new WebGLRenderState(extensions, capabilities);
+                                       renderStates.get(scene).push(renderState);
+                               } else {
+                                       renderState = renderStates.get(scene)[renderCallDepth];
+                               }
+                       }
+
+                       return renderState;
+               }
+
+               function dispose() {
+                       renderStates = new WeakMap();
+               }
+
+               return {
+                       get: get,
+                       dispose: dispose
+               };
+       }
+
+       /**
+        * parameters = {
+        *
+        *      opacity: <float>,
+        *
+        *      map: new THREE.Texture( <Image> ),
+        *
+        *      alphaMap: new THREE.Texture( <Image> ),
+        *
+        *      displacementMap: new THREE.Texture( <Image> ),
+        *      displacementScale: <float>,
+        *      displacementBias: <float>,
+        *
+        *      wireframe: <boolean>,
+        *      wireframeLinewidth: <float>
+        * }
+        */
+
+       class MeshDepthMaterial extends Material {
+               constructor(parameters) {
+                       super();
+                       this.type = 'MeshDepthMaterial';
+                       this.depthPacking = BasicDepthPacking;
+                       this.map = null;
+                       this.alphaMap = null;
+                       this.displacementMap = null;
+                       this.displacementScale = 1;
+                       this.displacementBias = 0;
+                       this.wireframe = false;
+                       this.wireframeLinewidth = 1;
+                       this.fog = false;
+                       this.setValues(parameters);
+               }
+
+               copy(source) {
+                       super.copy(source);
+                       this.depthPacking = source.depthPacking;
+                       this.map = source.map;
+                       this.alphaMap = source.alphaMap;
+                       this.displacementMap = source.displacementMap;
+                       this.displacementScale = source.displacementScale;
+                       this.displacementBias = source.displacementBias;
+                       this.wireframe = source.wireframe;
+                       this.wireframeLinewidth = source.wireframeLinewidth;
+                       return this;
+               }
+
+       }
+
+       MeshDepthMaterial.prototype.isMeshDepthMaterial = true;
+
+       /**
+        * parameters = {
+        *
+        *      referencePosition: <float>,
+        *      nearDistance: <float>,
+        *      farDistance: <float>,
+        *
+        *      map: new THREE.Texture( <Image> ),
+        *
+        *      alphaMap: new THREE.Texture( <Image> ),
+        *
+        *      displacementMap: new THREE.Texture( <Image> ),
+        *      displacementScale: <float>,
+        *      displacementBias: <float>
+        *
+        * }
+        */
+
+       class MeshDistanceMaterial extends Material {
+               constructor(parameters) {
+                       super();
+                       this.type = 'MeshDistanceMaterial';
+                       this.referencePosition = new Vector3();
+                       this.nearDistance = 1;
+                       this.farDistance = 1000;
+                       this.map = null;
+                       this.alphaMap = null;
+                       this.displacementMap = null;
+                       this.displacementScale = 1;
+                       this.displacementBias = 0;
+                       this.fog = false;
+                       this.setValues(parameters);
+               }
+
+               copy(source) {
+                       super.copy(source);
+                       this.referencePosition.copy(source.referencePosition);
+                       this.nearDistance = source.nearDistance;
+                       this.farDistance = source.farDistance;
+                       this.map = source.map;
+                       this.alphaMap = source.alphaMap;
+                       this.displacementMap = source.displacementMap;
+                       this.displacementScale = source.displacementScale;
+                       this.displacementBias = source.displacementBias;
+                       return this;
+               }
+
+       }
+
+       MeshDistanceMaterial.prototype.isMeshDistanceMaterial = true;
+
+       var vsm_frag = "uniform sampler2D shadow_pass;\nuniform vec2 resolution;\nuniform float radius;\nuniform float samples;\n#include <packing>\nvoid main() {\n\tfloat mean = 0.0;\n\tfloat squared_mean = 0.0;\n\tfloat uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 );\n\tfloat uvStart = samples <= 1.0 ? 0.0 : - 1.0;\n\tfor ( float i = 0.0; i < samples; i ++ ) {\n\t\tfloat uvOffset = uvStart + i * uvStride;\n\t\t#ifdef HORIZONTAL_PASS\n\t\t\tvec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ) );\n\t\t\tmean += distribution.x;\n\t\t\tsquared_mean += distribution.y * distribution.y + distribution.x * distribution.x;\n\t\t#else\n\t\t\tfloat depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ) );\n\t\t\tmean += depth;\n\t\t\tsquared_mean += depth * depth;\n\t\t#endif\n\t}\n\tmean = mean / samples;\n\tsquared_mean = squared_mean / samples;\n\tfloat std_dev = sqrt( squared_mean - mean * mean );\n\tgl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );\n}";
+
+       var vsm_vert = "void main() {\n\tgl_Position = vec4( position, 1.0 );\n}";
+
+       function WebGLShadowMap(_renderer, _objects, _capabilities) {
+               let _frustum = new Frustum();
+
+               const _shadowMapSize = new Vector2(),
+                                       _viewportSize = new Vector2(),
+                                       _viewport = new Vector4(),
+                                       _depthMaterial = new MeshDepthMaterial({
+                       depthPacking: RGBADepthPacking
+               }),
+                                       _distanceMaterial = new MeshDistanceMaterial(),
+                                       _materialCache = {},
+                                       _maxTextureSize = _capabilities.maxTextureSize;
+
+               const shadowSide = {
+                       0: BackSide,
+                       1: FrontSide,
+                       2: DoubleSide
+               };
+               const shadowMaterialVertical = new ShaderMaterial({
+                       uniforms: {
+                               shadow_pass: {
+                                       value: null
+                               },
+                               resolution: {
+                                       value: new Vector2()
+                               },
+                               radius: {
+                                       value: 4.0
+                               },
+                               samples: {
+                                       value: 8.0
+                               }
+                       },
+                       vertexShader: vsm_vert,
+                       fragmentShader: vsm_frag
+               });
+               const shadowMaterialHorizontal = shadowMaterialVertical.clone();
+               shadowMaterialHorizontal.defines.HORIZONTAL_PASS = 1;
+               const fullScreenTri = new BufferGeometry();
+               fullScreenTri.setAttribute('position', new BufferAttribute(new Float32Array([-1, -1, 0.5, 3, -1, 0.5, -1, 3, 0.5]), 3));
+               const fullScreenMesh = new Mesh(fullScreenTri, shadowMaterialVertical);
+               const scope = this;
+               this.enabled = false;
+               this.autoUpdate = true;
+               this.needsUpdate = false;
+               this.type = PCFShadowMap;
+
+               this.render = function (lights, scene, camera) {
+                       if (scope.enabled === false) return;
+                       if (scope.autoUpdate === false && scope.needsUpdate === false) return;
+                       if (lights.length === 0) return;
+
+                       const currentRenderTarget = _renderer.getRenderTarget();
+
+                       const activeCubeFace = _renderer.getActiveCubeFace();
+
+                       const activeMipmapLevel = _renderer.getActiveMipmapLevel();
+
+                       const _state = _renderer.state; // Set GL state for depth map.
+
+                       _state.setBlending(NoBlending);
+
+                       _state.buffers.color.setClear(1, 1, 1, 1);
+
+                       _state.buffers.depth.setTest(true);
+
+                       _state.setScissorTest(false); // render depth map
+
+
+                       for (let i = 0, il = lights.length; i < il; i++) {
+                               const light = lights[i];
+                               const shadow = light.shadow;
+
+                               if (shadow === undefined) {
+                                       console.warn('THREE.WebGLShadowMap:', light, 'has no shadow.');
+                                       continue;
+                               }
+
+                               if (shadow.autoUpdate === false && shadow.needsUpdate === false) continue;
+
+                               _shadowMapSize.copy(shadow.mapSize);
+
+                               const shadowFrameExtents = shadow.getFrameExtents();
+
+                               _shadowMapSize.multiply(shadowFrameExtents);
+
+                               _viewportSize.copy(shadow.mapSize);
+
+                               if (_shadowMapSize.x > _maxTextureSize || _shadowMapSize.y > _maxTextureSize) {
+                                       if (_shadowMapSize.x > _maxTextureSize) {
+                                               _viewportSize.x = Math.floor(_maxTextureSize / shadowFrameExtents.x);
+                                               _shadowMapSize.x = _viewportSize.x * shadowFrameExtents.x;
+                                               shadow.mapSize.x = _viewportSize.x;
+                                       }
+
+                                       if (_shadowMapSize.y > _maxTextureSize) {
+                                               _viewportSize.y = Math.floor(_maxTextureSize / shadowFrameExtents.y);
+                                               _shadowMapSize.y = _viewportSize.y * shadowFrameExtents.y;
+                                               shadow.mapSize.y = _viewportSize.y;
+                                       }
+                               }
+
+                               if (shadow.map === null && !shadow.isPointLightShadow && this.type === VSMShadowMap) {
+                                       const pars = {
+                                               minFilter: LinearFilter,
+                                               magFilter: LinearFilter,
+                                               format: RGBAFormat
+                                       };
+                                       shadow.map = new WebGLRenderTarget(_shadowMapSize.x, _shadowMapSize.y, pars);
+                                       shadow.map.texture.name = light.name + '.shadowMap';
+                                       shadow.mapPass = new WebGLRenderTarget(_shadowMapSize.x, _shadowMapSize.y, pars);
+                                       shadow.camera.updateProjectionMatrix();
+                               }
+
+                               if (shadow.map === null) {
+                                       const pars = {
+                                               minFilter: NearestFilter,
+                                               magFilter: NearestFilter,
+                                               format: RGBAFormat
+                                       };
+                                       shadow.map = new WebGLRenderTarget(_shadowMapSize.x, _shadowMapSize.y, pars);
+                                       shadow.map.texture.name = light.name + '.shadowMap';
+                                       shadow.camera.updateProjectionMatrix();
+                               }
+
+                               _renderer.setRenderTarget(shadow.map);
+
+                               _renderer.clear();
+
+                               const viewportCount = shadow.getViewportCount();
+
+                               for (let vp = 0; vp < viewportCount; vp++) {
+                                       const viewport = shadow.getViewport(vp);
+
+                                       _viewport.set(_viewportSize.x * viewport.x, _viewportSize.y * viewport.y, _viewportSize.x * viewport.z, _viewportSize.y * viewport.w);
+
+                                       _state.viewport(_viewport);
+
+                                       shadow.updateMatrices(light, vp);
+                                       _frustum = shadow.getFrustum();
+                                       renderObject(scene, camera, shadow.camera, light, this.type);
+                               } // do blur pass for VSM
+
+
+                               if (!shadow.isPointLightShadow && this.type === VSMShadowMap) {
+                                       VSMPass(shadow, camera);
+                               }
+
+                               shadow.needsUpdate = false;
+                       }
+
+                       scope.needsUpdate = false;
+
+                       _renderer.setRenderTarget(currentRenderTarget, activeCubeFace, activeMipmapLevel);
+               };
+
+               function VSMPass(shadow, camera) {
+                       const geometry = _objects.update(fullScreenMesh); // vertical pass
+
+
+                       shadowMaterialVertical.uniforms.shadow_pass.value = shadow.map.texture;
+                       shadowMaterialVertical.uniforms.resolution.value = shadow.mapSize;
+                       shadowMaterialVertical.uniforms.radius.value = shadow.radius;
+                       shadowMaterialVertical.uniforms.samples.value = shadow.blurSamples;
+
+                       _renderer.setRenderTarget(shadow.mapPass);
+
+                       _renderer.clear();
+
+                       _renderer.renderBufferDirect(camera, null, geometry, shadowMaterialVertical, fullScreenMesh, null); // horizontal pass
+
+
+                       shadowMaterialHorizontal.uniforms.shadow_pass.value = shadow.mapPass.texture;
+                       shadowMaterialHorizontal.uniforms.resolution.value = shadow.mapSize;
+                       shadowMaterialHorizontal.uniforms.radius.value = shadow.radius;
+                       shadowMaterialHorizontal.uniforms.samples.value = shadow.blurSamples;
+
+                       _renderer.setRenderTarget(shadow.map);
+
+                       _renderer.clear();
+
+                       _renderer.renderBufferDirect(camera, null, geometry, shadowMaterialHorizontal, fullScreenMesh, null);
+               }
+
+               function getDepthMaterial(object, geometry, material, light, shadowCameraNear, shadowCameraFar, type) {
+                       let result = null;
+                       const customMaterial = light.isPointLight === true ? object.customDistanceMaterial : object.customDepthMaterial;
+
+                       if (customMaterial !== undefined) {
+                               result = customMaterial;
+                       } else {
+                               result = light.isPointLight === true ? _distanceMaterial : _depthMaterial;
+                       }
+
+                       if (_renderer.localClippingEnabled && material.clipShadows === true && material.clippingPlanes.length !== 0 || material.displacementMap && material.displacementScale !== 0 || material.alphaMap && material.alphaTest > 0) {
+                               // in this case we need a unique material instance reflecting the
+                               // appropriate state
+                               const keyA = result.uuid,
+                                                       keyB = material.uuid;
+                               let materialsForVariant = _materialCache[keyA];
+
+                               if (materialsForVariant === undefined) {
+                                       materialsForVariant = {};
+                                       _materialCache[keyA] = materialsForVariant;
+                               }
+
+                               let cachedMaterial = materialsForVariant[keyB];
+
+                               if (cachedMaterial === undefined) {
+                                       cachedMaterial = result.clone();
+                                       materialsForVariant[keyB] = cachedMaterial;
+                               }
+
+                               result = cachedMaterial;
+                       }
+
+                       result.visible = material.visible;
+                       result.wireframe = material.wireframe;
+
+                       if (type === VSMShadowMap) {
+                               result.side = material.shadowSide !== null ? material.shadowSide : material.side;
+                       } else {
+                               result.side = material.shadowSide !== null ? material.shadowSide : shadowSide[material.side];
+                       }
+
+                       result.alphaMap = material.alphaMap;
+                       result.alphaTest = material.alphaTest;
+                       result.clipShadows = material.clipShadows;
+                       result.clippingPlanes = material.clippingPlanes;
+                       result.clipIntersection = material.clipIntersection;
+                       result.displacementMap = material.displacementMap;
+                       result.displacementScale = material.displacementScale;
+                       result.displacementBias = material.displacementBias;
+                       result.wireframeLinewidth = material.wireframeLinewidth;
+                       result.linewidth = material.linewidth;
+
+                       if (light.isPointLight === true && result.isMeshDistanceMaterial === true) {
+                               result.referencePosition.setFromMatrixPosition(light.matrixWorld);
+                               result.nearDistance = shadowCameraNear;
+                               result.farDistance = shadowCameraFar;
+                       }
+
+                       return result;
+               }
+
+               function renderObject(object, camera, shadowCamera, light, type) {
+                       if (object.visible === false) return;
+                       const visible = object.layers.test(camera.layers);
+
+                       if (visible && (object.isMesh || object.isLine || object.isPoints)) {
+                               if ((object.castShadow || object.receiveShadow && type === VSMShadowMap) && (!object.frustumCulled || _frustum.intersectsObject(object))) {
+                                       object.modelViewMatrix.multiplyMatrices(shadowCamera.matrixWorldInverse, object.matrixWorld);
+
+                                       const geometry = _objects.update(object);
+
+                                       const material = object.material;
+
+                                       if (Array.isArray(material)) {
+                                               const groups = geometry.groups;
+
+                                               for (let k = 0, kl = groups.length; k < kl; k++) {
+                                                       const group = groups[k];
+                                                       const groupMaterial = material[group.materialIndex];
+
+                                                       if (groupMaterial && groupMaterial.visible) {
+                                                               const depthMaterial = getDepthMaterial(object, geometry, groupMaterial, light, shadowCamera.near, shadowCamera.far, type);
+
+                                                               _renderer.renderBufferDirect(shadowCamera, null, geometry, depthMaterial, object, group);
+                                                       }
+                                               }
+                                       } else if (material.visible) {
+                                               const depthMaterial = getDepthMaterial(object, geometry, material, light, shadowCamera.near, shadowCamera.far, type);
+
+                                               _renderer.renderBufferDirect(shadowCamera, null, geometry, depthMaterial, object, null);
+                                       }
+                               }
+                       }
+
+                       const children = object.children;
+
+                       for (let i = 0, l = children.length; i < l; i++) {
+                               renderObject(children[i], camera, shadowCamera, light, type);
+                       }
+               }
+       }
+
+       function WebGLState(gl, extensions, capabilities) {
+               const isWebGL2 = capabilities.isWebGL2;
+
+               function ColorBuffer() {
+                       let locked = false;
+                       const color = new Vector4();
+                       let currentColorMask = null;
+                       const currentColorClear = new Vector4(0, 0, 0, 0);
+                       return {
+                               setMask: function (colorMask) {
+                                       if (currentColorMask !== colorMask && !locked) {
+                                               gl.colorMask(colorMask, colorMask, colorMask, colorMask);
+                                               currentColorMask = colorMask;
+                                       }
+                               },
+                               setLocked: function (lock) {
+                                       locked = lock;
+                               },
+                               setClear: function (r, g, b, a, premultipliedAlpha) {
+                                       if (premultipliedAlpha === true) {
+                                               r *= a;
+                                               g *= a;
+                                               b *= a;
+                                       }
+
+                                       color.set(r, g, b, a);
+
+                                       if (currentColorClear.equals(color) === false) {
+                                               gl.clearColor(r, g, b, a);
+                                               currentColorClear.copy(color);
+                                       }
+                               },
+                               reset: function () {
+                                       locked = false;
+                                       currentColorMask = null;
+                                       currentColorClear.set(-1, 0, 0, 0); // set to invalid state
+                               }
+                       };
+               }
+
+               function DepthBuffer() {
+                       let locked = false;
+                       let currentDepthMask = null;
+                       let currentDepthFunc = null;
+                       let currentDepthClear = null;
+                       return {
+                               setTest: function (depthTest) {
+                                       if (depthTest) {
+                                               enable(gl.DEPTH_TEST);
+                                       } else {
+                                               disable(gl.DEPTH_TEST);
+                                       }
+                               },
+                               setMask: function (depthMask) {
+                                       if (currentDepthMask !== depthMask && !locked) {
+                                               gl.depthMask(depthMask);
+                                               currentDepthMask = depthMask;
+                                       }
+                               },
+                               setFunc: function (depthFunc) {
+                                       if (currentDepthFunc !== depthFunc) {
+                                               if (depthFunc) {
+                                                       switch (depthFunc) {
+                                                               case NeverDepth:
+                                                                       gl.depthFunc(gl.NEVER);
+                                                                       break;
+
+                                                               case AlwaysDepth:
+                                                                       gl.depthFunc(gl.ALWAYS);
+                                                                       break;
+
+                                                               case LessDepth:
+                                                                       gl.depthFunc(gl.LESS);
+                                                                       break;
+
+                                                               case LessEqualDepth:
+                                                                       gl.depthFunc(gl.LEQUAL);
+                                                                       break;
+
+                                                               case EqualDepth:
+                                                                       gl.depthFunc(gl.EQUAL);
+                                                                       break;
+
+                                                               case GreaterEqualDepth:
+                                                                       gl.depthFunc(gl.GEQUAL);
+                                                                       break;
+
+                                                               case GreaterDepth:
+                                                                       gl.depthFunc(gl.GREATER);
+                                                                       break;
+
+                                                               case NotEqualDepth:
+                                                                       gl.depthFunc(gl.NOTEQUAL);
+                                                                       break;
+
+                                                               default:
+                                                                       gl.depthFunc(gl.LEQUAL);
+                                                       }
+                                               } else {
+                                                       gl.depthFunc(gl.LEQUAL);
+                                               }
+
+                                               currentDepthFunc = depthFunc;
+                                       }
+                               },
+                               setLocked: function (lock) {
+                                       locked = lock;
+                               },
+                               setClear: function (depth) {
+                                       if (currentDepthClear !== depth) {
+                                               gl.clearDepth(depth);
+                                               currentDepthClear = depth;
+                                       }
+                               },
+                               reset: function () {
+                                       locked = false;
+                                       currentDepthMask = null;
+                                       currentDepthFunc = null;
+                                       currentDepthClear = null;
+                               }
+                       };
+               }
+
+               function StencilBuffer() {
+                       let locked = false;
+                       let currentStencilMask = null;
+                       let currentStencilFunc = null;
+                       let currentStencilRef = null;
+                       let currentStencilFuncMask = null;
+                       let currentStencilFail = null;
+                       let currentStencilZFail = null;
+                       let currentStencilZPass = null;
+                       let currentStencilClear = null;
+                       return {
+                               setTest: function (stencilTest) {
+                                       if (!locked) {
+                                               if (stencilTest) {
+                                                       enable(gl.STENCIL_TEST);
+                                               } else {
+                                                       disable(gl.STENCIL_TEST);
+                                               }
+                                       }
+                               },
+                               setMask: function (stencilMask) {
+                                       if (currentStencilMask !== stencilMask && !locked) {
+                                               gl.stencilMask(stencilMask);
+                                               currentStencilMask = stencilMask;
+                                       }
+                               },
+                               setFunc: function (stencilFunc, stencilRef, stencilMask) {
+                                       if (currentStencilFunc !== stencilFunc || currentStencilRef !== stencilRef || currentStencilFuncMask !== stencilMask) {
+                                               gl.stencilFunc(stencilFunc, stencilRef, stencilMask);
+                                               currentStencilFunc = stencilFunc;
+                                               currentStencilRef = stencilRef;
+                                               currentStencilFuncMask = stencilMask;
+                                       }
+                               },
+                               setOp: function (stencilFail, stencilZFail, stencilZPass) {
+                                       if (currentStencilFail !== stencilFail || currentStencilZFail !== stencilZFail || currentStencilZPass !== stencilZPass) {
+                                               gl.stencilOp(stencilFail, stencilZFail, stencilZPass);
+                                               currentStencilFail = stencilFail;
+                                               currentStencilZFail = stencilZFail;
+                                               currentStencilZPass = stencilZPass;
+                                       }
+                               },
+                               setLocked: function (lock) {
+                                       locked = lock;
+                               },
+                               setClear: function (stencil) {
+                                       if (currentStencilClear !== stencil) {
+                                               gl.clearStencil(stencil);
+                                               currentStencilClear = stencil;
+                                       }
+                               },
+                               reset: function () {
+                                       locked = false;
+                                       currentStencilMask = null;
+                                       currentStencilFunc = null;
+                                       currentStencilRef = null;
+                                       currentStencilFuncMask = null;
+                                       currentStencilFail = null;
+                                       currentStencilZFail = null;
+                                       currentStencilZPass = null;
+                                       currentStencilClear = null;
+                               }
+                       };
+               } //
+
+
+               const colorBuffer = new ColorBuffer();
+               const depthBuffer = new DepthBuffer();
+               const stencilBuffer = new StencilBuffer();
+               let enabledCapabilities = {};
+               let xrFramebuffer = null;
+               let currentBoundFramebuffers = {};
+               let currentProgram = null;
+               let currentBlendingEnabled = false;
+               let currentBlending = null;
+               let currentBlendEquation = null;
+               let currentBlendSrc = null;
+               let currentBlendDst = null;
+               let currentBlendEquationAlpha = null;
+               let currentBlendSrcAlpha = null;
+               let currentBlendDstAlpha = null;
+               let currentPremultipledAlpha = false;
+               let currentFlipSided = null;
+               let currentCullFace = null;
+               let currentLineWidth = null;
+               let currentPolygonOffsetFactor = null;
+               let currentPolygonOffsetUnits = null;
+               const maxTextures = gl.getParameter(gl.MAX_COMBINED_TEXTURE_IMAGE_UNITS);
+               let lineWidthAvailable = false;
+               let version = 0;
+               const glVersion = gl.getParameter(gl.VERSION);
+
+               if (glVersion.indexOf('WebGL') !== -1) {
+                       version = parseFloat(/^WebGL (\d)/.exec(glVersion)[1]);
+                       lineWidthAvailable = version >= 1.0;
+               } else if (glVersion.indexOf('OpenGL ES') !== -1) {
+                       version = parseFloat(/^OpenGL ES (\d)/.exec(glVersion)[1]);
+                       lineWidthAvailable = version >= 2.0;
+               }
+
+               let currentTextureSlot = null;
+               let currentBoundTextures = {};
+               const scissorParam = gl.getParameter(gl.SCISSOR_BOX);
+               const viewportParam = gl.getParameter(gl.VIEWPORT);
+               const currentScissor = new Vector4().fromArray(scissorParam);
+               const currentViewport = new Vector4().fromArray(viewportParam);
+
+               function createTexture(type, target, count) {
+                       const data = new Uint8Array(4); // 4 is required to match default unpack alignment of 4.
+
+                       const texture = gl.createTexture();
+                       gl.bindTexture(type, texture);
+                       gl.texParameteri(type, gl.TEXTURE_MIN_FILTER, gl.NEAREST);
+                       gl.texParameteri(type, gl.TEXTURE_MAG_FILTER, gl.NEAREST);
+
+                       for (let i = 0; i < count; i++) {
+                               gl.texImage2D(target + i, 0, gl.RGBA, 1, 1, 0, gl.RGBA, gl.UNSIGNED_BYTE, data);
+                       }
+
+                       return texture;
+               }
+
+               const emptyTextures = {};
+               emptyTextures[gl.TEXTURE_2D] = createTexture(gl.TEXTURE_2D, gl.TEXTURE_2D, 1);
+               emptyTextures[gl.TEXTURE_CUBE_MAP] = createTexture(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_CUBE_MAP_POSITIVE_X, 6); // init
+
+               colorBuffer.setClear(0, 0, 0, 1);
+               depthBuffer.setClear(1);
+               stencilBuffer.setClear(0);
+               enable(gl.DEPTH_TEST);
+               depthBuffer.setFunc(LessEqualDepth);
+               setFlipSided(false);
+               setCullFace(CullFaceBack);
+               enable(gl.CULL_FACE);
+               setBlending(NoBlending); //
+
+               function enable(id) {
+                       if (enabledCapabilities[id] !== true) {
+                               gl.enable(id);
+                               enabledCapabilities[id] = true;
+                       }
+               }
+
+               function disable(id) {
+                       if (enabledCapabilities[id] !== false) {
+                               gl.disable(id);
+                               enabledCapabilities[id] = false;
+                       }
+               }
+
+               function bindXRFramebuffer(framebuffer) {
+                       if (framebuffer !== xrFramebuffer) {
+                               gl.bindFramebuffer(gl.FRAMEBUFFER, framebuffer);
+                               xrFramebuffer = framebuffer;
+                       }
+               }
+
+               function bindFramebuffer(target, framebuffer) {
+                       if (framebuffer === null && xrFramebuffer !== null) framebuffer = xrFramebuffer; // use active XR framebuffer if available
+
+                       if (currentBoundFramebuffers[target] !== framebuffer) {
+                               gl.bindFramebuffer(target, framebuffer);
+                               currentBoundFramebuffers[target] = framebuffer;
+
+                               if (isWebGL2) {
+                                       // gl.DRAW_FRAMEBUFFER is equivalent to gl.FRAMEBUFFER
+                                       if (target === gl.DRAW_FRAMEBUFFER) {
+                                               currentBoundFramebuffers[gl.FRAMEBUFFER] = framebuffer;
+                                       }
+
+                                       if (target === gl.FRAMEBUFFER) {
+                                               currentBoundFramebuffers[gl.DRAW_FRAMEBUFFER] = framebuffer;
+                                       }
+                               }
+
+                               return true;
+                       }
+
+                       return false;
+               }
+
+               function useProgram(program) {
+                       if (currentProgram !== program) {
+                               gl.useProgram(program);
+                               currentProgram = program;
+                               return true;
+                       }
+
+                       return false;
+               }
+
+               const equationToGL = {
+                       [AddEquation]: gl.FUNC_ADD,
+                       [SubtractEquation]: gl.FUNC_SUBTRACT,
+                       [ReverseSubtractEquation]: gl.FUNC_REVERSE_SUBTRACT
+               };
+
+               if (isWebGL2) {
+                       equationToGL[MinEquation] = gl.MIN;
+                       equationToGL[MaxEquation] = gl.MAX;
+               } else {
+                       const extension = extensions.get('EXT_blend_minmax');
+
+                       if (extension !== null) {
+                               equationToGL[MinEquation] = extension.MIN_EXT;
+                               equationToGL[MaxEquation] = extension.MAX_EXT;
+                       }
+               }
+
+               const factorToGL = {
+                       [ZeroFactor]: gl.ZERO,
+                       [OneFactor]: gl.ONE,
+                       [SrcColorFactor]: gl.SRC_COLOR,
+                       [SrcAlphaFactor]: gl.SRC_ALPHA,
+                       [SrcAlphaSaturateFactor]: gl.SRC_ALPHA_SATURATE,
+                       [DstColorFactor]: gl.DST_COLOR,
+                       [DstAlphaFactor]: gl.DST_ALPHA,
+                       [OneMinusSrcColorFactor]: gl.ONE_MINUS_SRC_COLOR,
+                       [OneMinusSrcAlphaFactor]: gl.ONE_MINUS_SRC_ALPHA,
+                       [OneMinusDstColorFactor]: gl.ONE_MINUS_DST_COLOR,
+                       [OneMinusDstAlphaFactor]: gl.ONE_MINUS_DST_ALPHA
+               };
+
+               function setBlending(blending, blendEquation, blendSrc, blendDst, blendEquationAlpha, blendSrcAlpha, blendDstAlpha, premultipliedAlpha) {
+                       if (blending === NoBlending) {
+                               if (currentBlendingEnabled === true) {
+                                       disable(gl.BLEND);
+                                       currentBlendingEnabled = false;
+                               }
+
+                               return;
+                       }
+
+                       if (currentBlendingEnabled === false) {
+                               enable(gl.BLEND);
+                               currentBlendingEnabled = true;
+                       }
+
+                       if (blending !== CustomBlending) {
+                               if (blending !== currentBlending || premultipliedAlpha !== currentPremultipledAlpha) {
+                                       if (currentBlendEquation !== AddEquation || currentBlendEquationAlpha !== AddEquation) {
+                                               gl.blendEquation(gl.FUNC_ADD);
+                                               currentBlendEquation = AddEquation;
+                                               currentBlendEquationAlpha = AddEquation;
+                                       }
+
+                                       if (premultipliedAlpha) {
+                                               switch (blending) {
+                                                       case NormalBlending:
+                                                               gl.blendFuncSeparate(gl.ONE, gl.ONE_MINUS_SRC_ALPHA, gl.ONE, gl.ONE_MINUS_SRC_ALPHA);
+                                                               break;
+
+                                                       case AdditiveBlending:
+                                                               gl.blendFunc(gl.ONE, gl.ONE);
+                                                               break;
+
+                                                       case SubtractiveBlending:
+                                                               gl.blendFuncSeparate(gl.ZERO, gl.ZERO, gl.ONE_MINUS_SRC_COLOR, gl.ONE_MINUS_SRC_ALPHA);
+                                                               break;
+
+                                                       case MultiplyBlending:
+                                                               gl.blendFuncSeparate(gl.ZERO, gl.SRC_COLOR, gl.ZERO, gl.SRC_ALPHA);
+                                                               break;
+
+                                                       default:
+                                                               console.error('THREE.WebGLState: Invalid blending: ', blending);
+                                                               break;
+                                               }
+                                       } else {
+                                               switch (blending) {
+                                                       case NormalBlending:
+                                                               gl.blendFuncSeparate(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA, gl.ONE, gl.ONE_MINUS_SRC_ALPHA);
+                                                               break;
+
+                                                       case AdditiveBlending:
+                                                               gl.blendFunc(gl.SRC_ALPHA, gl.ONE);
+                                                               break;
+
+                                                       case SubtractiveBlending:
+                                                               gl.blendFunc(gl.ZERO, gl.ONE_MINUS_SRC_COLOR);
+                                                               break;
+
+                                                       case MultiplyBlending:
+                                                               gl.blendFunc(gl.ZERO, gl.SRC_COLOR);
+                                                               break;
+
+                                                       default:
+                                                               console.error('THREE.WebGLState: Invalid blending: ', blending);
+                                                               break;
+                                               }
+                                       }
+
+                                       currentBlendSrc = null;
+                                       currentBlendDst = null;
+                                       currentBlendSrcAlpha = null;
+                                       currentBlendDstAlpha = null;
+                                       currentBlending = blending;
+                                       currentPremultipledAlpha = premultipliedAlpha;
+                               }
+
+                               return;
+                       } // custom blending
+
+
+                       blendEquationAlpha = blendEquationAlpha || blendEquation;
+                       blendSrcAlpha = blendSrcAlpha || blendSrc;
+                       blendDstAlpha = blendDstAlpha || blendDst;
+
+                       if (blendEquation !== currentBlendEquation || blendEquationAlpha !== currentBlendEquationAlpha) {
+                               gl.blendEquationSeparate(equationToGL[blendEquation], equationToGL[blendEquationAlpha]);
+                               currentBlendEquation = blendEquation;
+                               currentBlendEquationAlpha = blendEquationAlpha;
+                       }
+
+                       if (blendSrc !== currentBlendSrc || blendDst !== currentBlendDst || blendSrcAlpha !== currentBlendSrcAlpha || blendDstAlpha !== currentBlendDstAlpha) {
+                               gl.blendFuncSeparate(factorToGL[blendSrc], factorToGL[blendDst], factorToGL[blendSrcAlpha], factorToGL[blendDstAlpha]);
+                               currentBlendSrc = blendSrc;
+                               currentBlendDst = blendDst;
+                               currentBlendSrcAlpha = blendSrcAlpha;
+                               currentBlendDstAlpha = blendDstAlpha;
+                       }
+
+                       currentBlending = blending;
+                       currentPremultipledAlpha = null;
+               }
+
+               function setMaterial(material, frontFaceCW) {
+                       material.side === DoubleSide ? disable(gl.CULL_FACE) : enable(gl.CULL_FACE);
+                       let flipSided = material.side === BackSide;
+                       if (frontFaceCW) flipSided = !flipSided;
+                       setFlipSided(flipSided);
+                       material.blending === NormalBlending && material.transparent === false ? setBlending(NoBlending) : setBlending(material.blending, material.blendEquation, material.blendSrc, material.blendDst, material.blendEquationAlpha, material.blendSrcAlpha, material.blendDstAlpha, material.premultipliedAlpha);
+                       depthBuffer.setFunc(material.depthFunc);
+                       depthBuffer.setTest(material.depthTest);
+                       depthBuffer.setMask(material.depthWrite);
+                       colorBuffer.setMask(material.colorWrite);
+                       const stencilWrite = material.stencilWrite;
+                       stencilBuffer.setTest(stencilWrite);
+
+                       if (stencilWrite) {
+                               stencilBuffer.setMask(material.stencilWriteMask);
+                               stencilBuffer.setFunc(material.stencilFunc, material.stencilRef, material.stencilFuncMask);
+                               stencilBuffer.setOp(material.stencilFail, material.stencilZFail, material.stencilZPass);
+                       }
+
+                       setPolygonOffset(material.polygonOffset, material.polygonOffsetFactor, material.polygonOffsetUnits);
+                       material.alphaToCoverage === true ? enable(gl.SAMPLE_ALPHA_TO_COVERAGE) : disable(gl.SAMPLE_ALPHA_TO_COVERAGE);
+               } //
+
+
+               function setFlipSided(flipSided) {
+                       if (currentFlipSided !== flipSided) {
+                               if (flipSided) {
+                                       gl.frontFace(gl.CW);
+                               } else {
+                                       gl.frontFace(gl.CCW);
+                               }
+
+                               currentFlipSided = flipSided;
+                       }
+               }
+
+               function setCullFace(cullFace) {
+                       if (cullFace !== CullFaceNone) {
+                               enable(gl.CULL_FACE);
+
+                               if (cullFace !== currentCullFace) {
+                                       if (cullFace === CullFaceBack) {
+                                               gl.cullFace(gl.BACK);
+                                       } else if (cullFace === CullFaceFront) {
+                                               gl.cullFace(gl.FRONT);
+                                       } else {
+                                               gl.cullFace(gl.FRONT_AND_BACK);
+                                       }
+                               }
+                       } else {
+                               disable(gl.CULL_FACE);
+                       }
+
+                       currentCullFace = cullFace;
+               }
+
+               function setLineWidth(width) {
+                       if (width !== currentLineWidth) {
+                               if (lineWidthAvailable) gl.lineWidth(width);
+                               currentLineWidth = width;
+                       }
+               }
+
+               function setPolygonOffset(polygonOffset, factor, units) {
+                       if (polygonOffset) {
+                               enable(gl.POLYGON_OFFSET_FILL);
+
+                               if (currentPolygonOffsetFactor !== factor || currentPolygonOffsetUnits !== units) {
+                                       gl.polygonOffset(factor, units);
+                                       currentPolygonOffsetFactor = factor;
+                                       currentPolygonOffsetUnits = units;
+                               }
+                       } else {
+                               disable(gl.POLYGON_OFFSET_FILL);
+                       }
+               }
+
+               function setScissorTest(scissorTest) {
+                       if (scissorTest) {
+                               enable(gl.SCISSOR_TEST);
+                       } else {
+                               disable(gl.SCISSOR_TEST);
+                       }
+               } // texture
+
+
+               function activeTexture(webglSlot) {
+                       if (webglSlot === undefined) webglSlot = gl.TEXTURE0 + maxTextures - 1;
+
+                       if (currentTextureSlot !== webglSlot) {
+                               gl.activeTexture(webglSlot);
+                               currentTextureSlot = webglSlot;
+                       }
+               }
+
+               function bindTexture(webglType, webglTexture) {
+                       if (currentTextureSlot === null) {
+                               activeTexture();
+                       }
+
+                       let boundTexture = currentBoundTextures[currentTextureSlot];
+
+                       if (boundTexture === undefined) {
+                               boundTexture = {
+                                       type: undefined,
+                                       texture: undefined
+                               };
+                               currentBoundTextures[currentTextureSlot] = boundTexture;
+                       }
+
+                       if (boundTexture.type !== webglType || boundTexture.texture !== webglTexture) {
+                               gl.bindTexture(webglType, webglTexture || emptyTextures[webglType]);
+                               boundTexture.type = webglType;
+                               boundTexture.texture = webglTexture;
+                       }
+               }
+
+               function unbindTexture() {
+                       const boundTexture = currentBoundTextures[currentTextureSlot];
+
+                       if (boundTexture !== undefined && boundTexture.type !== undefined) {
+                               gl.bindTexture(boundTexture.type, null);
+                               boundTexture.type = undefined;
+                               boundTexture.texture = undefined;
+                       }
+               }
+
+               function compressedTexImage2D() {
+                       try {
+                               gl.compressedTexImage2D.apply(gl, arguments);
+                       } catch (error) {
+                               console.error('THREE.WebGLState:', error);
+                       }
+               }
+
+               function texImage2D() {
+                       try {
+                               gl.texImage2D.apply(gl, arguments);
+                       } catch (error) {
+                               console.error('THREE.WebGLState:', error);
+                       }
+               }
+
+               function texImage3D() {
+                       try {
+                               gl.texImage3D.apply(gl, arguments);
+                       } catch (error) {
+                               console.error('THREE.WebGLState:', error);
+                       }
+               } //
+
+
+               function scissor(scissor) {
+                       if (currentScissor.equals(scissor) === false) {
+                               gl.scissor(scissor.x, scissor.y, scissor.z, scissor.w);
+                               currentScissor.copy(scissor);
+                       }
+               }
+
+               function viewport(viewport) {
+                       if (currentViewport.equals(viewport) === false) {
+                               gl.viewport(viewport.x, viewport.y, viewport.z, viewport.w);
+                               currentViewport.copy(viewport);
+                       }
+               } //
+
+
+               function reset() {
+                       // reset state
+                       gl.disable(gl.BLEND);
+                       gl.disable(gl.CULL_FACE);
+                       gl.disable(gl.DEPTH_TEST);
+                       gl.disable(gl.POLYGON_OFFSET_FILL);
+                       gl.disable(gl.SCISSOR_TEST);
+                       gl.disable(gl.STENCIL_TEST);
+                       gl.disable(gl.SAMPLE_ALPHA_TO_COVERAGE);
+                       gl.blendEquation(gl.FUNC_ADD);
+                       gl.blendFunc(gl.ONE, gl.ZERO);
+                       gl.blendFuncSeparate(gl.ONE, gl.ZERO, gl.ONE, gl.ZERO);
+                       gl.colorMask(true, true, true, true);
+                       gl.clearColor(0, 0, 0, 0);
+                       gl.depthMask(true);
+                       gl.depthFunc(gl.LESS);
+                       gl.clearDepth(1);
+                       gl.stencilMask(0xffffffff);
+                       gl.stencilFunc(gl.ALWAYS, 0, 0xffffffff);
+                       gl.stencilOp(gl.KEEP, gl.KEEP, gl.KEEP);
+                       gl.clearStencil(0);
+                       gl.cullFace(gl.BACK);
+                       gl.frontFace(gl.CCW);
+                       gl.polygonOffset(0, 0);
+                       gl.activeTexture(gl.TEXTURE0);
+                       gl.bindFramebuffer(gl.FRAMEBUFFER, null);
+
+                       if (isWebGL2 === true) {
+                               gl.bindFramebuffer(gl.DRAW_FRAMEBUFFER, null);
+                               gl.bindFramebuffer(gl.READ_FRAMEBUFFER, null);
+                       }
+
+                       gl.useProgram(null);
+                       gl.lineWidth(1);
+                       gl.scissor(0, 0, gl.canvas.width, gl.canvas.height);
+                       gl.viewport(0, 0, gl.canvas.width, gl.canvas.height); // reset internals
+
+                       enabledCapabilities = {};
+                       currentTextureSlot = null;
+                       currentBoundTextures = {};
+                       xrFramebuffer = null;
+                       currentBoundFramebuffers = {};
+                       currentProgram = null;
+                       currentBlendingEnabled = false;
+                       currentBlending = null;
+                       currentBlendEquation = null;
+                       currentBlendSrc = null;
+                       currentBlendDst = null;
+                       currentBlendEquationAlpha = null;
+                       currentBlendSrcAlpha = null;
+                       currentBlendDstAlpha = null;
+                       currentPremultipledAlpha = false;
+                       currentFlipSided = null;
+                       currentCullFace = null;
+                       currentLineWidth = null;
+                       currentPolygonOffsetFactor = null;
+                       currentPolygonOffsetUnits = null;
+                       currentScissor.set(0, 0, gl.canvas.width, gl.canvas.height);
+                       currentViewport.set(0, 0, gl.canvas.width, gl.canvas.height);
+                       colorBuffer.reset();
+                       depthBuffer.reset();
+                       stencilBuffer.reset();
+               }
+
+               return {
+                       buffers: {
+                               color: colorBuffer,
+                               depth: depthBuffer,
+                               stencil: stencilBuffer
+                       },
+                       enable: enable,
+                       disable: disable,
+                       bindFramebuffer: bindFramebuffer,
+                       bindXRFramebuffer: bindXRFramebuffer,
+                       useProgram: useProgram,
+                       setBlending: setBlending,
+                       setMaterial: setMaterial,
+                       setFlipSided: setFlipSided,
+                       setCullFace: setCullFace,
+                       setLineWidth: setLineWidth,
+                       setPolygonOffset: setPolygonOffset,
+                       setScissorTest: setScissorTest,
+                       activeTexture: activeTexture,
+                       bindTexture: bindTexture,
+                       unbindTexture: unbindTexture,
+                       compressedTexImage2D: compressedTexImage2D,
+                       texImage2D: texImage2D,
+                       texImage3D: texImage3D,
+                       scissor: scissor,
+                       viewport: viewport,
+                       reset: reset
+               };
+       }
+
+       function WebGLTextures(_gl, extensions, state, properties, capabilities, utils, info) {
+               const isWebGL2 = capabilities.isWebGL2;
+               const maxTextures = capabilities.maxTextures;
+               const maxCubemapSize = capabilities.maxCubemapSize;
+               const maxTextureSize = capabilities.maxTextureSize;
+               const maxSamples = capabilities.maxSamples;
+
+               const _videoTextures = new WeakMap();
+
+               let _canvas; // cordova iOS (as of 5.0) still uses UIWebView, which provides OffscreenCanvas,
+               // also OffscreenCanvas.getContext("webgl"), but not OffscreenCanvas.getContext("2d")!
+               // Some implementations may only implement OffscreenCanvas partially (e.g. lacking 2d).
+
+
+               let useOffscreenCanvas = false;
+
+               try {
+                       useOffscreenCanvas = typeof OffscreenCanvas !== 'undefined' && new OffscreenCanvas(1, 1).getContext('2d') !== null;
+               } catch (err) {// Ignore any errors
+               }
+
+               function createCanvas(width, height) {
+                       // Use OffscreenCanvas when available. Specially needed in web workers
+                       return useOffscreenCanvas ? new OffscreenCanvas(width, height) : document.createElementNS('http://www.w3.org/1999/xhtml', 'canvas');
+               }
+
+               function resizeImage(image, needsPowerOfTwo, needsNewCanvas, maxSize) {
+                       let scale = 1; // handle case if texture exceeds max size
+
+                       if (image.width > maxSize || image.height > maxSize) {
+                               scale = maxSize / Math.max(image.width, image.height);
+                       } // only perform resize if necessary
+
+
+                       if (scale < 1 || needsPowerOfTwo === true) {
+                               // only perform resize for certain image types
+                               if (typeof HTMLImageElement !== 'undefined' && image instanceof HTMLImageElement || typeof HTMLCanvasElement !== 'undefined' && image instanceof HTMLCanvasElement || typeof ImageBitmap !== 'undefined' && image instanceof ImageBitmap) {
+                                       const floor = needsPowerOfTwo ? floorPowerOfTwo : Math.floor;
+                                       const width = floor(scale * image.width);
+                                       const height = floor(scale * image.height);
+                                       if (_canvas === undefined) _canvas = createCanvas(width, height); // cube textures can't reuse the same canvas
+
+                                       const canvas = needsNewCanvas ? createCanvas(width, height) : _canvas;
+                                       canvas.width = width;
+                                       canvas.height = height;
+                                       const context = canvas.getContext('2d');
+                                       context.drawImage(image, 0, 0, width, height);
+                                       console.warn('THREE.WebGLRenderer: Texture has been resized from (' + image.width + 'x' + image.height + ') to (' + width + 'x' + height + ').');
+                                       return canvas;
+                               } else {
+                                       if ('data' in image) {
+                                               console.warn('THREE.WebGLRenderer: Image in DataTexture is too big (' + image.width + 'x' + image.height + ').');
+                                       }
+
+                                       return image;
+                               }
+                       }
+
+                       return image;
+               }
+
+               function isPowerOfTwo$1(image) {
+                       return isPowerOfTwo(image.width) && isPowerOfTwo(image.height);
+               }
+
+               function textureNeedsPowerOfTwo(texture) {
+                       if (isWebGL2) return false;
+                       return texture.wrapS !== ClampToEdgeWrapping || texture.wrapT !== ClampToEdgeWrapping || texture.minFilter !== NearestFilter && texture.minFilter !== LinearFilter;
+               }
+
+               function textureNeedsGenerateMipmaps(texture, supportsMips) {
+                       return texture.generateMipmaps && supportsMips && texture.minFilter !== NearestFilter && texture.minFilter !== LinearFilter;
+               }
+
+               function generateMipmap(target, texture, width, height, depth = 1) {
+                       _gl.generateMipmap(target);
+
+                       const textureProperties = properties.get(texture);
+                       textureProperties.__maxMipLevel = Math.log2(Math.max(width, height, depth));
+               }
+
+               function getInternalFormat(internalFormatName, glFormat, glType) {
+                       if (isWebGL2 === false) return glFormat;
+
+                       if (internalFormatName !== null) {
+                               if (_gl[internalFormatName] !== undefined) return _gl[internalFormatName];
+                               console.warn('THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format \'' + internalFormatName + '\'');
+                       }
+
+                       let internalFormat = glFormat;
+
+                       if (glFormat === _gl.RED) {
+                               if (glType === _gl.FLOAT) internalFormat = _gl.R32F;
+                               if (glType === _gl.HALF_FLOAT) internalFormat = _gl.R16F;
+                               if (glType === _gl.UNSIGNED_BYTE) internalFormat = _gl.R8;
+                       }
+
+                       if (glFormat === _gl.RGB) {
+                               if (glType === _gl.FLOAT) internalFormat = _gl.RGB32F;
+                               if (glType === _gl.HALF_FLOAT) internalFormat = _gl.RGB16F;
+                               if (glType === _gl.UNSIGNED_BYTE) internalFormat = _gl.RGB8;
+                       }
+
+                       if (glFormat === _gl.RGBA) {
+                               if (glType === _gl.FLOAT) internalFormat = _gl.RGBA32F;
+                               if (glType === _gl.HALF_FLOAT) internalFormat = _gl.RGBA16F;
+                               if (glType === _gl.UNSIGNED_BYTE) internalFormat = _gl.RGBA8;
+                       }
+
+                       if (internalFormat === _gl.R16F || internalFormat === _gl.R32F || internalFormat === _gl.RGBA16F || internalFormat === _gl.RGBA32F) {
+                               extensions.get('EXT_color_buffer_float');
+                       }
+
+                       return internalFormat;
+               } // Fallback filters for non-power-of-2 textures
+
+
+               function filterFallback(f) {
+                       if (f === NearestFilter || f === NearestMipmapNearestFilter || f === NearestMipmapLinearFilter) {
+                               return _gl.NEAREST;
+                       }
+
+                       return _gl.LINEAR;
+               } //
+
+
+               function onTextureDispose(event) {
+                       const texture = event.target;
+                       texture.removeEventListener('dispose', onTextureDispose);
+                       deallocateTexture(texture);
+
+                       if (texture.isVideoTexture) {
+                               _videoTextures.delete(texture);
+                       }
+
+                       info.memory.textures--;
+               }
+
+               function onRenderTargetDispose(event) {
+                       const renderTarget = event.target;
+                       renderTarget.removeEventListener('dispose', onRenderTargetDispose);
+                       deallocateRenderTarget(renderTarget);
+               } //
+
+
+               function deallocateTexture(texture) {
+                       const textureProperties = properties.get(texture);
+                       if (textureProperties.__webglInit === undefined) return;
+
+                       _gl.deleteTexture(textureProperties.__webglTexture);
+
+                       properties.remove(texture);
+               }
+
+               function deallocateRenderTarget(renderTarget) {
+                       const texture = renderTarget.texture;
+                       const renderTargetProperties = properties.get(renderTarget);
+                       const textureProperties = properties.get(texture);
+                       if (!renderTarget) return;
+
+                       if (textureProperties.__webglTexture !== undefined) {
+                               _gl.deleteTexture(textureProperties.__webglTexture);
+
+                               info.memory.textures--;
+                       }
+
+                       if (renderTarget.depthTexture) {
+                               renderTarget.depthTexture.dispose();
+                       }
+
+                       if (renderTarget.isWebGLCubeRenderTarget) {
+                               for (let i = 0; i < 6; i++) {
+                                       _gl.deleteFramebuffer(renderTargetProperties.__webglFramebuffer[i]);
+
+                                       if (renderTargetProperties.__webglDepthbuffer) _gl.deleteRenderbuffer(renderTargetProperties.__webglDepthbuffer[i]);
+                               }
+                       } else {
+                               _gl.deleteFramebuffer(renderTargetProperties.__webglFramebuffer);
+
+                               if (renderTargetProperties.__webglDepthbuffer) _gl.deleteRenderbuffer(renderTargetProperties.__webglDepthbuffer);
+                               if (renderTargetProperties.__webglMultisampledFramebuffer) _gl.deleteFramebuffer(renderTargetProperties.__webglMultisampledFramebuffer);
+                               if (renderTargetProperties.__webglColorRenderbuffer) _gl.deleteRenderbuffer(renderTargetProperties.__webglColorRenderbuffer);
+                               if (renderTargetProperties.__webglDepthRenderbuffer) _gl.deleteRenderbuffer(renderTargetProperties.__webglDepthRenderbuffer);
+                       }
+
+                       if (renderTarget.isWebGLMultipleRenderTargets) {
+                               for (let i = 0, il = texture.length; i < il; i++) {
+                                       const attachmentProperties = properties.get(texture[i]);
+
+                                       if (attachmentProperties.__webglTexture) {
+                                               _gl.deleteTexture(attachmentProperties.__webglTexture);
+
+                                               info.memory.textures--;
+                                       }
+
+                                       properties.remove(texture[i]);
+                               }
+                       }
+
+                       properties.remove(texture);
+                       properties.remove(renderTarget);
+               } //
+
+
+               let textureUnits = 0;
+
+               function resetTextureUnits() {
+                       textureUnits = 0;
+               }
+
+               function allocateTextureUnit() {
+                       const textureUnit = textureUnits;
+
+                       if (textureUnit >= maxTextures) {
+                               console.warn('THREE.WebGLTextures: Trying to use ' + textureUnit + ' texture units while this GPU supports only ' + maxTextures);
+                       }
+
+                       textureUnits += 1;
+                       return textureUnit;
+               } //
+
+
+               function setTexture2D(texture, slot) {
+                       const textureProperties = properties.get(texture);
+                       if (texture.isVideoTexture) updateVideoTexture(texture);
+
+                       if (texture.version > 0 && textureProperties.__version !== texture.version) {
+                               const image = texture.image;
+
+                               if (image === undefined) {
+                                       console.warn('THREE.WebGLRenderer: Texture marked for update but image is undefined');
+                               } else if (image.complete === false) {
+                                       console.warn('THREE.WebGLRenderer: Texture marked for update but image is incomplete');
+                               } else {
+                                       uploadTexture(textureProperties, texture, slot);
+                                       return;
+                               }
+                       }
+
+                       state.activeTexture(_gl.TEXTURE0 + slot);
+                       state.bindTexture(_gl.TEXTURE_2D, textureProperties.__webglTexture);
+               }
+
+               function setTexture2DArray(texture, slot) {
+                       const textureProperties = properties.get(texture);
+
+                       if (texture.version > 0 && textureProperties.__version !== texture.version) {
+                               uploadTexture(textureProperties, texture, slot);
+                               return;
+                       }
+
+                       state.activeTexture(_gl.TEXTURE0 + slot);
+                       state.bindTexture(_gl.TEXTURE_2D_ARRAY, textureProperties.__webglTexture);
+               }
+
+               function setTexture3D(texture, slot) {
+                       const textureProperties = properties.get(texture);
+
+                       if (texture.version > 0 && textureProperties.__version !== texture.version) {
+                               uploadTexture(textureProperties, texture, slot);
+                               return;
+                       }
+
+                       state.activeTexture(_gl.TEXTURE0 + slot);
+                       state.bindTexture(_gl.TEXTURE_3D, textureProperties.__webglTexture);
+               }
+
+               function setTextureCube(texture, slot) {
+                       const textureProperties = properties.get(texture);
+
+                       if (texture.version > 0 && textureProperties.__version !== texture.version) {
+                               uploadCubeTexture(textureProperties, texture, slot);
+                               return;
+                       }
+
+                       state.activeTexture(_gl.TEXTURE0 + slot);
+                       state.bindTexture(_gl.TEXTURE_CUBE_MAP, textureProperties.__webglTexture);
+               }
+
+               const wrappingToGL = {
+                       [RepeatWrapping]: _gl.REPEAT,
+                       [ClampToEdgeWrapping]: _gl.CLAMP_TO_EDGE,
+                       [MirroredRepeatWrapping]: _gl.MIRRORED_REPEAT
+               };
+               const filterToGL = {
+                       [NearestFilter]: _gl.NEAREST,
+                       [NearestMipmapNearestFilter]: _gl.NEAREST_MIPMAP_NEAREST,
+                       [NearestMipmapLinearFilter]: _gl.NEAREST_MIPMAP_LINEAR,
+                       [LinearFilter]: _gl.LINEAR,
+                       [LinearMipmapNearestFilter]: _gl.LINEAR_MIPMAP_NEAREST,
+                       [LinearMipmapLinearFilter]: _gl.LINEAR_MIPMAP_LINEAR
+               };
+
+               function setTextureParameters(textureType, texture, supportsMips) {
+                       if (supportsMips) {
+                               _gl.texParameteri(textureType, _gl.TEXTURE_WRAP_S, wrappingToGL[texture.wrapS]);
+
+                               _gl.texParameteri(textureType, _gl.TEXTURE_WRAP_T, wrappingToGL[texture.wrapT]);
+
+                               if (textureType === _gl.TEXTURE_3D || textureType === _gl.TEXTURE_2D_ARRAY) {
+                                       _gl.texParameteri(textureType, _gl.TEXTURE_WRAP_R, wrappingToGL[texture.wrapR]);
+                               }
+
+                               _gl.texParameteri(textureType, _gl.TEXTURE_MAG_FILTER, filterToGL[texture.magFilter]);
+
+                               _gl.texParameteri(textureType, _gl.TEXTURE_MIN_FILTER, filterToGL[texture.minFilter]);
+                       } else {
+                               _gl.texParameteri(textureType, _gl.TEXTURE_WRAP_S, _gl.CLAMP_TO_EDGE);
+
+                               _gl.texParameteri(textureType, _gl.TEXTURE_WRAP_T, _gl.CLAMP_TO_EDGE);
+
+                               if (textureType === _gl.TEXTURE_3D || textureType === _gl.TEXTURE_2D_ARRAY) {
+                                       _gl.texParameteri(textureType, _gl.TEXTURE_WRAP_R, _gl.CLAMP_TO_EDGE);
+                               }
+
+                               if (texture.wrapS !== ClampToEdgeWrapping || texture.wrapT !== ClampToEdgeWrapping) {
+                                       console.warn('THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping.');
+                               }
+
+                               _gl.texParameteri(textureType, _gl.TEXTURE_MAG_FILTER, filterFallback(texture.magFilter));
+
+                               _gl.texParameteri(textureType, _gl.TEXTURE_MIN_FILTER, filterFallback(texture.minFilter));
+
+                               if (texture.minFilter !== NearestFilter && texture.minFilter !== LinearFilter) {
+                                       console.warn('THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.');
+                               }
+                       }
+
+                       if (extensions.has('EXT_texture_filter_anisotropic') === true) {
+                               const extension = extensions.get('EXT_texture_filter_anisotropic');
+                               if (texture.type === FloatType && extensions.has('OES_texture_float_linear') === false) return; // verify extension for WebGL 1 and WebGL 2
+
+                               if (isWebGL2 === false && texture.type === HalfFloatType && extensions.has('OES_texture_half_float_linear') === false) return; // verify extension for WebGL 1 only
+
+                               if (texture.anisotropy > 1 || properties.get(texture).__currentAnisotropy) {
+                                       _gl.texParameterf(textureType, extension.TEXTURE_MAX_ANISOTROPY_EXT, Math.min(texture.anisotropy, capabilities.getMaxAnisotropy()));
+
+                                       properties.get(texture).__currentAnisotropy = texture.anisotropy;
+                               }
+                       }
+               }
+
+               function initTexture(textureProperties, texture) {
+                       if (textureProperties.__webglInit === undefined) {
+                               textureProperties.__webglInit = true;
+                               texture.addEventListener('dispose', onTextureDispose);
+                               textureProperties.__webglTexture = _gl.createTexture();
+                               info.memory.textures++;
+                       }
+               }
+
+               function uploadTexture(textureProperties, texture, slot) {
+                       let textureType = _gl.TEXTURE_2D;
+                       if (texture.isDataTexture2DArray) textureType = _gl.TEXTURE_2D_ARRAY;
+                       if (texture.isDataTexture3D) textureType = _gl.TEXTURE_3D;
+                       initTexture(textureProperties, texture);
+                       state.activeTexture(_gl.TEXTURE0 + slot);
+                       state.bindTexture(textureType, textureProperties.__webglTexture);
+
+                       _gl.pixelStorei(_gl.UNPACK_FLIP_Y_WEBGL, texture.flipY);
+
+                       _gl.pixelStorei(_gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, texture.premultiplyAlpha);
+
+                       _gl.pixelStorei(_gl.UNPACK_ALIGNMENT, texture.unpackAlignment);
+
+                       _gl.pixelStorei(_gl.UNPACK_COLORSPACE_CONVERSION_WEBGL, _gl.NONE);
+
+                       const needsPowerOfTwo = textureNeedsPowerOfTwo(texture) && isPowerOfTwo$1(texture.image) === false;
+                       const image = resizeImage(texture.image, needsPowerOfTwo, false, maxTextureSize);
+                       const supportsMips = isPowerOfTwo$1(image) || isWebGL2,
+                                               glFormat = utils.convert(texture.format);
+                       let glType = utils.convert(texture.type),
+                                       glInternalFormat = getInternalFormat(texture.internalFormat, glFormat, glType);
+                       setTextureParameters(textureType, texture, supportsMips);
+                       let mipmap;
+                       const mipmaps = texture.mipmaps;
+
+                       if (texture.isDepthTexture) {
+                               // populate depth texture with dummy data
+                               glInternalFormat = _gl.DEPTH_COMPONENT;
+
+                               if (isWebGL2) {
+                                       if (texture.type === FloatType) {
+                                               glInternalFormat = _gl.DEPTH_COMPONENT32F;
+                                       } else if (texture.type === UnsignedIntType) {
+                                               glInternalFormat = _gl.DEPTH_COMPONENT24;
+                                       } else if (texture.type === UnsignedInt248Type) {
+                                               glInternalFormat = _gl.DEPTH24_STENCIL8;
+                                       } else {
+                                               glInternalFormat = _gl.DEPTH_COMPONENT16; // WebGL2 requires sized internalformat for glTexImage2D
+                                       }
+                               } else {
+                                       if (texture.type === FloatType) {
+                                               console.error('WebGLRenderer: Floating point depth texture requires WebGL2.');
+                                       }
+                               } // validation checks for WebGL 1
+
+
+                               if (texture.format === DepthFormat && glInternalFormat === _gl.DEPTH_COMPONENT) {
+                                       // The error INVALID_OPERATION is generated by texImage2D if format and internalformat are
+                                       // DEPTH_COMPONENT and type is not UNSIGNED_SHORT or UNSIGNED_INT
+                                       // (https://www.khronos.org/registry/webgl/extensions/WEBGL_depth_texture/)
+                                       if (texture.type !== UnsignedShortType && texture.type !== UnsignedIntType) {
+                                               console.warn('THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture.');
+                                               texture.type = UnsignedShortType;
+                                               glType = utils.convert(texture.type);
+                                       }
+                               }
+
+                               if (texture.format === DepthStencilFormat && glInternalFormat === _gl.DEPTH_COMPONENT) {
+                                       // Depth stencil textures need the DEPTH_STENCIL internal format
+                                       // (https://www.khronos.org/registry/webgl/extensions/WEBGL_depth_texture/)
+                                       glInternalFormat = _gl.DEPTH_STENCIL; // The error INVALID_OPERATION is generated by texImage2D if format and internalformat are
+                                       // DEPTH_STENCIL and type is not UNSIGNED_INT_24_8_WEBGL.
+                                       // (https://www.khronos.org/registry/webgl/extensions/WEBGL_depth_texture/)
+
+                                       if (texture.type !== UnsignedInt248Type) {
+                                               console.warn('THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture.');
+                                               texture.type = UnsignedInt248Type;
+                                               glType = utils.convert(texture.type);
+                                       }
+                               } //
+
+
+                               state.texImage2D(_gl.TEXTURE_2D, 0, glInternalFormat, image.width, image.height, 0, glFormat, glType, null);
+                       } else if (texture.isDataTexture) {
+                               // use manually created mipmaps if available
+                               // if there are no manual mipmaps
+                               // set 0 level mipmap and then use GL to generate other mipmap levels
+                               if (mipmaps.length > 0 && supportsMips) {
+                                       for (let i = 0, il = mipmaps.length; i < il; i++) {
+                                               mipmap = mipmaps[i];
+                                               state.texImage2D(_gl.TEXTURE_2D, i, glInternalFormat, mipmap.width, mipmap.height, 0, glFormat, glType, mipmap.data);
+                                       }
+
+                                       texture.generateMipmaps = false;
+                                       textureProperties.__maxMipLevel = mipmaps.length - 1;
+                               } else {
+                                       state.texImage2D(_gl.TEXTURE_2D, 0, glInternalFormat, image.width, image.height, 0, glFormat, glType, image.data);
+                                       textureProperties.__maxMipLevel = 0;
+                               }
+                       } else if (texture.isCompressedTexture) {
+                               for (let i = 0, il = mipmaps.length; i < il; i++) {
+                                       mipmap = mipmaps[i];
+
+                                       if (texture.format !== RGBAFormat && texture.format !== RGBFormat) {
+                                               if (glFormat !== null) {
+                                                       state.compressedTexImage2D(_gl.TEXTURE_2D, i, glInternalFormat, mipmap.width, mipmap.height, 0, mipmap.data);
+                                               } else {
+                                                       console.warn('THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()');
+                                               }
+                                       } else {
+                                               state.texImage2D(_gl.TEXTURE_2D, i, glInternalFormat, mipmap.width, mipmap.height, 0, glFormat, glType, mipmap.data);
+                                       }
+                               }
+
+                               textureProperties.__maxMipLevel = mipmaps.length - 1;
+                       } else if (texture.isDataTexture2DArray) {
+                               state.texImage3D(_gl.TEXTURE_2D_ARRAY, 0, glInternalFormat, image.width, image.height, image.depth, 0, glFormat, glType, image.data);
+                               textureProperties.__maxMipLevel = 0;
+                       } else if (texture.isDataTexture3D) {
+                               state.texImage3D(_gl.TEXTURE_3D, 0, glInternalFormat, image.width, image.height, image.depth, 0, glFormat, glType, image.data);
+                               textureProperties.__maxMipLevel = 0;
+                       } else {
+                               // regular Texture (image, video, canvas)
+                               // use manually created mipmaps if available
+                               // if there are no manual mipmaps
+                               // set 0 level mipmap and then use GL to generate other mipmap levels
+                               if (mipmaps.length > 0 && supportsMips) {
+                                       for (let i = 0, il = mipmaps.length; i < il; i++) {
+                                               mipmap = mipmaps[i];
+                                               state.texImage2D(_gl.TEXTURE_2D, i, glInternalFormat, glFormat, glType, mipmap);
+                                       }
+
+                                       texture.generateMipmaps = false;
+                                       textureProperties.__maxMipLevel = mipmaps.length - 1;
+                               } else {
+                                       state.texImage2D(_gl.TEXTURE_2D, 0, glInternalFormat, glFormat, glType, image);
+                                       textureProperties.__maxMipLevel = 0;
+                               }
+                       }
+
+                       if (textureNeedsGenerateMipmaps(texture, supportsMips)) {
+                               generateMipmap(textureType, texture, image.width, image.height);
+                       }
+
+                       textureProperties.__version = texture.version;
+                       if (texture.onUpdate) texture.onUpdate(texture);
+               }
+
+               function uploadCubeTexture(textureProperties, texture, slot) {
+                       if (texture.image.length !== 6) return;
+                       initTexture(textureProperties, texture);
+                       state.activeTexture(_gl.TEXTURE0 + slot);
+                       state.bindTexture(_gl.TEXTURE_CUBE_MAP, textureProperties.__webglTexture);
+
+                       _gl.pixelStorei(_gl.UNPACK_FLIP_Y_WEBGL, texture.flipY);
+
+                       _gl.pixelStorei(_gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, texture.premultiplyAlpha);
+
+                       _gl.pixelStorei(_gl.UNPACK_ALIGNMENT, texture.unpackAlignment);
+
+                       _gl.pixelStorei(_gl.UNPACK_COLORSPACE_CONVERSION_WEBGL, _gl.NONE);
+
+                       const isCompressed = texture && (texture.isCompressedTexture || texture.image[0].isCompressedTexture);
+                       const isDataTexture = texture.image[0] && texture.image[0].isDataTexture;
+                       const cubeImage = [];
+
+                       for (let i = 0; i < 6; i++) {
+                               if (!isCompressed && !isDataTexture) {
+                                       cubeImage[i] = resizeImage(texture.image[i], false, true, maxCubemapSize);
+                               } else {
+                                       cubeImage[i] = isDataTexture ? texture.image[i].image : texture.image[i];
+                               }
+                       }
+
+                       const image = cubeImage[0],
+                                               supportsMips = isPowerOfTwo$1(image) || isWebGL2,
+                                               glFormat = utils.convert(texture.format),
+                                               glType = utils.convert(texture.type),
+                                               glInternalFormat = getInternalFormat(texture.internalFormat, glFormat, glType);
+                       setTextureParameters(_gl.TEXTURE_CUBE_MAP, texture, supportsMips);
+                       let mipmaps;
+
+                       if (isCompressed) {
+                               for (let i = 0; i < 6; i++) {
+                                       mipmaps = cubeImage[i].mipmaps;
+
+                                       for (let j = 0; j < mipmaps.length; j++) {
+                                               const mipmap = mipmaps[j];
+
+                                               if (texture.format !== RGBAFormat && texture.format !== RGBFormat) {
+                                                       if (glFormat !== null) {
+                                                               state.compressedTexImage2D(_gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, j, glInternalFormat, mipmap.width, mipmap.height, 0, mipmap.data);
+                                                       } else {
+                                                               console.warn('THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()');
+                                                       }
+                                               } else {
+                                                       state.texImage2D(_gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, j, glInternalFormat, mipmap.width, mipmap.height, 0, glFormat, glType, mipmap.data);
+                                               }
+                                       }
+                               }
+
+                               textureProperties.__maxMipLevel = mipmaps.length - 1;
+                       } else {
+                               mipmaps = texture.mipmaps;
+
+                               for (let i = 0; i < 6; i++) {
+                                       if (isDataTexture) {
+                                               state.texImage2D(_gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, 0, glInternalFormat, cubeImage[i].width, cubeImage[i].height, 0, glFormat, glType, cubeImage[i].data);
+
+                                               for (let j = 0; j < mipmaps.length; j++) {
+                                                       const mipmap = mipmaps[j];
+                                                       const mipmapImage = mipmap.image[i].image;
+                                                       state.texImage2D(_gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, j + 1, glInternalFormat, mipmapImage.width, mipmapImage.height, 0, glFormat, glType, mipmapImage.data);
+                                               }
+                                       } else {
+                                               state.texImage2D(_gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, 0, glInternalFormat, glFormat, glType, cubeImage[i]);
+
+                                               for (let j = 0; j < mipmaps.length; j++) {
+                                                       const mipmap = mipmaps[j];
+                                                       state.texImage2D(_gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, j + 1, glInternalFormat, glFormat, glType, mipmap.image[i]);
+                                               }
+                                       }
+                               }
+
+                               textureProperties.__maxMipLevel = mipmaps.length;
+                       }
+
+                       if (textureNeedsGenerateMipmaps(texture, supportsMips)) {
+                               // We assume images for cube map have the same size.
+                               generateMipmap(_gl.TEXTURE_CUBE_MAP, texture, image.width, image.height);
+                       }
+
+                       textureProperties.__version = texture.version;
+                       if (texture.onUpdate) texture.onUpdate(texture);
+               } // Render targets
+               // Setup storage for target texture and bind it to correct framebuffer
+
+
+               function setupFrameBufferTexture(framebuffer, renderTarget, texture, attachment, textureTarget) {
+                       const glFormat = utils.convert(texture.format);
+                       const glType = utils.convert(texture.type);
+                       const glInternalFormat = getInternalFormat(texture.internalFormat, glFormat, glType);
+
+                       if (textureTarget === _gl.TEXTURE_3D || textureTarget === _gl.TEXTURE_2D_ARRAY) {
+                               state.texImage3D(textureTarget, 0, glInternalFormat, renderTarget.width, renderTarget.height, renderTarget.depth, 0, glFormat, glType, null);
+                       } else {
+                               state.texImage2D(textureTarget, 0, glInternalFormat, renderTarget.width, renderTarget.height, 0, glFormat, glType, null);
+                       }
+
+                       state.bindFramebuffer(_gl.FRAMEBUFFER, framebuffer);
+
+                       _gl.framebufferTexture2D(_gl.FRAMEBUFFER, attachment, textureTarget, properties.get(texture).__webglTexture, 0);
+
+                       state.bindFramebuffer(_gl.FRAMEBUFFER, null);
+               } // Setup storage for internal depth/stencil buffers and bind to correct framebuffer
+
+
+               function setupRenderBufferStorage(renderbuffer, renderTarget, isMultisample) {
+                       _gl.bindRenderbuffer(_gl.RENDERBUFFER, renderbuffer);
+
+                       if (renderTarget.depthBuffer && !renderTarget.stencilBuffer) {
+                               let glInternalFormat = _gl.DEPTH_COMPONENT16;
+
+                               if (isMultisample) {
+                                       const depthTexture = renderTarget.depthTexture;
+
+                                       if (depthTexture && depthTexture.isDepthTexture) {
+                                               if (depthTexture.type === FloatType) {
+                                                       glInternalFormat = _gl.DEPTH_COMPONENT32F;
+                                               } else if (depthTexture.type === UnsignedIntType) {
+                                                       glInternalFormat = _gl.DEPTH_COMPONENT24;
+                                               }
+                                       }
+
+                                       const samples = getRenderTargetSamples(renderTarget);
+
+                                       _gl.renderbufferStorageMultisample(_gl.RENDERBUFFER, samples, glInternalFormat, renderTarget.width, renderTarget.height);
+                               } else {
+                                       _gl.renderbufferStorage(_gl.RENDERBUFFER, glInternalFormat, renderTarget.width, renderTarget.height);
+                               }
+
+                               _gl.framebufferRenderbuffer(_gl.FRAMEBUFFER, _gl.DEPTH_ATTACHMENT, _gl.RENDERBUFFER, renderbuffer);
+                       } else if (renderTarget.depthBuffer && renderTarget.stencilBuffer) {
+                               if (isMultisample) {
+                                       const samples = getRenderTargetSamples(renderTarget);
+
+                                       _gl.renderbufferStorageMultisample(_gl.RENDERBUFFER, samples, _gl.DEPTH24_STENCIL8, renderTarget.width, renderTarget.height);
+                               } else {
+                                       _gl.renderbufferStorage(_gl.RENDERBUFFER, _gl.DEPTH_STENCIL, renderTarget.width, renderTarget.height);
+                               }
+
+                               _gl.framebufferRenderbuffer(_gl.FRAMEBUFFER, _gl.DEPTH_STENCIL_ATTACHMENT, _gl.RENDERBUFFER, renderbuffer);
+                       } else {
+                               // Use the first texture for MRT so far
+                               const texture = renderTarget.isWebGLMultipleRenderTargets === true ? renderTarget.texture[0] : renderTarget.texture;
+                               const glFormat = utils.convert(texture.format);
+                               const glType = utils.convert(texture.type);
+                               const glInternalFormat = getInternalFormat(texture.internalFormat, glFormat, glType);
+
+                               if (isMultisample) {
+                                       const samples = getRenderTargetSamples(renderTarget);
+
+                                       _gl.renderbufferStorageMultisample(_gl.RENDERBUFFER, samples, glInternalFormat, renderTarget.width, renderTarget.height);
+                               } else {
+                                       _gl.renderbufferStorage(_gl.RENDERBUFFER, glInternalFormat, renderTarget.width, renderTarget.height);
+                               }
+                       }
+
+                       _gl.bindRenderbuffer(_gl.RENDERBUFFER, null);
+               } // Setup resources for a Depth Texture for a FBO (needs an extension)
+
+
+               function setupDepthTexture(framebuffer, renderTarget) {
+                       const isCube = renderTarget && renderTarget.isWebGLCubeRenderTarget;
+                       if (isCube) throw new Error('Depth Texture with cube render targets is not supported');
+                       state.bindFramebuffer(_gl.FRAMEBUFFER, framebuffer);
+
+                       if (!(renderTarget.depthTexture && renderTarget.depthTexture.isDepthTexture)) {
+                               throw new Error('renderTarget.depthTexture must be an instance of THREE.DepthTexture');
+                       } // upload an empty depth texture with framebuffer size
+
+
+                       if (!properties.get(renderTarget.depthTexture).__webglTexture || renderTarget.depthTexture.image.width !== renderTarget.width || renderTarget.depthTexture.image.height !== renderTarget.height) {
+                               renderTarget.depthTexture.image.width = renderTarget.width;
+                               renderTarget.depthTexture.image.height = renderTarget.height;
+                               renderTarget.depthTexture.needsUpdate = true;
+                       }
+
+                       setTexture2D(renderTarget.depthTexture, 0);
+
+                       const webglDepthTexture = properties.get(renderTarget.depthTexture).__webglTexture;
+
+                       if (renderTarget.depthTexture.format === DepthFormat) {
+                               _gl.framebufferTexture2D(_gl.FRAMEBUFFER, _gl.DEPTH_ATTACHMENT, _gl.TEXTURE_2D, webglDepthTexture, 0);
+                       } else if (renderTarget.depthTexture.format === DepthStencilFormat) {
+                               _gl.framebufferTexture2D(_gl.FRAMEBUFFER, _gl.DEPTH_STENCIL_ATTACHMENT, _gl.TEXTURE_2D, webglDepthTexture, 0);
+                       } else {
+                               throw new Error('Unknown depthTexture format');
+                       }
+               } // Setup GL resources for a non-texture depth buffer
+
+
+               function setupDepthRenderbuffer(renderTarget) {
+                       const renderTargetProperties = properties.get(renderTarget);
+                       const isCube = renderTarget.isWebGLCubeRenderTarget === true;
+
+                       if (renderTarget.depthTexture) {
+                               if (isCube) throw new Error('target.depthTexture not supported in Cube render targets');
+                               setupDepthTexture(renderTargetProperties.__webglFramebuffer, renderTarget);
+                       } else {
+                               if (isCube) {
+                                       renderTargetProperties.__webglDepthbuffer = [];
+
+                                       for (let i = 0; i < 6; i++) {
+                                               state.bindFramebuffer(_gl.FRAMEBUFFER, renderTargetProperties.__webglFramebuffer[i]);
+                                               renderTargetProperties.__webglDepthbuffer[i] = _gl.createRenderbuffer();
+                                               setupRenderBufferStorage(renderTargetProperties.__webglDepthbuffer[i], renderTarget, false);
+                                       }
+                               } else {
+                                       state.bindFramebuffer(_gl.FRAMEBUFFER, renderTargetProperties.__webglFramebuffer);
+                                       renderTargetProperties.__webglDepthbuffer = _gl.createRenderbuffer();
+                                       setupRenderBufferStorage(renderTargetProperties.__webglDepthbuffer, renderTarget, false);
+                               }
+                       }
+
+                       state.bindFramebuffer(_gl.FRAMEBUFFER, null);
+               } // Set up GL resources for the render target
+
+
+               function setupRenderTarget(renderTarget) {
+                       const texture = renderTarget.texture;
+                       const renderTargetProperties = properties.get(renderTarget);
+                       const textureProperties = properties.get(texture);
+                       renderTarget.addEventListener('dispose', onRenderTargetDispose);
+
+                       if (renderTarget.isWebGLMultipleRenderTargets !== true) {
+                               textureProperties.__webglTexture = _gl.createTexture();
+                               textureProperties.__version = texture.version;
+                               info.memory.textures++;
+                       }
+
+                       const isCube = renderTarget.isWebGLCubeRenderTarget === true;
+                       const isMultipleRenderTargets = renderTarget.isWebGLMultipleRenderTargets === true;
+                       const isMultisample = renderTarget.isWebGLMultisampleRenderTarget === true;
+                       const isRenderTarget3D = texture.isDataTexture3D || texture.isDataTexture2DArray;
+                       const supportsMips = isPowerOfTwo$1(renderTarget) || isWebGL2; // Handles WebGL2 RGBFormat fallback - #18858
+
+                       if (isWebGL2 && texture.format === RGBFormat && (texture.type === FloatType || texture.type === HalfFloatType)) {
+                               texture.format = RGBAFormat;
+                               console.warn('THREE.WebGLRenderer: Rendering to textures with RGB format is not supported. Using RGBA format instead.');
+                       } // Setup framebuffer
+
+
+                       if (isCube) {
+                               renderTargetProperties.__webglFramebuffer = [];
+
+                               for (let i = 0; i < 6; i++) {
+                                       renderTargetProperties.__webglFramebuffer[i] = _gl.createFramebuffer();
+                               }
+                       } else {
+                               renderTargetProperties.__webglFramebuffer = _gl.createFramebuffer();
+
+                               if (isMultipleRenderTargets) {
+                                       if (capabilities.drawBuffers) {
+                                               const textures = renderTarget.texture;
+
+                                               for (let i = 0, il = textures.length; i < il; i++) {
+                                                       const attachmentProperties = properties.get(textures[i]);
+
+                                                       if (attachmentProperties.__webglTexture === undefined) {
+                                                               attachmentProperties.__webglTexture = _gl.createTexture();
+                                                               info.memory.textures++;
+                                                       }
+                                               }
+                                       } else {
+                                               console.warn('THREE.WebGLRenderer: WebGLMultipleRenderTargets can only be used with WebGL2 or WEBGL_draw_buffers extension.');
+                                       }
+                               } else if (isMultisample) {
+                                       if (isWebGL2) {
+                                               renderTargetProperties.__webglMultisampledFramebuffer = _gl.createFramebuffer();
+                                               renderTargetProperties.__webglColorRenderbuffer = _gl.createRenderbuffer();
+
+                                               _gl.bindRenderbuffer(_gl.RENDERBUFFER, renderTargetProperties.__webglColorRenderbuffer);
+
+                                               const glFormat = utils.convert(texture.format);
+                                               const glType = utils.convert(texture.type);
+                                               const glInternalFormat = getInternalFormat(texture.internalFormat, glFormat, glType);
+                                               const samples = getRenderTargetSamples(renderTarget);
+
+                                               _gl.renderbufferStorageMultisample(_gl.RENDERBUFFER, samples, glInternalFormat, renderTarget.width, renderTarget.height);
+
+                                               state.bindFramebuffer(_gl.FRAMEBUFFER, renderTargetProperties.__webglMultisampledFramebuffer);
+
+                                               _gl.framebufferRenderbuffer(_gl.FRAMEBUFFER, _gl.COLOR_ATTACHMENT0, _gl.RENDERBUFFER, renderTargetProperties.__webglColorRenderbuffer);
+
+                                               _gl.bindRenderbuffer(_gl.RENDERBUFFER, null);
+
+                                               if (renderTarget.depthBuffer) {
+                                                       renderTargetProperties.__webglDepthRenderbuffer = _gl.createRenderbuffer();
+                                                       setupRenderBufferStorage(renderTargetProperties.__webglDepthRenderbuffer, renderTarget, true);
+                                               }
+
+                                               state.bindFramebuffer(_gl.FRAMEBUFFER, null);
+                                       } else {
+                                               console.warn('THREE.WebGLRenderer: WebGLMultisampleRenderTarget can only be used with WebGL2.');
+                                       }
+                               }
+                       } // Setup color buffer
+
+
+                       if (isCube) {
+                               state.bindTexture(_gl.TEXTURE_CUBE_MAP, textureProperties.__webglTexture);
+                               setTextureParameters(_gl.TEXTURE_CUBE_MAP, texture, supportsMips);
+
+                               for (let i = 0; i < 6; i++) {
+                                       setupFrameBufferTexture(renderTargetProperties.__webglFramebuffer[i], renderTarget, texture, _gl.COLOR_ATTACHMENT0, _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i);
+                               }
+
+                               if (textureNeedsGenerateMipmaps(texture, supportsMips)) {
+                                       generateMipmap(_gl.TEXTURE_CUBE_MAP, texture, renderTarget.width, renderTarget.height);
+                               }
+
+                               state.unbindTexture();
+                       } else if (isMultipleRenderTargets) {
+                               const textures = renderTarget.texture;
+
+                               for (let i = 0, il = textures.length; i < il; i++) {
+                                       const attachment = textures[i];
+                                       const attachmentProperties = properties.get(attachment);
+                                       state.bindTexture(_gl.TEXTURE_2D, attachmentProperties.__webglTexture);
+                                       setTextureParameters(_gl.TEXTURE_2D, attachment, supportsMips);
+                                       setupFrameBufferTexture(renderTargetProperties.__webglFramebuffer, renderTarget, attachment, _gl.COLOR_ATTACHMENT0 + i, _gl.TEXTURE_2D);
+
+                                       if (textureNeedsGenerateMipmaps(attachment, supportsMips)) {
+                                               generateMipmap(_gl.TEXTURE_2D, attachment, renderTarget.width, renderTarget.height);
+                                       }
+                               }
+
+                               state.unbindTexture();
+                       } else {
+                               let glTextureType = _gl.TEXTURE_2D;
+
+                               if (isRenderTarget3D) {
+                                       // Render targets containing layers, i.e: Texture 3D and 2d arrays
+                                       if (isWebGL2) {
+                                               const isTexture3D = texture.isDataTexture3D;
+                                               glTextureType = isTexture3D ? _gl.TEXTURE_3D : _gl.TEXTURE_2D_ARRAY;
+                                       } else {
+                                               console.warn('THREE.DataTexture3D and THREE.DataTexture2DArray only supported with WebGL2.');
+                                       }
+                               }
+
+                               state.bindTexture(glTextureType, textureProperties.__webglTexture);
+                               setTextureParameters(glTextureType, texture, supportsMips);
+                               setupFrameBufferTexture(renderTargetProperties.__webglFramebuffer, renderTarget, texture, _gl.COLOR_ATTACHMENT0, glTextureType);
+
+                               if (textureNeedsGenerateMipmaps(texture, supportsMips)) {
+                                       generateMipmap(glTextureType, texture, renderTarget.width, renderTarget.height, renderTarget.depth);
+                               }
+
+                               state.unbindTexture();
+                       } // Setup depth and stencil buffers
+
+
+                       if (renderTarget.depthBuffer) {
+                               setupDepthRenderbuffer(renderTarget);
+                       }
+               }
+
+               function updateRenderTargetMipmap(renderTarget) {
+                       const supportsMips = isPowerOfTwo$1(renderTarget) || isWebGL2;
+                       const textures = renderTarget.isWebGLMultipleRenderTargets === true ? renderTarget.texture : [renderTarget.texture];
+
+                       for (let i = 0, il = textures.length; i < il; i++) {
+                               const texture = textures[i];
+
+                               if (textureNeedsGenerateMipmaps(texture, supportsMips)) {
+                                       const target = renderTarget.isWebGLCubeRenderTarget ? _gl.TEXTURE_CUBE_MAP : _gl.TEXTURE_2D;
+
+                                       const webglTexture = properties.get(texture).__webglTexture;
+
+                                       state.bindTexture(target, webglTexture);
+                                       generateMipmap(target, texture, renderTarget.width, renderTarget.height);
+                                       state.unbindTexture();
+                               }
+                       }
+               }
+
+               function updateMultisampleRenderTarget(renderTarget) {
+                       if (renderTarget.isWebGLMultisampleRenderTarget) {
+                               if (isWebGL2) {
+                                       const width = renderTarget.width;
+                                       const height = renderTarget.height;
+                                       let mask = _gl.COLOR_BUFFER_BIT;
+                                       if (renderTarget.depthBuffer) mask |= _gl.DEPTH_BUFFER_BIT;
+                                       if (renderTarget.stencilBuffer) mask |= _gl.STENCIL_BUFFER_BIT;
+                                       const renderTargetProperties = properties.get(renderTarget);
+                                       state.bindFramebuffer(_gl.READ_FRAMEBUFFER, renderTargetProperties.__webglMultisampledFramebuffer);
+                                       state.bindFramebuffer(_gl.DRAW_FRAMEBUFFER, renderTargetProperties.__webglFramebuffer);
+
+                                       _gl.blitFramebuffer(0, 0, width, height, 0, 0, width, height, mask, _gl.NEAREST);
+
+                                       state.bindFramebuffer(_gl.READ_FRAMEBUFFER, null);
+                                       state.bindFramebuffer(_gl.DRAW_FRAMEBUFFER, renderTargetProperties.__webglMultisampledFramebuffer);
+                               } else {
+                                       console.warn('THREE.WebGLRenderer: WebGLMultisampleRenderTarget can only be used with WebGL2.');
+                               }
+                       }
+               }
+
+               function getRenderTargetSamples(renderTarget) {
+                       return isWebGL2 && renderTarget.isWebGLMultisampleRenderTarget ? Math.min(maxSamples, renderTarget.samples) : 0;
+               }
+
+               function updateVideoTexture(texture) {
+                       const frame = info.render.frame; // Check the last frame we updated the VideoTexture
+
+                       if (_videoTextures.get(texture) !== frame) {
+                               _videoTextures.set(texture, frame);
+
+                               texture.update();
+                       }
+               } // backwards compatibility
+
+
+               let warnedTexture2D = false;
+               let warnedTextureCube = false;
+
+               function safeSetTexture2D(texture, slot) {
+                       if (texture && texture.isWebGLRenderTarget) {
+                               if (warnedTexture2D === false) {
+                                       console.warn('THREE.WebGLTextures.safeSetTexture2D: don\'t use render targets as textures. Use their .texture property instead.');
+                                       warnedTexture2D = true;
+                               }
+
+                               texture = texture.texture;
+                       }
+
+                       setTexture2D(texture, slot);
+               }
+
+               function safeSetTextureCube(texture, slot) {
+                       if (texture && texture.isWebGLCubeRenderTarget) {
+                               if (warnedTextureCube === false) {
+                                       console.warn('THREE.WebGLTextures.safeSetTextureCube: don\'t use cube render targets as textures. Use their .texture property instead.');
+                                       warnedTextureCube = true;
+                               }
+
+                               texture = texture.texture;
+                       }
+
+                       setTextureCube(texture, slot);
+               } //
+
+
+               this.allocateTextureUnit = allocateTextureUnit;
+               this.resetTextureUnits = resetTextureUnits;
+               this.setTexture2D = setTexture2D;
+               this.setTexture2DArray = setTexture2DArray;
+               this.setTexture3D = setTexture3D;
+               this.setTextureCube = setTextureCube;
+               this.setupRenderTarget = setupRenderTarget;
+               this.updateRenderTargetMipmap = updateRenderTargetMipmap;
+               this.updateMultisampleRenderTarget = updateMultisampleRenderTarget;
+               this.safeSetTexture2D = safeSetTexture2D;
+               this.safeSetTextureCube = safeSetTextureCube;
+       }
+
+       function WebGLUtils(gl, extensions, capabilities) {
+               const isWebGL2 = capabilities.isWebGL2;
+
+               function convert(p) {
+                       let extension;
+                       if (p === UnsignedByteType) return gl.UNSIGNED_BYTE;
+                       if (p === UnsignedShort4444Type) return gl.UNSIGNED_SHORT_4_4_4_4;
+                       if (p === UnsignedShort5551Type) return gl.UNSIGNED_SHORT_5_5_5_1;
+                       if (p === UnsignedShort565Type) return gl.UNSIGNED_SHORT_5_6_5;
+                       if (p === ByteType) return gl.BYTE;
+                       if (p === ShortType) return gl.SHORT;
+                       if (p === UnsignedShortType) return gl.UNSIGNED_SHORT;
+                       if (p === IntType) return gl.INT;
+                       if (p === UnsignedIntType) return gl.UNSIGNED_INT;
+                       if (p === FloatType) return gl.FLOAT;
+
+                       if (p === HalfFloatType) {
+                               if (isWebGL2) return gl.HALF_FLOAT;
+                               extension = extensions.get('OES_texture_half_float');
+
+                               if (extension !== null) {
+                                       return extension.HALF_FLOAT_OES;
+                               } else {
+                                       return null;
+                               }
+                       }
+
+                       if (p === AlphaFormat) return gl.ALPHA;
+                       if (p === RGBFormat) return gl.RGB;
+                       if (p === RGBAFormat) return gl.RGBA;
+                       if (p === LuminanceFormat) return gl.LUMINANCE;
+                       if (p === LuminanceAlphaFormat) return gl.LUMINANCE_ALPHA;
+                       if (p === DepthFormat) return gl.DEPTH_COMPONENT;
+                       if (p === DepthStencilFormat) return gl.DEPTH_STENCIL;
+                       if (p === RedFormat) return gl.RED; // WebGL2 formats.
+
+                       if (p === RedIntegerFormat) return gl.RED_INTEGER;
+                       if (p === RGFormat) return gl.RG;
+                       if (p === RGIntegerFormat) return gl.RG_INTEGER;
+                       if (p === RGBIntegerFormat) return gl.RGB_INTEGER;
+                       if (p === RGBAIntegerFormat) return gl.RGBA_INTEGER;
+
+                       if (p === RGB_S3TC_DXT1_Format || p === RGBA_S3TC_DXT1_Format || p === RGBA_S3TC_DXT3_Format || p === RGBA_S3TC_DXT5_Format) {
+                               extension = extensions.get('WEBGL_compressed_texture_s3tc');
+
+                               if (extension !== null) {
+                                       if (p === RGB_S3TC_DXT1_Format) return extension.COMPRESSED_RGB_S3TC_DXT1_EXT;
+                                       if (p === RGBA_S3TC_DXT1_Format) return extension.COMPRESSED_RGBA_S3TC_DXT1_EXT;
+                                       if (p === RGBA_S3TC_DXT3_Format) return extension.COMPRESSED_RGBA_S3TC_DXT3_EXT;
+                                       if (p === RGBA_S3TC_DXT5_Format) return extension.COMPRESSED_RGBA_S3TC_DXT5_EXT;
+                               } else {
+                                       return null;
+                               }
+                       }
+
+                       if (p === RGB_PVRTC_4BPPV1_Format || p === RGB_PVRTC_2BPPV1_Format || p === RGBA_PVRTC_4BPPV1_Format || p === RGBA_PVRTC_2BPPV1_Format) {
+                               extension = extensions.get('WEBGL_compressed_texture_pvrtc');
+
+                               if (extension !== null) {
+                                       if (p === RGB_PVRTC_4BPPV1_Format) return extension.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;
+                                       if (p === RGB_PVRTC_2BPPV1_Format) return extension.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;
+                                       if (p === RGBA_PVRTC_4BPPV1_Format) return extension.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;
+                                       if (p === RGBA_PVRTC_2BPPV1_Format) return extension.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG;
+                               } else {
+                                       return null;
+                               }
+                       }
+
+                       if (p === RGB_ETC1_Format) {
+                               extension = extensions.get('WEBGL_compressed_texture_etc1');
+
+                               if (extension !== null) {
+                                       return extension.COMPRESSED_RGB_ETC1_WEBGL;
+                               } else {
+                                       return null;
+                               }
+                       }
+
+                       if (p === RGB_ETC2_Format || p === RGBA_ETC2_EAC_Format) {
+                               extension = extensions.get('WEBGL_compressed_texture_etc');
+
+                               if (extension !== null) {
+                                       if (p === RGB_ETC2_Format) return extension.COMPRESSED_RGB8_ETC2;
+                                       if (p === RGBA_ETC2_EAC_Format) return extension.COMPRESSED_RGBA8_ETC2_EAC;
+                               }
+                       }
+
+                       if (p === RGBA_ASTC_4x4_Format || p === RGBA_ASTC_5x4_Format || p === RGBA_ASTC_5x5_Format || p === RGBA_ASTC_6x5_Format || p === RGBA_ASTC_6x6_Format || p === RGBA_ASTC_8x5_Format || p === RGBA_ASTC_8x6_Format || p === RGBA_ASTC_8x8_Format || p === RGBA_ASTC_10x5_Format || p === RGBA_ASTC_10x6_Format || p === RGBA_ASTC_10x8_Format || p === RGBA_ASTC_10x10_Format || p === RGBA_ASTC_12x10_Format || p === RGBA_ASTC_12x12_Format || p === SRGB8_ALPHA8_ASTC_4x4_Format || p === SRGB8_ALPHA8_ASTC_5x4_Format || p === SRGB8_ALPHA8_ASTC_5x5_Format || p === SRGB8_ALPHA8_ASTC_6x5_Format || p === SRGB8_ALPHA8_ASTC_6x6_Format || p === SRGB8_ALPHA8_ASTC_8x5_Format || p === SRGB8_ALPHA8_ASTC_8x6_Format || p === SRGB8_ALPHA8_ASTC_8x8_Format || p === SRGB8_ALPHA8_ASTC_10x5_Format || p === SRGB8_ALPHA8_ASTC_10x6_Format || p === SRGB8_ALPHA8_ASTC_10x8_Format || p === SRGB8_ALPHA8_ASTC_10x10_Format || p === SRGB8_ALPHA8_ASTC_12x10_Format || p === SRGB8_ALPHA8_ASTC_12x12_Format) {
+                               extension = extensions.get('WEBGL_compressed_texture_astc');
+
+                               if (extension !== null) {
+                                       // TODO Complete?
+                                       return p;
+                               } else {
+                                       return null;
+                               }
+                       }
+
+                       if (p === RGBA_BPTC_Format) {
+                               extension = extensions.get('EXT_texture_compression_bptc');
+
+                               if (extension !== null) {
+                                       // TODO Complete?
+                                       return p;
+                               } else {
+                                       return null;
+                               }
+                       }
+
+                       if (p === UnsignedInt248Type) {
+                               if (isWebGL2) return gl.UNSIGNED_INT_24_8;
+                               extension = extensions.get('WEBGL_depth_texture');
+
+                               if (extension !== null) {
+                                       return extension.UNSIGNED_INT_24_8_WEBGL;
+                               } else {
+                                       return null;
+                               }
+                       }
+               }
+
+               return {
+                       convert: convert
+               };
+       }
+
+       class ArrayCamera extends PerspectiveCamera {
+               constructor(array = []) {
+                       super();
+                       this.cameras = array;
+               }
+
+       }
+
+       ArrayCamera.prototype.isArrayCamera = true;
+
+       class Group extends Object3D {
+               constructor() {
+                       super();
+                       this.type = 'Group';
+               }
+
+       }
+
+       Group.prototype.isGroup = true;
+
+       const _moveEvent = {
+               type: 'move'
+       };
+
+       class WebXRController {
+               constructor() {
+                       this._targetRay = null;
+                       this._grip = null;
+                       this._hand = null;
+               }
+
+               getHandSpace() {
+                       if (this._hand === null) {
+                               this._hand = new Group();
+                               this._hand.matrixAutoUpdate = false;
+                               this._hand.visible = false;
+                               this._hand.joints = {};
+                               this._hand.inputState = {
+                                       pinching: false
+                               };
+                       }
+
+                       return this._hand;
+               }
+
+               getTargetRaySpace() {
+                       if (this._targetRay === null) {
+                               this._targetRay = new Group();
+                               this._targetRay.matrixAutoUpdate = false;
+                               this._targetRay.visible = false;
+                               this._targetRay.hasLinearVelocity = false;
+                               this._targetRay.linearVelocity = new Vector3();
+                               this._targetRay.hasAngularVelocity = false;
+                               this._targetRay.angularVelocity = new Vector3();
+                       }
+
+                       return this._targetRay;
+               }
+
+               getGripSpace() {
+                       if (this._grip === null) {
+                               this._grip = new Group();
+                               this._grip.matrixAutoUpdate = false;
+                               this._grip.visible = false;
+                               this._grip.hasLinearVelocity = false;
+                               this._grip.linearVelocity = new Vector3();
+                               this._grip.hasAngularVelocity = false;
+                               this._grip.angularVelocity = new Vector3();
+                       }
+
+                       return this._grip;
+               }
+
+               dispatchEvent(event) {
+                       if (this._targetRay !== null) {
+                               this._targetRay.dispatchEvent(event);
+                       }
+
+                       if (this._grip !== null) {
+                               this._grip.dispatchEvent(event);
+                       }
+
+                       if (this._hand !== null) {
+                               this._hand.dispatchEvent(event);
+                       }
+
+                       return this;
+               }
+
+               disconnect(inputSource) {
+                       this.dispatchEvent({
+                               type: 'disconnected',
+                               data: inputSource
+                       });
+
+                       if (this._targetRay !== null) {
+                               this._targetRay.visible = false;
+                       }
+
+                       if (this._grip !== null) {
+                               this._grip.visible = false;
+                       }
+
+                       if (this._hand !== null) {
+                               this._hand.visible = false;
+                       }
+
+                       return this;
+               }
+
+               update(inputSource, frame, referenceSpace) {
+                       let inputPose = null;
+                       let gripPose = null;
+                       let handPose = null;
+                       const targetRay = this._targetRay;
+                       const grip = this._grip;
+                       const hand = this._hand;
+
+                       if (inputSource && frame.session.visibilityState !== 'visible-blurred') {
+                               if (targetRay !== null) {
+                                       inputPose = frame.getPose(inputSource.targetRaySpace, referenceSpace);
+
+                                       if (inputPose !== null) {
+                                               targetRay.matrix.fromArray(inputPose.transform.matrix);
+                                               targetRay.matrix.decompose(targetRay.position, targetRay.rotation, targetRay.scale);
+
+                                               if (inputPose.linearVelocity) {
+                                                       targetRay.hasLinearVelocity = true;
+                                                       targetRay.linearVelocity.copy(inputPose.linearVelocity);
+                                               } else {
+                                                       targetRay.hasLinearVelocity = false;
+                                               }
+
+                                               if (inputPose.angularVelocity) {
+                                                       targetRay.hasAngularVelocity = true;
+                                                       targetRay.angularVelocity.copy(inputPose.angularVelocity);
+                                               } else {
+                                                       targetRay.hasAngularVelocity = false;
+                                               }
+
+                                               this.dispatchEvent(_moveEvent);
+                                       }
+                               }
+
+                               if (hand && inputSource.hand) {
+                                       handPose = true;
+
+                                       for (const inputjoint of inputSource.hand.values()) {
+                                               // Update the joints groups with the XRJoint poses
+                                               const jointPose = frame.getJointPose(inputjoint, referenceSpace);
+
+                                               if (hand.joints[inputjoint.jointName] === undefined) {
+                                                       // The transform of this joint will be updated with the joint pose on each frame
+                                                       const joint = new Group();
+                                                       joint.matrixAutoUpdate = false;
+                                                       joint.visible = false;
+                                                       hand.joints[inputjoint.jointName] = joint; // ??
+
+                                                       hand.add(joint);
+                                               }
+
+                                               const joint = hand.joints[inputjoint.jointName];
+
+                                               if (jointPose !== null) {
+                                                       joint.matrix.fromArray(jointPose.transform.matrix);
+                                                       joint.matrix.decompose(joint.position, joint.rotation, joint.scale);
+                                                       joint.jointRadius = jointPose.radius;
+                                               }
+
+                                               joint.visible = jointPose !== null;
+                                       } // Custom events
+                                       // Check pinchz
+
+
+                                       const indexTip = hand.joints['index-finger-tip'];
+                                       const thumbTip = hand.joints['thumb-tip'];
+                                       const distance = indexTip.position.distanceTo(thumbTip.position);
+                                       const distanceToPinch = 0.02;
+                                       const threshold = 0.005;
+
+                                       if (hand.inputState.pinching && distance > distanceToPinch + threshold) {
+                                               hand.inputState.pinching = false;
+                                               this.dispatchEvent({
+                                                       type: 'pinchend',
+                                                       handedness: inputSource.handedness,
+                                                       target: this
+                                               });
+                                       } else if (!hand.inputState.pinching && distance <= distanceToPinch - threshold) {
+                                               hand.inputState.pinching = true;
+                                               this.dispatchEvent({
+                                                       type: 'pinchstart',
+                                                       handedness: inputSource.handedness,
+                                                       target: this
+                                               });
+                                       }
+                               } else {
+                                       if (grip !== null && inputSource.gripSpace) {
+                                               gripPose = frame.getPose(inputSource.gripSpace, referenceSpace);
+
+                                               if (gripPose !== null) {
+                                                       grip.matrix.fromArray(gripPose.transform.matrix);
+                                                       grip.matrix.decompose(grip.position, grip.rotation, grip.scale);
+
+                                                       if (gripPose.linearVelocity) {
+                                                               grip.hasLinearVelocity = true;
+                                                               grip.linearVelocity.copy(gripPose.linearVelocity);
+                                                       } else {
+                                                               grip.hasLinearVelocity = false;
+                                                       }
+
+                                                       if (gripPose.angularVelocity) {
+                                                               grip.hasAngularVelocity = true;
+                                                               grip.angularVelocity.copy(gripPose.angularVelocity);
+                                                       } else {
+                                                               grip.hasAngularVelocity = false;
+                                                       }
+                                               }
+                                       }
+                               }
+                       }
+
+                       if (targetRay !== null) {
+                               targetRay.visible = inputPose !== null;
+                       }
+
+                       if (grip !== null) {
+                               grip.visible = gripPose !== null;
+                       }
+
+                       if (hand !== null) {
+                               hand.visible = handPose !== null;
+                       }
+
+                       return this;
+               }
+
+       }
+
+       class WebXRManager extends EventDispatcher {
+               constructor(renderer, gl) {
+                       super();
+                       const scope = this;
+                       const state = renderer.state;
+                       let session = null;
+                       let framebufferScaleFactor = 1.0;
+                       let referenceSpace = null;
+                       let referenceSpaceType = 'local-floor';
+                       let pose = null;
+                       let glBinding = null;
+                       let glFramebuffer = null;
+                       let glProjLayer = null;
+                       let glBaseLayer = null;
+                       let isMultisample = false;
+                       let glMultisampledFramebuffer = null;
+                       let glColorRenderbuffer = null;
+                       let glDepthRenderbuffer = null;
+                       let xrFrame = null;
+                       let depthStyle = null;
+                       let clearStyle = null;
+                       const controllers = [];
+                       const inputSourcesMap = new Map(); //
+
+                       const cameraL = new PerspectiveCamera();
+                       cameraL.layers.enable(1);
+                       cameraL.viewport = new Vector4();
+                       const cameraR = new PerspectiveCamera();
+                       cameraR.layers.enable(2);
+                       cameraR.viewport = new Vector4();
+                       const cameras = [cameraL, cameraR];
+                       const cameraVR = new ArrayCamera();
+                       cameraVR.layers.enable(1);
+                       cameraVR.layers.enable(2);
+                       let _currentDepthNear = null;
+                       let _currentDepthFar = null; //
+
+                       this.cameraAutoUpdate = true;
+                       this.enabled = false;
+                       this.isPresenting = false;
+
+                       this.getController = function (index) {
+                               let controller = controllers[index];
+
+                               if (controller === undefined) {
+                                       controller = new WebXRController();
+                                       controllers[index] = controller;
+                               }
+
+                               return controller.getTargetRaySpace();
+                       };
+
+                       this.getControllerGrip = function (index) {
+                               let controller = controllers[index];
+
+                               if (controller === undefined) {
+                                       controller = new WebXRController();
+                                       controllers[index] = controller;
+                               }
+
+                               return controller.getGripSpace();
+                       };
+
+                       this.getHand = function (index) {
+                               let controller = controllers[index];
+
+                               if (controller === undefined) {
+                                       controller = new WebXRController();
+                                       controllers[index] = controller;
+                               }
+
+                               return controller.getHandSpace();
+                       }; //
+
+
+                       function onSessionEvent(event) {
+                               const controller = inputSourcesMap.get(event.inputSource);
+
+                               if (controller) {
+                                       controller.dispatchEvent({
+                                               type: event.type,
+                                               data: event.inputSource
+                                       });
+                               }
+                       }
+
+                       function onSessionEnd() {
+                               inputSourcesMap.forEach(function (controller, inputSource) {
+                                       controller.disconnect(inputSource);
+                               });
+                               inputSourcesMap.clear();
+                               _currentDepthNear = null;
+                               _currentDepthFar = null; // restore framebuffer/rendering state
+
+                               state.bindXRFramebuffer(null);
+                               renderer.setRenderTarget(renderer.getRenderTarget());
+                               if (glFramebuffer) gl.deleteFramebuffer(glFramebuffer);
+                               if (glMultisampledFramebuffer) gl.deleteFramebuffer(glMultisampledFramebuffer);
+                               if (glColorRenderbuffer) gl.deleteRenderbuffer(glColorRenderbuffer);
+                               if (glDepthRenderbuffer) gl.deleteRenderbuffer(glDepthRenderbuffer);
+                               glFramebuffer = null;
+                               glMultisampledFramebuffer = null;
+                               glColorRenderbuffer = null;
+                               glDepthRenderbuffer = null;
+                               glBaseLayer = null;
+                               glProjLayer = null;
+                               glBinding = null;
+                               session = null; //
+
+                               animation.stop();
+                               scope.isPresenting = false;
+                               scope.dispatchEvent({
+                                       type: 'sessionend'
+                               });
+                       }
+
+                       this.setFramebufferScaleFactor = function (value) {
+                               framebufferScaleFactor = value;
+
+                               if (scope.isPresenting === true) {
+                                       console.warn('THREE.WebXRManager: Cannot change framebuffer scale while presenting.');
+                               }
+                       };
+
+                       this.setReferenceSpaceType = function (value) {
+                               referenceSpaceType = value;
+
+                               if (scope.isPresenting === true) {
+                                       console.warn('THREE.WebXRManager: Cannot change reference space type while presenting.');
+                               }
+                       };
+
+                       this.getReferenceSpace = function () {
+                               return referenceSpace;
+                       };
+
+                       this.getBaseLayer = function () {
+                               return glProjLayer !== null ? glProjLayer : glBaseLayer;
+                       };
+
+                       this.getBinding = function () {
+                               return glBinding;
+                       };
+
+                       this.getFrame = function () {
+                               return xrFrame;
+                       };
+
+                       this.getSession = function () {
+                               return session;
+                       };
+
+                       this.setSession = async function (value) {
+                               session = value;
+
+                               if (session !== null) {
+                                       session.addEventListener('select', onSessionEvent);
+                                       session.addEventListener('selectstart', onSessionEvent);
+                                       session.addEventListener('selectend', onSessionEvent);
+                                       session.addEventListener('squeeze', onSessionEvent);
+                                       session.addEventListener('squeezestart', onSessionEvent);
+                                       session.addEventListener('squeezeend', onSessionEvent);
+                                       session.addEventListener('end', onSessionEnd);
+                                       session.addEventListener('inputsourceschange', onInputSourcesChange);
+                                       const attributes = gl.getContextAttributes();
+
+                                       if (attributes.xrCompatible !== true) {
+                                               await gl.makeXRCompatible();
+                                       }
+
+                                       if (session.renderState.layers === undefined) {
+                                               const layerInit = {
+                                                       antialias: attributes.antialias,
+                                                       alpha: attributes.alpha,
+                                                       depth: attributes.depth,
+                                                       stencil: attributes.stencil,
+                                                       framebufferScaleFactor: framebufferScaleFactor
+                                               };
+                                               glBaseLayer = new XRWebGLLayer(session, gl, layerInit);
+                                               session.updateRenderState({
+                                                       baseLayer: glBaseLayer
+                                               });
+                                       } else if (gl instanceof WebGLRenderingContext) {
+                                               // Use old style webgl layer because we can't use MSAA
+                                               // WebGL2 support.
+                                               const layerInit = {
+                                                       antialias: true,
+                                                       alpha: attributes.alpha,
+                                                       depth: attributes.depth,
+                                                       stencil: attributes.stencil,
+                                                       framebufferScaleFactor: framebufferScaleFactor
+                                               };
+                                               glBaseLayer = new XRWebGLLayer(session, gl, layerInit);
+                                               session.updateRenderState({
+                                                       layers: [glBaseLayer]
+                                               });
+                                       } else {
+                                               isMultisample = attributes.antialias;
+                                               let depthFormat = null;
+
+                                               if (attributes.depth) {
+                                                       clearStyle = gl.DEPTH_BUFFER_BIT;
+                                                       if (attributes.stencil) clearStyle |= gl.STENCIL_BUFFER_BIT;
+                                                       depthStyle = attributes.stencil ? gl.DEPTH_STENCIL_ATTACHMENT : gl.DEPTH_ATTACHMENT;
+                                                       depthFormat = attributes.stencil ? gl.DEPTH24_STENCIL8 : gl.DEPTH_COMPONENT24;
+                                               }
+
+                                               const projectionlayerInit = {
+                                                       colorFormat: attributes.alpha ? gl.RGBA8 : gl.RGB8,
+                                                       depthFormat: depthFormat,
+                                                       scaleFactor: framebufferScaleFactor
+                                               };
+                                               glBinding = new XRWebGLBinding(session, gl);
+                                               glProjLayer = glBinding.createProjectionLayer(projectionlayerInit);
+                                               glFramebuffer = gl.createFramebuffer();
+                                               session.updateRenderState({
+                                                       layers: [glProjLayer]
+                                               });
+
+                                               if (isMultisample) {
+                                                       glMultisampledFramebuffer = gl.createFramebuffer();
+                                                       glColorRenderbuffer = gl.createRenderbuffer();
+                                                       gl.bindRenderbuffer(gl.RENDERBUFFER, glColorRenderbuffer);
+                                                       gl.renderbufferStorageMultisample(gl.RENDERBUFFER, 4, gl.RGBA8, glProjLayer.textureWidth, glProjLayer.textureHeight);
+                                                       state.bindFramebuffer(gl.FRAMEBUFFER, glMultisampledFramebuffer);
+                                                       gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.RENDERBUFFER, glColorRenderbuffer);
+                                                       gl.bindRenderbuffer(gl.RENDERBUFFER, null);
+
+                                                       if (depthFormat !== null) {
+                                                               glDepthRenderbuffer = gl.createRenderbuffer();
+                                                               gl.bindRenderbuffer(gl.RENDERBUFFER, glDepthRenderbuffer);
+                                                               gl.renderbufferStorageMultisample(gl.RENDERBUFFER, 4, depthFormat, glProjLayer.textureWidth, glProjLayer.textureHeight);
+                                                               gl.framebufferRenderbuffer(gl.FRAMEBUFFER, depthStyle, gl.RENDERBUFFER, glDepthRenderbuffer);
+                                                               gl.bindRenderbuffer(gl.RENDERBUFFER, null);
+                                                       }
+
+                                                       state.bindFramebuffer(gl.FRAMEBUFFER, null);
+                                               }
+                                       }
+
+                                       referenceSpace = await session.requestReferenceSpace(referenceSpaceType);
+                                       animation.setContext(session);
+                                       animation.start();
+                                       scope.isPresenting = true;
+                                       scope.dispatchEvent({
+                                               type: 'sessionstart'
+                                       });
+                               }
+                       };
+
+                       function onInputSourcesChange(event) {
+                               const inputSources = session.inputSources; // Assign inputSources to available controllers
+
+                               for (let i = 0; i < controllers.length; i++) {
+                                       inputSourcesMap.set(inputSources[i], controllers[i]);
+                               } // Notify disconnected
+
+
+                               for (let i = 0; i < event.removed.length; i++) {
+                                       const inputSource = event.removed[i];
+                                       const controller = inputSourcesMap.get(inputSource);
+
+                                       if (controller) {
+                                               controller.dispatchEvent({
+                                                       type: 'disconnected',
+                                                       data: inputSource
+                                               });
+                                               inputSourcesMap.delete(inputSource);
+                                       }
+                               } // Notify connected
+
+
+                               for (let i = 0; i < event.added.length; i++) {
+                                       const inputSource = event.added[i];
+                                       const controller = inputSourcesMap.get(inputSource);
+
+                                       if (controller) {
+                                               controller.dispatchEvent({
+                                                       type: 'connected',
+                                                       data: inputSource
+                                               });
+                                       }
+                               }
+                       } //
+
+
+                       const cameraLPos = new Vector3();
+                       const cameraRPos = new Vector3();
+                       /**
+                        * Assumes 2 cameras that are parallel and share an X-axis, and that
+                        * the cameras' projection and world matrices have already been set.
+                        * And that near and far planes are identical for both cameras.
+                        * Visualization of this technique: https://computergraphics.stackexchange.com/a/4765
+                        */
+
+                       function setProjectionFromUnion(camera, cameraL, cameraR) {
+                               cameraLPos.setFromMatrixPosition(cameraL.matrixWorld);
+                               cameraRPos.setFromMatrixPosition(cameraR.matrixWorld);
+                               const ipd = cameraLPos.distanceTo(cameraRPos);
+                               const projL = cameraL.projectionMatrix.elements;
+                               const projR = cameraR.projectionMatrix.elements; // VR systems will have identical far and near planes, and
+                               // most likely identical top and bottom frustum extents.
+                               // Use the left camera for these values.
+
+                               const near = projL[14] / (projL[10] - 1);
+                               const far = projL[14] / (projL[10] + 1);
+                               const topFov = (projL[9] + 1) / projL[5];
+                               const bottomFov = (projL[9] - 1) / projL[5];
+                               const leftFov = (projL[8] - 1) / projL[0];
+                               const rightFov = (projR[8] + 1) / projR[0];
+                               const left = near * leftFov;
+                               const right = near * rightFov; // Calculate the new camera's position offset from the
+                               // left camera. xOffset should be roughly half `ipd`.
+
+                               const zOffset = ipd / (-leftFov + rightFov);
+                               const xOffset = zOffset * -leftFov; // TODO: Better way to apply this offset?
+
+                               cameraL.matrixWorld.decompose(camera.position, camera.quaternion, camera.scale);
+                               camera.translateX(xOffset);
+                               camera.translateZ(zOffset);
+                               camera.matrixWorld.compose(camera.position, camera.quaternion, camera.scale);
+                               camera.matrixWorldInverse.copy(camera.matrixWorld).invert(); // Find the union of the frustum values of the cameras and scale
+                               // the values so that the near plane's position does not change in world space,
+                               // although must now be relative to the new union camera.
+
+                               const near2 = near + zOffset;
+                               const far2 = far + zOffset;
+                               const left2 = left - xOffset;
+                               const right2 = right + (ipd - xOffset);
+                               const top2 = topFov * far / far2 * near2;
+                               const bottom2 = bottomFov * far / far2 * near2;
+                               camera.projectionMatrix.makePerspective(left2, right2, top2, bottom2, near2, far2);
+                       }
+
+                       function updateCamera(camera, parent) {
+                               if (parent === null) {
+                                       camera.matrixWorld.copy(camera.matrix);
+                               } else {
+                                       camera.matrixWorld.multiplyMatrices(parent.matrixWorld, camera.matrix);
+                               }
+
+                               camera.matrixWorldInverse.copy(camera.matrixWorld).invert();
+                       }
+
+                       this.updateCamera = function (camera) {
+                               if (session === null) return;
+                               cameraVR.near = cameraR.near = cameraL.near = camera.near;
+                               cameraVR.far = cameraR.far = cameraL.far = camera.far;
+
+                               if (_currentDepthNear !== cameraVR.near || _currentDepthFar !== cameraVR.far) {
+                                       // Note that the new renderState won't apply until the next frame. See #18320
+                                       session.updateRenderState({
+                                               depthNear: cameraVR.near,
+                                               depthFar: cameraVR.far
+                                       });
+                                       _currentDepthNear = cameraVR.near;
+                                       _currentDepthFar = cameraVR.far;
+                               }
+
+                               const parent = camera.parent;
+                               const cameras = cameraVR.cameras;
+                               updateCamera(cameraVR, parent);
+
+                               for (let i = 0; i < cameras.length; i++) {
+                                       updateCamera(cameras[i], parent);
+                               }
+
+                               cameraVR.matrixWorld.decompose(cameraVR.position, cameraVR.quaternion, cameraVR.scale); // update user camera and its children
+
+                               camera.position.copy(cameraVR.position);
+                               camera.quaternion.copy(cameraVR.quaternion);
+                               camera.scale.copy(cameraVR.scale);
+                               camera.matrix.copy(cameraVR.matrix);
+                               camera.matrixWorld.copy(cameraVR.matrixWorld);
+                               const children = camera.children;
+
+                               for (let i = 0, l = children.length; i < l; i++) {
+                                       children[i].updateMatrixWorld(true);
+                               } // update projection matrix for proper view frustum culling
+
+
+                               if (cameras.length === 2) {
+                                       setProjectionFromUnion(cameraVR, cameraL, cameraR);
+                               } else {
+                                       // assume single camera setup (AR)
+                                       cameraVR.projectionMatrix.copy(cameraL.projectionMatrix);
+                               }
+                       };
+
+                       this.getCamera = function () {
+                               return cameraVR;
+                       };
+
+                       this.getFoveation = function () {
+                               if (glProjLayer !== null) {
+                                       return glProjLayer.fixedFoveation;
+                               }
+
+                               if (glBaseLayer !== null) {
+                                       return glBaseLayer.fixedFoveation;
+                               }
+
+                               return undefined;
+                       };
+
+                       this.setFoveation = function (foveation) {
+                               // 0 = no foveation = full resolution
+                               // 1 = maximum foveation = the edges render at lower resolution
+                               if (glProjLayer !== null) {
+                                       glProjLayer.fixedFoveation = foveation;
+                               }
+
+                               if (glBaseLayer !== null && glBaseLayer.fixedFoveation !== undefined) {
+                                       glBaseLayer.fixedFoveation = foveation;
+                               }
+                       }; // Animation Loop
+
+
+                       let onAnimationFrameCallback = null;
+
+                       function onAnimationFrame(time, frame) {
+                               pose = frame.getViewerPose(referenceSpace);
+                               xrFrame = frame;
+
+                               if (pose !== null) {
+                                       const views = pose.views;
+
+                                       if (glBaseLayer !== null) {
+                                               state.bindXRFramebuffer(glBaseLayer.framebuffer);
+                                       }
+
+                                       let cameraVRNeedsUpdate = false; // check if it's necessary to rebuild cameraVR's camera list
+
+                                       if (views.length !== cameraVR.cameras.length) {
+                                               cameraVR.cameras.length = 0;
+                                               cameraVRNeedsUpdate = true;
+                                       }
+
+                                       for (let i = 0; i < views.length; i++) {
+                                               const view = views[i];
+                                               let viewport = null;
+
+                                               if (glBaseLayer !== null) {
+                                                       viewport = glBaseLayer.getViewport(view);
+                                               } else {
+                                                       const glSubImage = glBinding.getViewSubImage(glProjLayer, view);
+                                                       state.bindXRFramebuffer(glFramebuffer);
+
+                                                       if (glSubImage.depthStencilTexture !== undefined) {
+                                                               gl.framebufferTexture2D(gl.FRAMEBUFFER, depthStyle, gl.TEXTURE_2D, glSubImage.depthStencilTexture, 0);
+                                                       }
+
+                                                       gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, glSubImage.colorTexture, 0);
+                                                       viewport = glSubImage.viewport;
+                                               }
+
+                                               const camera = cameras[i];
+                                               camera.matrix.fromArray(view.transform.matrix);
+                                               camera.projectionMatrix.fromArray(view.projectionMatrix);
+                                               camera.viewport.set(viewport.x, viewport.y, viewport.width, viewport.height);
+
+                                               if (i === 0) {
+                                                       cameraVR.matrix.copy(camera.matrix);
+                                               }
+
+                                               if (cameraVRNeedsUpdate === true) {
+                                                       cameraVR.cameras.push(camera);
+                                               }
+                                       }
+
+                                       if (isMultisample) {
+                                               state.bindXRFramebuffer(glMultisampledFramebuffer);
+                                               if (clearStyle !== null) gl.clear(clearStyle);
+                                       }
+                               } //
+
+
+                               const inputSources = session.inputSources;
+
+                               for (let i = 0; i < controllers.length; i++) {
+                                       const controller = controllers[i];
+                                       const inputSource = inputSources[i];
+                                       controller.update(inputSource, frame, referenceSpace);
+                               }
+
+                               if (onAnimationFrameCallback) onAnimationFrameCallback(time, frame);
+
+                               if (isMultisample) {
+                                       const width = glProjLayer.textureWidth;
+                                       const height = glProjLayer.textureHeight;
+                                       state.bindFramebuffer(gl.READ_FRAMEBUFFER, glMultisampledFramebuffer);
+                                       state.bindFramebuffer(gl.DRAW_FRAMEBUFFER, glFramebuffer); // Invalidate the depth here to avoid flush of the depth data to main memory.
+
+                                       gl.invalidateFramebuffer(gl.READ_FRAMEBUFFER, [depthStyle]);
+                                       gl.invalidateFramebuffer(gl.DRAW_FRAMEBUFFER, [depthStyle]);
+                                       gl.blitFramebuffer(0, 0, width, height, 0, 0, width, height, gl.COLOR_BUFFER_BIT, gl.NEAREST); // Invalidate the MSAA buffer because it's not needed anymore.
+
+                                       gl.invalidateFramebuffer(gl.READ_FRAMEBUFFER, [gl.COLOR_ATTACHMENT0]);
+                                       state.bindFramebuffer(gl.READ_FRAMEBUFFER, null);
+                                       state.bindFramebuffer(gl.DRAW_FRAMEBUFFER, null);
+                                       state.bindFramebuffer(gl.FRAMEBUFFER, glMultisampledFramebuffer);
+                               }
+
+                               xrFrame = null;
+                       }
+
+                       const animation = new WebGLAnimation();
+                       animation.setAnimationLoop(onAnimationFrame);
+
+                       this.setAnimationLoop = function (callback) {
+                               onAnimationFrameCallback = callback;
+                       };
+
+                       this.dispose = function () {};
+               }
+
+       }
+
+       function WebGLMaterials(properties) {
+               function refreshFogUniforms(uniforms, fog) {
+                       uniforms.fogColor.value.copy(fog.color);
+
+                       if (fog.isFog) {
+                               uniforms.fogNear.value = fog.near;
+                               uniforms.fogFar.value = fog.far;
+                       } else if (fog.isFogExp2) {
+                               uniforms.fogDensity.value = fog.density;
+                       }
+               }
+
+               function refreshMaterialUniforms(uniforms, material, pixelRatio, height, transmissionRenderTarget) {
+                       if (material.isMeshBasicMaterial) {
+                               refreshUniformsCommon(uniforms, material);
+                       } else if (material.isMeshLambertMaterial) {
+                               refreshUniformsCommon(uniforms, material);
+                               refreshUniformsLambert(uniforms, material);
+                       } else if (material.isMeshToonMaterial) {
+                               refreshUniformsCommon(uniforms, material);
+                               refreshUniformsToon(uniforms, material);
+                       } else if (material.isMeshPhongMaterial) {
+                               refreshUniformsCommon(uniforms, material);
+                               refreshUniformsPhong(uniforms, material);
+                       } else if (material.isMeshStandardMaterial) {
+                               refreshUniformsCommon(uniforms, material);
+
+                               if (material.isMeshPhysicalMaterial) {
+                                       refreshUniformsPhysical(uniforms, material, transmissionRenderTarget);
+                               } else {
+                                       refreshUniformsStandard(uniforms, material);
+                               }
+                       } else if (material.isMeshMatcapMaterial) {
+                               refreshUniformsCommon(uniforms, material);
+                               refreshUniformsMatcap(uniforms, material);
+                       } else if (material.isMeshDepthMaterial) {
+                               refreshUniformsCommon(uniforms, material);
+                               refreshUniformsDepth(uniforms, material);
+                       } else if (material.isMeshDistanceMaterial) {
+                               refreshUniformsCommon(uniforms, material);
+                               refreshUniformsDistance(uniforms, material);
+                       } else if (material.isMeshNormalMaterial) {
+                               refreshUniformsCommon(uniforms, material);
+                               refreshUniformsNormal(uniforms, material);
+                       } else if (material.isLineBasicMaterial) {
+                               refreshUniformsLine(uniforms, material);
+
+                               if (material.isLineDashedMaterial) {
+                                       refreshUniformsDash(uniforms, material);
+                               }
+                       } else if (material.isPointsMaterial) {
+                               refreshUniformsPoints(uniforms, material, pixelRatio, height);
+                       } else if (material.isSpriteMaterial) {
+                               refreshUniformsSprites(uniforms, material);
+                       } else if (material.isShadowMaterial) {
+                               uniforms.color.value.copy(material.color);
+                               uniforms.opacity.value = material.opacity;
+                       } else if (material.isShaderMaterial) {
+                               material.uniformsNeedUpdate = false; // #15581
+                       }
+               }
+
+               function refreshUniformsCommon(uniforms, material) {
+                       uniforms.opacity.value = material.opacity;
+
+                       if (material.color) {
+                               uniforms.diffuse.value.copy(material.color);
+                       }
+
+                       if (material.emissive) {
+                               uniforms.emissive.value.copy(material.emissive).multiplyScalar(material.emissiveIntensity);
+                       }
+
+                       if (material.map) {
+                               uniforms.map.value = material.map;
+                       }
+
+                       if (material.alphaMap) {
+                               uniforms.alphaMap.value = material.alphaMap;
+                       }
+
+                       if (material.specularMap) {
+                               uniforms.specularMap.value = material.specularMap;
+                       }
+
+                       if (material.alphaTest > 0) {
+                               uniforms.alphaTest.value = material.alphaTest;
+                       }
+
+                       const envMap = properties.get(material).envMap;
+
+                       if (envMap) {
+                               uniforms.envMap.value = envMap;
+                               uniforms.flipEnvMap.value = envMap.isCubeTexture && envMap.isRenderTargetTexture === false ? -1 : 1;
+                               uniforms.reflectivity.value = material.reflectivity;
+                               uniforms.ior.value = material.ior;
+                               uniforms.refractionRatio.value = material.refractionRatio;
+
+                               const maxMipLevel = properties.get(envMap).__maxMipLevel;
+
+                               if (maxMipLevel !== undefined) {
+                                       uniforms.maxMipLevel.value = maxMipLevel;
+                               }
+                       }
+
+                       if (material.lightMap) {
+                               uniforms.lightMap.value = material.lightMap;
+                               uniforms.lightMapIntensity.value = material.lightMapIntensity;
+                       }
+
+                       if (material.aoMap) {
+                               uniforms.aoMap.value = material.aoMap;
+                               uniforms.aoMapIntensity.value = material.aoMapIntensity;
+                       } // uv repeat and offset setting priorities
+                       // 1. color map
+                       // 2. specular map
+                       // 3. displacementMap map
+                       // 4. normal map
+                       // 5. bump map
+                       // 6. roughnessMap map
+                       // 7. metalnessMap map
+                       // 8. alphaMap map
+                       // 9. emissiveMap map
+                       // 10. clearcoat map
+                       // 11. clearcoat normal map
+                       // 12. clearcoat roughnessMap map
+                       // 13. specular intensity map
+                       // 14. specular tint map
+                       // 15. transmission map
+                       // 16. thickness map
+
+
+                       let uvScaleMap;
+
+                       if (material.map) {
+                               uvScaleMap = material.map;
+                       } else if (material.specularMap) {
+                               uvScaleMap = material.specularMap;
+                       } else if (material.displacementMap) {
+                               uvScaleMap = material.displacementMap;
+                       } else if (material.normalMap) {
+                               uvScaleMap = material.normalMap;
+                       } else if (material.bumpMap) {
+                               uvScaleMap = material.bumpMap;
+                       } else if (material.roughnessMap) {
+                               uvScaleMap = material.roughnessMap;
+                       } else if (material.metalnessMap) {
+                               uvScaleMap = material.metalnessMap;
+                       } else if (material.alphaMap) {
+                               uvScaleMap = material.alphaMap;
+                       } else if (material.emissiveMap) {
+                               uvScaleMap = material.emissiveMap;
+                       } else if (material.clearcoatMap) {
+                               uvScaleMap = material.clearcoatMap;
+                       } else if (material.clearcoatNormalMap) {
+                               uvScaleMap = material.clearcoatNormalMap;
+                       } else if (material.clearcoatRoughnessMap) {
+                               uvScaleMap = material.clearcoatRoughnessMap;
+                       } else if (material.specularIntensityMap) {
+                               uvScaleMap = material.specularIntensityMap;
+                       } else if (material.specularTintMap) {
+                               uvScaleMap = material.specularTintMap;
+                       } else if (material.transmissionMap) {
+                               uvScaleMap = material.transmissionMap;
+                       } else if (material.thicknessMap) {
+                               uvScaleMap = material.thicknessMap;
+                       }
+
+                       if (uvScaleMap !== undefined) {
+                               // backwards compatibility
+                               if (uvScaleMap.isWebGLRenderTarget) {
+                                       uvScaleMap = uvScaleMap.texture;
+                               }
+
+                               if (uvScaleMap.matrixAutoUpdate === true) {
+                                       uvScaleMap.updateMatrix();
+                               }
+
+                               uniforms.uvTransform.value.copy(uvScaleMap.matrix);
+                       } // uv repeat and offset setting priorities for uv2
+                       // 1. ao map
+                       // 2. light map
+
+
+                       let uv2ScaleMap;
+
+                       if (material.aoMap) {
+                               uv2ScaleMap = material.aoMap;
+                       } else if (material.lightMap) {
+                               uv2ScaleMap = material.lightMap;
+                       }
+
+                       if (uv2ScaleMap !== undefined) {
+                               // backwards compatibility
+                               if (uv2ScaleMap.isWebGLRenderTarget) {
+                                       uv2ScaleMap = uv2ScaleMap.texture;
+                               }
+
+                               if (uv2ScaleMap.matrixAutoUpdate === true) {
+                                       uv2ScaleMap.updateMatrix();
+                               }
+
+                               uniforms.uv2Transform.value.copy(uv2ScaleMap.matrix);
+                       }
+               }
+
+               function refreshUniformsLine(uniforms, material) {
+                       uniforms.diffuse.value.copy(material.color);
+                       uniforms.opacity.value = material.opacity;
+               }
+
+               function refreshUniformsDash(uniforms, material) {
+                       uniforms.dashSize.value = material.dashSize;
+                       uniforms.totalSize.value = material.dashSize + material.gapSize;
+                       uniforms.scale.value = material.scale;
+               }
+
+               function refreshUniformsPoints(uniforms, material, pixelRatio, height) {
+                       uniforms.diffuse.value.copy(material.color);
+                       uniforms.opacity.value = material.opacity;
+                       uniforms.size.value = material.size * pixelRatio;
+                       uniforms.scale.value = height * 0.5;
+
+                       if (material.map) {
+                               uniforms.map.value = material.map;
+                       }
+
+                       if (material.alphaMap) {
+                               uniforms.alphaMap.value = material.alphaMap;
+                       }
+
+                       if (material.alphaTest > 0) {
+                               uniforms.alphaTest.value = material.alphaTest;
+                       } // uv repeat and offset setting priorities
+                       // 1. color map
+                       // 2. alpha map
+
+
+                       let uvScaleMap;
+
+                       if (material.map) {
+                               uvScaleMap = material.map;
+                       } else if (material.alphaMap) {
+                               uvScaleMap = material.alphaMap;
+                       }
+
+                       if (uvScaleMap !== undefined) {
+                               if (uvScaleMap.matrixAutoUpdate === true) {
+                                       uvScaleMap.updateMatrix();
+                               }
+
+                               uniforms.uvTransform.value.copy(uvScaleMap.matrix);
+                       }
+               }
+
+               function refreshUniformsSprites(uniforms, material) {
+                       uniforms.diffuse.value.copy(material.color);
+                       uniforms.opacity.value = material.opacity;
+                       uniforms.rotation.value = material.rotation;
+
+                       if (material.map) {
+                               uniforms.map.value = material.map;
+                       }
+
+                       if (material.alphaMap) {
+                               uniforms.alphaMap.value = material.alphaMap;
+                       }
+
+                       if (material.alphaTest > 0) {
+                               uniforms.alphaTest.value = material.alphaTest;
+                       } // uv repeat and offset setting priorities
+                       // 1. color map
+                       // 2. alpha map
+
+
+                       let uvScaleMap;
+
+                       if (material.map) {
+                               uvScaleMap = material.map;
+                       } else if (material.alphaMap) {
+                               uvScaleMap = material.alphaMap;
+                       }
+
+                       if (uvScaleMap !== undefined) {
+                               if (uvScaleMap.matrixAutoUpdate === true) {
+                                       uvScaleMap.updateMatrix();
+                               }
+
+                               uniforms.uvTransform.value.copy(uvScaleMap.matrix);
+                       }
+               }
+
+               function refreshUniformsLambert(uniforms, material) {
+                       if (material.emissiveMap) {
+                               uniforms.emissiveMap.value = material.emissiveMap;
+                       }
+               }
+
+               function refreshUniformsPhong(uniforms, material) {
+                       uniforms.specular.value.copy(material.specular);
+                       uniforms.shininess.value = Math.max(material.shininess, 1e-4); // to prevent pow( 0.0, 0.0 )
+
+                       if (material.emissiveMap) {
+                               uniforms.emissiveMap.value = material.emissiveMap;
+                       }
+
+                       if (material.bumpMap) {
+                               uniforms.bumpMap.value = material.bumpMap;
+                               uniforms.bumpScale.value = material.bumpScale;
+                               if (material.side === BackSide) uniforms.bumpScale.value *= -1;
+                       }
+
+                       if (material.normalMap) {
+                               uniforms.normalMap.value = material.normalMap;
+                               uniforms.normalScale.value.copy(material.normalScale);
+                               if (material.side === BackSide) uniforms.normalScale.value.negate();
+                       }
+
+                       if (material.displacementMap) {
+                               uniforms.displacementMap.value = material.displacementMap;
+                               uniforms.displacementScale.value = material.displacementScale;
+                               uniforms.displacementBias.value = material.displacementBias;
+                       }
+               }
+
+               function refreshUniformsToon(uniforms, material) {
+                       if (material.gradientMap) {
+                               uniforms.gradientMap.value = material.gradientMap;
+                       }
+
+                       if (material.emissiveMap) {
+                               uniforms.emissiveMap.value = material.emissiveMap;
+                       }
+
+                       if (material.bumpMap) {
+                               uniforms.bumpMap.value = material.bumpMap;
+                               uniforms.bumpScale.value = material.bumpScale;
+                               if (material.side === BackSide) uniforms.bumpScale.value *= -1;
+                       }
+
+                       if (material.normalMap) {
+                               uniforms.normalMap.value = material.normalMap;
+                               uniforms.normalScale.value.copy(material.normalScale);
+                               if (material.side === BackSide) uniforms.normalScale.value.negate();
+                       }
+
+                       if (material.displacementMap) {
+                               uniforms.displacementMap.value = material.displacementMap;
+                               uniforms.displacementScale.value = material.displacementScale;
+                               uniforms.displacementBias.value = material.displacementBias;
+                       }
+               }
+
+               function refreshUniformsStandard(uniforms, material) {
+                       uniforms.roughness.value = material.roughness;
+                       uniforms.metalness.value = material.metalness;
+
+                       if (material.roughnessMap) {
+                               uniforms.roughnessMap.value = material.roughnessMap;
+                       }
+
+                       if (material.metalnessMap) {
+                               uniforms.metalnessMap.value = material.metalnessMap;
+                       }
+
+                       if (material.emissiveMap) {
+                               uniforms.emissiveMap.value = material.emissiveMap;
+                       }
+
+                       if (material.bumpMap) {
+                               uniforms.bumpMap.value = material.bumpMap;
+                               uniforms.bumpScale.value = material.bumpScale;
+                               if (material.side === BackSide) uniforms.bumpScale.value *= -1;
+                       }
+
+                       if (material.normalMap) {
+                               uniforms.normalMap.value = material.normalMap;
+                               uniforms.normalScale.value.copy(material.normalScale);
+                               if (material.side === BackSide) uniforms.normalScale.value.negate();
+                       }
+
+                       if (material.displacementMap) {
+                               uniforms.displacementMap.value = material.displacementMap;
+                               uniforms.displacementScale.value = material.displacementScale;
+                               uniforms.displacementBias.value = material.displacementBias;
+                       }
+
+                       const envMap = properties.get(material).envMap;
+
+                       if (envMap) {
+                               //uniforms.envMap.value = material.envMap; // part of uniforms common
+                               uniforms.envMapIntensity.value = material.envMapIntensity;
+                       }
+               }
+
+               function refreshUniformsPhysical(uniforms, material, transmissionRenderTarget) {
+                       refreshUniformsStandard(uniforms, material);
+                       uniforms.ior.value = material.ior; // also part of uniforms common
+
+                       if (material.sheenTint) uniforms.sheenTint.value.copy(material.sheenTint);
+
+                       if (material.clearcoat > 0) {
+                               uniforms.clearcoat.value = material.clearcoat;
+                               uniforms.clearcoatRoughness.value = material.clearcoatRoughness;
+
+                               if (material.clearcoatMap) {
+                                       uniforms.clearcoatMap.value = material.clearcoatMap;
+                               }
+
+                               if (material.clearcoatRoughnessMap) {
+                                       uniforms.clearcoatRoughnessMap.value = material.clearcoatRoughnessMap;
+                               }
+
+                               if (material.clearcoatNormalMap) {
+                                       uniforms.clearcoatNormalScale.value.copy(material.clearcoatNormalScale);
+                                       uniforms.clearcoatNormalMap.value = material.clearcoatNormalMap;
+
+                                       if (material.side === BackSide) {
+                                               uniforms.clearcoatNormalScale.value.negate();
+                                       }
+                               }
+                       }
+
+                       if (material.transmission > 0) {
+                               uniforms.transmission.value = material.transmission;
+                               uniforms.transmissionSamplerMap.value = transmissionRenderTarget.texture;
+                               uniforms.transmissionSamplerSize.value.set(transmissionRenderTarget.width, transmissionRenderTarget.height);
+
+                               if (material.transmissionMap) {
+                                       uniforms.transmissionMap.value = material.transmissionMap;
+                               }
+
+                               uniforms.thickness.value = material.thickness;
+
+                               if (material.thicknessMap) {
+                                       uniforms.thicknessMap.value = material.thicknessMap;
+                               }
+
+                               uniforms.attenuationDistance.value = material.attenuationDistance;
+                               uniforms.attenuationTint.value.copy(material.attenuationTint);
+                       }
+
+                       uniforms.specularIntensity.value = material.specularIntensity;
+                       uniforms.specularTint.value.copy(material.specularTint);
+
+                       if (material.specularIntensityMap) {
+                               uniforms.specularIntensityMap.value = material.specularIntensityMap;
+                       }
+
+                       if (material.specularTintMap) {
+                               uniforms.specularTintMap.value = material.specularTintMap;
+                       }
+               }
+
+               function refreshUniformsMatcap(uniforms, material) {
+                       if (material.matcap) {
+                               uniforms.matcap.value = material.matcap;
+                       }
+
+                       if (material.bumpMap) {
+                               uniforms.bumpMap.value = material.bumpMap;
+                               uniforms.bumpScale.value = material.bumpScale;
+                               if (material.side === BackSide) uniforms.bumpScale.value *= -1;
+                       }
+
+                       if (material.normalMap) {
+                               uniforms.normalMap.value = material.normalMap;
+                               uniforms.normalScale.value.copy(material.normalScale);
+                               if (material.side === BackSide) uniforms.normalScale.value.negate();
+                       }
+
+                       if (material.displacementMap) {
+                               uniforms.displacementMap.value = material.displacementMap;
+                               uniforms.displacementScale.value = material.displacementScale;
+                               uniforms.displacementBias.value = material.displacementBias;
+                       }
+               }
+
+               function refreshUniformsDepth(uniforms, material) {
+                       if (material.displacementMap) {
+                               uniforms.displacementMap.value = material.displacementMap;
+                               uniforms.displacementScale.value = material.displacementScale;
+                               uniforms.displacementBias.value = material.displacementBias;
+                       }
+               }
+
+               function refreshUniformsDistance(uniforms, material) {
+                       if (material.displacementMap) {
+                               uniforms.displacementMap.value = material.displacementMap;
+                               uniforms.displacementScale.value = material.displacementScale;
+                               uniforms.displacementBias.value = material.displacementBias;
+                       }
+
+                       uniforms.referencePosition.value.copy(material.referencePosition);
+                       uniforms.nearDistance.value = material.nearDistance;
+                       uniforms.farDistance.value = material.farDistance;
+               }
+
+               function refreshUniformsNormal(uniforms, material) {
+                       if (material.bumpMap) {
+                               uniforms.bumpMap.value = material.bumpMap;
+                               uniforms.bumpScale.value = material.bumpScale;
+                               if (material.side === BackSide) uniforms.bumpScale.value *= -1;
+                       }
+
+                       if (material.normalMap) {
+                               uniforms.normalMap.value = material.normalMap;
+                               uniforms.normalScale.value.copy(material.normalScale);
+                               if (material.side === BackSide) uniforms.normalScale.value.negate();
+                       }
+
+                       if (material.displacementMap) {
+                               uniforms.displacementMap.value = material.displacementMap;
+                               uniforms.displacementScale.value = material.displacementScale;
+                               uniforms.displacementBias.value = material.displacementBias;
+                       }
+               }
+
+               return {
+                       refreshFogUniforms: refreshFogUniforms,
+                       refreshMaterialUniforms: refreshMaterialUniforms
+               };
+       }
+
+       function createCanvasElement() {
+               const canvas = document.createElementNS('http://www.w3.org/1999/xhtml', 'canvas');
+               canvas.style.display = 'block';
+               return canvas;
+       }
+
+       function WebGLRenderer(parameters = {}) {
+               const _canvas = parameters.canvas !== undefined ? parameters.canvas : createCanvasElement(),
+                                       _context = parameters.context !== undefined ? parameters.context : null,
+                                       _alpha = parameters.alpha !== undefined ? parameters.alpha : false,
+                                       _depth = parameters.depth !== undefined ? parameters.depth : true,
+                                       _stencil = parameters.stencil !== undefined ? parameters.stencil : true,
+                                       _antialias = parameters.antialias !== undefined ? parameters.antialias : false,
+                                       _premultipliedAlpha = parameters.premultipliedAlpha !== undefined ? parameters.premultipliedAlpha : true,
+                                       _preserveDrawingBuffer = parameters.preserveDrawingBuffer !== undefined ? parameters.preserveDrawingBuffer : false,
+                                       _powerPreference = parameters.powerPreference !== undefined ? parameters.powerPreference : 'default',
+                                       _failIfMajorPerformanceCaveat = parameters.failIfMajorPerformanceCaveat !== undefined ? parameters.failIfMajorPerformanceCaveat : false;
+
+               let currentRenderList = null;
+               let currentRenderState = null; // render() can be called from within a callback triggered by another render.
+               // We track this so that the nested render call gets its list and state isolated from the parent render call.
+
+               const renderListStack = [];
+               const renderStateStack = []; // public properties
+
+               this.domElement = _canvas; // Debug configuration container
+
+               this.debug = {
+                       /**
+                        * Enables error checking and reporting when shader programs are being compiled
+                        * @type {boolean}
+                        */
+                       checkShaderErrors: true
+               }; // clearing
+
+               this.autoClear = true;
+               this.autoClearColor = true;
+               this.autoClearDepth = true;
+               this.autoClearStencil = true; // scene graph
+
+               this.sortObjects = true; // user-defined clipping
+
+               this.clippingPlanes = [];
+               this.localClippingEnabled = false; // physically based shading
+
+               this.gammaFactor = 2.0; // for backwards compatibility
+
+               this.outputEncoding = LinearEncoding; // physical lights
+
+               this.physicallyCorrectLights = false; // tone mapping
+
+               this.toneMapping = NoToneMapping;
+               this.toneMappingExposure = 1.0; // internal properties
+
+               const _this = this;
+
+               let _isContextLost = false; // internal state cache
+
+               let _currentActiveCubeFace = 0;
+               let _currentActiveMipmapLevel = 0;
+               let _currentRenderTarget = null;
+
+               let _currentMaterialId = -1;
+
+               let _currentCamera = null;
+
+               const _currentViewport = new Vector4();
+
+               const _currentScissor = new Vector4();
+
+               let _currentScissorTest = null; //
+
+               let _width = _canvas.width;
+               let _height = _canvas.height;
+               let _pixelRatio = 1;
+               let _opaqueSort = null;
+               let _transparentSort = null;
+
+               const _viewport = new Vector4(0, 0, _width, _height);
+
+               const _scissor = new Vector4(0, 0, _width, _height);
+
+               let _scissorTest = false; //
+
+               const _currentDrawBuffers = []; // frustum
+
+               const _frustum = new Frustum(); // clipping
+
+
+               let _clippingEnabled = false;
+               let _localClippingEnabled = false; // transmission
+
+               let _transmissionRenderTarget = null; // camera matrices cache
+
+               const _projScreenMatrix = new Matrix4();
+
+               const _vector3 = new Vector3();
+
+               const _emptyScene = {
+                       background: null,
+                       fog: null,
+                       environment: null,
+                       overrideMaterial: null,
+                       isScene: true
+               };
+
+               function getTargetPixelRatio() {
+                       return _currentRenderTarget === null ? _pixelRatio : 1;
+               } // initialize
+
+
+               let _gl = _context;
+
+               function getContext(contextNames, contextAttributes) {
+                       for (let i = 0; i < contextNames.length; i++) {
+                               const contextName = contextNames[i];
+
+                               const context = _canvas.getContext(contextName, contextAttributes);
+
+                               if (context !== null) return context;
+                       }
+
+                       return null;
+               }
+
+               try {
+                       const contextAttributes = {
+                               alpha: _alpha,
+                               depth: _depth,
+                               stencil: _stencil,
+                               antialias: _antialias,
+                               premultipliedAlpha: _premultipliedAlpha,
+                               preserveDrawingBuffer: _preserveDrawingBuffer,
+                               powerPreference: _powerPreference,
+                               failIfMajorPerformanceCaveat: _failIfMajorPerformanceCaveat
+                       }; // event listeners must be registered before WebGL context is created, see #12753
+
+                       _canvas.addEventListener('webglcontextlost', onContextLost, false);
+
+                       _canvas.addEventListener('webglcontextrestored', onContextRestore, false);
+
+                       if (_gl === null) {
+                               const contextNames = ['webgl2', 'webgl', 'experimental-webgl'];
+
+                               if (_this.isWebGL1Renderer === true) {
+                                       contextNames.shift();
+                               }
+
+                               _gl = getContext(contextNames, contextAttributes);
+
+                               if (_gl === null) {
+                                       if (getContext(contextNames)) {
+                                               throw new Error('Error creating WebGL context with your selected attributes.');
+                                       } else {
+                                               throw new Error('Error creating WebGL context.');
+                                       }
+                               }
+                       } // Some experimental-webgl implementations do not have getShaderPrecisionFormat
+
+
+                       if (_gl.getShaderPrecisionFormat === undefined) {
+                               _gl.getShaderPrecisionFormat = function () {
+                                       return {
+                                               'rangeMin': 1,
+                                               'rangeMax': 1,
+                                               'precision': 1
+                                       };
+                               };
+                       }
+               } catch (error) {
+                       console.error('THREE.WebGLRenderer: ' + error.message);
+                       throw error;
+               }
+
+               let extensions, capabilities, state, info;
+               let properties, textures, cubemaps, cubeuvmaps, attributes, geometries, objects;
+               let programCache, materials, renderLists, renderStates, clipping, shadowMap;
+               let background, morphtargets, bufferRenderer, indexedBufferRenderer;
+               let utils, bindingStates;
+
+               function initGLContext() {
+                       extensions = new WebGLExtensions(_gl);
+                       capabilities = new WebGLCapabilities(_gl, extensions, parameters);
+                       extensions.init(capabilities);
+                       utils = new WebGLUtils(_gl, extensions, capabilities);
+                       state = new WebGLState(_gl, extensions, capabilities);
+                       _currentDrawBuffers[0] = _gl.BACK;
+                       info = new WebGLInfo(_gl);
+                       properties = new WebGLProperties();
+                       textures = new WebGLTextures(_gl, extensions, state, properties, capabilities, utils, info);
+                       cubemaps = new WebGLCubeMaps(_this);
+                       cubeuvmaps = new WebGLCubeUVMaps(_this);
+                       attributes = new WebGLAttributes(_gl, capabilities);
+                       bindingStates = new WebGLBindingStates(_gl, extensions, attributes, capabilities);
+                       geometries = new WebGLGeometries(_gl, attributes, info, bindingStates);
+                       objects = new WebGLObjects(_gl, geometries, attributes, info);
+                       morphtargets = new WebGLMorphtargets(_gl);
+                       clipping = new WebGLClipping(properties);
+                       programCache = new WebGLPrograms(_this, cubemaps, cubeuvmaps, extensions, capabilities, bindingStates, clipping);
+                       materials = new WebGLMaterials(properties);
+                       renderLists = new WebGLRenderLists(properties);
+                       renderStates = new WebGLRenderStates(extensions, capabilities);
+                       background = new WebGLBackground(_this, cubemaps, state, objects, _premultipliedAlpha);
+                       shadowMap = new WebGLShadowMap(_this, objects, capabilities);
+                       bufferRenderer = new WebGLBufferRenderer(_gl, extensions, info, capabilities);
+                       indexedBufferRenderer = new WebGLIndexedBufferRenderer(_gl, extensions, info, capabilities);
+                       info.programs = programCache.programs;
+                       _this.capabilities = capabilities;
+                       _this.extensions = extensions;
+                       _this.properties = properties;
+                       _this.renderLists = renderLists;
+                       _this.shadowMap = shadowMap;
+                       _this.state = state;
+                       _this.info = info;
+               }
+
+               initGLContext(); // xr
+
+               const xr = new WebXRManager(_this, _gl);
+               this.xr = xr; // API
+
+               this.getContext = function () {
+                       return _gl;
+               };
+
+               this.getContextAttributes = function () {
+                       return _gl.getContextAttributes();
+               };
+
+               this.forceContextLoss = function () {
+                       const extension = extensions.get('WEBGL_lose_context');
+                       if (extension) extension.loseContext();
+               };
+
+               this.forceContextRestore = function () {
+                       const extension = extensions.get('WEBGL_lose_context');
+                       if (extension) extension.restoreContext();
+               };
+
+               this.getPixelRatio = function () {
+                       return _pixelRatio;
+               };
+
+               this.setPixelRatio = function (value) {
+                       if (value === undefined) return;
+                       _pixelRatio = value;
+                       this.setSize(_width, _height, false);
+               };
+
+               this.getSize = function (target) {
+                       return target.set(_width, _height);
+               };
+
+               this.setSize = function (width, height, updateStyle) {
+                       if (xr.isPresenting) {
+                               console.warn('THREE.WebGLRenderer: Can\'t change size while VR device is presenting.');
+                               return;
+                       }
+
+                       _width = width;
+                       _height = height;
+                       _canvas.width = Math.floor(width * _pixelRatio);
+                       _canvas.height = Math.floor(height * _pixelRatio);
+
+                       if (updateStyle !== false) {
+                               _canvas.style.width = width + 'px';
+                               _canvas.style.height = height + 'px';
+                       }
+
+                       this.setViewport(0, 0, width, height);
+               };
+
+               this.getDrawingBufferSize = function (target) {
+                       return target.set(_width * _pixelRatio, _height * _pixelRatio).floor();
+               };
+
+               this.setDrawingBufferSize = function (width, height, pixelRatio) {
+                       _width = width;
+                       _height = height;
+                       _pixelRatio = pixelRatio;
+                       _canvas.width = Math.floor(width * pixelRatio);
+                       _canvas.height = Math.floor(height * pixelRatio);
+                       this.setViewport(0, 0, width, height);
+               };
+
+               this.getCurrentViewport = function (target) {
+                       return target.copy(_currentViewport);
+               };
+
+               this.getViewport = function (target) {
+                       return target.copy(_viewport);
+               };
+
+               this.setViewport = function (x, y, width, height) {
+                       if (x.isVector4) {
+                               _viewport.set(x.x, x.y, x.z, x.w);
+                       } else {
+                               _viewport.set(x, y, width, height);
+                       }
+
+                       state.viewport(_currentViewport.copy(_viewport).multiplyScalar(_pixelRatio).floor());
+               };
+
+               this.getScissor = function (target) {
+                       return target.copy(_scissor);
+               };
+
+               this.setScissor = function (x, y, width, height) {
+                       if (x.isVector4) {
+                               _scissor.set(x.x, x.y, x.z, x.w);
+                       } else {
+                               _scissor.set(x, y, width, height);
+                       }
+
+                       state.scissor(_currentScissor.copy(_scissor).multiplyScalar(_pixelRatio).floor());
+               };
+
+               this.getScissorTest = function () {
+                       return _scissorTest;
+               };
+
+               this.setScissorTest = function (boolean) {
+                       state.setScissorTest(_scissorTest = boolean);
+               };
+
+               this.setOpaqueSort = function (method) {
+                       _opaqueSort = method;
+               };
+
+               this.setTransparentSort = function (method) {
+                       _transparentSort = method;
+               }; // Clearing
+
+
+               this.getClearColor = function (target) {
+                       return target.copy(background.getClearColor());
+               };
+
+               this.setClearColor = function () {
+                       background.setClearColor.apply(background, arguments);
+               };
+
+               this.getClearAlpha = function () {
+                       return background.getClearAlpha();
+               };
+
+               this.setClearAlpha = function () {
+                       background.setClearAlpha.apply(background, arguments);
+               };
+
+               this.clear = function (color, depth, stencil) {
+                       let bits = 0;
+                       if (color === undefined || color) bits |= _gl.COLOR_BUFFER_BIT;
+                       if (depth === undefined || depth) bits |= _gl.DEPTH_BUFFER_BIT;
+                       if (stencil === undefined || stencil) bits |= _gl.STENCIL_BUFFER_BIT;
+
+                       _gl.clear(bits);
+               };
+
+               this.clearColor = function () {
+                       this.clear(true, false, false);
+               };
+
+               this.clearDepth = function () {
+                       this.clear(false, true, false);
+               };
+
+               this.clearStencil = function () {
+                       this.clear(false, false, true);
+               }; //
+
+
+               this.dispose = function () {
+                       _canvas.removeEventListener('webglcontextlost', onContextLost, false);
+
+                       _canvas.removeEventListener('webglcontextrestored', onContextRestore, false);
+
+                       renderLists.dispose();
+                       renderStates.dispose();
+                       properties.dispose();
+                       cubemaps.dispose();
+                       cubeuvmaps.dispose();
+                       objects.dispose();
+                       bindingStates.dispose();
+                       xr.dispose();
+                       xr.removeEventListener('sessionstart', onXRSessionStart);
+                       xr.removeEventListener('sessionend', onXRSessionEnd);
+
+                       if (_transmissionRenderTarget) {
+                               _transmissionRenderTarget.dispose();
+
+                               _transmissionRenderTarget = null;
+                       }
+
+                       animation.stop();
+               }; // Events
+
+
+               function onContextLost(event) {
+                       event.preventDefault();
+                       console.log('THREE.WebGLRenderer: Context Lost.');
+                       _isContextLost = true;
+               }
+
+               function onContextRestore() {
+                       console.log('THREE.WebGLRenderer: Context Restored.');
+                       _isContextLost = false;
+                       const infoAutoReset = info.autoReset;
+                       const shadowMapEnabled = shadowMap.enabled;
+                       const shadowMapAutoUpdate = shadowMap.autoUpdate;
+                       const shadowMapNeedsUpdate = shadowMap.needsUpdate;
+                       const shadowMapType = shadowMap.type;
+                       initGLContext();
+                       info.autoReset = infoAutoReset;
+                       shadowMap.enabled = shadowMapEnabled;
+                       shadowMap.autoUpdate = shadowMapAutoUpdate;
+                       shadowMap.needsUpdate = shadowMapNeedsUpdate;
+                       shadowMap.type = shadowMapType;
+               }
+
+               function onMaterialDispose(event) {
+                       const material = event.target;
+                       material.removeEventListener('dispose', onMaterialDispose);
+                       deallocateMaterial(material);
+               } // Buffer deallocation
+
+
+               function deallocateMaterial(material) {
+                       releaseMaterialProgramReferences(material);
+                       properties.remove(material);
+               }
+
+               function releaseMaterialProgramReferences(material) {
+                       const programs = properties.get(material).programs;
+
+                       if (programs !== undefined) {
+                               programs.forEach(function (program) {
+                                       programCache.releaseProgram(program);
+                               });
+                       }
+               } // Buffer rendering
+
+
+               function renderObjectImmediate(object, program) {
+                       object.render(function (object) {
+                               _this.renderBufferImmediate(object, program);
+                       });
+               }
+
+               this.renderBufferImmediate = function (object, program) {
+                       bindingStates.initAttributes();
+                       const buffers = properties.get(object);
+                       if (object.hasPositions && !buffers.position) buffers.position = _gl.createBuffer();
+                       if (object.hasNormals && !buffers.normal) buffers.normal = _gl.createBuffer();
+                       if (object.hasUvs && !buffers.uv) buffers.uv = _gl.createBuffer();
+                       if (object.hasColors && !buffers.color) buffers.color = _gl.createBuffer();
+                       const programAttributes = program.getAttributes();
+
+                       if (object.hasPositions) {
+                               _gl.bindBuffer(_gl.ARRAY_BUFFER, buffers.position);
+
+                               _gl.bufferData(_gl.ARRAY_BUFFER, object.positionArray, _gl.DYNAMIC_DRAW);
+
+                               bindingStates.enableAttribute(programAttributes.position.location);
+
+                               _gl.vertexAttribPointer(programAttributes.position.location, 3, _gl.FLOAT, false, 0, 0);
+                       }
+
+                       if (object.hasNormals) {
+                               _gl.bindBuffer(_gl.ARRAY_BUFFER, buffers.normal);
+
+                               _gl.bufferData(_gl.ARRAY_BUFFER, object.normalArray, _gl.DYNAMIC_DRAW);
+
+                               bindingStates.enableAttribute(programAttributes.normal.location);
+
+                               _gl.vertexAttribPointer(programAttributes.normal.location, 3, _gl.FLOAT, false, 0, 0);
+                       }
+
+                       if (object.hasUvs) {
+                               _gl.bindBuffer(_gl.ARRAY_BUFFER, buffers.uv);
+
+                               _gl.bufferData(_gl.ARRAY_BUFFER, object.uvArray, _gl.DYNAMIC_DRAW);
+
+                               bindingStates.enableAttribute(programAttributes.uv.location);
+
+                               _gl.vertexAttribPointer(programAttributes.uv.location, 2, _gl.FLOAT, false, 0, 0);
+                       }
+
+                       if (object.hasColors) {
+                               _gl.bindBuffer(_gl.ARRAY_BUFFER, buffers.color);
+
+                               _gl.bufferData(_gl.ARRAY_BUFFER, object.colorArray, _gl.DYNAMIC_DRAW);
+
+                               bindingStates.enableAttribute(programAttributes.color.location);
+
+                               _gl.vertexAttribPointer(programAttributes.color.location, 3, _gl.FLOAT, false, 0, 0);
+                       }
+
+                       bindingStates.disableUnusedAttributes();
+
+                       _gl.drawArrays(_gl.TRIANGLES, 0, object.count);
+
+                       object.count = 0;
+               };
+
+               this.renderBufferDirect = function (camera, scene, geometry, material, object, group) {
+                       if (scene === null) scene = _emptyScene; // renderBufferDirect second parameter used to be fog (could be null)
+
+                       const frontFaceCW = object.isMesh && object.matrixWorld.determinant() < 0;
+                       const program = setProgram(camera, scene, material, object);
+                       state.setMaterial(material, frontFaceCW); //
+
+                       let index = geometry.index;
+                       const position = geometry.attributes.position; //
+
+                       if (index === null) {
+                               if (position === undefined || position.count === 0) return;
+                       } else if (index.count === 0) {
+                               return;
+                       } //
+
+
+                       let rangeFactor = 1;
+
+                       if (material.wireframe === true) {
+                               index = geometries.getWireframeAttribute(geometry);
+                               rangeFactor = 2;
+                       }
+
+                       if (geometry.morphAttributes.position !== undefined || geometry.morphAttributes.normal !== undefined) {
+                               morphtargets.update(object, geometry, material, program);
+                       }
+
+                       bindingStates.setup(object, material, program, geometry, index);
+                       let attribute;
+                       let renderer = bufferRenderer;
+
+                       if (index !== null) {
+                               attribute = attributes.get(index);
+                               renderer = indexedBufferRenderer;
+                               renderer.setIndex(attribute);
+                       } //
+
+
+                       const dataCount = index !== null ? index.count : position.count;
+                       const rangeStart = geometry.drawRange.start * rangeFactor;
+                       const rangeCount = geometry.drawRange.count * rangeFactor;
+                       const groupStart = group !== null ? group.start * rangeFactor : 0;
+                       const groupCount = group !== null ? group.count * rangeFactor : Infinity;
+                       const drawStart = Math.max(rangeStart, groupStart);
+                       const drawEnd = Math.min(dataCount, rangeStart + rangeCount, groupStart + groupCount) - 1;
+                       const drawCount = Math.max(0, drawEnd - drawStart + 1);
+                       if (drawCount === 0) return; //
+
+                       if (object.isMesh) {
+                               if (material.wireframe === true) {
+                                       state.setLineWidth(material.wireframeLinewidth * getTargetPixelRatio());
+                                       renderer.setMode(_gl.LINES);
+                               } else {
+                                       renderer.setMode(_gl.TRIANGLES);
+                               }
+                       } else if (object.isLine) {
+                               let lineWidth = material.linewidth;
+                               if (lineWidth === undefined) lineWidth = 1; // Not using Line*Material
+
+                               state.setLineWidth(lineWidth * getTargetPixelRatio());
+
+                               if (object.isLineSegments) {
+                                       renderer.setMode(_gl.LINES);
+                               } else if (object.isLineLoop) {
+                                       renderer.setMode(_gl.LINE_LOOP);
+                               } else {
+                                       renderer.setMode(_gl.LINE_STRIP);
+                               }
+                       } else if (object.isPoints) {
+                               renderer.setMode(_gl.POINTS);
+                       } else if (object.isSprite) {
+                               renderer.setMode(_gl.TRIANGLES);
+                       }
+
+                       if (object.isInstancedMesh) {
+                               renderer.renderInstances(drawStart, drawCount, object.count);
+                       } else if (geometry.isInstancedBufferGeometry) {
+                               const instanceCount = Math.min(geometry.instanceCount, geometry._maxInstanceCount);
+                               renderer.renderInstances(drawStart, drawCount, instanceCount);
+                       } else {
+                               renderer.render(drawStart, drawCount);
+                       }
+               }; // Compile
+
+
+               this.compile = function (scene, camera) {
+                       currentRenderState = renderStates.get(scene);
+                       currentRenderState.init();
+                       renderStateStack.push(currentRenderState);
+                       scene.traverseVisible(function (object) {
+                               if (object.isLight && object.layers.test(camera.layers)) {
+                                       currentRenderState.pushLight(object);
+
+                                       if (object.castShadow) {
+                                               currentRenderState.pushShadow(object);
+                                       }
+                               }
+                       });
+                       currentRenderState.setupLights(_this.physicallyCorrectLights);
+                       scene.traverse(function (object) {
+                               const material = object.material;
+
+                               if (material) {
+                                       if (Array.isArray(material)) {
+                                               for (let i = 0; i < material.length; i++) {
+                                                       const material2 = material[i];
+                                                       getProgram(material2, scene, object);
+                                               }
+                                       } else {
+                                               getProgram(material, scene, object);
+                                       }
+                               }
+                       });
+                       renderStateStack.pop();
+                       currentRenderState = null;
+               }; // Animation Loop
+
+
+               let onAnimationFrameCallback = null;
+
+               function onAnimationFrame(time) {
+                       if (onAnimationFrameCallback) onAnimationFrameCallback(time);
+               }
+
+               function onXRSessionStart() {
+                       animation.stop();
+               }
+
+               function onXRSessionEnd() {
+                       animation.start();
+               }
+
+               const animation = new WebGLAnimation();
+               animation.setAnimationLoop(onAnimationFrame);
+               if (typeof window !== 'undefined') animation.setContext(window);
+
+               this.setAnimationLoop = function (callback) {
+                       onAnimationFrameCallback = callback;
+                       xr.setAnimationLoop(callback);
+                       callback === null ? animation.stop() : animation.start();
+               };
+
+               xr.addEventListener('sessionstart', onXRSessionStart);
+               xr.addEventListener('sessionend', onXRSessionEnd); // Rendering
+
+               this.render = function (scene, camera) {
+                       if (camera !== undefined && camera.isCamera !== true) {
+                               console.error('THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.');
+                               return;
+                       }
+
+                       if (_isContextLost === true) return; // update scene graph
+
+                       if (scene.autoUpdate === true) scene.updateMatrixWorld(); // update camera matrices and frustum
+
+                       if (camera.parent === null) camera.updateMatrixWorld();
+
+                       if (xr.enabled === true && xr.isPresenting === true) {
+                               if (xr.cameraAutoUpdate === true) xr.updateCamera(camera);
+                               camera = xr.getCamera(); // use XR camera for rendering
+                       } //
+
+
+                       if (scene.isScene === true) scene.onBeforeRender(_this, scene, camera, _currentRenderTarget);
+                       currentRenderState = renderStates.get(scene, renderStateStack.length);
+                       currentRenderState.init();
+                       renderStateStack.push(currentRenderState);
+
+                       _projScreenMatrix.multiplyMatrices(camera.projectionMatrix, camera.matrixWorldInverse);
+
+                       _frustum.setFromProjectionMatrix(_projScreenMatrix);
+
+                       _localClippingEnabled = this.localClippingEnabled;
+                       _clippingEnabled = clipping.init(this.clippingPlanes, _localClippingEnabled, camera);
+                       currentRenderList = renderLists.get(scene, renderListStack.length);
+                       currentRenderList.init();
+                       renderListStack.push(currentRenderList);
+                       projectObject(scene, camera, 0, _this.sortObjects);
+                       currentRenderList.finish();
+
+                       if (_this.sortObjects === true) {
+                               currentRenderList.sort(_opaqueSort, _transparentSort);
+                       } //
+
+
+                       if (_clippingEnabled === true) clipping.beginShadows();
+                       const shadowsArray = currentRenderState.state.shadowsArray;
+                       shadowMap.render(shadowsArray, scene, camera);
+                       if (_clippingEnabled === true) clipping.endShadows(); //
+
+                       if (this.info.autoReset === true) this.info.reset(); //
+
+                       background.render(currentRenderList, scene); // render scene
+
+                       currentRenderState.setupLights(_this.physicallyCorrectLights);
+
+                       if (camera.isArrayCamera) {
+                               const cameras = camera.cameras;
+
+                               for (let i = 0, l = cameras.length; i < l; i++) {
+                                       const camera2 = cameras[i];
+                                       renderScene(currentRenderList, scene, camera2, camera2.viewport);
+                               }
+                       } else {
+                               renderScene(currentRenderList, scene, camera);
+                       } //
+
+
+                       if (_currentRenderTarget !== null) {
+                               // resolve multisample renderbuffers to a single-sample texture if necessary
+                               textures.updateMultisampleRenderTarget(_currentRenderTarget); // Generate mipmap if we're using any kind of mipmap filtering
+
+                               textures.updateRenderTargetMipmap(_currentRenderTarget);
+                       } //
+
+
+                       if (scene.isScene === true) scene.onAfterRender(_this, scene, camera); // Ensure depth buffer writing is enabled so it can be cleared on next render
+
+                       state.buffers.depth.setTest(true);
+                       state.buffers.depth.setMask(true);
+                       state.buffers.color.setMask(true);
+                       state.setPolygonOffset(false); // _gl.finish();
+
+                       bindingStates.resetDefaultState();
+                       _currentMaterialId = -1;
+                       _currentCamera = null;
+                       renderStateStack.pop();
+
+                       if (renderStateStack.length > 0) {
+                               currentRenderState = renderStateStack[renderStateStack.length - 1];
+                       } else {
+                               currentRenderState = null;
+                       }
+
+                       renderListStack.pop();
+
+                       if (renderListStack.length > 0) {
+                               currentRenderList = renderListStack[renderListStack.length - 1];
+                       } else {
+                               currentRenderList = null;
+                       }
+               };
+
+               function projectObject(object, camera, groupOrder, sortObjects) {
+                       if (object.visible === false) return;
+                       const visible = object.layers.test(camera.layers);
+
+                       if (visible) {
+                               if (object.isGroup) {
+                                       groupOrder = object.renderOrder;
+                               } else if (object.isLOD) {
+                                       if (object.autoUpdate === true) object.update(camera);
+                               } else if (object.isLight) {
+                                       currentRenderState.pushLight(object);
+
+                                       if (object.castShadow) {
+                                               currentRenderState.pushShadow(object);
+                                       }
+                               } else if (object.isSprite) {
+                                       if (!object.frustumCulled || _frustum.intersectsSprite(object)) {
+                                               if (sortObjects) {
+                                                       _vector3.setFromMatrixPosition(object.matrixWorld).applyMatrix4(_projScreenMatrix);
+                                               }
+
+                                               const geometry = objects.update(object);
+                                               const material = object.material;
+
+                                               if (material.visible) {
+                                                       currentRenderList.push(object, geometry, material, groupOrder, _vector3.z, null);
+                                               }
+                                       }
+                               } else if (object.isImmediateRenderObject) {
+                                       if (sortObjects) {
+                                               _vector3.setFromMatrixPosition(object.matrixWorld).applyMatrix4(_projScreenMatrix);
+                                       }
+
+                                       currentRenderList.push(object, null, object.material, groupOrder, _vector3.z, null);
+                               } else if (object.isMesh || object.isLine || object.isPoints) {
+                                       if (object.isSkinnedMesh) {
+                                               // update skeleton only once in a frame
+                                               if (object.skeleton.frame !== info.render.frame) {
+                                                       object.skeleton.update();
+                                                       object.skeleton.frame = info.render.frame;
+                                               }
+                                       }
+
+                                       if (!object.frustumCulled || _frustum.intersectsObject(object)) {
+                                               if (sortObjects) {
+                                                       _vector3.setFromMatrixPosition(object.matrixWorld).applyMatrix4(_projScreenMatrix);
+                                               }
+
+                                               const geometry = objects.update(object);
+                                               const material = object.material;
+
+                                               if (Array.isArray(material)) {
+                                                       const groups = geometry.groups;
+
+                                                       for (let i = 0, l = groups.length; i < l; i++) {
+                                                               const group = groups[i];
+                                                               const groupMaterial = material[group.materialIndex];
+
+                                                               if (groupMaterial && groupMaterial.visible) {
+                                                                       currentRenderList.push(object, geometry, groupMaterial, groupOrder, _vector3.z, group);
+                                                               }
+                                                       }
+                                               } else if (material.visible) {
+                                                       currentRenderList.push(object, geometry, material, groupOrder, _vector3.z, null);
+                                               }
+                                       }
+                               }
+                       }
+
+                       const children = object.children;
+
+                       for (let i = 0, l = children.length; i < l; i++) {
+                               projectObject(children[i], camera, groupOrder, sortObjects);
+                       }
+               }
+
+               function renderScene(currentRenderList, scene, camera, viewport) {
+                       const opaqueObjects = currentRenderList.opaque;
+                       const transmissiveObjects = currentRenderList.transmissive;
+                       const transparentObjects = currentRenderList.transparent;
+                       currentRenderState.setupLightsView(camera);
+                       if (transmissiveObjects.length > 0) renderTransmissionPass(opaqueObjects, scene, camera);
+                       if (viewport) state.viewport(_currentViewport.copy(viewport));
+                       if (opaqueObjects.length > 0) renderObjects(opaqueObjects, scene, camera);
+                       if (transmissiveObjects.length > 0) renderObjects(transmissiveObjects, scene, camera);
+                       if (transparentObjects.length > 0) renderObjects(transparentObjects, scene, camera);
+               }
+
+               function renderTransmissionPass(opaqueObjects, scene, camera) {
+                       if (_transmissionRenderTarget === null) {
+                               const needsAntialias = _antialias === true && capabilities.isWebGL2 === true;
+                               const renderTargetType = needsAntialias ? WebGLMultisampleRenderTarget : WebGLRenderTarget;
+                               _transmissionRenderTarget = new renderTargetType(1024, 1024, {
+                                       generateMipmaps: true,
+                                       type: utils.convert(HalfFloatType) !== null ? HalfFloatType : UnsignedByteType,
+                                       minFilter: LinearMipmapLinearFilter,
+                                       magFilter: NearestFilter,
+                                       wrapS: ClampToEdgeWrapping,
+                                       wrapT: ClampToEdgeWrapping
+                               });
+                       }
+
+                       const currentRenderTarget = _this.getRenderTarget();
+
+                       _this.setRenderTarget(_transmissionRenderTarget);
+
+                       _this.clear(); // Turn off the features which can affect the frag color for opaque objects pass.
+                       // Otherwise they are applied twice in opaque objects pass and transmission objects pass.
+
+
+                       const currentToneMapping = _this.toneMapping;
+                       _this.toneMapping = NoToneMapping;
+                       renderObjects(opaqueObjects, scene, camera);
+                       _this.toneMapping = currentToneMapping;
+                       textures.updateMultisampleRenderTarget(_transmissionRenderTarget);
+                       textures.updateRenderTargetMipmap(_transmissionRenderTarget);
+
+                       _this.setRenderTarget(currentRenderTarget);
+               }
+
+               function renderObjects(renderList, scene, camera) {
+                       const overrideMaterial = scene.isScene === true ? scene.overrideMaterial : null;
+
+                       for (let i = 0, l = renderList.length; i < l; i++) {
+                               const renderItem = renderList[i];
+                               const object = renderItem.object;
+                               const geometry = renderItem.geometry;
+                               const material = overrideMaterial === null ? renderItem.material : overrideMaterial;
+                               const group = renderItem.group;
+
+                               if (object.layers.test(camera.layers)) {
+                                       renderObject(object, scene, camera, geometry, material, group);
+                               }
+                       }
+               }
+
+               function renderObject(object, scene, camera, geometry, material, group) {
+                       object.onBeforeRender(_this, scene, camera, geometry, material, group);
+                       object.modelViewMatrix.multiplyMatrices(camera.matrixWorldInverse, object.matrixWorld);
+                       object.normalMatrix.getNormalMatrix(object.modelViewMatrix);
+
+                       if (object.isImmediateRenderObject) {
+                               const program = setProgram(camera, scene, material, object);
+                               state.setMaterial(material);
+                               bindingStates.reset();
+                               renderObjectImmediate(object, program);
+                       } else {
+                               if (material.transparent === true && material.side === DoubleSide) {
+                                       material.side = BackSide;
+                                       material.needsUpdate = true;
+
+                                       _this.renderBufferDirect(camera, scene, geometry, material, object, group);
+
+                                       material.side = FrontSide;
+                                       material.needsUpdate = true;
+
+                                       _this.renderBufferDirect(camera, scene, geometry, material, object, group);
+
+                                       material.side = DoubleSide;
+                               } else {
+                                       _this.renderBufferDirect(camera, scene, geometry, material, object, group);
+                               }
+                       }
+
+                       object.onAfterRender(_this, scene, camera, geometry, material, group);
+               }
+
+               function getProgram(material, scene, object) {
+                       if (scene.isScene !== true) scene = _emptyScene; // scene could be a Mesh, Line, Points, ...
+
+                       const materialProperties = properties.get(material);
+                       const lights = currentRenderState.state.lights;
+                       const shadowsArray = currentRenderState.state.shadowsArray;
+                       const lightsStateVersion = lights.state.version;
+                       const parameters = programCache.getParameters(material, lights.state, shadowsArray, scene, object);
+                       const programCacheKey = programCache.getProgramCacheKey(parameters);
+                       let programs = materialProperties.programs; // always update environment and fog - changing these trigger an getProgram call, but it's possible that the program doesn't change
+
+                       materialProperties.environment = material.isMeshStandardMaterial ? scene.environment : null;
+                       materialProperties.fog = scene.fog;
+                       materialProperties.envMap = (material.isMeshStandardMaterial ? cubeuvmaps : cubemaps).get(material.envMap || materialProperties.environment);
+
+                       if (programs === undefined) {
+                               // new material
+                               material.addEventListener('dispose', onMaterialDispose);
+                               programs = new Map();
+                               materialProperties.programs = programs;
+                       }
+
+                       let program = programs.get(programCacheKey);
+
+                       if (program !== undefined) {
+                               // early out if program and light state is identical
+                               if (materialProperties.currentProgram === program && materialProperties.lightsStateVersion === lightsStateVersion) {
+                                       updateCommonMaterialProperties(material, parameters);
+                                       return program;
+                               }
+                       } else {
+                               parameters.uniforms = programCache.getUniforms(material);
+                               material.onBuild(parameters, _this);
+                               material.onBeforeCompile(parameters, _this);
+                               program = programCache.acquireProgram(parameters, programCacheKey);
+                               programs.set(programCacheKey, program);
+                               materialProperties.uniforms = parameters.uniforms;
+                       }
+
+                       const uniforms = materialProperties.uniforms;
+
+                       if (!material.isShaderMaterial && !material.isRawShaderMaterial || material.clipping === true) {
+                               uniforms.clippingPlanes = clipping.uniform;
+                       }
+
+                       updateCommonMaterialProperties(material, parameters); // store the light setup it was created for
+
+                       materialProperties.needsLights = materialNeedsLights(material);
+                       materialProperties.lightsStateVersion = lightsStateVersion;
+
+                       if (materialProperties.needsLights) {
+                               // wire up the material to this renderer's lighting state
+                               uniforms.ambientLightColor.value = lights.state.ambient;
+                               uniforms.lightProbe.value = lights.state.probe;
+                               uniforms.directionalLights.value = lights.state.directional;
+                               uniforms.directionalLightShadows.value = lights.state.directionalShadow;
+                               uniforms.spotLights.value = lights.state.spot;
+                               uniforms.spotLightShadows.value = lights.state.spotShadow;
+                               uniforms.rectAreaLights.value = lights.state.rectArea;
+                               uniforms.ltc_1.value = lights.state.rectAreaLTC1;
+                               uniforms.ltc_2.value = lights.state.rectAreaLTC2;
+                               uniforms.pointLights.value = lights.state.point;
+                               uniforms.pointLightShadows.value = lights.state.pointShadow;
+                               uniforms.hemisphereLights.value = lights.state.hemi;
+                               uniforms.directionalShadowMap.value = lights.state.directionalShadowMap;
+                               uniforms.directionalShadowMatrix.value = lights.state.directionalShadowMatrix;
+                               uniforms.spotShadowMap.value = lights.state.spotShadowMap;
+                               uniforms.spotShadowMatrix.value = lights.state.spotShadowMatrix;
+                               uniforms.pointShadowMap.value = lights.state.pointShadowMap;
+                               uniforms.pointShadowMatrix.value = lights.state.pointShadowMatrix; // TODO (abelnation): add area lights shadow info to uniforms
+                       }
+
+                       const progUniforms = program.getUniforms();
+                       const uniformsList = WebGLUniforms.seqWithValue(progUniforms.seq, uniforms);
+                       materialProperties.currentProgram = program;
+                       materialProperties.uniformsList = uniformsList;
+                       return program;
+               }
+
+               function updateCommonMaterialProperties(material, parameters) {
+                       const materialProperties = properties.get(material);
+                       materialProperties.outputEncoding = parameters.outputEncoding;
+                       materialProperties.instancing = parameters.instancing;
+                       materialProperties.skinning = parameters.skinning;
+                       materialProperties.morphTargets = parameters.morphTargets;
+                       materialProperties.morphNormals = parameters.morphNormals;
+                       materialProperties.numClippingPlanes = parameters.numClippingPlanes;
+                       materialProperties.numIntersection = parameters.numClipIntersection;
+                       materialProperties.vertexAlphas = parameters.vertexAlphas;
+                       materialProperties.vertexTangents = parameters.vertexTangents;
+               }
+
+               function setProgram(camera, scene, material, object) {
+                       if (scene.isScene !== true) scene = _emptyScene; // scene could be a Mesh, Line, Points, ...
+
+                       textures.resetTextureUnits();
+                       const fog = scene.fog;
+                       const environment = material.isMeshStandardMaterial ? scene.environment : null;
+                       const encoding = _currentRenderTarget === null ? _this.outputEncoding : _currentRenderTarget.texture.encoding;
+                       const envMap = (material.isMeshStandardMaterial ? cubeuvmaps : cubemaps).get(material.envMap || environment);
+                       const vertexAlphas = material.vertexColors === true && !!object.geometry && !!object.geometry.attributes.color && object.geometry.attributes.color.itemSize === 4;
+                       const vertexTangents = !!object.geometry && !!object.geometry.attributes.tangent;
+                       const morphTargets = !!object.geometry && !!object.geometry.morphAttributes.position;
+                       const morphNormals = !!object.geometry && !!object.geometry.morphAttributes.normal;
+                       const materialProperties = properties.get(material);
+                       const lights = currentRenderState.state.lights;
+
+                       if (_clippingEnabled === true) {
+                               if (_localClippingEnabled === true || camera !== _currentCamera) {
+                                       const useCache = camera === _currentCamera && material.id === _currentMaterialId; // we might want to call this function with some ClippingGroup
+                                       // object instead of the material, once it becomes feasible
+                                       // (#8465, #8379)
+
+                                       clipping.setState(material, camera, useCache);
+                               }
+                       } //
+
+
+                       let needsProgramChange = false;
+
+                       if (material.version === materialProperties.__version) {
+                               if (materialProperties.needsLights && materialProperties.lightsStateVersion !== lights.state.version) {
+                                       needsProgramChange = true;
+                               } else if (materialProperties.outputEncoding !== encoding) {
+                                       needsProgramChange = true;
+                               } else if (object.isInstancedMesh && materialProperties.instancing === false) {
+                                       needsProgramChange = true;
+                               } else if (!object.isInstancedMesh && materialProperties.instancing === true) {
+                                       needsProgramChange = true;
+                               } else if (object.isSkinnedMesh && materialProperties.skinning === false) {
+                                       needsProgramChange = true;
+                               } else if (!object.isSkinnedMesh && materialProperties.skinning === true) {
+                                       needsProgramChange = true;
+                               } else if (materialProperties.envMap !== envMap) {
+                                       needsProgramChange = true;
+                               } else if (material.fog && materialProperties.fog !== fog) {
+                                       needsProgramChange = true;
+                               } else if (materialProperties.numClippingPlanes !== undefined && (materialProperties.numClippingPlanes !== clipping.numPlanes || materialProperties.numIntersection !== clipping.numIntersection)) {
+                                       needsProgramChange = true;
+                               } else if (materialProperties.vertexAlphas !== vertexAlphas) {
+                                       needsProgramChange = true;
+                               } else if (materialProperties.vertexTangents !== vertexTangents) {
+                                       needsProgramChange = true;
+                               } else if (materialProperties.morphTargets !== morphTargets) {
+                                       needsProgramChange = true;
+                               } else if (materialProperties.morphNormals !== morphNormals) {
+                                       needsProgramChange = true;
+                               }
+                       } else {
+                               needsProgramChange = true;
+                               materialProperties.__version = material.version;
+                       } //
+
+
+                       let program = materialProperties.currentProgram;
+
+                       if (needsProgramChange === true) {
+                               program = getProgram(material, scene, object);
+                       }
+
+                       let refreshProgram = false;
+                       let refreshMaterial = false;
+                       let refreshLights = false;
+                       const p_uniforms = program.getUniforms(),
+                                               m_uniforms = materialProperties.uniforms;
+
+                       if (state.useProgram(program.program)) {
+                               refreshProgram = true;
+                               refreshMaterial = true;
+                               refreshLights = true;
+                       }
+
+                       if (material.id !== _currentMaterialId) {
+                               _currentMaterialId = material.id;
+                               refreshMaterial = true;
+                       }
+
+                       if (refreshProgram || _currentCamera !== camera) {
+                               p_uniforms.setValue(_gl, 'projectionMatrix', camera.projectionMatrix);
+
+                               if (capabilities.logarithmicDepthBuffer) {
+                                       p_uniforms.setValue(_gl, 'logDepthBufFC', 2.0 / (Math.log(camera.far + 1.0) / Math.LN2));
+                               }
+
+                               if (_currentCamera !== camera) {
+                                       _currentCamera = camera; // lighting uniforms depend on the camera so enforce an update
+                                       // now, in case this material supports lights - or later, when
+                                       // the next material that does gets activated:
+
+                                       refreshMaterial = true; // set to true on material change
+
+                                       refreshLights = true; // remains set until update done
+                               } // load material specific uniforms
+                               // (shader material also gets them for the sake of genericity)
+
+
+                               if (material.isShaderMaterial || material.isMeshPhongMaterial || material.isMeshToonMaterial || material.isMeshStandardMaterial || material.envMap) {
+                                       const uCamPos = p_uniforms.map.cameraPosition;
+
+                                       if (uCamPos !== undefined) {
+                                               uCamPos.setValue(_gl, _vector3.setFromMatrixPosition(camera.matrixWorld));
+                                       }
+                               }
+
+                               if (material.isMeshPhongMaterial || material.isMeshToonMaterial || material.isMeshLambertMaterial || material.isMeshBasicMaterial || material.isMeshStandardMaterial || material.isShaderMaterial) {
+                                       p_uniforms.setValue(_gl, 'isOrthographic', camera.isOrthographicCamera === true);
+                               }
+
+                               if (material.isMeshPhongMaterial || material.isMeshToonMaterial || material.isMeshLambertMaterial || material.isMeshBasicMaterial || material.isMeshStandardMaterial || material.isShaderMaterial || material.isShadowMaterial || object.isSkinnedMesh) {
+                                       p_uniforms.setValue(_gl, 'viewMatrix', camera.matrixWorldInverse);
+                               }
+                       } // skinning uniforms must be set even if material didn't change
+                       // auto-setting of texture unit for bone texture must go before other textures
+                       // otherwise textures used for skinning can take over texture units reserved for other material textures
+
+
+                       if (object.isSkinnedMesh) {
+                               p_uniforms.setOptional(_gl, object, 'bindMatrix');
+                               p_uniforms.setOptional(_gl, object, 'bindMatrixInverse');
+                               const skeleton = object.skeleton;
+
+                               if (skeleton) {
+                                       if (capabilities.floatVertexTextures) {
+                                               if (skeleton.boneTexture === null) skeleton.computeBoneTexture();
+                                               p_uniforms.setValue(_gl, 'boneTexture', skeleton.boneTexture, textures);
+                                               p_uniforms.setValue(_gl, 'boneTextureSize', skeleton.boneTextureSize);
+                                       } else {
+                                               p_uniforms.setOptional(_gl, skeleton, 'boneMatrices');
+                                       }
+                               }
+                       }
+
+                       if (refreshMaterial || materialProperties.receiveShadow !== object.receiveShadow) {
+                               materialProperties.receiveShadow = object.receiveShadow;
+                               p_uniforms.setValue(_gl, 'receiveShadow', object.receiveShadow);
+                       }
+
+                       if (refreshMaterial) {
+                               p_uniforms.setValue(_gl, 'toneMappingExposure', _this.toneMappingExposure);
+
+                               if (materialProperties.needsLights) {
+                                       // the current material requires lighting info
+                                       // note: all lighting uniforms are always set correctly
+                                       // they simply reference the renderer's state for their
+                                       // values
+                                       //
+                                       // use the current material's .needsUpdate flags to set
+                                       // the GL state when required
+                                       markUniformsLightsNeedsUpdate(m_uniforms, refreshLights);
+                               } // refresh uniforms common to several materials
+
+
+                               if (fog && material.fog) {
+                                       materials.refreshFogUniforms(m_uniforms, fog);
+                               }
+
+                               materials.refreshMaterialUniforms(m_uniforms, material, _pixelRatio, _height, _transmissionRenderTarget);
+                               WebGLUniforms.upload(_gl, materialProperties.uniformsList, m_uniforms, textures);
+                       }
+
+                       if (material.isShaderMaterial && material.uniformsNeedUpdate === true) {
+                               WebGLUniforms.upload(_gl, materialProperties.uniformsList, m_uniforms, textures);
+                               material.uniformsNeedUpdate = false;
+                       }
+
+                       if (material.isSpriteMaterial) {
+                               p_uniforms.setValue(_gl, 'center', object.center);
+                       } // common matrices
+
+
+                       p_uniforms.setValue(_gl, 'modelViewMatrix', object.modelViewMatrix);
+                       p_uniforms.setValue(_gl, 'normalMatrix', object.normalMatrix);
+                       p_uniforms.setValue(_gl, 'modelMatrix', object.matrixWorld);
+                       return program;
+               } // If uniforms are marked as clean, they don't need to be loaded to the GPU.
+
+
+               function markUniformsLightsNeedsUpdate(uniforms, value) {
+                       uniforms.ambientLightColor.needsUpdate = value;
+                       uniforms.lightProbe.needsUpdate = value;
+                       uniforms.directionalLights.needsUpdate = value;
+                       uniforms.directionalLightShadows.needsUpdate = value;
+                       uniforms.pointLights.needsUpdate = value;
+                       uniforms.pointLightShadows.needsUpdate = value;
+                       uniforms.spotLights.needsUpdate = value;
+                       uniforms.spotLightShadows.needsUpdate = value;
+                       uniforms.rectAreaLights.needsUpdate = value;
+                       uniforms.hemisphereLights.needsUpdate = value;
+               }
+
+               function materialNeedsLights(material) {
+                       return material.isMeshLambertMaterial || material.isMeshToonMaterial || material.isMeshPhongMaterial || material.isMeshStandardMaterial || material.isShadowMaterial || material.isShaderMaterial && material.lights === true;
+               }
+
+               this.getActiveCubeFace = function () {
+                       return _currentActiveCubeFace;
+               };
+
+               this.getActiveMipmapLevel = function () {
+                       return _currentActiveMipmapLevel;
+               };
+
+               this.getRenderTarget = function () {
+                       return _currentRenderTarget;
+               };
+
+               this.setRenderTarget = function (renderTarget, activeCubeFace = 0, activeMipmapLevel = 0) {
+                       _currentRenderTarget = renderTarget;
+                       _currentActiveCubeFace = activeCubeFace;
+                       _currentActiveMipmapLevel = activeMipmapLevel;
+
+                       if (renderTarget && properties.get(renderTarget).__webglFramebuffer === undefined) {
+                               textures.setupRenderTarget(renderTarget);
+                       }
+
+                       let framebuffer = null;
+                       let isCube = false;
+                       let isRenderTarget3D = false;
+
+                       if (renderTarget) {
+                               const texture = renderTarget.texture;
+
+                               if (texture.isDataTexture3D || texture.isDataTexture2DArray) {
+                                       isRenderTarget3D = true;
+                               }
+
+                               const __webglFramebuffer = properties.get(renderTarget).__webglFramebuffer;
+
+                               if (renderTarget.isWebGLCubeRenderTarget) {
+                                       framebuffer = __webglFramebuffer[activeCubeFace];
+                                       isCube = true;
+                               } else if (renderTarget.isWebGLMultisampleRenderTarget) {
+                                       framebuffer = properties.get(renderTarget).__webglMultisampledFramebuffer;
+                               } else {
+                                       framebuffer = __webglFramebuffer;
+                               }
+
+                               _currentViewport.copy(renderTarget.viewport);
+
+                               _currentScissor.copy(renderTarget.scissor);
+
+                               _currentScissorTest = renderTarget.scissorTest;
+                       } else {
+                               _currentViewport.copy(_viewport).multiplyScalar(_pixelRatio).floor();
+
+                               _currentScissor.copy(_scissor).multiplyScalar(_pixelRatio).floor();
+
+                               _currentScissorTest = _scissorTest;
+                       }
+
+                       const framebufferBound = state.bindFramebuffer(_gl.FRAMEBUFFER, framebuffer);
+
+                       if (framebufferBound && capabilities.drawBuffers) {
+                               let needsUpdate = false;
+
+                               if (renderTarget) {
+                                       if (renderTarget.isWebGLMultipleRenderTargets) {
+                                               const textures = renderTarget.texture;
+
+                                               if (_currentDrawBuffers.length !== textures.length || _currentDrawBuffers[0] !== _gl.COLOR_ATTACHMENT0) {
+                                                       for (let i = 0, il = textures.length; i < il; i++) {
+                                                               _currentDrawBuffers[i] = _gl.COLOR_ATTACHMENT0 + i;
+                                                       }
+
+                                                       _currentDrawBuffers.length = textures.length;
+                                                       needsUpdate = true;
+                                               }
+                                       } else {
+                                               if (_currentDrawBuffers.length !== 1 || _currentDrawBuffers[0] !== _gl.COLOR_ATTACHMENT0) {
+                                                       _currentDrawBuffers[0] = _gl.COLOR_ATTACHMENT0;
+                                                       _currentDrawBuffers.length = 1;
+                                                       needsUpdate = true;
+                                               }
+                                       }
+                               } else {
+                                       if (_currentDrawBuffers.length !== 1 || _currentDrawBuffers[0] !== _gl.BACK) {
+                                               _currentDrawBuffers[0] = _gl.BACK;
+                                               _currentDrawBuffers.length = 1;
+                                               needsUpdate = true;
+                                       }
+                               }
+
+                               if (needsUpdate) {
+                                       if (capabilities.isWebGL2) {
+                                               _gl.drawBuffers(_currentDrawBuffers);
+                                       } else {
+                                               extensions.get('WEBGL_draw_buffers').drawBuffersWEBGL(_currentDrawBuffers);
+                                       }
+                               }
+                       }
+
+                       state.viewport(_currentViewport);
+                       state.scissor(_currentScissor);
+                       state.setScissorTest(_currentScissorTest);
+
+                       if (isCube) {
+                               const textureProperties = properties.get(renderTarget.texture);
+
+                               _gl.framebufferTexture2D(_gl.FRAMEBUFFER, _gl.COLOR_ATTACHMENT0, _gl.TEXTURE_CUBE_MAP_POSITIVE_X + activeCubeFace, textureProperties.__webglTexture, activeMipmapLevel);
+                       } else if (isRenderTarget3D) {
+                               const textureProperties = properties.get(renderTarget.texture);
+                               const layer = activeCubeFace || 0;
+
+                               _gl.framebufferTextureLayer(_gl.FRAMEBUFFER, _gl.COLOR_ATTACHMENT0, textureProperties.__webglTexture, activeMipmapLevel || 0, layer);
+                       }
+
+                       _currentMaterialId = -1; // reset current material to ensure correct uniform bindings
+               };
+
+               this.readRenderTargetPixels = function (renderTarget, x, y, width, height, buffer, activeCubeFaceIndex) {
+                       if (!(renderTarget && renderTarget.isWebGLRenderTarget)) {
+                               console.error('THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.');
+                               return;
+                       }
+
+                       let framebuffer = properties.get(renderTarget).__webglFramebuffer;
+
+                       if (renderTarget.isWebGLCubeRenderTarget && activeCubeFaceIndex !== undefined) {
+                               framebuffer = framebuffer[activeCubeFaceIndex];
+                       }
+
+                       if (framebuffer) {
+                               state.bindFramebuffer(_gl.FRAMEBUFFER, framebuffer);
+
+                               try {
+                                       const texture = renderTarget.texture;
+                                       const textureFormat = texture.format;
+                                       const textureType = texture.type;
+
+                                       if (textureFormat !== RGBAFormat && utils.convert(textureFormat) !== _gl.getParameter(_gl.IMPLEMENTATION_COLOR_READ_FORMAT)) {
+                                               console.error('THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.');
+                                               return;
+                                       }
+
+                                       const halfFloatSupportedByExt = textureType === HalfFloatType && (extensions.has('EXT_color_buffer_half_float') || capabilities.isWebGL2 && extensions.has('EXT_color_buffer_float'));
+
+                                       if (textureType !== UnsignedByteType && utils.convert(textureType) !== _gl.getParameter(_gl.IMPLEMENTATION_COLOR_READ_TYPE) && // Edge and Chrome Mac < 52 (#9513)
+                                       !(textureType === FloatType && (capabilities.isWebGL2 || extensions.has('OES_texture_float') || extensions.has('WEBGL_color_buffer_float'))) && // Chrome Mac >= 52 and Firefox
+                                       !halfFloatSupportedByExt) {
+                                               console.error('THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.');
+                                               return;
+                                       }
+
+                                       if (_gl.checkFramebufferStatus(_gl.FRAMEBUFFER) === _gl.FRAMEBUFFER_COMPLETE) {
+                                               // the following if statement ensures valid read requests (no out-of-bounds pixels, see #8604)
+                                               if (x >= 0 && x <= renderTarget.width - width && y >= 0 && y <= renderTarget.height - height) {
+                                                       _gl.readPixels(x, y, width, height, utils.convert(textureFormat), utils.convert(textureType), buffer);
+                                               }
+                                       } else {
+                                               console.error('THREE.WebGLRenderer.readRenderTargetPixels: readPixels from renderTarget failed. Framebuffer not complete.');
+                                       }
+                               } finally {
+                                       // restore framebuffer of current render target if necessary
+                                       const framebuffer = _currentRenderTarget !== null ? properties.get(_currentRenderTarget).__webglFramebuffer : null;
+                                       state.bindFramebuffer(_gl.FRAMEBUFFER, framebuffer);
+                               }
+                       }
+               };
+
+               this.copyFramebufferToTexture = function (position, texture, level = 0) {
+                       const levelScale = Math.pow(2, -level);
+                       const width = Math.floor(texture.image.width * levelScale);
+                       const height = Math.floor(texture.image.height * levelScale);
+                       let glFormat = utils.convert(texture.format);
+
+                       if (capabilities.isWebGL2) {
+                               // Workaround for https://bugs.chromium.org/p/chromium/issues/detail?id=1120100
+                               // Not needed in Chrome 93+
+                               if (glFormat === _gl.RGB) glFormat = _gl.RGB8;
+                               if (glFormat === _gl.RGBA) glFormat = _gl.RGBA8;
+                       }
+
+                       textures.setTexture2D(texture, 0);
+
+                       _gl.copyTexImage2D(_gl.TEXTURE_2D, level, glFormat, position.x, position.y, width, height, 0);
+
+                       state.unbindTexture();
+               };
+
+               this.copyTextureToTexture = function (position, srcTexture, dstTexture, level = 0) {
+                       const width = srcTexture.image.width;
+                       const height = srcTexture.image.height;
+                       const glFormat = utils.convert(dstTexture.format);
+                       const glType = utils.convert(dstTexture.type);
+                       textures.setTexture2D(dstTexture, 0); // As another texture upload may have changed pixelStorei
+                       // parameters, make sure they are correct for the dstTexture
+
+                       _gl.pixelStorei(_gl.UNPACK_FLIP_Y_WEBGL, dstTexture.flipY);
+
+                       _gl.pixelStorei(_gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, dstTexture.premultiplyAlpha);
+
+                       _gl.pixelStorei(_gl.UNPACK_ALIGNMENT, dstTexture.unpackAlignment);
+
+                       if (srcTexture.isDataTexture) {
+                               _gl.texSubImage2D(_gl.TEXTURE_2D, level, position.x, position.y, width, height, glFormat, glType, srcTexture.image.data);
+                       } else {
+                               if (srcTexture.isCompressedTexture) {
+                                       _gl.compressedTexSubImage2D(_gl.TEXTURE_2D, level, position.x, position.y, srcTexture.mipmaps[0].width, srcTexture.mipmaps[0].height, glFormat, srcTexture.mipmaps[0].data);
+                               } else {
+                                       _gl.texSubImage2D(_gl.TEXTURE_2D, level, position.x, position.y, glFormat, glType, srcTexture.image);
+                               }
+                       } // Generate mipmaps only when copying level 0
+
+
+                       if (level === 0 && dstTexture.generateMipmaps) _gl.generateMipmap(_gl.TEXTURE_2D);
+                       state.unbindTexture();
+               };
+
+               this.copyTextureToTexture3D = function (sourceBox, position, srcTexture, dstTexture, level = 0) {
+                       if (_this.isWebGL1Renderer) {
+                               console.warn('THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.');
+                               return;
+                       }
+
+                       const width = sourceBox.max.x - sourceBox.min.x + 1;
+                       const height = sourceBox.max.y - sourceBox.min.y + 1;
+                       const depth = sourceBox.max.z - sourceBox.min.z + 1;
+                       const glFormat = utils.convert(dstTexture.format);
+                       const glType = utils.convert(dstTexture.type);
+                       let glTarget;
+
+                       if (dstTexture.isDataTexture3D) {
+                               textures.setTexture3D(dstTexture, 0);
+                               glTarget = _gl.TEXTURE_3D;
+                       } else if (dstTexture.isDataTexture2DArray) {
+                               textures.setTexture2DArray(dstTexture, 0);
+                               glTarget = _gl.TEXTURE_2D_ARRAY;
+                       } else {
+                               console.warn('THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.');
+                               return;
+                       }
+
+                       _gl.pixelStorei(_gl.UNPACK_FLIP_Y_WEBGL, dstTexture.flipY);
+
+                       _gl.pixelStorei(_gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, dstTexture.premultiplyAlpha);
+
+                       _gl.pixelStorei(_gl.UNPACK_ALIGNMENT, dstTexture.unpackAlignment);
+
+                       const unpackRowLen = _gl.getParameter(_gl.UNPACK_ROW_LENGTH);
+
+                       const unpackImageHeight = _gl.getParameter(_gl.UNPACK_IMAGE_HEIGHT);
+
+                       const unpackSkipPixels = _gl.getParameter(_gl.UNPACK_SKIP_PIXELS);
+
+                       const unpackSkipRows = _gl.getParameter(_gl.UNPACK_SKIP_ROWS);
+
+                       const unpackSkipImages = _gl.getParameter(_gl.UNPACK_SKIP_IMAGES);
+
+                       const image = srcTexture.isCompressedTexture ? srcTexture.mipmaps[0] : srcTexture.image;
+
+                       _gl.pixelStorei(_gl.UNPACK_ROW_LENGTH, image.width);
+
+                       _gl.pixelStorei(_gl.UNPACK_IMAGE_HEIGHT, image.height);
+
+                       _gl.pixelStorei(_gl.UNPACK_SKIP_PIXELS, sourceBox.min.x);
+
+                       _gl.pixelStorei(_gl.UNPACK_SKIP_ROWS, sourceBox.min.y);
+
+                       _gl.pixelStorei(_gl.UNPACK_SKIP_IMAGES, sourceBox.min.z);
+
+                       if (srcTexture.isDataTexture || srcTexture.isDataTexture3D) {
+                               _gl.texSubImage3D(glTarget, level, position.x, position.y, position.z, width, height, depth, glFormat, glType, image.data);
+                       } else {
+                               if (srcTexture.isCompressedTexture) {
+                                       console.warn('THREE.WebGLRenderer.copyTextureToTexture3D: untested support for compressed srcTexture.');
+
+                                       _gl.compressedTexSubImage3D(glTarget, level, position.x, position.y, position.z, width, height, depth, glFormat, image.data);
+                               } else {
+                                       _gl.texSubImage3D(glTarget, level, position.x, position.y, position.z, width, height, depth, glFormat, glType, image);
+                               }
+                       }
+
+                       _gl.pixelStorei(_gl.UNPACK_ROW_LENGTH, unpackRowLen);
+
+                       _gl.pixelStorei(_gl.UNPACK_IMAGE_HEIGHT, unpackImageHeight);
+
+                       _gl.pixelStorei(_gl.UNPACK_SKIP_PIXELS, unpackSkipPixels);
+
+                       _gl.pixelStorei(_gl.UNPACK_SKIP_ROWS, unpackSkipRows);
+
+                       _gl.pixelStorei(_gl.UNPACK_SKIP_IMAGES, unpackSkipImages); // Generate mipmaps only when copying level 0
+
+
+                       if (level === 0 && dstTexture.generateMipmaps) _gl.generateMipmap(glTarget);
+                       state.unbindTexture();
+               };
+
+               this.initTexture = function (texture) {
+                       textures.setTexture2D(texture, 0);
+                       state.unbindTexture();
+               };
+
+               this.resetState = function () {
+                       _currentActiveCubeFace = 0;
+                       _currentActiveMipmapLevel = 0;
+                       _currentRenderTarget = null;
+                       state.reset();
+                       bindingStates.reset();
+               };
+
+               if (typeof __THREE_DEVTOOLS__ !== 'undefined') {
+                       __THREE_DEVTOOLS__.dispatchEvent(new CustomEvent('observe', {
+                               detail: this
+                       })); // eslint-disable-line no-undef
+
+               }
+       }
+
+       class WebGL1Renderer extends WebGLRenderer {}
+
+       WebGL1Renderer.prototype.isWebGL1Renderer = true;
+
+       class FogExp2 {
+               constructor(color, density = 0.00025) {
+                       this.name = '';
+                       this.color = new Color(color);
+                       this.density = density;
+               }
+
+               clone() {
+                       return new FogExp2(this.color, this.density);
+               }
+
+               toJSON() {
+                       return {
+                               type: 'FogExp2',
+                               color: this.color.getHex(),
+                               density: this.density
+                       };
+               }
+
+       }
+
+       FogExp2.prototype.isFogExp2 = true;
+
+       class Fog {
+               constructor(color, near = 1, far = 1000) {
+                       this.name = '';
+                       this.color = new Color(color);
+                       this.near = near;
+                       this.far = far;
+               }
+
+               clone() {
+                       return new Fog(this.color, this.near, this.far);
+               }
+
+               toJSON() {
+                       return {
+                               type: 'Fog',
+                               color: this.color.getHex(),
+                               near: this.near,
+                               far: this.far
+                       };
+               }
+
+       }
+
+       Fog.prototype.isFog = true;
+
+       class Scene extends Object3D {
+               constructor() {
+                       super();
+                       this.type = 'Scene';
+                       this.background = null;
+                       this.environment = null;
+                       this.fog = null;
+                       this.overrideMaterial = null;
+                       this.autoUpdate = true; // checked by the renderer
+
+                       if (typeof __THREE_DEVTOOLS__ !== 'undefined') {
+                               __THREE_DEVTOOLS__.dispatchEvent(new CustomEvent('observe', {
+                                       detail: this
+                               })); // eslint-disable-line no-undef
+
+                       }
+               }
+
+               copy(source, recursive) {
+                       super.copy(source, recursive);
+                       if (source.background !== null) this.background = source.background.clone();
+                       if (source.environment !== null) this.environment = source.environment.clone();
+                       if (source.fog !== null) this.fog = source.fog.clone();
+                       if (source.overrideMaterial !== null) this.overrideMaterial = source.overrideMaterial.clone();
+                       this.autoUpdate = source.autoUpdate;
+                       this.matrixAutoUpdate = source.matrixAutoUpdate;
+                       return this;
+               }
+
+               toJSON(meta) {
+                       const data = super.toJSON(meta);
+                       if (this.fog !== null) data.object.fog = this.fog.toJSON();
+                       return data;
+               }
+
+       }
+
+       Scene.prototype.isScene = true;
+
+       class InterleavedBuffer {
+               constructor(array, stride) {
+                       this.array = array;
+                       this.stride = stride;
+                       this.count = array !== undefined ? array.length / stride : 0;
+                       this.usage = StaticDrawUsage;
+                       this.updateRange = {
+                               offset: 0,
+                               count: -1
+                       };
+                       this.version = 0;
+                       this.uuid = generateUUID();
+               }
+
+               onUploadCallback() {}
+
+               set needsUpdate(value) {
+                       if (value === true) this.version++;
+               }
+
+               setUsage(value) {
+                       this.usage = value;
+                       return this;
+               }
+
+               copy(source) {
+                       this.array = new source.array.constructor(source.array);
+                       this.count = source.count;
+                       this.stride = source.stride;
+                       this.usage = source.usage;
+                       return this;
+               }
+
+               copyAt(index1, attribute, index2) {
+                       index1 *= this.stride;
+                       index2 *= attribute.stride;
+
+                       for (let i = 0, l = this.stride; i < l; i++) {
+                               this.array[index1 + i] = attribute.array[index2 + i];
+                       }
+
+                       return this;
+               }
+
+               set(value, offset = 0) {
+                       this.array.set(value, offset);
+                       return this;
+               }
+
+               clone(data) {
+                       if (data.arrayBuffers === undefined) {
+                               data.arrayBuffers = {};
+                       }
+
+                       if (this.array.buffer._uuid === undefined) {
+                               this.array.buffer._uuid = generateUUID();
+                       }
+
+                       if (data.arrayBuffers[this.array.buffer._uuid] === undefined) {
+                               data.arrayBuffers[this.array.buffer._uuid] = this.array.slice(0).buffer;
+                       }
+
+                       const array = new this.array.constructor(data.arrayBuffers[this.array.buffer._uuid]);
+                       const ib = new this.constructor(array, this.stride);
+                       ib.setUsage(this.usage);
+                       return ib;
+               }
+
+               onUpload(callback) {
+                       this.onUploadCallback = callback;
+                       return this;
+               }
+
+               toJSON(data) {
+                       if (data.arrayBuffers === undefined) {
+                               data.arrayBuffers = {};
+                       } // generate UUID for array buffer if necessary
+
+
+                       if (this.array.buffer._uuid === undefined) {
+                               this.array.buffer._uuid = generateUUID();
+                       }
+
+                       if (data.arrayBuffers[this.array.buffer._uuid] === undefined) {
+                               data.arrayBuffers[this.array.buffer._uuid] = Array.prototype.slice.call(new Uint32Array(this.array.buffer));
+                       } //
+
+
+                       return {
+                               uuid: this.uuid,
+                               buffer: this.array.buffer._uuid,
+                               type: this.array.constructor.name,
+                               stride: this.stride
+                       };
+               }
+
+       }
+
+       InterleavedBuffer.prototype.isInterleavedBuffer = true;
+
+       const _vector$6 = /*@__PURE__*/new Vector3();
+
+       class InterleavedBufferAttribute {
+               constructor(interleavedBuffer, itemSize, offset, normalized = false) {
+                       this.name = '';
+                       this.data = interleavedBuffer;
+                       this.itemSize = itemSize;
+                       this.offset = offset;
+                       this.normalized = normalized === true;
+               }
+
+               get count() {
+                       return this.data.count;
+               }
+
+               get array() {
+                       return this.data.array;
+               }
+
+               set needsUpdate(value) {
+                       this.data.needsUpdate = value;
+               }
+
+               applyMatrix4(m) {
+                       for (let i = 0, l = this.data.count; i < l; i++) {
+                               _vector$6.x = this.getX(i);
+                               _vector$6.y = this.getY(i);
+                               _vector$6.z = this.getZ(i);
+
+                               _vector$6.applyMatrix4(m);
+
+                               this.setXYZ(i, _vector$6.x, _vector$6.y, _vector$6.z);
+                       }
+
+                       return this;
+               }
+
+               applyNormalMatrix(m) {
+                       for (let i = 0, l = this.count; i < l; i++) {
+                               _vector$6.x = this.getX(i);
+                               _vector$6.y = this.getY(i);
+                               _vector$6.z = this.getZ(i);
+
+                               _vector$6.applyNormalMatrix(m);
+
+                               this.setXYZ(i, _vector$6.x, _vector$6.y, _vector$6.z);
+                       }
+
+                       return this;
+               }
+
+               transformDirection(m) {
+                       for (let i = 0, l = this.count; i < l; i++) {
+                               _vector$6.x = this.getX(i);
+                               _vector$6.y = this.getY(i);
+                               _vector$6.z = this.getZ(i);
+
+                               _vector$6.transformDirection(m);
+
+                               this.setXYZ(i, _vector$6.x, _vector$6.y, _vector$6.z);
+                       }
+
+                       return this;
+               }
+
+               setX(index, x) {
+                       this.data.array[index * this.data.stride + this.offset] = x;
+                       return this;
+               }
+
+               setY(index, y) {
+                       this.data.array[index * this.data.stride + this.offset + 1] = y;
+                       return this;
+               }
+
+               setZ(index, z) {
+                       this.data.array[index * this.data.stride + this.offset + 2] = z;
+                       return this;
+               }
+
+               setW(index, w) {
+                       this.data.array[index * this.data.stride + this.offset + 3] = w;
+                       return this;
+               }
+
+               getX(index) {
+                       return this.data.array[index * this.data.stride + this.offset];
+               }
+
+               getY(index) {
+                       return this.data.array[index * this.data.stride + this.offset + 1];
+               }
+
+               getZ(index) {
+                       return this.data.array[index * this.data.stride + this.offset + 2];
+               }
+
+               getW(index) {
+                       return this.data.array[index * this.data.stride + this.offset + 3];
+               }
+
+               setXY(index, x, y) {
+                       index = index * this.data.stride + this.offset;
+                       this.data.array[index + 0] = x;
+                       this.data.array[index + 1] = y;
+                       return this;
+               }
+
+               setXYZ(index, x, y, z) {
+                       index = index * this.data.stride + this.offset;
+                       this.data.array[index + 0] = x;
+                       this.data.array[index + 1] = y;
+                       this.data.array[index + 2] = z;
+                       return this;
+               }
+
+               setXYZW(index, x, y, z, w) {
+                       index = index * this.data.stride + this.offset;
+                       this.data.array[index + 0] = x;
+                       this.data.array[index + 1] = y;
+                       this.data.array[index + 2] = z;
+                       this.data.array[index + 3] = w;
+                       return this;
+               }
+
+               clone(data) {
+                       if (data === undefined) {
+                               console.log('THREE.InterleavedBufferAttribute.clone(): Cloning an interlaved buffer attribute will deinterleave buffer data.');
+                               const array = [];
+
+                               for (let i = 0; i < this.count; i++) {
+                                       const index = i * this.data.stride + this.offset;
+
+                                       for (let j = 0; j < this.itemSize; j++) {
+                                               array.push(this.data.array[index + j]);
+                                       }
+                               }
+
+                               return new BufferAttribute(new this.array.constructor(array), this.itemSize, this.normalized);
+                       } else {
+                               if (data.interleavedBuffers === undefined) {
+                                       data.interleavedBuffers = {};
+                               }
+
+                               if (data.interleavedBuffers[this.data.uuid] === undefined) {
+                                       data.interleavedBuffers[this.data.uuid] = this.data.clone(data);
+                               }
+
+                               return new InterleavedBufferAttribute(data.interleavedBuffers[this.data.uuid], this.itemSize, this.offset, this.normalized);
+                       }
+               }
+
+               toJSON(data) {
+                       if (data === undefined) {
+                               console.log('THREE.InterleavedBufferAttribute.toJSON(): Serializing an interlaved buffer attribute will deinterleave buffer data.');
+                               const array = [];
+
+                               for (let i = 0; i < this.count; i++) {
+                                       const index = i * this.data.stride + this.offset;
+
+                                       for (let j = 0; j < this.itemSize; j++) {
+                                               array.push(this.data.array[index + j]);
+                                       }
+                               } // deinterleave data and save it as an ordinary buffer attribute for now
+
+
+                               return {
+                                       itemSize: this.itemSize,
+                                       type: this.array.constructor.name,
+                                       array: array,
+                                       normalized: this.normalized
+                               };
+                       } else {
+                               // save as true interlaved attribtue
+                               if (data.interleavedBuffers === undefined) {
+                                       data.interleavedBuffers = {};
+                               }
+
+                               if (data.interleavedBuffers[this.data.uuid] === undefined) {
+                                       data.interleavedBuffers[this.data.uuid] = this.data.toJSON(data);
+                               }
+
+                               return {
+                                       isInterleavedBufferAttribute: true,
+                                       itemSize: this.itemSize,
+                                       data: this.data.uuid,
+                                       offset: this.offset,
+                                       normalized: this.normalized
+                               };
+                       }
+               }
+
+       }
+
+       InterleavedBufferAttribute.prototype.isInterleavedBufferAttribute = true;
+
+       /**
+        * parameters = {
+        *      color: <hex>,
+        *      map: new THREE.Texture( <Image> ),
+        *      alphaMap: new THREE.Texture( <Image> ),
+        *      rotation: <float>,
+        *      sizeAttenuation: <bool>
+        * }
+        */
+
+       class SpriteMaterial extends Material {
+               constructor(parameters) {
+                       super();
+                       this.type = 'SpriteMaterial';
+                       this.color = new Color(0xffffff);
+                       this.map = null;
+                       this.alphaMap = null;
+                       this.rotation = 0;
+                       this.sizeAttenuation = true;
+                       this.transparent = true;
+                       this.setValues(parameters);
+               }
+
+               copy(source) {
+                       super.copy(source);
+                       this.color.copy(source.color);
+                       this.map = source.map;
+                       this.alphaMap = source.alphaMap;
+                       this.rotation = source.rotation;
+                       this.sizeAttenuation = source.sizeAttenuation;
+                       return this;
+               }
+
+       }
+
+       SpriteMaterial.prototype.isSpriteMaterial = true;
+
+       let _geometry;
+
+       const _intersectPoint = /*@__PURE__*/new Vector3();
+
+       const _worldScale = /*@__PURE__*/new Vector3();
+
+       const _mvPosition = /*@__PURE__*/new Vector3();
+
+       const _alignedPosition = /*@__PURE__*/new Vector2();
+
+       const _rotatedPosition = /*@__PURE__*/new Vector2();
+
+       const _viewWorldMatrix = /*@__PURE__*/new Matrix4();
+
+       const _vA = /*@__PURE__*/new Vector3();
+
+       const _vB = /*@__PURE__*/new Vector3();
+
+       const _vC = /*@__PURE__*/new Vector3();
+
+       const _uvA = /*@__PURE__*/new Vector2();
+
+       const _uvB = /*@__PURE__*/new Vector2();
+
+       const _uvC = /*@__PURE__*/new Vector2();
+
+       class Sprite extends Object3D {
+               constructor(material) {
+                       super();
+                       this.type = 'Sprite';
+
+                       if (_geometry === undefined) {
+                               _geometry = new BufferGeometry();
+                               const float32Array = new Float32Array([-0.5, -0.5, 0, 0, 0, 0.5, -0.5, 0, 1, 0, 0.5, 0.5, 0, 1, 1, -0.5, 0.5, 0, 0, 1]);
+                               const interleavedBuffer = new InterleavedBuffer(float32Array, 5);
+
+                               _geometry.setIndex([0, 1, 2, 0, 2, 3]);
+
+                               _geometry.setAttribute('position', new InterleavedBufferAttribute(interleavedBuffer, 3, 0, false));
+
+                               _geometry.setAttribute('uv', new InterleavedBufferAttribute(interleavedBuffer, 2, 3, false));
+                       }
+
+                       this.geometry = _geometry;
+                       this.material = material !== undefined ? material : new SpriteMaterial();
+                       this.center = new Vector2(0.5, 0.5);
+               }
+
+               raycast(raycaster, intersects) {
+                       if (raycaster.camera === null) {
+                               console.error('THREE.Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.');
+                       }
+
+                       _worldScale.setFromMatrixScale(this.matrixWorld);
+
+                       _viewWorldMatrix.copy(raycaster.camera.matrixWorld);
+
+                       this.modelViewMatrix.multiplyMatrices(raycaster.camera.matrixWorldInverse, this.matrixWorld);
+
+                       _mvPosition.setFromMatrixPosition(this.modelViewMatrix);
+
+                       if (raycaster.camera.isPerspectiveCamera && this.material.sizeAttenuation === false) {
+                               _worldScale.multiplyScalar(-_mvPosition.z);
+                       }
+
+                       const rotation = this.material.rotation;
+                       let sin, cos;
+
+                       if (rotation !== 0) {
+                               cos = Math.cos(rotation);
+                               sin = Math.sin(rotation);
+                       }
+
+                       const center = this.center;
+                       transformVertex(_vA.set(-0.5, -0.5, 0), _mvPosition, center, _worldScale, sin, cos);
+                       transformVertex(_vB.set(0.5, -0.5, 0), _mvPosition, center, _worldScale, sin, cos);
+                       transformVertex(_vC.set(0.5, 0.5, 0), _mvPosition, center, _worldScale, sin, cos);
+
+                       _uvA.set(0, 0);
+
+                       _uvB.set(1, 0);
+
+                       _uvC.set(1, 1); // check first triangle
+
+
+                       let intersect = raycaster.ray.intersectTriangle(_vA, _vB, _vC, false, _intersectPoint);
+
+                       if (intersect === null) {
+                               // check second triangle
+                               transformVertex(_vB.set(-0.5, 0.5, 0), _mvPosition, center, _worldScale, sin, cos);
+
+                               _uvB.set(0, 1);
+
+                               intersect = raycaster.ray.intersectTriangle(_vA, _vC, _vB, false, _intersectPoint);
+
+                               if (intersect === null) {
+                                       return;
+                               }
+                       }
+
+                       const distance = raycaster.ray.origin.distanceTo(_intersectPoint);
+                       if (distance < raycaster.near || distance > raycaster.far) return;
+                       intersects.push({
+                               distance: distance,
+                               point: _intersectPoint.clone(),
+                               uv: Triangle.getUV(_intersectPoint, _vA, _vB, _vC, _uvA, _uvB, _uvC, new Vector2()),
+                               face: null,
+                               object: this
+                       });
+               }
+
+               copy(source) {
+                       super.copy(source);
+                       if (source.center !== undefined) this.center.copy(source.center);
+                       this.material = source.material;
+                       return this;
+               }
+
+       }
+
+       Sprite.prototype.isSprite = true;
+
+       function transformVertex(vertexPosition, mvPosition, center, scale, sin, cos) {
+               // compute position in camera space
+               _alignedPosition.subVectors(vertexPosition, center).addScalar(0.5).multiply(scale); // to check if rotation is not zero
+
+
+               if (sin !== undefined) {
+                       _rotatedPosition.x = cos * _alignedPosition.x - sin * _alignedPosition.y;
+                       _rotatedPosition.y = sin * _alignedPosition.x + cos * _alignedPosition.y;
+               } else {
+                       _rotatedPosition.copy(_alignedPosition);
+               }
+
+               vertexPosition.copy(mvPosition);
+               vertexPosition.x += _rotatedPosition.x;
+               vertexPosition.y += _rotatedPosition.y; // transform to world space
+
+               vertexPosition.applyMatrix4(_viewWorldMatrix);
+       }
+
+       const _v1$2 = /*@__PURE__*/new Vector3();
+
+       const _v2$1 = /*@__PURE__*/new Vector3();
+
+       class LOD extends Object3D {
+               constructor() {
+                       super();
+                       this._currentLevel = 0;
+                       this.type = 'LOD';
+                       Object.defineProperties(this, {
+                               levels: {
+                                       enumerable: true,
+                                       value: []
+                               },
+                               isLOD: {
+                                       value: true
+                               }
+                       });
+                       this.autoUpdate = true;
+               }
+
+               copy(source) {
+                       super.copy(source, false);
+                       const levels = source.levels;
+
+                       for (let i = 0, l = levels.length; i < l; i++) {
+                               const level = levels[i];
+                               this.addLevel(level.object.clone(), level.distance);
+                       }
+
+                       this.autoUpdate = source.autoUpdate;
+                       return this;
+               }
+
+               addLevel(object, distance = 0) {
+                       distance = Math.abs(distance);
+                       const levels = this.levels;
+                       let l;
+
+                       for (l = 0; l < levels.length; l++) {
+                               if (distance < levels[l].distance) {
+                                       break;
+                               }
+                       }
+
+                       levels.splice(l, 0, {
+                               distance: distance,
+                               object: object
+                       });
+                       this.add(object);
+                       return this;
+               }
+
+               getCurrentLevel() {
+                       return this._currentLevel;
+               }
+
+               getObjectForDistance(distance) {
+                       const levels = this.levels;
+
+                       if (levels.length > 0) {
+                               let i, l;
+
+                               for (i = 1, l = levels.length; i < l; i++) {
+                                       if (distance < levels[i].distance) {
+                                               break;
+                                       }
+                               }
+
+                               return levels[i - 1].object;
+                       }
+
+                       return null;
+               }
+
+               raycast(raycaster, intersects) {
+                       const levels = this.levels;
+
+                       if (levels.length > 0) {
+                               _v1$2.setFromMatrixPosition(this.matrixWorld);
+
+                               const distance = raycaster.ray.origin.distanceTo(_v1$2);
+                               this.getObjectForDistance(distance).raycast(raycaster, intersects);
+                       }
+               }
+
+               update(camera) {
+                       const levels = this.levels;
+
+                       if (levels.length > 1) {
+                               _v1$2.setFromMatrixPosition(camera.matrixWorld);
+
+                               _v2$1.setFromMatrixPosition(this.matrixWorld);
+
+                               const distance = _v1$2.distanceTo(_v2$1) / camera.zoom;
+                               levels[0].object.visible = true;
+                               let i, l;
+
+                               for (i = 1, l = levels.length; i < l; i++) {
+                                       if (distance >= levels[i].distance) {
+                                               levels[i - 1].object.visible = false;
+                                               levels[i].object.visible = true;
+                                       } else {
+                                               break;
+                                       }
+                               }
+
+                               this._currentLevel = i - 1;
+
+                               for (; i < l; i++) {
+                                       levels[i].object.visible = false;
+                               }
+                       }
+               }
+
+               toJSON(meta) {
+                       const data = super.toJSON(meta);
+                       if (this.autoUpdate === false) data.object.autoUpdate = false;
+                       data.object.levels = [];
+                       const levels = this.levels;
+
+                       for (let i = 0, l = levels.length; i < l; i++) {
+                               const level = levels[i];
+                               data.object.levels.push({
+                                       object: level.object.uuid,
+                                       distance: level.distance
+                               });
+                       }
+
+                       return data;
+               }
+
+       }
+
+       const _basePosition = /*@__PURE__*/new Vector3();
+
+       const _skinIndex = /*@__PURE__*/new Vector4();
+
+       const _skinWeight = /*@__PURE__*/new Vector4();
+
+       const _vector$5 = /*@__PURE__*/new Vector3();
+
+       const _matrix = /*@__PURE__*/new Matrix4();
+
+       class SkinnedMesh extends Mesh {
+               constructor(geometry, material) {
+                       super(geometry, material);
+                       this.type = 'SkinnedMesh';
+                       this.bindMode = 'attached';
+                       this.bindMatrix = new Matrix4();
+                       this.bindMatrixInverse = new Matrix4();
+               }
+
+               copy(source) {
+                       super.copy(source);
+                       this.bindMode = source.bindMode;
+                       this.bindMatrix.copy(source.bindMatrix);
+                       this.bindMatrixInverse.copy(source.bindMatrixInverse);
+                       this.skeleton = source.skeleton;
+                       return this;
+               }
+
+               bind(skeleton, bindMatrix) {
+                       this.skeleton = skeleton;
+
+                       if (bindMatrix === undefined) {
+                               this.updateMatrixWorld(true);
+                               this.skeleton.calculateInverses();
+                               bindMatrix = this.matrixWorld;
+                       }
+
+                       this.bindMatrix.copy(bindMatrix);
+                       this.bindMatrixInverse.copy(bindMatrix).invert();
+               }
+
+               pose() {
+                       this.skeleton.pose();
+               }
+
+               normalizeSkinWeights() {
+                       const vector = new Vector4();
+                       const skinWeight = this.geometry.attributes.skinWeight;
+
+                       for (let i = 0, l = skinWeight.count; i < l; i++) {
+                               vector.x = skinWeight.getX(i);
+                               vector.y = skinWeight.getY(i);
+                               vector.z = skinWeight.getZ(i);
+                               vector.w = skinWeight.getW(i);
+                               const scale = 1.0 / vector.manhattanLength();
+
+                               if (scale !== Infinity) {
+                                       vector.multiplyScalar(scale);
+                               } else {
+                                       vector.set(1, 0, 0, 0); // do something reasonable
+                               }
+
+                               skinWeight.setXYZW(i, vector.x, vector.y, vector.z, vector.w);
+                       }
+               }
+
+               updateMatrixWorld(force) {
+                       super.updateMatrixWorld(force);
+
+                       if (this.bindMode === 'attached') {
+                               this.bindMatrixInverse.copy(this.matrixWorld).invert();
+                       } else if (this.bindMode === 'detached') {
+                               this.bindMatrixInverse.copy(this.bindMatrix).invert();
+                       } else {
+                               console.warn('THREE.SkinnedMesh: Unrecognized bindMode: ' + this.bindMode);
+                       }
+               }
+
+               boneTransform(index, target) {
+                       const skeleton = this.skeleton;
+                       const geometry = this.geometry;
+
+                       _skinIndex.fromBufferAttribute(geometry.attributes.skinIndex, index);
+
+                       _skinWeight.fromBufferAttribute(geometry.attributes.skinWeight, index);
+
+                       _basePosition.fromBufferAttribute(geometry.attributes.position, index).applyMatrix4(this.bindMatrix);
+
+                       target.set(0, 0, 0);
+
+                       for (let i = 0; i < 4; i++) {
+                               const weight = _skinWeight.getComponent(i);
+
+                               if (weight !== 0) {
+                                       const boneIndex = _skinIndex.getComponent(i);
+
+                                       _matrix.multiplyMatrices(skeleton.bones[boneIndex].matrixWorld, skeleton.boneInverses[boneIndex]);
+
+                                       target.addScaledVector(_vector$5.copy(_basePosition).applyMatrix4(_matrix), weight);
+                               }
+                       }
+
+                       return target.applyMatrix4(this.bindMatrixInverse);
+               }
+
+       }
+
+       SkinnedMesh.prototype.isSkinnedMesh = true;
+
+       class Bone extends Object3D {
+               constructor() {
+                       super();
+                       this.type = 'Bone';
+               }
+
+       }
+
+       Bone.prototype.isBone = true;
+
+       class DataTexture extends Texture {
+               constructor(data = null, width = 1, height = 1, format, type, mapping, wrapS, wrapT, magFilter = NearestFilter, minFilter = NearestFilter, anisotropy, encoding) {
+                       super(null, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy, encoding);
+                       this.image = {
+                               data: data,
+                               width: width,
+                               height: height
+                       };
+                       this.magFilter = magFilter;
+                       this.minFilter = minFilter;
+                       this.generateMipmaps = false;
+                       this.flipY = false;
+                       this.unpackAlignment = 1;
+                       this.needsUpdate = true;
+               }
+
+       }
+
+       DataTexture.prototype.isDataTexture = true;
+
+       const _offsetMatrix = /*@__PURE__*/new Matrix4();
+
+       const _identityMatrix = /*@__PURE__*/new Matrix4();
+
+       class Skeleton {
+               constructor(bones = [], boneInverses = []) {
+                       this.uuid = generateUUID();
+                       this.bones = bones.slice(0);
+                       this.boneInverses = boneInverses;
+                       this.boneMatrices = null;
+                       this.boneTexture = null;
+                       this.boneTextureSize = 0;
+                       this.frame = -1;
+                       this.init();
+               }
+
+               init() {
+                       const bones = this.bones;
+                       const boneInverses = this.boneInverses;
+                       this.boneMatrices = new Float32Array(bones.length * 16); // calculate inverse bone matrices if necessary
+
+                       if (boneInverses.length === 0) {
+                               this.calculateInverses();
+                       } else {
+                               // handle special case
+                               if (bones.length !== boneInverses.length) {
+                                       console.warn('THREE.Skeleton: Number of inverse bone matrices does not match amount of bones.');
+                                       this.boneInverses = [];
+
+                                       for (let i = 0, il = this.bones.length; i < il; i++) {
+                                               this.boneInverses.push(new Matrix4());
+                                       }
+                               }
+                       }
+               }
+
+               calculateInverses() {
+                       this.boneInverses.length = 0;
+
+                       for (let i = 0, il = this.bones.length; i < il; i++) {
+                               const inverse = new Matrix4();
+
+                               if (this.bones[i]) {
+                                       inverse.copy(this.bones[i].matrixWorld).invert();
+                               }
+
+                               this.boneInverses.push(inverse);
+                       }
+               }
+
+               pose() {
+                       // recover the bind-time world matrices
+                       for (let i = 0, il = this.bones.length; i < il; i++) {
+                               const bone = this.bones[i];
+
+                               if (bone) {
+                                       bone.matrixWorld.copy(this.boneInverses[i]).invert();
+                               }
+                       } // compute the local matrices, positions, rotations and scales
+
+
+                       for (let i = 0, il = this.bones.length; i < il; i++) {
+                               const bone = this.bones[i];
+
+                               if (bone) {
+                                       if (bone.parent && bone.parent.isBone) {
+                                               bone.matrix.copy(bone.parent.matrixWorld).invert();
+                                               bone.matrix.multiply(bone.matrixWorld);
+                                       } else {
+                                               bone.matrix.copy(bone.matrixWorld);
+                                       }
+
+                                       bone.matrix.decompose(bone.position, bone.quaternion, bone.scale);
+                               }
+                       }
+               }
+
+               update() {
+                       const bones = this.bones;
+                       const boneInverses = this.boneInverses;
+                       const boneMatrices = this.boneMatrices;
+                       const boneTexture = this.boneTexture; // flatten bone matrices to array
+
+                       for (let i = 0, il = bones.length; i < il; i++) {
+                               // compute the offset between the current and the original transform
+                               const matrix = bones[i] ? bones[i].matrixWorld : _identityMatrix;
+
+                               _offsetMatrix.multiplyMatrices(matrix, boneInverses[i]);
+
+                               _offsetMatrix.toArray(boneMatrices, i * 16);
+                       }
+
+                       if (boneTexture !== null) {
+                               boneTexture.needsUpdate = true;
+                       }
+               }
+
+               clone() {
+                       return new Skeleton(this.bones, this.boneInverses);
+               }
+
+               computeBoneTexture() {
+                       // layout (1 matrix = 4 pixels)
+                       //                      RGBA RGBA RGBA RGBA (=> column1, column2, column3, column4)
+                       //      with    8x8     pixel texture max        16 bones * 4 pixels =  (8 * 8)
+                       //                       16x16 pixel texture max         64 bones * 4 pixels = (16 * 16)
+                       //                       32x32 pixel texture max        256 bones * 4 pixels = (32 * 32)
+                       //                       64x64 pixel texture max 1024 bones * 4 pixels = (64 * 64)
+                       let size = Math.sqrt(this.bones.length * 4); // 4 pixels needed for 1 matrix
+
+                       size = ceilPowerOfTwo(size);
+                       size = Math.max(size, 4);
+                       const boneMatrices = new Float32Array(size * size * 4); // 4 floats per RGBA pixel
+
+                       boneMatrices.set(this.boneMatrices); // copy current values
+
+                       const boneTexture = new DataTexture(boneMatrices, size, size, RGBAFormat, FloatType);
+                       this.boneMatrices = boneMatrices;
+                       this.boneTexture = boneTexture;
+                       this.boneTextureSize = size;
+                       return this;
+               }
+
+               getBoneByName(name) {
+                       for (let i = 0, il = this.bones.length; i < il; i++) {
+                               const bone = this.bones[i];
+
+                               if (bone.name === name) {
+                                       return bone;
+                               }
+                       }
+
+                       return undefined;
+               }
+
+               dispose() {
+                       if (this.boneTexture !== null) {
+                               this.boneTexture.dispose();
+                               this.boneTexture = null;
+                       }
+               }
+
+               fromJSON(json, bones) {
+                       this.uuid = json.uuid;
+
+                       for (let i = 0, l = json.bones.length; i < l; i++) {
+                               const uuid = json.bones[i];
+                               let bone = bones[uuid];
+
+                               if (bone === undefined) {
+                                       console.warn('THREE.Skeleton: No bone found with UUID:', uuid);
+                                       bone = new Bone();
+                               }
+
+                               this.bones.push(bone);
+                               this.boneInverses.push(new Matrix4().fromArray(json.boneInverses[i]));
+                       }
+
+                       this.init();
+                       return this;
+               }
+
+               toJSON() {
+                       const data = {
+                               metadata: {
+                                       version: 4.5,
+                                       type: 'Skeleton',
+                                       generator: 'Skeleton.toJSON'
+                               },
+                               bones: [],
+                               boneInverses: []
+                       };
+                       data.uuid = this.uuid;
+                       const bones = this.bones;
+                       const boneInverses = this.boneInverses;
+
+                       for (let i = 0, l = bones.length; i < l; i++) {
+                               const bone = bones[i];
+                               data.bones.push(bone.uuid);
+                               const boneInverse = boneInverses[i];
+                               data.boneInverses.push(boneInverse.toArray());
+                       }
+
+                       return data;
+               }
+
+       }
+
+       class InstancedBufferAttribute extends BufferAttribute {
+               constructor(array, itemSize, normalized, meshPerAttribute = 1) {
+                       if (typeof normalized === 'number') {
+                               meshPerAttribute = normalized;
+                               normalized = false;
+                               console.error('THREE.InstancedBufferAttribute: The constructor now expects normalized as the third argument.');
+                       }
+
+                       super(array, itemSize, normalized);
+                       this.meshPerAttribute = meshPerAttribute;
+               }
+
+               copy(source) {
+                       super.copy(source);
+                       this.meshPerAttribute = source.meshPerAttribute;
+                       return this;
+               }
+
+               toJSON() {
+                       const data = super.toJSON();
+                       data.meshPerAttribute = this.meshPerAttribute;
+                       data.isInstancedBufferAttribute = true;
+                       return data;
+               }
+
+       }
+
+       InstancedBufferAttribute.prototype.isInstancedBufferAttribute = true;
+
+       const _instanceLocalMatrix = /*@__PURE__*/new Matrix4();
+
+       const _instanceWorldMatrix = /*@__PURE__*/new Matrix4();
+
+       const _instanceIntersects = [];
+
+       const _mesh = /*@__PURE__*/new Mesh();
+
+       class InstancedMesh extends Mesh {
+               constructor(geometry, material, count) {
+                       super(geometry, material);
+                       this.instanceMatrix = new InstancedBufferAttribute(new Float32Array(count * 16), 16);
+                       this.instanceColor = null;
+                       this.count = count;
+                       this.frustumCulled = false;
+               }
+
+               copy(source) {
+                       super.copy(source);
+                       this.instanceMatrix.copy(source.instanceMatrix);
+                       if (source.instanceColor !== null) this.instanceColor = source.instanceColor.clone();
+                       this.count = source.count;
+                       return this;
+               }
+
+               getColorAt(index, color) {
+                       color.fromArray(this.instanceColor.array, index * 3);
+               }
+
+               getMatrixAt(index, matrix) {
+                       matrix.fromArray(this.instanceMatrix.array, index * 16);
+               }
+
+               raycast(raycaster, intersects) {
+                       const matrixWorld = this.matrixWorld;
+                       const raycastTimes = this.count;
+                       _mesh.geometry = this.geometry;
+                       _mesh.material = this.material;
+                       if (_mesh.material === undefined) return;
+
+                       for (let instanceId = 0; instanceId < raycastTimes; instanceId++) {
+                               // calculate the world matrix for each instance
+                               this.getMatrixAt(instanceId, _instanceLocalMatrix);
+
+                               _instanceWorldMatrix.multiplyMatrices(matrixWorld, _instanceLocalMatrix); // the mesh represents this single instance
+
+
+                               _mesh.matrixWorld = _instanceWorldMatrix;
+
+                               _mesh.raycast(raycaster, _instanceIntersects); // process the result of raycast
+
+
+                               for (let i = 0, l = _instanceIntersects.length; i < l; i++) {
+                                       const intersect = _instanceIntersects[i];
+                                       intersect.instanceId = instanceId;
+                                       intersect.object = this;
+                                       intersects.push(intersect);
+                               }
+
+                               _instanceIntersects.length = 0;
+                       }
+               }
+
+               setColorAt(index, color) {
+                       if (this.instanceColor === null) {
+                               this.instanceColor = new InstancedBufferAttribute(new Float32Array(this.instanceMatrix.count * 3), 3);
+                       }
+
+                       color.toArray(this.instanceColor.array, index * 3);
+               }
+
+               setMatrixAt(index, matrix) {
+                       matrix.toArray(this.instanceMatrix.array, index * 16);
+               }
+
+               updateMorphTargets() {}
+
+               dispose() {
+                       this.dispatchEvent({
+                               type: 'dispose'
+                       });
+               }
+
+       }
+
+       InstancedMesh.prototype.isInstancedMesh = true;
+
+       /**
+        * parameters = {
+        *      color: <hex>,
+        *      opacity: <float>,
+        *
+        *      linewidth: <float>,
+        *      linecap: "round",
+        *      linejoin: "round"
+        * }
+        */
+
+       class LineBasicMaterial extends Material {
+               constructor(parameters) {
+                       super();
+                       this.type = 'LineBasicMaterial';
+                       this.color = new Color(0xffffff);
+                       this.linewidth = 1;
+                       this.linecap = 'round';
+                       this.linejoin = 'round';
+                       this.setValues(parameters);
+               }
+
+               copy(source) {
+                       super.copy(source);
+                       this.color.copy(source.color);
+                       this.linewidth = source.linewidth;
+                       this.linecap = source.linecap;
+                       this.linejoin = source.linejoin;
+                       return this;
+               }
+
+       }
+
+       LineBasicMaterial.prototype.isLineBasicMaterial = true;
+
+       const _start$1 = /*@__PURE__*/new Vector3();
+
+       const _end$1 = /*@__PURE__*/new Vector3();
+
+       const _inverseMatrix$1 = /*@__PURE__*/new Matrix4();
+
+       const _ray$1 = /*@__PURE__*/new Ray();
+
+       const _sphere$1 = /*@__PURE__*/new Sphere();
+
+       class Line extends Object3D {
+               constructor(geometry = new BufferGeometry(), material = new LineBasicMaterial()) {
+                       super();
+                       this.type = 'Line';
+                       this.geometry = geometry;
+                       this.material = material;
+                       this.updateMorphTargets();
+               }
+
+               copy(source) {
+                       super.copy(source);
+                       this.material = source.material;
+                       this.geometry = source.geometry;
+                       return this;
+               }
+
+               computeLineDistances() {
+                       const geometry = this.geometry;
+
+                       if (geometry.isBufferGeometry) {
+                               // we assume non-indexed geometry
+                               if (geometry.index === null) {
+                                       const positionAttribute = geometry.attributes.position;
+                                       const lineDistances = [0];
+
+                                       for (let i = 1, l = positionAttribute.count; i < l; i++) {
+                                               _start$1.fromBufferAttribute(positionAttribute, i - 1);
+
+                                               _end$1.fromBufferAttribute(positionAttribute, i);
+
+                                               lineDistances[i] = lineDistances[i - 1];
+                                               lineDistances[i] += _start$1.distanceTo(_end$1);
+                                       }
+
+                                       geometry.setAttribute('lineDistance', new Float32BufferAttribute(lineDistances, 1));
+                               } else {
+                                       console.warn('THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.');
+                               }
+                       } else if (geometry.isGeometry) {
+                               console.error('THREE.Line.computeLineDistances() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.');
+                       }
+
+                       return this;
+               }
+
+               raycast(raycaster, intersects) {
+                       const geometry = this.geometry;
+                       const matrixWorld = this.matrixWorld;
+                       const threshold = raycaster.params.Line.threshold;
+                       const drawRange = geometry.drawRange; // Checking boundingSphere distance to ray
+
+                       if (geometry.boundingSphere === null) geometry.computeBoundingSphere();
+
+                       _sphere$1.copy(geometry.boundingSphere);
+
+                       _sphere$1.applyMatrix4(matrixWorld);
+
+                       _sphere$1.radius += threshold;
+                       if (raycaster.ray.intersectsSphere(_sphere$1) === false) return; //
+
+                       _inverseMatrix$1.copy(matrixWorld).invert();
+
+                       _ray$1.copy(raycaster.ray).applyMatrix4(_inverseMatrix$1);
+
+                       const localThreshold = threshold / ((this.scale.x + this.scale.y + this.scale.z) / 3);
+                       const localThresholdSq = localThreshold * localThreshold;
+                       const vStart = new Vector3();
+                       const vEnd = new Vector3();
+                       const interSegment = new Vector3();
+                       const interRay = new Vector3();
+                       const step = this.isLineSegments ? 2 : 1;
+
+                       if (geometry.isBufferGeometry) {
+                               const index = geometry.index;
+                               const attributes = geometry.attributes;
+                               const positionAttribute = attributes.position;
+
+                               if (index !== null) {
+                                       const start = Math.max(0, drawRange.start);
+                                       const end = Math.min(index.count, drawRange.start + drawRange.count);
+
+                                       for (let i = start, l = end - 1; i < l; i += step) {
+                                               const a = index.getX(i);
+                                               const b = index.getX(i + 1);
+                                               vStart.fromBufferAttribute(positionAttribute, a);
+                                               vEnd.fromBufferAttribute(positionAttribute, b);
+
+                                               const distSq = _ray$1.distanceSqToSegment(vStart, vEnd, interRay, interSegment);
+
+                                               if (distSq > localThresholdSq) continue;
+                                               interRay.applyMatrix4(this.matrixWorld); //Move back to world space for distance calculation
+
+                                               const distance = raycaster.ray.origin.distanceTo(interRay);
+                                               if (distance < raycaster.near || distance > raycaster.far) continue;
+                                               intersects.push({
+                                                       distance: distance,
+                                                       // What do we want? intersection point on the ray or on the segment??
+                                                       // point: raycaster.ray.at( distance ),
+                                                       point: interSegment.clone().applyMatrix4(this.matrixWorld),
+                                                       index: i,
+                                                       face: null,
+                                                       faceIndex: null,
+                                                       object: this
+                                               });
+                                       }
+                               } else {
+                                       const start = Math.max(0, drawRange.start);
+                                       const end = Math.min(positionAttribute.count, drawRange.start + drawRange.count);
+
+                                       for (let i = start, l = end - 1; i < l; i += step) {
+                                               vStart.fromBufferAttribute(positionAttribute, i);
+                                               vEnd.fromBufferAttribute(positionAttribute, i + 1);
+
+                                               const distSq = _ray$1.distanceSqToSegment(vStart, vEnd, interRay, interSegment);
+
+                                               if (distSq > localThresholdSq) continue;
+                                               interRay.applyMatrix4(this.matrixWorld); //Move back to world space for distance calculation
+
+                                               const distance = raycaster.ray.origin.distanceTo(interRay);
+                                               if (distance < raycaster.near || distance > raycaster.far) continue;
+                                               intersects.push({
+                                                       distance: distance,
+                                                       // What do we want? intersection point on the ray or on the segment??
+                                                       // point: raycaster.ray.at( distance ),
+                                                       point: interSegment.clone().applyMatrix4(this.matrixWorld),
+                                                       index: i,
+                                                       face: null,
+                                                       faceIndex: null,
+                                                       object: this
+                                               });
+                                       }
+                               }
+                       } else if (geometry.isGeometry) {
+                               console.error('THREE.Line.raycast() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.');
+                       }
+               }
+
+               updateMorphTargets() {
+                       const geometry = this.geometry;
+
+                       if (geometry.isBufferGeometry) {
+                               const morphAttributes = geometry.morphAttributes;
+                               const keys = Object.keys(morphAttributes);
+
+                               if (keys.length > 0) {
+                                       const morphAttribute = morphAttributes[keys[0]];
+
+                                       if (morphAttribute !== undefined) {
+                                               this.morphTargetInfluences = [];
+                                               this.morphTargetDictionary = {};
+
+                                               for (let m = 0, ml = morphAttribute.length; m < ml; m++) {
+                                                       const name = morphAttribute[m].name || String(m);
+                                                       this.morphTargetInfluences.push(0);
+                                                       this.morphTargetDictionary[name] = m;
+                                               }
+                                       }
+                               }
+                       } else {
+                               const morphTargets = geometry.morphTargets;
+
+                               if (morphTargets !== undefined && morphTargets.length > 0) {
+                                       console.error('THREE.Line.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.');
+                               }
+                       }
+               }
+
+       }
+
+       Line.prototype.isLine = true;
+
+       const _start = /*@__PURE__*/new Vector3();
+
+       const _end = /*@__PURE__*/new Vector3();
+
+       class LineSegments extends Line {
+               constructor(geometry, material) {
+                       super(geometry, material);
+                       this.type = 'LineSegments';
+               }
+
+               computeLineDistances() {
+                       const geometry = this.geometry;
+
+                       if (geometry.isBufferGeometry) {
+                               // we assume non-indexed geometry
+                               if (geometry.index === null) {
+                                       const positionAttribute = geometry.attributes.position;
+                                       const lineDistances = [];
+
+                                       for (let i = 0, l = positionAttribute.count; i < l; i += 2) {
+                                               _start.fromBufferAttribute(positionAttribute, i);
+
+                                               _end.fromBufferAttribute(positionAttribute, i + 1);
+
+                                               lineDistances[i] = i === 0 ? 0 : lineDistances[i - 1];
+                                               lineDistances[i + 1] = lineDistances[i] + _start.distanceTo(_end);
+                                       }
+
+                                       geometry.setAttribute('lineDistance', new Float32BufferAttribute(lineDistances, 1));
+                               } else {
+                                       console.warn('THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.');
+                               }
+                       } else if (geometry.isGeometry) {
+                               console.error('THREE.LineSegments.computeLineDistances() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.');
+                       }
+
+                       return this;
+               }
+
+       }
+
+       LineSegments.prototype.isLineSegments = true;
+
+       class LineLoop extends Line {
+               constructor(geometry, material) {
+                       super(geometry, material);
+                       this.type = 'LineLoop';
+               }
+
+       }
+
+       LineLoop.prototype.isLineLoop = true;
+
+       /**
+        * parameters = {
+        *      color: <hex>,
+        *      opacity: <float>,
+        *      map: new THREE.Texture( <Image> ),
+        *      alphaMap: new THREE.Texture( <Image> ),
+        *
+        *      size: <float>,
+        *      sizeAttenuation: <bool>
+        *
+        * }
+        */
+
+       class PointsMaterial extends Material {
+               constructor(parameters) {
+                       super();
+                       this.type = 'PointsMaterial';
+                       this.color = new Color(0xffffff);
+                       this.map = null;
+                       this.alphaMap = null;
+                       this.size = 1;
+                       this.sizeAttenuation = true;
+                       this.setValues(parameters);
+               }
+
+               copy(source) {
+                       super.copy(source);
+                       this.color.copy(source.color);
+                       this.map = source.map;
+                       this.alphaMap = source.alphaMap;
+                       this.size = source.size;
+                       this.sizeAttenuation = source.sizeAttenuation;
+                       return this;
+               }
+
+       }
+
+       PointsMaterial.prototype.isPointsMaterial = true;
+
+       const _inverseMatrix = /*@__PURE__*/new Matrix4();
+
+       const _ray = /*@__PURE__*/new Ray();
+
+       const _sphere = /*@__PURE__*/new Sphere();
+
+       const _position$2 = /*@__PURE__*/new Vector3();
+
+       class Points extends Object3D {
+               constructor(geometry = new BufferGeometry(), material = new PointsMaterial()) {
+                       super();
+                       this.type = 'Points';
+                       this.geometry = geometry;
+                       this.material = material;
+                       this.updateMorphTargets();
+               }
+
+               copy(source) {
+                       super.copy(source);
+                       this.material = source.material;
+                       this.geometry = source.geometry;
+                       return this;
+               }
+
+               raycast(raycaster, intersects) {
+                       const geometry = this.geometry;
+                       const matrixWorld = this.matrixWorld;
+                       const threshold = raycaster.params.Points.threshold;
+                       const drawRange = geometry.drawRange; // Checking boundingSphere distance to ray
+
+                       if (geometry.boundingSphere === null) geometry.computeBoundingSphere();
+
+                       _sphere.copy(geometry.boundingSphere);
+
+                       _sphere.applyMatrix4(matrixWorld);
+
+                       _sphere.radius += threshold;
+                       if (raycaster.ray.intersectsSphere(_sphere) === false) return; //
+
+                       _inverseMatrix.copy(matrixWorld).invert();
+
+                       _ray.copy(raycaster.ray).applyMatrix4(_inverseMatrix);
+
+                       const localThreshold = threshold / ((this.scale.x + this.scale.y + this.scale.z) / 3);
+                       const localThresholdSq = localThreshold * localThreshold;
+
+                       if (geometry.isBufferGeometry) {
+                               const index = geometry.index;
+                               const attributes = geometry.attributes;
+                               const positionAttribute = attributes.position;
+
+                               if (index !== null) {
+                                       const start = Math.max(0, drawRange.start);
+                                       const end = Math.min(index.count, drawRange.start + drawRange.count);
+
+                                       for (let i = start, il = end; i < il; i++) {
+                                               const a = index.getX(i);
+
+                                               _position$2.fromBufferAttribute(positionAttribute, a);
+
+                                               testPoint(_position$2, a, localThresholdSq, matrixWorld, raycaster, intersects, this);
+                                       }
+                               } else {
+                                       const start = Math.max(0, drawRange.start);
+                                       const end = Math.min(positionAttribute.count, drawRange.start + drawRange.count);
+
+                                       for (let i = start, l = end; i < l; i++) {
+                                               _position$2.fromBufferAttribute(positionAttribute, i);
+
+                                               testPoint(_position$2, i, localThresholdSq, matrixWorld, raycaster, intersects, this);
+                                       }
+                               }
+                       } else {
+                               console.error('THREE.Points.raycast() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.');
+                       }
+               }
+
+               updateMorphTargets() {
+                       const geometry = this.geometry;
+
+                       if (geometry.isBufferGeometry) {
+                               const morphAttributes = geometry.morphAttributes;
+                               const keys = Object.keys(morphAttributes);
+
+                               if (keys.length > 0) {
+                                       const morphAttribute = morphAttributes[keys[0]];
+
+                                       if (morphAttribute !== undefined) {
+                                               this.morphTargetInfluences = [];
+                                               this.morphTargetDictionary = {};
+
+                                               for (let m = 0, ml = morphAttribute.length; m < ml; m++) {
+                                                       const name = morphAttribute[m].name || String(m);
+                                                       this.morphTargetInfluences.push(0);
+                                                       this.morphTargetDictionary[name] = m;
+                                               }
+                                       }
+                               }
+                       } else {
+                               const morphTargets = geometry.morphTargets;
+
+                               if (morphTargets !== undefined && morphTargets.length > 0) {
+                                       console.error('THREE.Points.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.');
+                               }
+                       }
+               }
+
+       }
+
+       Points.prototype.isPoints = true;
+
+       function testPoint(point, index, localThresholdSq, matrixWorld, raycaster, intersects, object) {
+               const rayPointDistanceSq = _ray.distanceSqToPoint(point);
+
+               if (rayPointDistanceSq < localThresholdSq) {
+                       const intersectPoint = new Vector3();
+
+                       _ray.closestPointToPoint(point, intersectPoint);
+
+                       intersectPoint.applyMatrix4(matrixWorld);
+                       const distance = raycaster.ray.origin.distanceTo(intersectPoint);
+                       if (distance < raycaster.near || distance > raycaster.far) return;
+                       intersects.push({
+                               distance: distance,
+                               distanceToRay: Math.sqrt(rayPointDistanceSq),
+                               point: intersectPoint,
+                               index: index,
+                               face: null,
+                               object: object
+                       });
+               }
+       }
+
+       class VideoTexture extends Texture {
+               constructor(video, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy) {
+                       super(video, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy);
+                       this.format = format !== undefined ? format : RGBFormat;
+                       this.minFilter = minFilter !== undefined ? minFilter : LinearFilter;
+                       this.magFilter = magFilter !== undefined ? magFilter : LinearFilter;
+                       this.generateMipmaps = false;
+                       const scope = this;
+
+                       function updateVideo() {
+                               scope.needsUpdate = true;
+                               video.requestVideoFrameCallback(updateVideo);
+                       }
+
+                       if ('requestVideoFrameCallback' in video) {
+                               video.requestVideoFrameCallback(updateVideo);
+                       }
+               }
+
+               clone() {
+                       return new this.constructor(this.image).copy(this);
+               }
+
+               update() {
+                       const video = this.image;
+                       const hasVideoFrameCallback = ('requestVideoFrameCallback' in video);
+
+                       if (hasVideoFrameCallback === false && video.readyState >= video.HAVE_CURRENT_DATA) {
+                               this.needsUpdate = true;
+                       }
+               }
+
+       }
+
+       VideoTexture.prototype.isVideoTexture = true;
+
+       class CompressedTexture extends Texture {
+               constructor(mipmaps, width, height, format, type, mapping, wrapS, wrapT, magFilter, minFilter, anisotropy, encoding) {
+                       super(null, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy, encoding);
+                       this.image = {
+                               width: width,
+                               height: height
+                       };
+                       this.mipmaps = mipmaps; // no flipping for cube textures
+                       // (also flipping doesn't work for compressed textures )
+
+                       this.flipY = false; // can't generate mipmaps for compressed textures
+                       // mips must be embedded in DDS files
+
+                       this.generateMipmaps = false;
+               }
+
+       }
+
+       CompressedTexture.prototype.isCompressedTexture = true;
+
+       class CanvasTexture extends Texture {
+               constructor(canvas, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy) {
+                       super(canvas, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy);
+                       this.needsUpdate = true;
+               }
+
+       }
+
+       CanvasTexture.prototype.isCanvasTexture = true;
+
+       class DepthTexture extends Texture {
+               constructor(width, height, type, mapping, wrapS, wrapT, magFilter, minFilter, anisotropy, format) {
+                       format = format !== undefined ? format : DepthFormat;
+
+                       if (format !== DepthFormat && format !== DepthStencilFormat) {
+                               throw new Error('DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat');
+                       }
+
+                       if (type === undefined && format === DepthFormat) type = UnsignedShortType;
+                       if (type === undefined && format === DepthStencilFormat) type = UnsignedInt248Type;
+                       super(null, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy);
+                       this.image = {
+                               width: width,
+                               height: height
+                       };
+                       this.magFilter = magFilter !== undefined ? magFilter : NearestFilter;
+                       this.minFilter = minFilter !== undefined ? minFilter : NearestFilter;
+                       this.flipY = false;
+                       this.generateMipmaps = false;
+               }
+
+       }
+
+       DepthTexture.prototype.isDepthTexture = true;
+
+       class CircleGeometry extends BufferGeometry {
+               constructor(radius = 1, segments = 8, thetaStart = 0, thetaLength = Math.PI * 2) {
+                       super();
+                       this.type = 'CircleGeometry';
+                       this.parameters = {
+                               radius: radius,
+                               segments: segments,
+                               thetaStart: thetaStart,
+                               thetaLength: thetaLength
+                       };
+                       segments = Math.max(3, segments); // buffers
+
+                       const indices = [];
+                       const vertices = [];
+                       const normals = [];
+                       const uvs = []; // helper variables
+
+                       const vertex = new Vector3();
+                       const uv = new Vector2(); // center point
+
+                       vertices.push(0, 0, 0);
+                       normals.push(0, 0, 1);
+                       uvs.push(0.5, 0.5);
+
+                       for (let s = 0, i = 3; s <= segments; s++, i += 3) {
+                               const segment = thetaStart + s / segments * thetaLength; // vertex
+
+                               vertex.x = radius * Math.cos(segment);
+                               vertex.y = radius * Math.sin(segment);
+                               vertices.push(vertex.x, vertex.y, vertex.z); // normal
+
+                               normals.push(0, 0, 1); // uvs
+
+                               uv.x = (vertices[i] / radius + 1) / 2;
+                               uv.y = (vertices[i + 1] / radius + 1) / 2;
+                               uvs.push(uv.x, uv.y);
+                       } // indices
+
+
+                       for (let i = 1; i <= segments; i++) {
+                               indices.push(i, i + 1, 0);
+                       } // build geometry
+
+
+                       this.setIndex(indices);
+                       this.setAttribute('position', new Float32BufferAttribute(vertices, 3));
+                       this.setAttribute('normal', new Float32BufferAttribute(normals, 3));
+                       this.setAttribute('uv', new Float32BufferAttribute(uvs, 2));
+               }
+
+               static fromJSON(data) {
+                       return new CircleGeometry(data.radius, data.segments, data.thetaStart, data.thetaLength);
+               }
+
+       }
+
+       class CylinderGeometry extends BufferGeometry {
+               constructor(radiusTop = 1, radiusBottom = 1, height = 1, radialSegments = 8, heightSegments = 1, openEnded = false, thetaStart = 0, thetaLength = Math.PI * 2) {
+                       super();
+                       this.type = 'CylinderGeometry';
+                       this.parameters = {
+                               radiusTop: radiusTop,
+                               radiusBottom: radiusBottom,
+                               height: height,
+                               radialSegments: radialSegments,
+                               heightSegments: heightSegments,
+                               openEnded: openEnded,
+                               thetaStart: thetaStart,
+                               thetaLength: thetaLength
+                       };
+                       const scope = this;
+                       radialSegments = Math.floor(radialSegments);
+                       heightSegments = Math.floor(heightSegments); // buffers
+
+                       const indices = [];
+                       const vertices = [];
+                       const normals = [];
+                       const uvs = []; // helper variables
+
+                       let index = 0;
+                       const indexArray = [];
+                       const halfHeight = height / 2;
+                       let groupStart = 0; // generate geometry
+
+                       generateTorso();
+
+                       if (openEnded === false) {
+                               if (radiusTop > 0) generateCap(true);
+                               if (radiusBottom > 0) generateCap(false);
+                       } // build geometry
+
+
+                       this.setIndex(indices);
+                       this.setAttribute('position', new Float32BufferAttribute(vertices, 3));
+                       this.setAttribute('normal', new Float32BufferAttribute(normals, 3));
+                       this.setAttribute('uv', new Float32BufferAttribute(uvs, 2));
+
+                       function generateTorso() {
+                               const normal = new Vector3();
+                               const vertex = new Vector3();
+                               let groupCount = 0; // this will be used to calculate the normal
+
+                               const slope = (radiusBottom - radiusTop) / height; // generate vertices, normals and uvs
+
+                               for (let y = 0; y <= heightSegments; y++) {
+                                       const indexRow = [];
+                                       const v = y / heightSegments; // calculate the radius of the current row
+
+                                       const radius = v * (radiusBottom - radiusTop) + radiusTop;
+
+                                       for (let x = 0; x <= radialSegments; x++) {
+                                               const u = x / radialSegments;
+                                               const theta = u * thetaLength + thetaStart;
+                                               const sinTheta = Math.sin(theta);
+                                               const cosTheta = Math.cos(theta); // vertex
+
+                                               vertex.x = radius * sinTheta;
+                                               vertex.y = -v * height + halfHeight;
+                                               vertex.z = radius * cosTheta;
+                                               vertices.push(vertex.x, vertex.y, vertex.z); // normal
+
+                                               normal.set(sinTheta, slope, cosTheta).normalize();
+                                               normals.push(normal.x, normal.y, normal.z); // uv
+
+                                               uvs.push(u, 1 - v); // save index of vertex in respective row
+
+                                               indexRow.push(index++);
+                                       } // now save vertices of the row in our index array
+
+
+                                       indexArray.push(indexRow);
+                               } // generate indices
+
+
+                               for (let x = 0; x < radialSegments; x++) {
+                                       for (let y = 0; y < heightSegments; y++) {
+                                               // we use the index array to access the correct indices
+                                               const a = indexArray[y][x];
+                                               const b = indexArray[y + 1][x];
+                                               const c = indexArray[y + 1][x + 1];
+                                               const d = indexArray[y][x + 1]; // faces
+
+                                               indices.push(a, b, d);
+                                               indices.push(b, c, d); // update group counter
+
+                                               groupCount += 6;
+                                       }
+                               } // add a group to the geometry. this will ensure multi material support
+
+
+                               scope.addGroup(groupStart, groupCount, 0); // calculate new start value for groups
+
+                               groupStart += groupCount;
+                       }
+
+                       function generateCap(top) {
+                               // save the index of the first center vertex
+                               const centerIndexStart = index;
+                               const uv = new Vector2();
+                               const vertex = new Vector3();
+                               let groupCount = 0;
+                               const radius = top === true ? radiusTop : radiusBottom;
+                               const sign = top === true ? 1 : -1; // first we generate the center vertex data of the cap.
+                               // because the geometry needs one set of uvs per face,
+                               // we must generate a center vertex per face/segment
+
+                               for (let x = 1; x <= radialSegments; x++) {
+                                       // vertex
+                                       vertices.push(0, halfHeight * sign, 0); // normal
+
+                                       normals.push(0, sign, 0); // uv
+
+                                       uvs.push(0.5, 0.5); // increase index
+
+                                       index++;
+                               } // save the index of the last center vertex
+
+
+                               const centerIndexEnd = index; // now we generate the surrounding vertices, normals and uvs
+
+                               for (let x = 0; x <= radialSegments; x++) {
+                                       const u = x / radialSegments;
+                                       const theta = u * thetaLength + thetaStart;
+                                       const cosTheta = Math.cos(theta);
+                                       const sinTheta = Math.sin(theta); // vertex
+
+                                       vertex.x = radius * sinTheta;
+                                       vertex.y = halfHeight * sign;
+                                       vertex.z = radius * cosTheta;
+                                       vertices.push(vertex.x, vertex.y, vertex.z); // normal
+
+                                       normals.push(0, sign, 0); // uv
+
+                                       uv.x = cosTheta * 0.5 + 0.5;
+                                       uv.y = sinTheta * 0.5 * sign + 0.5;
+                                       uvs.push(uv.x, uv.y); // increase index
+
+                                       index++;
+                               } // generate indices
+
+
+                               for (let x = 0; x < radialSegments; x++) {
+                                       const c = centerIndexStart + x;
+                                       const i = centerIndexEnd + x;
+
+                                       if (top === true) {
+                                               // face top
+                                               indices.push(i, i + 1, c);
+                                       } else {
+                                               // face bottom
+                                               indices.push(i + 1, i, c);
+                                       }
+
+                                       groupCount += 3;
+                               } // add a group to the geometry. this will ensure multi material support
+
+
+                               scope.addGroup(groupStart, groupCount, top === true ? 1 : 2); // calculate new start value for groups
+
+                               groupStart += groupCount;
+                       }
+               }
+
+               static fromJSON(data) {
+                       return new CylinderGeometry(data.radiusTop, data.radiusBottom, data.height, data.radialSegments, data.heightSegments, data.openEnded, data.thetaStart, data.thetaLength);
+               }
+
+       }
+
+       class ConeGeometry extends CylinderGeometry {
+               constructor(radius = 1, height = 1, radialSegments = 8, heightSegments = 1, openEnded = false, thetaStart = 0, thetaLength = Math.PI * 2) {
+                       super(0, radius, height, radialSegments, heightSegments, openEnded, thetaStart, thetaLength);
+                       this.type = 'ConeGeometry';
+                       this.parameters = {
+                               radius: radius,
+                               height: height,
+                               radialSegments: radialSegments,
+                               heightSegments: heightSegments,
+                               openEnded: openEnded,
+                               thetaStart: thetaStart,
+                               thetaLength: thetaLength
+                       };
+               }
+
+               static fromJSON(data) {
+                       return new ConeGeometry(data.radius, data.height, data.radialSegments, data.heightSegments, data.openEnded, data.thetaStart, data.thetaLength);
+               }
+
+       }
+
+       class PolyhedronGeometry extends BufferGeometry {
+               constructor(vertices, indices, radius = 1, detail = 0) {
+                       super();
+                       this.type = 'PolyhedronGeometry';
+                       this.parameters = {
+                               vertices: vertices,
+                               indices: indices,
+                               radius: radius,
+                               detail: detail
+                       }; // default buffer data
+
+                       const vertexBuffer = [];
+                       const uvBuffer = []; // the subdivision creates the vertex buffer data
+
+                       subdivide(detail); // all vertices should lie on a conceptual sphere with a given radius
+
+                       applyRadius(radius); // finally, create the uv data
+
+                       generateUVs(); // build non-indexed geometry
+
+                       this.setAttribute('position', new Float32BufferAttribute(vertexBuffer, 3));
+                       this.setAttribute('normal', new Float32BufferAttribute(vertexBuffer.slice(), 3));
+                       this.setAttribute('uv', new Float32BufferAttribute(uvBuffer, 2));
+
+                       if (detail === 0) {
+                               this.computeVertexNormals(); // flat normals
+                       } else {
+                               this.normalizeNormals(); // smooth normals
+                       } // helper functions
+
+
+                       function subdivide(detail) {
+                               const a = new Vector3();
+                               const b = new Vector3();
+                               const c = new Vector3(); // iterate over all faces and apply a subdivison with the given detail value
+
+                               for (let i = 0; i < indices.length; i += 3) {
+                                       // get the vertices of the face
+                                       getVertexByIndex(indices[i + 0], a);
+                                       getVertexByIndex(indices[i + 1], b);
+                                       getVertexByIndex(indices[i + 2], c); // perform subdivision
+
+                                       subdivideFace(a, b, c, detail);
+                               }
+                       }
+
+                       function subdivideFace(a, b, c, detail) {
+                               const cols = detail + 1; // we use this multidimensional array as a data structure for creating the subdivision
+
+                               const v = []; // construct all of the vertices for this subdivision
+
+                               for (let i = 0; i <= cols; i++) {
+                                       v[i] = [];
+                                       const aj = a.clone().lerp(c, i / cols);
+                                       const bj = b.clone().lerp(c, i / cols);
+                                       const rows = cols - i;
+
+                                       for (let j = 0; j <= rows; j++) {
+                                               if (j === 0 && i === cols) {
+                                                       v[i][j] = aj;
+                                               } else {
+                                                       v[i][j] = aj.clone().lerp(bj, j / rows);
+                                               }
+                                       }
+                               } // construct all of the faces
+
+
+                               for (let i = 0; i < cols; i++) {
+                                       for (let j = 0; j < 2 * (cols - i) - 1; j++) {
+                                               const k = Math.floor(j / 2);
+
+                                               if (j % 2 === 0) {
+                                                       pushVertex(v[i][k + 1]);
+                                                       pushVertex(v[i + 1][k]);
+                                                       pushVertex(v[i][k]);
+                                               } else {
+                                                       pushVertex(v[i][k + 1]);
+                                                       pushVertex(v[i + 1][k + 1]);
+                                                       pushVertex(v[i + 1][k]);
+                                               }
+                                       }
+                               }
+                       }
+
+                       function applyRadius(radius) {
+                               const vertex = new Vector3(); // iterate over the entire buffer and apply the radius to each vertex
+
+                               for (let i = 0; i < vertexBuffer.length; i += 3) {
+                                       vertex.x = vertexBuffer[i + 0];
+                                       vertex.y = vertexBuffer[i + 1];
+                                       vertex.z = vertexBuffer[i + 2];
+                                       vertex.normalize().multiplyScalar(radius);
+                                       vertexBuffer[i + 0] = vertex.x;
+                                       vertexBuffer[i + 1] = vertex.y;
+                                       vertexBuffer[i + 2] = vertex.z;
+                               }
+                       }
+
+                       function generateUVs() {
+                               const vertex = new Vector3();
+
+                               for (let i = 0; i < vertexBuffer.length; i += 3) {
+                                       vertex.x = vertexBuffer[i + 0];
+                                       vertex.y = vertexBuffer[i + 1];
+                                       vertex.z = vertexBuffer[i + 2];
+                                       const u = azimuth(vertex) / 2 / Math.PI + 0.5;
+                                       const v = inclination(vertex) / Math.PI + 0.5;
+                                       uvBuffer.push(u, 1 - v);
+                               }
+
+                               correctUVs();
+                               correctSeam();
+                       }
+
+                       function correctSeam() {
+                               // handle case when face straddles the seam, see #3269
+                               for (let i = 0; i < uvBuffer.length; i += 6) {
+                                       // uv data of a single face
+                                       const x0 = uvBuffer[i + 0];
+                                       const x1 = uvBuffer[i + 2];
+                                       const x2 = uvBuffer[i + 4];
+                                       const max = Math.max(x0, x1, x2);
+                                       const min = Math.min(x0, x1, x2); // 0.9 is somewhat arbitrary
+
+                                       if (max > 0.9 && min < 0.1) {
+                                               if (x0 < 0.2) uvBuffer[i + 0] += 1;
+                                               if (x1 < 0.2) uvBuffer[i + 2] += 1;
+                                               if (x2 < 0.2) uvBuffer[i + 4] += 1;
+                                       }
+                               }
+                       }
+
+                       function pushVertex(vertex) {
+                               vertexBuffer.push(vertex.x, vertex.y, vertex.z);
+                       }
+
+                       function getVertexByIndex(index, vertex) {
+                               const stride = index * 3;
+                               vertex.x = vertices[stride + 0];
+                               vertex.y = vertices[stride + 1];
+                               vertex.z = vertices[stride + 2];
+                       }
+
+                       function correctUVs() {
+                               const a = new Vector3();
+                               const b = new Vector3();
+                               const c = new Vector3();
+                               const centroid = new Vector3();
+                               const uvA = new Vector2();
+                               const uvB = new Vector2();
+                               const uvC = new Vector2();
+
+                               for (let i = 0, j = 0; i < vertexBuffer.length; i += 9, j += 6) {
+                                       a.set(vertexBuffer[i + 0], vertexBuffer[i + 1], vertexBuffer[i + 2]);
+                                       b.set(vertexBuffer[i + 3], vertexBuffer[i + 4], vertexBuffer[i + 5]);
+                                       c.set(vertexBuffer[i + 6], vertexBuffer[i + 7], vertexBuffer[i + 8]);
+                                       uvA.set(uvBuffer[j + 0], uvBuffer[j + 1]);
+                                       uvB.set(uvBuffer[j + 2], uvBuffer[j + 3]);
+                                       uvC.set(uvBuffer[j + 4], uvBuffer[j + 5]);
+                                       centroid.copy(a).add(b).add(c).divideScalar(3);
+                                       const azi = azimuth(centroid);
+                                       correctUV(uvA, j + 0, a, azi);
+                                       correctUV(uvB, j + 2, b, azi);
+                                       correctUV(uvC, j + 4, c, azi);
+                               }
+                       }
+
+                       function correctUV(uv, stride, vector, azimuth) {
+                               if (azimuth < 0 && uv.x === 1) {
+                                       uvBuffer[stride] = uv.x - 1;
+                               }
+
+                               if (vector.x === 0 && vector.z === 0) {
+                                       uvBuffer[stride] = azimuth / 2 / Math.PI + 0.5;
+                               }
+                       } // Angle around the Y axis, counter-clockwise when looking from above.
+
+
+                       function azimuth(vector) {
+                               return Math.atan2(vector.z, -vector.x);
+                       } // Angle above the XZ plane.
+
+
+                       function inclination(vector) {
+                               return Math.atan2(-vector.y, Math.sqrt(vector.x * vector.x + vector.z * vector.z));
+                       }
+               }
+
+               static fromJSON(data) {
+                       return new PolyhedronGeometry(data.vertices, data.indices, data.radius, data.details);
+               }
+
+       }
+
+       class DodecahedronGeometry extends PolyhedronGeometry {
+               constructor(radius = 1, detail = 0) {
+                       const t = (1 + Math.sqrt(5)) / 2;
+                       const r = 1 / t;
+                       const vertices = [// (±1, Â±1, Â±1)
+                       -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, Â±1/φ, Â±Ï†)
+                       0, -r, -t, 0, -r, t, 0, r, -t, 0, r, t, // (±1/φ, Â±Ï†, 0)
+                       -r, -t, 0, -r, t, 0, r, -t, 0, r, t, 0, // (±φ, 0, Â±1/φ)
+                       -t, 0, -r, t, 0, -r, -t, 0, r, t, 0, r];
+                       const indices = [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(vertices, indices, radius, detail);
+                       this.type = 'DodecahedronGeometry';
+                       this.parameters = {
+                               radius: radius,
+                               detail: detail
+                       };
+               }
+
+               static fromJSON(data) {
+                       return new DodecahedronGeometry(data.radius, data.detail);
+               }
+
+       }
+
+       const _v0 = new Vector3();
+
+       const _v1$1 = new Vector3();
+
+       const _normal = new Vector3();
+
+       const _triangle = new Triangle();
+
+       class EdgesGeometry extends BufferGeometry {
+               constructor(geometry, thresholdAngle) {
+                       super();
+                       this.type = 'EdgesGeometry';
+                       this.parameters = {
+                               thresholdAngle: thresholdAngle
+                       };
+                       thresholdAngle = thresholdAngle !== undefined ? thresholdAngle : 1;
+
+                       if (geometry.isGeometry === true) {
+                               console.error('THREE.EdgesGeometry no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.');
+                               return;
+                       }
+
+                       const precisionPoints = 4;
+                       const precision = Math.pow(10, precisionPoints);
+                       const thresholdDot = Math.cos(DEG2RAD * thresholdAngle);
+                       const indexAttr = geometry.getIndex();
+                       const positionAttr = geometry.getAttribute('position');
+                       const indexCount = indexAttr ? indexAttr.count : positionAttr.count;
+                       const indexArr = [0, 0, 0];
+                       const vertKeys = ['a', 'b', 'c'];
+                       const hashes = new Array(3);
+                       const edgeData = {};
+                       const vertices = [];
+
+                       for (let i = 0; i < indexCount; i += 3) {
+                               if (indexAttr) {
+                                       indexArr[0] = indexAttr.getX(i);
+                                       indexArr[1] = indexAttr.getX(i + 1);
+                                       indexArr[2] = indexAttr.getX(i + 2);
+                               } else {
+                                       indexArr[0] = i;
+                                       indexArr[1] = i + 1;
+                                       indexArr[2] = i + 2;
+                               }
+
+                               const {
+                                       a,
+                                       b,
+                                       c
+                               } = _triangle;
+                               a.fromBufferAttribute(positionAttr, indexArr[0]);
+                               b.fromBufferAttribute(positionAttr, indexArr[1]);
+                               c.fromBufferAttribute(positionAttr, indexArr[2]);
+
+                               _triangle.getNormal(_normal); // create hashes for the edge from the vertices
+
+
+                               hashes[0] = `${Math.round(a.x * precision)},${Math.round(a.y * precision)},${Math.round(a.z * precision)}`;
+                               hashes[1] = `${Math.round(b.x * precision)},${Math.round(b.y * precision)},${Math.round(b.z * precision)}`;
+                               hashes[2] = `${Math.round(c.x * precision)},${Math.round(c.y * precision)},${Math.round(c.z * precision)}`; // skip degenerate triangles
+
+                               if (hashes[0] === hashes[1] || hashes[1] === hashes[2] || hashes[2] === hashes[0]) {
+                                       continue;
+                               } // iterate over every edge
+
+
+                               for (let j = 0; j < 3; j++) {
+                                       // get the first and next vertex making up the edge
+                                       const jNext = (j + 1) % 3;
+                                       const vecHash0 = hashes[j];
+                                       const vecHash1 = hashes[jNext];
+                                       const v0 = _triangle[vertKeys[j]];
+                                       const v1 = _triangle[vertKeys[jNext]];
+                                       const hash = `${vecHash0}_${vecHash1}`;
+                                       const reverseHash = `${vecHash1}_${vecHash0}`;
+
+                                       if (reverseHash in edgeData && edgeData[reverseHash]) {
+                                               // if we found a sibling edge add it into the vertex array if
+                                               // it meets the angle threshold and delete the edge from the map.
+                                               if (_normal.dot(edgeData[reverseHash].normal) <= thresholdDot) {
+                                                       vertices.push(v0.x, v0.y, v0.z);
+                                                       vertices.push(v1.x, v1.y, v1.z);
+                                               }
+
+                                               edgeData[reverseHash] = null;
+                                       } else if (!(hash in edgeData)) {
+                                               // if we've already got an edge here then skip adding a new one
+                                               edgeData[hash] = {
+                                                       index0: indexArr[j],
+                                                       index1: indexArr[jNext],
+                                                       normal: _normal.clone()
+                                               };
+                                       }
+                               }
+                       } // iterate over all remaining, unmatched edges and add them to the vertex array
+
+
+                       for (const key in edgeData) {
+                               if (edgeData[key]) {
+                                       const {
+                                               index0,
+                                               index1
+                                       } = edgeData[key];
+
+                                       _v0.fromBufferAttribute(positionAttr, index0);
+
+                                       _v1$1.fromBufferAttribute(positionAttr, index1);
+
+                                       vertices.push(_v0.x, _v0.y, _v0.z);
+                                       vertices.push(_v1$1.x, _v1$1.y, _v1$1.z);
+                               }
+                       }
+
+                       this.setAttribute('position', new Float32BufferAttribute(vertices, 3));
+               }
+
+       }
+
+       /**
+        * Extensible curve object.
+        *
+        * Some common of curve methods:
+        * .getPoint( t, optionalTarget ), .getTangent( t, optionalTarget )
+        * .getPointAt( u, optionalTarget ), .getTangentAt( u, optionalTarget )
+        * .getPoints(), .getSpacedPoints()
+        * .getLength()
+        * .updateArcLengths()
+        *
+        * This following curves inherit from THREE.Curve:
+        *
+        * -- 2D curves --
+        * THREE.ArcCurve
+        * THREE.CubicBezierCurve
+        * THREE.EllipseCurve
+        * THREE.LineCurve
+        * THREE.QuadraticBezierCurve
+        * THREE.SplineCurve
+        *
+        * -- 3D curves --
+        * THREE.CatmullRomCurve3
+        * THREE.CubicBezierCurve3
+        * THREE.LineCurve3
+        * THREE.QuadraticBezierCurve3
+        *
+        * A series of curves can be represented as a THREE.CurvePath.
+        *
+        **/
+
+       class Curve {
+               constructor() {
+                       this.type = 'Curve';
+                       this.arcLengthDivisions = 200;
+               } // Virtual base class method to overwrite and implement in subclasses
+               //      - t [0 .. 1]
+
+
+               getPoint() {
+                       console.warn('THREE.Curve: .getPoint() not implemented.');
+                       return null;
+               } // Get point at relative position in curve according to arc length
+               // - u [0 .. 1]
+
+
+               getPointAt(u, optionalTarget) {
+                       const t = this.getUtoTmapping(u);
+                       return this.getPoint(t, optionalTarget);
+               } // Get sequence of points using getPoint( t )
+
+
+               getPoints(divisions = 5) {
+                       const points = [];
+
+                       for (let d = 0; d <= divisions; d++) {
+                               points.push(this.getPoint(d / divisions));
+                       }
+
+                       return points;
+               } // Get sequence of points using getPointAt( u )
+
+
+               getSpacedPoints(divisions = 5) {
+                       const points = [];
+
+                       for (let d = 0; d <= divisions; d++) {
+                               points.push(this.getPointAt(d / divisions));
+                       }
+
+                       return points;
+               } // Get total curve arc length
+
+
+               getLength() {
+                       const lengths = this.getLengths();
+                       return lengths[lengths.length - 1];
+               } // Get list of cumulative segment lengths
+
+
+               getLengths(divisions = this.arcLengthDivisions) {
+                       if (this.cacheArcLengths && this.cacheArcLengths.length === divisions + 1 && !this.needsUpdate) {
+                               return this.cacheArcLengths;
+                       }
+
+                       this.needsUpdate = false;
+                       const cache = [];
+                       let current,
+                                       last = this.getPoint(0);
+                       let sum = 0;
+                       cache.push(0);
+
+                       for (let p = 1; p <= divisions; p++) {
+                               current = this.getPoint(p / divisions);
+                               sum += current.distanceTo(last);
+                               cache.push(sum);
+                               last = current;
+                       }
+
+                       this.cacheArcLengths = cache;
+                       return cache; // { sums: cache, sum: sum }; Sum is in the last element.
+               }
+
+               updateArcLengths() {
+                       this.needsUpdate = true;
+                       this.getLengths();
+               } // Given u ( 0 .. 1 ), get a t to find p. This gives you points which are equidistant
+
+
+               getUtoTmapping(u, distance) {
+                       const arcLengths = this.getLengths();
+                       let i = 0;
+                       const il = arcLengths.length;
+                       let targetArcLength; // The targeted u distance value to get
+
+                       if (distance) {
+                               targetArcLength = distance;
+                       } else {
+                               targetArcLength = u * arcLengths[il - 1];
+                       } // binary search for the index with largest value smaller than target u distance
+
+
+                       let low = 0,
+                                       high = il - 1,
+                                       comparison;
+
+                       while (low <= high) {
+                               i = Math.floor(low + (high - low) / 2); // less likely to overflow, though probably not issue here, JS doesn't really have integers, all numbers are floats
+
+                               comparison = arcLengths[i] - targetArcLength;
+
+                               if (comparison < 0) {
+                                       low = i + 1;
+                               } else if (comparison > 0) {
+                                       high = i - 1;
+                               } else {
+                                       high = i;
+                                       break; // DONE
+                               }
+                       }
+
+                       i = high;
+
+                       if (arcLengths[i] === targetArcLength) {
+                               return i / (il - 1);
+                       } // we could get finer grain at lengths, or use simple interpolation between two points
+
+
+                       const lengthBefore = arcLengths[i];
+                       const lengthAfter = arcLengths[i + 1];
+                       const segmentLength = lengthAfter - lengthBefore; // determine where we are between the 'before' and 'after' points
+
+                       const segmentFraction = (targetArcLength - lengthBefore) / segmentLength; // add that fractional amount to t
+
+                       const t = (i + segmentFraction) / (il - 1);
+                       return t;
+               } // Returns a unit vector tangent at t
+               // In case any sub curve does not implement its tangent derivation,
+               // 2 points a small delta apart will be used to find its gradient
+               // which seems to give a reasonable approximation
+
+
+               getTangent(t, optionalTarget) {
+                       const delta = 0.0001;
+                       let t1 = t - delta;
+                       let t2 = t + delta; // Capping in case of danger
+
+                       if (t1 < 0) t1 = 0;
+                       if (t2 > 1) t2 = 1;
+                       const pt1 = this.getPoint(t1);
+                       const pt2 = this.getPoint(t2);
+                       const tangent = optionalTarget || (pt1.isVector2 ? new Vector2() : new Vector3());
+                       tangent.copy(pt2).sub(pt1).normalize();
+                       return tangent;
+               }
+
+               getTangentAt(u, optionalTarget) {
+                       const t = this.getUtoTmapping(u);
+                       return this.getTangent(t, optionalTarget);
+               }
+
+               computeFrenetFrames(segments, closed) {
+                       // see http://www.cs.indiana.edu/pub/techreports/TR425.pdf
+                       const normal = new Vector3();
+                       const tangents = [];
+                       const normals = [];
+                       const binormals = [];
+                       const vec = new Vector3();
+                       const mat = new Matrix4(); // compute the tangent vectors for each segment on the curve
+
+                       for (let i = 0; i <= segments; i++) {
+                               const u = i / segments;
+                               tangents[i] = this.getTangentAt(u, new Vector3());
+                               tangents[i].normalize();
+                       } // select an initial normal vector perpendicular to the first tangent vector,
+                       // and in the direction of the minimum tangent xyz component
+
+
+                       normals[0] = new Vector3();
+                       binormals[0] = new Vector3();
+                       let min = Number.MAX_VALUE;
+                       const tx = Math.abs(tangents[0].x);
+                       const ty = Math.abs(tangents[0].y);
+                       const tz = Math.abs(tangents[0].z);
+
+                       if (tx <= min) {
+                               min = tx;
+                               normal.set(1, 0, 0);
+                       }
+
+                       if (ty <= min) {
+                               min = ty;
+                               normal.set(0, 1, 0);
+                       }
+
+                       if (tz <= min) {
+                               normal.set(0, 0, 1);
+                       }
+
+                       vec.crossVectors(tangents[0], normal).normalize();
+                       normals[0].crossVectors(tangents[0], vec);
+                       binormals[0].crossVectors(tangents[0], normals[0]); // compute the slowly-varying normal and binormal vectors for each segment on the curve
+
+                       for (let i = 1; i <= segments; i++) {
+                               normals[i] = normals[i - 1].clone();
+                               binormals[i] = binormals[i - 1].clone();
+                               vec.crossVectors(tangents[i - 1], tangents[i]);
+
+                               if (vec.length() > Number.EPSILON) {
+                                       vec.normalize();
+                                       const theta = Math.acos(clamp(tangents[i - 1].dot(tangents[i]), -1, 1)); // clamp for floating pt errors
+
+                                       normals[i].applyMatrix4(mat.makeRotationAxis(vec, theta));
+                               }
+
+                               binormals[i].crossVectors(tangents[i], normals[i]);
+                       } // if the curve is closed, postprocess the vectors so the first and last normal vectors are the same
+
+
+                       if (closed === true) {
+                               let theta = Math.acos(clamp(normals[0].dot(normals[segments]), -1, 1));
+                               theta /= segments;
+
+                               if (tangents[0].dot(vec.crossVectors(normals[0], normals[segments])) > 0) {
+                                       theta = -theta;
+                               }
+
+                               for (let i = 1; i <= segments; i++) {
+                                       // twist a little...
+                                       normals[i].applyMatrix4(mat.makeRotationAxis(tangents[i], theta * i));
+                                       binormals[i].crossVectors(tangents[i], normals[i]);
+                               }
+                       }
+
+                       return {
+                               tangents: tangents,
+                               normals: normals,
+                               binormals: binormals
+                       };
+               }
+
+               clone() {
+                       return new this.constructor().copy(this);
+               }
+
+               copy(source) {
+                       this.arcLengthDivisions = source.arcLengthDivisions;
+                       return this;
+               }
+
+               toJSON() {
+                       const data = {
+                               metadata: {
+                                       version: 4.5,
+                                       type: 'Curve',
+                                       generator: 'Curve.toJSON'
+                               }
+                       };
+                       data.arcLengthDivisions = this.arcLengthDivisions;
+                       data.type = this.type;
+                       return data;
+               }
+
+               fromJSON(json) {
+                       this.arcLengthDivisions = json.arcLengthDivisions;
+                       return this;
+               }
+
+       }
+
+       class EllipseCurve extends Curve {
+               constructor(aX = 0, aY = 0, xRadius = 1, yRadius = 1, aStartAngle = 0, aEndAngle = Math.PI * 2, aClockwise = false, aRotation = 0) {
+                       super();
+                       this.type = 'EllipseCurve';
+                       this.aX = aX;
+                       this.aY = aY;
+                       this.xRadius = xRadius;
+                       this.yRadius = yRadius;
+                       this.aStartAngle = aStartAngle;
+                       this.aEndAngle = aEndAngle;
+                       this.aClockwise = aClockwise;
+                       this.aRotation = aRotation;
+               }
+
+               getPoint(t, optionalTarget) {
+                       const point = optionalTarget || new Vector2();
+                       const twoPi = Math.PI * 2;
+                       let deltaAngle = this.aEndAngle - this.aStartAngle;
+                       const samePoints = Math.abs(deltaAngle) < Number.EPSILON; // ensures that deltaAngle is 0 .. 2 PI
+
+                       while (deltaAngle < 0) deltaAngle += twoPi;
+
+                       while (deltaAngle > twoPi) deltaAngle -= twoPi;
+
+                       if (deltaAngle < Number.EPSILON) {
+                               if (samePoints) {
+                                       deltaAngle = 0;
+                               } else {
+                                       deltaAngle = twoPi;
+                               }
+                       }
+
+                       if (this.aClockwise === true && !samePoints) {
+                               if (deltaAngle === twoPi) {
+                                       deltaAngle = -twoPi;
+                               } else {
+                                       deltaAngle = deltaAngle - twoPi;
+                               }
+                       }
+
+                       const angle = this.aStartAngle + t * deltaAngle;
+                       let x = this.aX + this.xRadius * Math.cos(angle);
+                       let y = this.aY + this.yRadius * Math.sin(angle);
+
+                       if (this.aRotation !== 0) {
+                               const cos = Math.cos(this.aRotation);
+                               const sin = Math.sin(this.aRotation);
+                               const tx = x - this.aX;
+                               const ty = y - this.aY; // Rotate the point about the center of the ellipse.
+
+                               x = tx * cos - ty * sin + this.aX;
+                               y = tx * sin + ty * cos + this.aY;
+                       }
+
+                       return point.set(x, y);
+               }
+
+               copy(source) {
+                       super.copy(source);
+                       this.aX = source.aX;
+                       this.aY = source.aY;
+                       this.xRadius = source.xRadius;
+                       this.yRadius = source.yRadius;
+                       this.aStartAngle = source.aStartAngle;
+                       this.aEndAngle = source.aEndAngle;
+                       this.aClockwise = source.aClockwise;
+                       this.aRotation = source.aRotation;
+                       return this;
+               }
+
+               toJSON() {
+                       const data = super.toJSON();
+                       data.aX = this.aX;
+                       data.aY = this.aY;
+                       data.xRadius = this.xRadius;
+                       data.yRadius = this.yRadius;
+                       data.aStartAngle = this.aStartAngle;
+                       data.aEndAngle = this.aEndAngle;
+                       data.aClockwise = this.aClockwise;
+                       data.aRotation = this.aRotation;
+                       return data;
+               }
+
+               fromJSON(json) {
+                       super.fromJSON(json);
+                       this.aX = json.aX;
+                       this.aY = json.aY;
+                       this.xRadius = json.xRadius;
+                       this.yRadius = json.yRadius;
+                       this.aStartAngle = json.aStartAngle;
+                       this.aEndAngle = json.aEndAngle;
+                       this.aClockwise = json.aClockwise;
+                       this.aRotation = json.aRotation;
+                       return this;
+               }
+
+       }
+
+       EllipseCurve.prototype.isEllipseCurve = true;
+
+       class ArcCurve extends EllipseCurve {
+               constructor(aX, aY, aRadius, aStartAngle, aEndAngle, aClockwise) {
+                       super(aX, aY, aRadius, aRadius, aStartAngle, aEndAngle, aClockwise);
+                       this.type = 'ArcCurve';
+               }
+
+       }
+
+       ArcCurve.prototype.isArcCurve = true;
+
+       /**
+        * Centripetal CatmullRom Curve - which is useful for avoiding
+        * cusps and self-intersections in non-uniform catmull rom curves.
+        * http://www.cemyuksel.com/research/catmullrom_param/catmullrom.pdf
+        *
+        * curve.type accepts centripetal(default), chordal and catmullrom
+        * curve.tension is used for catmullrom which defaults to 0.5
+        */
+
+       /*
+       Based on an optimized c++ solution in
+        - http://stackoverflow.com/questions/9489736/catmull-rom-curve-with-no-cusps-and-no-self-intersections/
+        - http://ideone.com/NoEbVM
+
+       This CubicPoly class could be used for reusing some variables and calculations,
+       but for three.js curve use, it could be possible inlined and flatten into a single function call
+       which can be placed in CurveUtils.
+       */
+
+       function CubicPoly() {
+               let c0 = 0,
+                               c1 = 0,
+                               c2 = 0,
+                               c3 = 0;
+               /*
+                * Compute coefficients for a cubic polynomial
+                *       p(s) = c0 + c1*s + c2*s^2 + c3*s^3
+                * such that
+                *       p(0) = x0, p(1) = x1
+                *      and
+                *       p'(0) = t0, p'(1) = t1.
+                */
+
+               function init(x0, x1, t0, t1) {
+                       c0 = x0;
+                       c1 = t0;
+                       c2 = -3 * x0 + 3 * x1 - 2 * t0 - t1;
+                       c3 = 2 * x0 - 2 * x1 + t0 + t1;
+               }
+
+               return {
+                       initCatmullRom: function (x0, x1, x2, x3, tension) {
+                               init(x1, x2, tension * (x2 - x0), tension * (x3 - x1));
+                       },
+                       initNonuniformCatmullRom: function (x0, x1, x2, x3, dt0, dt1, dt2) {
+                               // compute tangents when parameterized in [t1,t2]
+                               let t1 = (x1 - x0) / dt0 - (x2 - x0) / (dt0 + dt1) + (x2 - x1) / dt1;
+                               let t2 = (x2 - x1) / dt1 - (x3 - x1) / (dt1 + dt2) + (x3 - x2) / dt2; // rescale tangents for parametrization in [0,1]
+
+                               t1 *= dt1;
+                               t2 *= dt1;
+                               init(x1, x2, t1, t2);
+                       },
+                       calc: function (t) {
+                               const t2 = t * t;
+                               const t3 = t2 * t;
+                               return c0 + c1 * t + c2 * t2 + c3 * t3;
+                       }
+               };
+       } //
+
+
+       const tmp = new Vector3();
+       const px = new CubicPoly(),
+                               py = new CubicPoly(),
+                               pz = new CubicPoly();
+
+       class CatmullRomCurve3 extends Curve {
+               constructor(points = [], closed = false, curveType = 'centripetal', tension = 0.5) {
+                       super();
+                       this.type = 'CatmullRomCurve3';
+                       this.points = points;
+                       this.closed = closed;
+                       this.curveType = curveType;
+                       this.tension = tension;
+               }
+
+               getPoint(t, optionalTarget = new Vector3()) {
+                       const point = optionalTarget;
+                       const points = this.points;
+                       const l = points.length;
+                       const p = (l - (this.closed ? 0 : 1)) * t;
+                       let intPoint = Math.floor(p);
+                       let weight = p - intPoint;
+
+                       if (this.closed) {
+                               intPoint += intPoint > 0 ? 0 : (Math.floor(Math.abs(intPoint) / l) + 1) * l;
+                       } else if (weight === 0 && intPoint === l - 1) {
+                               intPoint = l - 2;
+                               weight = 1;
+                       }
+
+                       let p0, p3; // 4 points (p1 & p2 defined below)
+
+                       if (this.closed || intPoint > 0) {
+                               p0 = points[(intPoint - 1) % l];
+                       } else {
+                               // extrapolate first point
+                               tmp.subVectors(points[0], points[1]).add(points[0]);
+                               p0 = tmp;
+                       }
+
+                       const p1 = points[intPoint % l];
+                       const p2 = points[(intPoint + 1) % l];
+
+                       if (this.closed || intPoint + 2 < l) {
+                               p3 = points[(intPoint + 2) % l];
+                       } else {
+                               // extrapolate last point
+                               tmp.subVectors(points[l - 1], points[l - 2]).add(points[l - 1]);
+                               p3 = tmp;
+                       }
+
+                       if (this.curveType === 'centripetal' || this.curveType === 'chordal') {
+                               // init Centripetal / Chordal Catmull-Rom
+                               const pow = this.curveType === 'chordal' ? 0.5 : 0.25;
+                               let dt0 = Math.pow(p0.distanceToSquared(p1), pow);
+                               let dt1 = Math.pow(p1.distanceToSquared(p2), pow);
+                               let dt2 = Math.pow(p2.distanceToSquared(p3), pow); // safety check for repeated points
+
+                               if (dt1 < 1e-4) dt1 = 1.0;
+                               if (dt0 < 1e-4) dt0 = dt1;
+                               if (dt2 < 1e-4) dt2 = dt1;
+                               px.initNonuniformCatmullRom(p0.x, p1.x, p2.x, p3.x, dt0, dt1, dt2);
+                               py.initNonuniformCatmullRom(p0.y, p1.y, p2.y, p3.y, dt0, dt1, dt2);
+                               pz.initNonuniformCatmullRom(p0.z, p1.z, p2.z, p3.z, dt0, dt1, dt2);
+                       } else if (this.curveType === 'catmullrom') {
+                               px.initCatmullRom(p0.x, p1.x, p2.x, p3.x, this.tension);
+                               py.initCatmullRom(p0.y, p1.y, p2.y, p3.y, this.tension);
+                               pz.initCatmullRom(p0.z, p1.z, p2.z, p3.z, this.tension);
+                       }
+
+                       point.set(px.calc(weight), py.calc(weight), pz.calc(weight));
+                       return point;
+               }
+
+               copy(source) {
+                       super.copy(source);
+                       this.points = [];
+
+                       for (let i = 0, l = source.points.length; i < l; i++) {
+                               const point = source.points[i];
+                               this.points.push(point.clone());
+                       }
+
+                       this.closed = source.closed;
+                       this.curveType = source.curveType;
+                       this.tension = source.tension;
+                       return this;
+               }
+
+               toJSON() {
+                       const data = super.toJSON();
+                       data.points = [];
+
+                       for (let i = 0, l = this.points.length; i < l; i++) {
+                               const point = this.points[i];
+                               data.points.push(point.toArray());
+                       }
+
+                       data.closed = this.closed;
+                       data.curveType = this.curveType;
+                       data.tension = this.tension;
+                       return data;
+               }
+
+               fromJSON(json) {
+                       super.fromJSON(json);
+                       this.points = [];
+
+                       for (let i = 0, l = json.points.length; i < l; i++) {
+                               const point = json.points[i];
+                               this.points.push(new Vector3().fromArray(point));
+                       }
+
+                       this.closed = json.closed;
+                       this.curveType = json.curveType;
+                       this.tension = json.tension;
+                       return this;
+               }
+
+       }
+
+       CatmullRomCurve3.prototype.isCatmullRomCurve3 = true;
+
+       /**
+        * Bezier Curves formulas obtained from
+        * http://en.wikipedia.org/wiki/Bézier_curve
+        */
+       function CatmullRom(t, p0, p1, p2, p3) {
+               const v0 = (p2 - p0) * 0.5;
+               const v1 = (p3 - p1) * 0.5;
+               const t2 = t * t;
+               const t3 = t * t2;
+               return (2 * p1 - 2 * p2 + v0 + v1) * t3 + (-3 * p1 + 3 * p2 - 2 * v0 - v1) * t2 + v0 * t + p1;
+       } //
+
+
+       function QuadraticBezierP0(t, p) {
+               const k = 1 - t;
+               return k * k * p;
+       }
+
+       function QuadraticBezierP1(t, p) {
+               return 2 * (1 - t) * t * p;
+       }
+
+       function QuadraticBezierP2(t, p) {
+               return t * t * p;
+       }
+
+       function QuadraticBezier(t, p0, p1, p2) {
+               return QuadraticBezierP0(t, p0) + QuadraticBezierP1(t, p1) + QuadraticBezierP2(t, p2);
+       } //
+
+
+       function CubicBezierP0(t, p) {
+               const k = 1 - t;
+               return k * k * k * p;
+       }
+
+       function CubicBezierP1(t, p) {
+               const k = 1 - t;
+               return 3 * k * k * t * p;
+       }
+
+       function CubicBezierP2(t, p) {
+               return 3 * (1 - t) * t * t * p;
+       }
+
+       function CubicBezierP3(t, p) {
+               return t * t * t * p;
+       }
+
+       function CubicBezier(t, p0, p1, p2, p3) {
+               return CubicBezierP0(t, p0) + CubicBezierP1(t, p1) + CubicBezierP2(t, p2) + CubicBezierP3(t, p3);
+       }
+
+       class CubicBezierCurve extends Curve {
+               constructor(v0 = new Vector2(), v1 = new Vector2(), v2 = new Vector2(), v3 = new Vector2()) {
+                       super();
+                       this.type = 'CubicBezierCurve';
+                       this.v0 = v0;
+                       this.v1 = v1;
+                       this.v2 = v2;
+                       this.v3 = v3;
+               }
+
+               getPoint(t, optionalTarget = new Vector2()) {
+                       const point = optionalTarget;
+                       const v0 = this.v0,
+                                               v1 = this.v1,
+                                               v2 = this.v2,
+                                               v3 = this.v3;
+                       point.set(CubicBezier(t, v0.x, v1.x, v2.x, v3.x), CubicBezier(t, v0.y, v1.y, v2.y, v3.y));
+                       return point;
+               }
+
+               copy(source) {
+                       super.copy(source);
+                       this.v0.copy(source.v0);
+                       this.v1.copy(source.v1);
+                       this.v2.copy(source.v2);
+                       this.v3.copy(source.v3);
+                       return this;
+               }
+
+               toJSON() {
+                       const data = super.toJSON();
+                       data.v0 = this.v0.toArray();
+                       data.v1 = this.v1.toArray();
+                       data.v2 = this.v2.toArray();
+                       data.v3 = this.v3.toArray();
+                       return data;
+               }
+
+               fromJSON(json) {
+                       super.fromJSON(json);
+                       this.v0.fromArray(json.v0);
+                       this.v1.fromArray(json.v1);
+                       this.v2.fromArray(json.v2);
+                       this.v3.fromArray(json.v3);
+                       return this;
+               }
+
+       }
+
+       CubicBezierCurve.prototype.isCubicBezierCurve = true;
+
+       class CubicBezierCurve3 extends Curve {
+               constructor(v0 = new Vector3(), v1 = new Vector3(), v2 = new Vector3(), v3 = new Vector3()) {
+                       super();
+                       this.type = 'CubicBezierCurve3';
+                       this.v0 = v0;
+                       this.v1 = v1;
+                       this.v2 = v2;
+                       this.v3 = v3;
+               }
+
+               getPoint(t, optionalTarget = new Vector3()) {
+                       const point = optionalTarget;
+                       const v0 = this.v0,
+                                               v1 = this.v1,
+                                               v2 = this.v2,
+                                               v3 = this.v3;
+                       point.set(CubicBezier(t, v0.x, v1.x, v2.x, v3.x), CubicBezier(t, v0.y, v1.y, v2.y, v3.y), CubicBezier(t, v0.z, v1.z, v2.z, v3.z));
+                       return point;
+               }
+
+               copy(source) {
+                       super.copy(source);
+                       this.v0.copy(source.v0);
+                       this.v1.copy(source.v1);
+                       this.v2.copy(source.v2);
+                       this.v3.copy(source.v3);
+                       return this;
+               }
+
+               toJSON() {
+                       const data = super.toJSON();
+                       data.v0 = this.v0.toArray();
+                       data.v1 = this.v1.toArray();
+                       data.v2 = this.v2.toArray();
+                       data.v3 = this.v3.toArray();
+                       return data;
+               }
+
+               fromJSON(json) {
+                       super.fromJSON(json);
+                       this.v0.fromArray(json.v0);
+                       this.v1.fromArray(json.v1);
+                       this.v2.fromArray(json.v2);
+                       this.v3.fromArray(json.v3);
+                       return this;
+               }
+
+       }
+
+       CubicBezierCurve3.prototype.isCubicBezierCurve3 = true;
+
+       class LineCurve extends Curve {
+               constructor(v1 = new Vector2(), v2 = new Vector2()) {
+                       super();
+                       this.type = 'LineCurve';
+                       this.v1 = v1;
+                       this.v2 = v2;
+               }
+
+               getPoint(t, optionalTarget = new Vector2()) {
+                       const point = optionalTarget;
+
+                       if (t === 1) {
+                               point.copy(this.v2);
+                       } else {
+                               point.copy(this.v2).sub(this.v1);
+                               point.multiplyScalar(t).add(this.v1);
+                       }
+
+                       return point;
+               } // Line curve is linear, so we can overwrite default getPointAt
+
+
+               getPointAt(u, optionalTarget) {
+                       return this.getPoint(u, optionalTarget);
+               }
+
+               getTangent(t, optionalTarget) {
+                       const tangent = optionalTarget || new Vector2();
+                       tangent.copy(this.v2).sub(this.v1).normalize();
+                       return tangent;
+               }
+
+               copy(source) {
+                       super.copy(source);
+                       this.v1.copy(source.v1);
+                       this.v2.copy(source.v2);
+                       return this;
+               }
+
+               toJSON() {
+                       const data = super.toJSON();
+                       data.v1 = this.v1.toArray();
+                       data.v2 = this.v2.toArray();
+                       return data;
+               }
+
+               fromJSON(json) {
+                       super.fromJSON(json);
+                       this.v1.fromArray(json.v1);
+                       this.v2.fromArray(json.v2);
+                       return this;
+               }
+
+       }
+
+       LineCurve.prototype.isLineCurve = true;
+
+       class LineCurve3 extends Curve {
+               constructor(v1 = new Vector3(), v2 = new Vector3()) {
+                       super();
+                       this.type = 'LineCurve3';
+                       this.isLineCurve3 = true;
+                       this.v1 = v1;
+                       this.v2 = v2;
+               }
+
+               getPoint(t, optionalTarget = new Vector3()) {
+                       const point = optionalTarget;
+
+                       if (t === 1) {
+                               point.copy(this.v2);
+                       } else {
+                               point.copy(this.v2).sub(this.v1);
+                               point.multiplyScalar(t).add(this.v1);
+                       }
+
+                       return point;
+               } // Line curve is linear, so we can overwrite default getPointAt
+
+
+               getPointAt(u, optionalTarget) {
+                       return this.getPoint(u, optionalTarget);
+               }
+
+               copy(source) {
+                       super.copy(source);
+                       this.v1.copy(source.v1);
+                       this.v2.copy(source.v2);
+                       return this;
+               }
+
+               toJSON() {
+                       const data = super.toJSON();
+                       data.v1 = this.v1.toArray();
+                       data.v2 = this.v2.toArray();
+                       return data;
+               }
+
+               fromJSON(json) {
+                       super.fromJSON(json);
+                       this.v1.fromArray(json.v1);
+                       this.v2.fromArray(json.v2);
+                       return this;
+               }
+
+       }
+
+       class QuadraticBezierCurve extends Curve {
+               constructor(v0 = new Vector2(), v1 = new Vector2(), v2 = new Vector2()) {
+                       super();
+                       this.type = 'QuadraticBezierCurve';
+                       this.v0 = v0;
+                       this.v1 = v1;
+                       this.v2 = v2;
+               }
+
+               getPoint(t, optionalTarget = new Vector2()) {
+                       const point = optionalTarget;
+                       const v0 = this.v0,
+                                               v1 = this.v1,
+                                               v2 = this.v2;
+                       point.set(QuadraticBezier(t, v0.x, v1.x, v2.x), QuadraticBezier(t, v0.y, v1.y, v2.y));
+                       return point;
+               }
+
+               copy(source) {
+                       super.copy(source);
+                       this.v0.copy(source.v0);
+                       this.v1.copy(source.v1);
+                       this.v2.copy(source.v2);
+                       return this;
+               }
+
+               toJSON() {
+                       const data = super.toJSON();
+                       data.v0 = this.v0.toArray();
+                       data.v1 = this.v1.toArray();
+                       data.v2 = this.v2.toArray();
+                       return data;
+               }
+
+               fromJSON(json) {
+                       super.fromJSON(json);
+                       this.v0.fromArray(json.v0);
+                       this.v1.fromArray(json.v1);
+                       this.v2.fromArray(json.v2);
+                       return this;
+               }
+
+       }
+
+       QuadraticBezierCurve.prototype.isQuadraticBezierCurve = true;
+
+       class QuadraticBezierCurve3 extends Curve {
+               constructor(v0 = new Vector3(), v1 = new Vector3(), v2 = new Vector3()) {
+                       super();
+                       this.type = 'QuadraticBezierCurve3';
+                       this.v0 = v0;
+                       this.v1 = v1;
+                       this.v2 = v2;
+               }
+
+               getPoint(t, optionalTarget = new Vector3()) {
+                       const point = optionalTarget;
+                       const v0 = this.v0,
+                                               v1 = this.v1,
+                                               v2 = this.v2;
+                       point.set(QuadraticBezier(t, v0.x, v1.x, v2.x), QuadraticBezier(t, v0.y, v1.y, v2.y), QuadraticBezier(t, v0.z, v1.z, v2.z));
+                       return point;
+               }
+
+               copy(source) {
+                       super.copy(source);
+                       this.v0.copy(source.v0);
+                       this.v1.copy(source.v1);
+                       this.v2.copy(source.v2);
+                       return this;
+               }
+
+               toJSON() {
+                       const data = super.toJSON();
+                       data.v0 = this.v0.toArray();
+                       data.v1 = this.v1.toArray();
+                       data.v2 = this.v2.toArray();
+                       return data;
+               }
+
+               fromJSON(json) {
+                       super.fromJSON(json);
+                       this.v0.fromArray(json.v0);
+                       this.v1.fromArray(json.v1);
+                       this.v2.fromArray(json.v2);
+                       return this;
+               }
+
+       }
+
+       QuadraticBezierCurve3.prototype.isQuadraticBezierCurve3 = true;
+
+       class SplineCurve extends Curve {
+               constructor(points = []) {
+                       super();
+                       this.type = 'SplineCurve';
+                       this.points = points;
+               }
+
+               getPoint(t, optionalTarget = new Vector2()) {
+                       const point = optionalTarget;
+                       const points = this.points;
+                       const p = (points.length - 1) * t;
+                       const intPoint = Math.floor(p);
+                       const weight = p - intPoint;
+                       const p0 = points[intPoint === 0 ? intPoint : intPoint - 1];
+                       const p1 = points[intPoint];
+                       const p2 = points[intPoint > points.length - 2 ? points.length - 1 : intPoint + 1];
+                       const p3 = points[intPoint > points.length - 3 ? points.length - 1 : intPoint + 2];
+                       point.set(CatmullRom(weight, p0.x, p1.x, p2.x, p3.x), CatmullRom(weight, p0.y, p1.y, p2.y, p3.y));
+                       return point;
+               }
+
+               copy(source) {
+                       super.copy(source);
+                       this.points = [];
+
+                       for (let i = 0, l = source.points.length; i < l; i++) {
+                               const point = source.points[i];
+                               this.points.push(point.clone());
+                       }
+
+                       return this;
+               }
+
+               toJSON() {
+                       const data = super.toJSON();
+                       data.points = [];
+
+                       for (let i = 0, l = this.points.length; i < l; i++) {
+                               const point = this.points[i];
+                               data.points.push(point.toArray());
+                       }
+
+                       return data;
+               }
+
+               fromJSON(json) {
+                       super.fromJSON(json);
+                       this.points = [];
+
+                       for (let i = 0, l = json.points.length; i < l; i++) {
+                               const point = json.points[i];
+                               this.points.push(new Vector2().fromArray(point));
+                       }
+
+                       return this;
+               }
+
+       }
+
+       SplineCurve.prototype.isSplineCurve = true;
+
+       var Curves = /*#__PURE__*/Object.freeze({
+               __proto__: null,
+               ArcCurve: ArcCurve,
+               CatmullRomCurve3: CatmullRomCurve3,
+               CubicBezierCurve: CubicBezierCurve,
+               CubicBezierCurve3: CubicBezierCurve3,
+               EllipseCurve: EllipseCurve,
+               LineCurve: LineCurve,
+               LineCurve3: LineCurve3,
+               QuadraticBezierCurve: QuadraticBezierCurve,
+               QuadraticBezierCurve3: QuadraticBezierCurve3,
+               SplineCurve: SplineCurve
+       });
+
+       /**
+        * Port from https://github.com/mapbox/earcut (v2.2.2)
+        */
+       const Earcut = {
+               triangulate: function (data, holeIndices, dim = 2) {
+                       const hasHoles = holeIndices && holeIndices.length;
+                       const outerLen = hasHoles ? holeIndices[0] * dim : data.length;
+                       let outerNode = linkedList(data, 0, outerLen, dim, true);
+                       const triangles = [];
+                       if (!outerNode || outerNode.next === outerNode.prev) return triangles;
+                       let minX, minY, maxX, maxY, x, y, invSize;
+                       if (hasHoles) outerNode = eliminateHoles(data, holeIndices, outerNode, dim); // if the shape is not too simple, we'll use z-order curve hash later; calculate polygon bbox
+
+                       if (data.length > 80 * dim) {
+                               minX = maxX = data[0];
+                               minY = maxY = data[1];
+
+                               for (let i = dim; i < outerLen; i += dim) {
+                                       x = data[i];
+                                       y = data[i + 1];
+                                       if (x < minX) minX = x;
+                                       if (y < minY) minY = y;
+                                       if (x > maxX) maxX = x;
+                                       if (y > maxY) maxY = y;
+                               } // minX, minY and invSize are later used to transform coords into integers for z-order calculation
+
+
+                               invSize = Math.max(maxX - minX, maxY - minY);
+                               invSize = invSize !== 0 ? 1 / invSize : 0;
+                       }
+
+                       earcutLinked(outerNode, triangles, dim, minX, minY, invSize);
+                       return triangles;
+               }
+       }; // create a circular doubly linked list from polygon points in the specified winding order
+
+       function linkedList(data, start, end, dim, clockwise) {
+               let i, last;
+
+               if (clockwise === signedArea(data, start, end, dim) > 0) {
+                       for (i = start; i < end; i += dim) last = insertNode(i, data[i], data[i + 1], last);
+               } else {
+                       for (i = end - dim; i >= start; i -= dim) last = insertNode(i, data[i], data[i + 1], last);
+               }
+
+               if (last && equals(last, last.next)) {
+                       removeNode(last);
+                       last = last.next;
+               }
+
+               return last;
+       } // eliminate colinear or duplicate points
+
+
+       function filterPoints(start, end) {
+               if (!start) return start;
+               if (!end) end = start;
+               let p = start,
+                               again;
+
+               do {
+                       again = false;
+
+                       if (!p.steiner && (equals(p, p.next) || area(p.prev, p, p.next) === 0)) {
+                               removeNode(p);
+                               p = end = p.prev;
+                               if (p === p.next) break;
+                               again = true;
+                       } else {
+                               p = p.next;
+                       }
+               } while (again || p !== end);
+
+               return end;
+       } // main ear slicing loop which triangulates a polygon (given as a linked list)
+
+
+       function earcutLinked(ear, triangles, dim, minX, minY, invSize, pass) {
+               if (!ear) return; // interlink polygon nodes in z-order
+
+               if (!pass && invSize) indexCurve(ear, minX, minY, invSize);
+               let stop = ear,
+                               prev,
+                               next; // iterate through ears, slicing them one by one
+
+               while (ear.prev !== ear.next) {
+                       prev = ear.prev;
+                       next = ear.next;
+
+                       if (invSize ? isEarHashed(ear, minX, minY, invSize) : isEar(ear)) {
+                               // cut off the triangle
+                               triangles.push(prev.i / dim);
+                               triangles.push(ear.i / dim);
+                               triangles.push(next.i / dim);
+                               removeNode(ear); // skipping the next vertex leads to less sliver triangles
+
+                               ear = next.next;
+                               stop = next.next;
+                               continue;
+                       }
+
+                       ear = next; // if we looped through the whole remaining polygon and can't find any more ears
+
+                       if (ear === stop) {
+                               // try filtering points and slicing again
+                               if (!pass) {
+                                       earcutLinked(filterPoints(ear), triangles, dim, minX, minY, invSize, 1); // if this didn't work, try curing all small self-intersections locally
+                               } else if (pass === 1) {
+                                       ear = cureLocalIntersections(filterPoints(ear), triangles, dim);
+                                       earcutLinked(ear, triangles, dim, minX, minY, invSize, 2); // as a last resort, try splitting the remaining polygon into two
+                               } else if (pass === 2) {
+                                       splitEarcut(ear, triangles, dim, minX, minY, invSize);
+                               }
+
+                               break;
+                       }
+               }
+       } // check whether a polygon node forms a valid ear with adjacent nodes
+
+
+       function isEar(ear) {
+               const a = ear.prev,
+                                       b = ear,
+                                       c = ear.next;
+               if (area(a, b, c) >= 0) return false; // reflex, can't be an ear
+               // now make sure we don't have other points inside the potential ear
+
+               let p = ear.next.next;
+
+               while (p !== ear.prev) {
+                       if (pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, p.x, p.y) && area(p.prev, p, p.next) >= 0) return false;
+                       p = p.next;
+               }
+
+               return true;
+       }
+
+       function isEarHashed(ear, minX, minY, invSize) {
+               const a = ear.prev,
+                                       b = ear,
+                                       c = ear.next;
+               if (area(a, b, c) >= 0) return false; // reflex, can't be an ear
+               // triangle bbox; min & max are calculated like this for speed
+
+               const minTX = a.x < b.x ? a.x < c.x ? a.x : c.x : b.x < c.x ? b.x : c.x,
+                                       minTY = a.y < b.y ? a.y < c.y ? a.y : c.y : b.y < c.y ? b.y : c.y,
+                                       maxTX = a.x > b.x ? a.x > c.x ? a.x : c.x : b.x > c.x ? b.x : c.x,
+                                       maxTY = a.y > b.y ? a.y > c.y ? a.y : c.y : b.y > c.y ? b.y : c.y; // z-order range for the current triangle bbox;
+
+               const minZ = zOrder(minTX, minTY, minX, minY, invSize),
+                                       maxZ = zOrder(maxTX, maxTY, minX, minY, invSize);
+               let p = ear.prevZ,
+                               n = ear.nextZ; // look for points inside the triangle in both directions
+
+               while (p && p.z >= minZ && n && n.z <= maxZ) {
+                       if (p !== ear.prev && p !== ear.next && pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, p.x, p.y) && area(p.prev, p, p.next) >= 0) return false;
+                       p = p.prevZ;
+                       if (n !== ear.prev && n !== ear.next && pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, n.x, n.y) && area(n.prev, n, n.next) >= 0) return false;
+                       n = n.nextZ;
+               } // look for remaining points in decreasing z-order
+
+
+               while (p && p.z >= minZ) {
+                       if (p !== ear.prev && p !== ear.next && pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, p.x, p.y) && area(p.prev, p, p.next) >= 0) return false;
+                       p = p.prevZ;
+               } // look for remaining points in increasing z-order
+
+
+               while (n && n.z <= maxZ) {
+                       if (n !== ear.prev && n !== ear.next && pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, n.x, n.y) && area(n.prev, n, n.next) >= 0) return false;
+                       n = n.nextZ;
+               }
+
+               return true;
+       } // go through all polygon nodes and cure small local self-intersections
+
+
+       function cureLocalIntersections(start, triangles, dim) {
+               let p = start;
+
+               do {
+                       const a = p.prev,
+                                               b = p.next.next;
+
+                       if (!equals(a, b) && intersects(a, p, p.next, b) && locallyInside(a, b) && locallyInside(b, a)) {
+                               triangles.push(a.i / dim);
+                               triangles.push(p.i / dim);
+                               triangles.push(b.i / dim); // remove two nodes involved
+
+                               removeNode(p);
+                               removeNode(p.next);
+                               p = start = b;
+                       }
+
+                       p = p.next;
+               } while (p !== start);
+
+               return filterPoints(p);
+       } // try splitting polygon into two and triangulate them independently
+
+
+       function splitEarcut(start, triangles, dim, minX, minY, invSize) {
+               // look for a valid diagonal that divides the polygon into two
+               let a = start;
+
+               do {
+                       let b = a.next.next;
+
+                       while (b !== a.prev) {
+                               if (a.i !== b.i && isValidDiagonal(a, b)) {
+                                       // split the polygon in two by the diagonal
+                                       let c = splitPolygon(a, b); // filter colinear points around the cuts
+
+                                       a = filterPoints(a, a.next);
+                                       c = filterPoints(c, c.next); // run earcut on each half
+
+                                       earcutLinked(a, triangles, dim, minX, minY, invSize);
+                                       earcutLinked(c, triangles, dim, minX, minY, invSize);
+                                       return;
+                               }
+
+                               b = b.next;
+                       }
+
+                       a = a.next;
+               } while (a !== start);
+       } // link every hole into the outer loop, producing a single-ring polygon without holes
+
+
+       function eliminateHoles(data, holeIndices, outerNode, dim) {
+               const queue = [];
+               let i, len, start, end, list;
+
+               for (i = 0, len = holeIndices.length; i < len; i++) {
+                       start = holeIndices[i] * dim;
+                       end = i < len - 1 ? holeIndices[i + 1] * dim : data.length;
+                       list = linkedList(data, start, end, dim, false);
+                       if (list === list.next) list.steiner = true;
+                       queue.push(getLeftmost(list));
+               }
+
+               queue.sort(compareX); // process holes from left to right
+
+               for (i = 0; i < queue.length; i++) {
+                       eliminateHole(queue[i], outerNode);
+                       outerNode = filterPoints(outerNode, outerNode.next);
+               }
+
+               return outerNode;
+       }
+
+       function compareX(a, b) {
+               return a.x - b.x;
+       } // find a bridge between vertices that connects hole with an outer ring and and link it
+
+
+       function eliminateHole(hole, outerNode) {
+               outerNode = findHoleBridge(hole, outerNode);
+
+               if (outerNode) {
+                       const b = splitPolygon(outerNode, hole); // filter collinear points around the cuts
+
+                       filterPoints(outerNode, outerNode.next);
+                       filterPoints(b, b.next);
+               }
+       } // David Eberly's algorithm for finding a bridge between hole and outer polygon
+
+
+       function findHoleBridge(hole, outerNode) {
+               let p = outerNode;
+               const hx = hole.x;
+               const hy = hole.y;
+               let qx = -Infinity,
+                               m; // find a segment intersected by a ray from the hole's leftmost point to the left;
+               // segment's endpoint with lesser x will be potential connection point
+
+               do {
+                       if (hy <= p.y && hy >= p.next.y && p.next.y !== p.y) {
+                               const x = p.x + (hy - p.y) * (p.next.x - p.x) / (p.next.y - p.y);
+
+                               if (x <= hx && x > qx) {
+                                       qx = x;
+
+                                       if (x === hx) {
+                                               if (hy === p.y) return p;
+                                               if (hy === p.next.y) return p.next;
+                                       }
+
+                                       m = p.x < p.next.x ? p : p.next;
+                               }
+                       }
+
+                       p = p.next;
+               } while (p !== outerNode);
+
+               if (!m) return null;
+               if (hx === qx) return m; // hole touches outer segment; pick leftmost endpoint
+               // look for points inside the triangle of hole point, segment intersection and endpoint;
+               // if there are no points found, we have a valid connection;
+               // otherwise choose the point of the minimum angle with the ray as connection point
+
+               const stop = m,
+                                       mx = m.x,
+                                       my = m.y;
+               let tanMin = Infinity,
+                               tan;
+               p = m;
+
+               do {
+                       if (hx >= p.x && p.x >= mx && hx !== p.x && pointInTriangle(hy < my ? hx : qx, hy, mx, my, hy < my ? qx : hx, hy, p.x, p.y)) {
+                               tan = Math.abs(hy - p.y) / (hx - p.x); // tangential
+
+                               if (locallyInside(p, hole) && (tan < tanMin || tan === tanMin && (p.x > m.x || p.x === m.x && sectorContainsSector(m, p)))) {
+                                       m = p;
+                                       tanMin = tan;
+                               }
+                       }
+
+                       p = p.next;
+               } while (p !== stop);
+
+               return m;
+       } // whether sector in vertex m contains sector in vertex p in the same coordinates
+
+
+       function sectorContainsSector(m, p) {
+               return area(m.prev, m, p.prev) < 0 && area(p.next, m, m.next) < 0;
+       } // interlink polygon nodes in z-order
+
+
+       function indexCurve(start, minX, minY, invSize) {
+               let p = start;
+
+               do {
+                       if (p.z === null) p.z = zOrder(p.x, p.y, minX, minY, invSize);
+                       p.prevZ = p.prev;
+                       p.nextZ = p.next;
+                       p = p.next;
+               } while (p !== start);
+
+               p.prevZ.nextZ = null;
+               p.prevZ = null;
+               sortLinked(p);
+       } // Simon Tatham's linked list merge sort algorithm
+       // http://www.chiark.greenend.org.uk/~sgtatham/algorithms/listsort.html
+
+
+       function sortLinked(list) {
+               let i,
+                               p,
+                               q,
+                               e,
+                               tail,
+                               numMerges,
+                               pSize,
+                               qSize,
+                               inSize = 1;
+
+               do {
+                       p = list;
+                       list = null;
+                       tail = null;
+                       numMerges = 0;
+
+                       while (p) {
+                               numMerges++;
+                               q = p;
+                               pSize = 0;
+
+                               for (i = 0; i < inSize; i++) {
+                                       pSize++;
+                                       q = q.nextZ;
+                                       if (!q) break;
+                               }
+
+                               qSize = inSize;
+
+                               while (pSize > 0 || qSize > 0 && q) {
+                                       if (pSize !== 0 && (qSize === 0 || !q || p.z <= q.z)) {
+                                               e = p;
+                                               p = p.nextZ;
+                                               pSize--;
+                                       } else {
+                                               e = q;
+                                               q = q.nextZ;
+                                               qSize--;
+                                       }
+
+                                       if (tail) tail.nextZ = e;else list = e;
+                                       e.prevZ = tail;
+                                       tail = e;
+                               }
+
+                               p = q;
+                       }
+
+                       tail.nextZ = null;
+                       inSize *= 2;
+               } while (numMerges > 1);
+
+               return list;
+       } // z-order of a point given coords and inverse of the longer side of data bbox
+
+
+       function zOrder(x, y, minX, minY, invSize) {
+               // coords are transformed into non-negative 15-bit integer range
+               x = 32767 * (x - minX) * invSize;
+               y = 32767 * (y - minY) * invSize;
+               x = (x | x << 8) & 0x00FF00FF;
+               x = (x | x << 4) & 0x0F0F0F0F;
+               x = (x | x << 2) & 0x33333333;
+               x = (x | x << 1) & 0x55555555;
+               y = (y | y << 8) & 0x00FF00FF;
+               y = (y | y << 4) & 0x0F0F0F0F;
+               y = (y | y << 2) & 0x33333333;
+               y = (y | y << 1) & 0x55555555;
+               return x | y << 1;
+       } // find the leftmost node of a polygon ring
+
+
+       function getLeftmost(start) {
+               let p = start,
+                               leftmost = start;
+
+               do {
+                       if (p.x < leftmost.x || p.x === leftmost.x && p.y < leftmost.y) leftmost = p;
+                       p = p.next;
+               } while (p !== start);
+
+               return leftmost;
+       } // check if a point lies within a convex triangle
+
+
+       function pointInTriangle(ax, ay, bx, by, cx, cy, px, py) {
+               return (cx - px) * (ay - py) - (ax - px) * (cy - py) >= 0 && (ax - px) * (by - py) - (bx - px) * (ay - py) >= 0 && (bx - px) * (cy - py) - (cx - px) * (by - py) >= 0;
+       } // check if a diagonal between two polygon nodes is valid (lies in polygon interior)
+
+
+       function isValidDiagonal(a, b) {
+               return a.next.i !== b.i && a.prev.i !== b.i && !intersectsPolygon(a, b) && (locallyInside(a, b) && locallyInside(b, a) && middleInside(a, b) && (area(a.prev, a, b.prev) || area(a, b.prev, b)) || // does not create opposite-facing sectors
+               equals(a, b) && area(a.prev, a, a.next) > 0 && area(b.prev, b, b.next) > 0); // special zero-length case
+       } // signed area of a triangle
+
+
+       function area(p, q, r) {
+               return (q.y - p.y) * (r.x - q.x) - (q.x - p.x) * (r.y - q.y);
+       } // check if two points are equal
+
+
+       function equals(p1, p2) {
+               return p1.x === p2.x && p1.y === p2.y;
+       } // check if two segments intersect
+
+
+       function intersects(p1, q1, p2, q2) {
+               const o1 = sign(area(p1, q1, p2));
+               const o2 = sign(area(p1, q1, q2));
+               const o3 = sign(area(p2, q2, p1));
+               const o4 = sign(area(p2, q2, q1));
+               if (o1 !== o2 && o3 !== o4) return true; // general case
+
+               if (o1 === 0 && onSegment(p1, p2, q1)) return true; // p1, q1 and p2 are collinear and p2 lies on p1q1
+
+               if (o2 === 0 && onSegment(p1, q2, q1)) return true; // p1, q1 and q2 are collinear and q2 lies on p1q1
+
+               if (o3 === 0 && onSegment(p2, p1, q2)) return true; // p2, q2 and p1 are collinear and p1 lies on p2q2
+
+               if (o4 === 0 && onSegment(p2, q1, q2)) return true; // p2, q2 and q1 are collinear and q1 lies on p2q2
+
+               return false;
+       } // for collinear points p, q, r, check if point q lies on segment pr
+
+
+       function onSegment(p, q, r) {
+               return q.x <= Math.max(p.x, r.x) && q.x >= Math.min(p.x, r.x) && q.y <= Math.max(p.y, r.y) && q.y >= Math.min(p.y, r.y);
+       }
+
+       function sign(num) {
+               return num > 0 ? 1 : num < 0 ? -1 : 0;
+       } // check if a polygon diagonal intersects any polygon segments
+
+
+       function intersectsPolygon(a, b) {
+               let p = a;
+
+               do {
+                       if (p.i !== a.i && p.next.i !== a.i && p.i !== b.i && p.next.i !== b.i && intersects(p, p.next, a, b)) return true;
+                       p = p.next;
+               } while (p !== a);
+
+               return false;
+       } // check if a polygon diagonal is locally inside the polygon
+
+
+       function locallyInside(a, b) {
+               return area(a.prev, a, a.next) < 0 ? area(a, b, a.next) >= 0 && area(a, a.prev, b) >= 0 : area(a, b, a.prev) < 0 || area(a, a.next, b) < 0;
+       } // check if the middle point of a polygon diagonal is inside the polygon
+
+
+       function middleInside(a, b) {
+               let p = a,
+                               inside = false;
+               const px = (a.x + b.x) / 2,
+                                       py = (a.y + b.y) / 2;
+
+               do {
+                       if (p.y > py !== p.next.y > py && p.next.y !== p.y && px < (p.next.x - p.x) * (py - p.y) / (p.next.y - p.y) + p.x) inside = !inside;
+                       p = p.next;
+               } while (p !== a);
+
+               return inside;
+       } // link two polygon vertices with a bridge; if the vertices belong to the same ring, it splits polygon into two;
+       // if one belongs to the outer ring and another to a hole, it merges it into a single ring
+
+
+       function splitPolygon(a, b) {
+               const a2 = new Node(a.i, a.x, a.y),
+                                       b2 = new Node(b.i, b.x, b.y),
+                                       an = a.next,
+                                       bp = b.prev;
+               a.next = b;
+               b.prev = a;
+               a2.next = an;
+               an.prev = a2;
+               b2.next = a2;
+               a2.prev = b2;
+               bp.next = b2;
+               b2.prev = bp;
+               return b2;
+       } // create a node and optionally link it with previous one (in a circular doubly linked list)
+
+
+       function insertNode(i, x, y, last) {
+               const p = new Node(i, x, y);
+
+               if (!last) {
+                       p.prev = p;
+                       p.next = p;
+               } else {
+                       p.next = last.next;
+                       p.prev = last;
+                       last.next.prev = p;
+                       last.next = p;
+               }
+
+               return p;
+       }
+
+       function removeNode(p) {
+               p.next.prev = p.prev;
+               p.prev.next = p.next;
+               if (p.prevZ) p.prevZ.nextZ = p.nextZ;
+               if (p.nextZ) p.nextZ.prevZ = p.prevZ;
+       }
+
+       function Node(i, x, y) {
+               // vertex index in coordinates array
+               this.i = i; // vertex coordinates
+
+               this.x = x;
+               this.y = y; // previous and next vertex nodes in a polygon ring
+
+               this.prev = null;
+               this.next = null; // z-order curve value
+
+               this.z = null; // previous and next nodes in z-order
+
+               this.prevZ = null;
+               this.nextZ = null; // indicates whether this is a steiner point
+
+               this.steiner = false;
+       }
+
+       function signedArea(data, start, end, dim) {
+               let sum = 0;
+
+               for (let i = start, j = end - dim; i < end; i += dim) {
+                       sum += (data[j] - data[i]) * (data[i + 1] + data[j + 1]);
+                       j = i;
+               }
+
+               return sum;
+       }
+
+       class ShapeUtils {
+               // calculate area of the contour polygon
+               static area(contour) {
+                       const n = contour.length;
+                       let a = 0.0;
+
+                       for (let p = n - 1, q = 0; q < n; p = q++) {
+                               a += contour[p].x * contour[q].y - contour[q].x * contour[p].y;
+                       }
+
+                       return a * 0.5;
+               }
+
+               static isClockWise(pts) {
+                       return ShapeUtils.area(pts) < 0;
+               }
+
+               static triangulateShape(contour, holes) {
+                       const vertices = []; // flat array of vertices like [ x0,y0, x1,y1, x2,y2, ... ]
+
+                       const holeIndices = []; // array of hole indices
+
+                       const faces = []; // final array of vertex indices like [ [ a,b,d ], [ b,c,d ] ]
+
+                       removeDupEndPts(contour);
+                       addContour(vertices, contour); //
+
+                       let holeIndex = contour.length;
+                       holes.forEach(removeDupEndPts);
+
+                       for (let i = 0; i < holes.length; i++) {
+                               holeIndices.push(holeIndex);
+                               holeIndex += holes[i].length;
+                               addContour(vertices, holes[i]);
+                       } //
+
+
+                       const triangles = Earcut.triangulate(vertices, holeIndices); //
+
+                       for (let i = 0; i < triangles.length; i += 3) {
+                               faces.push(triangles.slice(i, i + 3));
+                       }
+
+                       return faces;
+               }
+
+       }
+
+       function removeDupEndPts(points) {
+               const l = points.length;
+
+               if (l > 2 && points[l - 1].equals(points[0])) {
+                       points.pop();
+               }
+       }
+
+       function addContour(vertices, contour) {
+               for (let i = 0; i < contour.length; i++) {
+                       vertices.push(contour[i].x);
+                       vertices.push(contour[i].y);
+               }
+       }
+
+       /**
+        * Creates extruded geometry from a path shape.
+        *
+        * parameters = {
+        *
+        *      curveSegments: <int>, // number of points on the curves
+        *      steps: <int>, // number of points for z-side extrusions / used for subdividing segments of extrude spline too
+        *      depth: <float>, // Depth to extrude the shape
+        *
+        *      bevelEnabled: <bool>, // turn on bevel
+        *      bevelThickness: <float>, // how deep into the original shape bevel goes
+        *      bevelSize: <float>, // how far from shape outline (including bevelOffset) is bevel
+        *      bevelOffset: <float>, // how far from shape outline does bevel start
+        *      bevelSegments: <int>, // number of bevel layers
+        *
+        *      extrudePath: <THREE.Curve> // curve to extrude shape along
+        *
+        *      UVGenerator: <Object> // object that provides UV generator functions
+        *
+        * }
+        */
+
+       class ExtrudeGeometry extends BufferGeometry {
+               constructor(shapes, options) {
+                       super();
+                       this.type = 'ExtrudeGeometry';
+                       this.parameters = {
+                               shapes: shapes,
+                               options: options
+                       };
+                       shapes = Array.isArray(shapes) ? shapes : [shapes];
+                       const scope = this;
+                       const verticesArray = [];
+                       const uvArray = [];
+
+                       for (let i = 0, l = shapes.length; i < l; i++) {
+                               const shape = shapes[i];
+                               addShape(shape);
+                       } // build geometry
+
+
+                       this.setAttribute('position', new Float32BufferAttribute(verticesArray, 3));
+                       this.setAttribute('uv', new Float32BufferAttribute(uvArray, 2));
+                       this.computeVertexNormals(); // functions
+
+                       function addShape(shape) {
+                               const placeholder = []; // options
+
+                               const curveSegments = options.curveSegments !== undefined ? options.curveSegments : 12;
+                               const steps = options.steps !== undefined ? options.steps : 1;
+                               let depth = options.depth !== undefined ? options.depth : 100;
+                               let bevelEnabled = options.bevelEnabled !== undefined ? options.bevelEnabled : true;
+                               let bevelThickness = options.bevelThickness !== undefined ? options.bevelThickness : 6;
+                               let bevelSize = options.bevelSize !== undefined ? options.bevelSize : bevelThickness - 2;
+                               let bevelOffset = options.bevelOffset !== undefined ? options.bevelOffset : 0;
+                               let bevelSegments = options.bevelSegments !== undefined ? options.bevelSegments : 3;
+                               const extrudePath = options.extrudePath;
+                               const uvgen = options.UVGenerator !== undefined ? options.UVGenerator : WorldUVGenerator; // deprecated options
+
+                               if (options.amount !== undefined) {
+                                       console.warn('THREE.ExtrudeBufferGeometry: amount has been renamed to depth.');
+                                       depth = options.amount;
+                               } //
+
+
+                               let extrudePts,
+                                               extrudeByPath = false;
+                               let splineTube, binormal, normal, position2;
+
+                               if (extrudePath) {
+                                       extrudePts = extrudePath.getSpacedPoints(steps);
+                                       extrudeByPath = true;
+                                       bevelEnabled = false; // bevels not supported for path extrusion
+                                       // SETUP TNB variables
+                                       // TODO1 - have a .isClosed in spline?
+
+                                       splineTube = extrudePath.computeFrenetFrames(steps, false); // console.log(splineTube, 'splineTube', splineTube.normals.length, 'steps', steps, 'extrudePts', extrudePts.length);
+
+                                       binormal = new Vector3();
+                                       normal = new Vector3();
+                                       position2 = new Vector3();
+                               } // Safeguards if bevels are not enabled
+
+
+                               if (!bevelEnabled) {
+                                       bevelSegments = 0;
+                                       bevelThickness = 0;
+                                       bevelSize = 0;
+                                       bevelOffset = 0;
+                               } // Variables initialization
+
+
+                               const shapePoints = shape.extractPoints(curveSegments);
+                               let vertices = shapePoints.shape;
+                               const holes = shapePoints.holes;
+                               const reverse = !ShapeUtils.isClockWise(vertices);
+
+                               if (reverse) {
+                                       vertices = vertices.reverse(); // Maybe we should also check if holes are in the opposite direction, just to be safe ...
+
+                                       for (let h = 0, hl = holes.length; h < hl; h++) {
+                                               const ahole = holes[h];
+
+                                               if (ShapeUtils.isClockWise(ahole)) {
+                                                       holes[h] = ahole.reverse();
+                                               }
+                                       }
+                               }
+
+                               const faces = ShapeUtils.triangulateShape(vertices, holes);
+                               /* Vertices */
+
+                               const contour = vertices; // vertices has all points but contour has only points of circumference
+
+                               for (let h = 0, hl = holes.length; h < hl; h++) {
+                                       const ahole = holes[h];
+                                       vertices = vertices.concat(ahole);
+                               }
+
+                               function scalePt2(pt, vec, size) {
+                                       if (!vec) console.error('THREE.ExtrudeGeometry: vec does not exist');
+                                       return vec.clone().multiplyScalar(size).add(pt);
+                               }
+
+                               const vlen = vertices.length,
+                                                       flen = faces.length; // Find directions for point movement
+
+                               function getBevelVec(inPt, inPrev, inNext) {
+                                       // computes for inPt the corresponding point inPt' on a new contour
+                                       //       shifted by 1 unit (length of normalized vector) to the left
+                                       // if we walk along contour clockwise, this new contour is outside the old one
+                                       //
+                                       // inPt' is the intersection of the two lines parallel to the two
+                                       //      adjacent edges of inPt at a distance of 1 unit on the left side.
+                                       let v_trans_x, v_trans_y, shrink_by; // resulting translation vector for inPt
+                                       // good reading for geometry algorithms (here: line-line intersection)
+                                       // http://geomalgorithms.com/a05-_intersect-1.html
+
+                                       const v_prev_x = inPt.x - inPrev.x,
+                                                               v_prev_y = inPt.y - inPrev.y;
+                                       const v_next_x = inNext.x - inPt.x,
+                                                               v_next_y = inNext.y - inPt.y;
+                                       const v_prev_lensq = v_prev_x * v_prev_x + v_prev_y * v_prev_y; // check for collinear edges
+
+                                       const collinear0 = v_prev_x * v_next_y - v_prev_y * v_next_x;
+
+                                       if (Math.abs(collinear0) > Number.EPSILON) {
+                                               // not collinear
+                                               // length of vectors for normalizing
+                                               const v_prev_len = Math.sqrt(v_prev_lensq);
+                                               const v_next_len = Math.sqrt(v_next_x * v_next_x + v_next_y * v_next_y); // shift adjacent points by unit vectors to the left
+
+                                               const ptPrevShift_x = inPrev.x - v_prev_y / v_prev_len;
+                                               const ptPrevShift_y = inPrev.y + v_prev_x / v_prev_len;
+                                               const ptNextShift_x = inNext.x - v_next_y / v_next_len;
+                                               const ptNextShift_y = inNext.y + v_next_x / v_next_len; // scaling factor for v_prev to intersection point
+
+                                               const sf = ((ptNextShift_x - ptPrevShift_x) * v_next_y - (ptNextShift_y - ptPrevShift_y) * v_next_x) / (v_prev_x * v_next_y - v_prev_y * v_next_x); // vector from inPt to intersection point
+
+                                               v_trans_x = ptPrevShift_x + v_prev_x * sf - inPt.x;
+                                               v_trans_y = ptPrevShift_y + v_prev_y * sf - inPt.y; // Don't normalize!, otherwise sharp corners become ugly
+                                               //      but prevent crazy spikes
+
+                                               const v_trans_lensq = v_trans_x * v_trans_x + v_trans_y * v_trans_y;
+
+                                               if (v_trans_lensq <= 2) {
+                                                       return new Vector2(v_trans_x, v_trans_y);
+                                               } else {
+                                                       shrink_by = Math.sqrt(v_trans_lensq / 2);
+                                               }
+                                       } else {
+                                               // handle special case of collinear edges
+                                               let direction_eq = false; // assumes: opposite
+
+                                               if (v_prev_x > Number.EPSILON) {
+                                                       if (v_next_x > Number.EPSILON) {
+                                                               direction_eq = true;
+                                                       }
+                                               } else {
+                                                       if (v_prev_x < -Number.EPSILON) {
+                                                               if (v_next_x < -Number.EPSILON) {
+                                                                       direction_eq = true;
+                                                               }
+                                                       } else {
+                                                               if (Math.sign(v_prev_y) === Math.sign(v_next_y)) {
+                                                                       direction_eq = true;
+                                                               }
+                                                       }
+                                               }
+
+                                               if (direction_eq) {
+                                                       // console.log("Warning: lines are a straight sequence");
+                                                       v_trans_x = -v_prev_y;
+                                                       v_trans_y = v_prev_x;
+                                                       shrink_by = Math.sqrt(v_prev_lensq);
+                                               } else {
+                                                       // console.log("Warning: lines are a straight spike");
+                                                       v_trans_x = v_prev_x;
+                                                       v_trans_y = v_prev_y;
+                                                       shrink_by = Math.sqrt(v_prev_lensq / 2);
+                                               }
+                                       }
+
+                                       return new Vector2(v_trans_x / shrink_by, v_trans_y / shrink_by);
+                               }
+
+                               const contourMovements = [];
+
+                               for (let i = 0, il = contour.length, j = il - 1, k = i + 1; i < il; i++, j++, k++) {
+                                       if (j === il) j = 0;
+                                       if (k === il) k = 0; // (j)---(i)---(k)
+                                       // console.log('i,j,k', i, j , k)
+
+                                       contourMovements[i] = getBevelVec(contour[i], contour[j], contour[k]);
+                               }
+
+                               const holesMovements = [];
+                               let oneHoleMovements,
+                                               verticesMovements = contourMovements.concat();
+
+                               for (let h = 0, hl = holes.length; h < hl; h++) {
+                                       const ahole = holes[h];
+                                       oneHoleMovements = [];
+
+                                       for (let i = 0, il = ahole.length, j = il - 1, k = i + 1; i < il; i++, j++, k++) {
+                                               if (j === il) j = 0;
+                                               if (k === il) k = 0; // (j)---(i)---(k)
+
+                                               oneHoleMovements[i] = getBevelVec(ahole[i], ahole[j], ahole[k]);
+                                       }
+
+                                       holesMovements.push(oneHoleMovements);
+                                       verticesMovements = verticesMovements.concat(oneHoleMovements);
+                               } // Loop bevelSegments, 1 for the front, 1 for the back
+
+
+                               for (let b = 0; b < bevelSegments; b++) {
+                                       //for ( b = bevelSegments; b > 0; b -- ) {
+                                       const t = b / bevelSegments;
+                                       const z = bevelThickness * Math.cos(t * Math.PI / 2);
+                                       const bs = bevelSize * Math.sin(t * Math.PI / 2) + bevelOffset; // contract shape
+
+                                       for (let i = 0, il = contour.length; i < il; i++) {
+                                               const vert = scalePt2(contour[i], contourMovements[i], bs);
+                                               v(vert.x, vert.y, -z);
+                                       } // expand holes
+
+
+                                       for (let h = 0, hl = holes.length; h < hl; h++) {
+                                               const ahole = holes[h];
+                                               oneHoleMovements = holesMovements[h];
+
+                                               for (let i = 0, il = ahole.length; i < il; i++) {
+                                                       const vert = scalePt2(ahole[i], oneHoleMovements[i], bs);
+                                                       v(vert.x, vert.y, -z);
+                                               }
+                                       }
+                               }
+
+                               const bs = bevelSize + bevelOffset; // Back facing vertices
+
+                               for (let i = 0; i < vlen; i++) {
+                                       const vert = bevelEnabled ? scalePt2(vertices[i], verticesMovements[i], bs) : vertices[i];
+
+                                       if (!extrudeByPath) {
+                                               v(vert.x, vert.y, 0);
+                                       } else {
+                                               // v( vert.x, vert.y + extrudePts[ 0 ].y, extrudePts[ 0 ].x );
+                                               normal.copy(splineTube.normals[0]).multiplyScalar(vert.x);
+                                               binormal.copy(splineTube.binormals[0]).multiplyScalar(vert.y);
+                                               position2.copy(extrudePts[0]).add(normal).add(binormal);
+                                               v(position2.x, position2.y, position2.z);
+                                       }
+                               } // Add stepped vertices...
+                               // Including front facing vertices
+
+
+                               for (let s = 1; s <= steps; s++) {
+                                       for (let i = 0; i < vlen; i++) {
+                                               const vert = bevelEnabled ? scalePt2(vertices[i], verticesMovements[i], bs) : vertices[i];
+
+                                               if (!extrudeByPath) {
+                                                       v(vert.x, vert.y, depth / steps * s);
+                                               } else {
+                                                       // v( vert.x, vert.y + extrudePts[ s - 1 ].y, extrudePts[ s - 1 ].x );
+                                                       normal.copy(splineTube.normals[s]).multiplyScalar(vert.x);
+                                                       binormal.copy(splineTube.binormals[s]).multiplyScalar(vert.y);
+                                                       position2.copy(extrudePts[s]).add(normal).add(binormal);
+                                                       v(position2.x, position2.y, position2.z);
+                                               }
+                                       }
+                               } // Add bevel segments planes
+                               //for ( b = 1; b <= bevelSegments; b ++ ) {
+
+
+                               for (let b = bevelSegments - 1; b >= 0; b--) {
+                                       const t = b / bevelSegments;
+                                       const z = bevelThickness * Math.cos(t * Math.PI / 2);
+                                       const bs = bevelSize * Math.sin(t * Math.PI / 2) + bevelOffset; // contract shape
+
+                                       for (let i = 0, il = contour.length; i < il; i++) {
+                                               const vert = scalePt2(contour[i], contourMovements[i], bs);
+                                               v(vert.x, vert.y, depth + z);
+                                       } // expand holes
+
+
+                                       for (let h = 0, hl = holes.length; h < hl; h++) {
+                                               const ahole = holes[h];
+                                               oneHoleMovements = holesMovements[h];
+
+                                               for (let i = 0, il = ahole.length; i < il; i++) {
+                                                       const vert = scalePt2(ahole[i], oneHoleMovements[i], bs);
+
+                                                       if (!extrudeByPath) {
+                                                               v(vert.x, vert.y, depth + z);
+                                                       } else {
+                                                               v(vert.x, vert.y + extrudePts[steps - 1].y, extrudePts[steps - 1].x + z);
+                                                       }
+                                               }
+                                       }
+                               }
+                               /* Faces */
+                               // Top and bottom faces
+
+
+                               buildLidFaces(); // Sides faces
+
+                               buildSideFaces(); ///// Internal functions
+
+                               function buildLidFaces() {
+                                       const start = verticesArray.length / 3;
+
+                                       if (bevelEnabled) {
+                                               let layer = 0; // steps + 1
+
+                                               let offset = vlen * layer; // Bottom faces
+
+                                               for (let i = 0; i < flen; i++) {
+                                                       const face = faces[i];
+                                                       f3(face[2] + offset, face[1] + offset, face[0] + offset);
+                                               }
+
+                                               layer = steps + bevelSegments * 2;
+                                               offset = vlen * layer; // Top faces
+
+                                               for (let i = 0; i < flen; i++) {
+                                                       const face = faces[i];
+                                                       f3(face[0] + offset, face[1] + offset, face[2] + offset);
+                                               }
+                                       } else {
+                                               // Bottom faces
+                                               for (let i = 0; i < flen; i++) {
+                                                       const face = faces[i];
+                                                       f3(face[2], face[1], face[0]);
+                                               } // Top faces
+
+
+                                               for (let i = 0; i < flen; i++) {
+                                                       const face = faces[i];
+                                                       f3(face[0] + vlen * steps, face[1] + vlen * steps, face[2] + vlen * steps);
+                                               }
+                                       }
+
+                                       scope.addGroup(start, verticesArray.length / 3 - start, 0);
+                               } // Create faces for the z-sides of the shape
+
+
+                               function buildSideFaces() {
+                                       const start = verticesArray.length / 3;
+                                       let layeroffset = 0;
+                                       sidewalls(contour, layeroffset);
+                                       layeroffset += contour.length;
+
+                                       for (let h = 0, hl = holes.length; h < hl; h++) {
+                                               const ahole = holes[h];
+                                               sidewalls(ahole, layeroffset); //, true
+
+                                               layeroffset += ahole.length;
+                                       }
+
+                                       scope.addGroup(start, verticesArray.length / 3 - start, 1);
+                               }
+
+                               function sidewalls(contour, layeroffset) {
+                                       let i = contour.length;
+
+                                       while (--i >= 0) {
+                                               const j = i;
+                                               let k = i - 1;
+                                               if (k < 0) k = contour.length - 1; //console.log('b', i,j, i-1, k,vertices.length);
+
+                                               for (let s = 0, sl = steps + bevelSegments * 2; s < sl; s++) {
+                                                       const slen1 = vlen * s;
+                                                       const slen2 = vlen * (s + 1);
+                                                       const a = layeroffset + j + slen1,
+                                                                               b = layeroffset + k + slen1,
+                                                                               c = layeroffset + k + slen2,
+                                                                               d = layeroffset + j + slen2;
+                                                       f4(a, b, c, d);
+                                               }
+                                       }
+                               }
+
+                               function v(x, y, z) {
+                                       placeholder.push(x);
+                                       placeholder.push(y);
+                                       placeholder.push(z);
+                               }
+
+                               function f3(a, b, c) {
+                                       addVertex(a);
+                                       addVertex(b);
+                                       addVertex(c);
+                                       const nextIndex = verticesArray.length / 3;
+                                       const uvs = uvgen.generateTopUV(scope, verticesArray, nextIndex - 3, nextIndex - 2, nextIndex - 1);
+                                       addUV(uvs[0]);
+                                       addUV(uvs[1]);
+                                       addUV(uvs[2]);
+                               }
+
+                               function f4(a, b, c, d) {
+                                       addVertex(a);
+                                       addVertex(b);
+                                       addVertex(d);
+                                       addVertex(b);
+                                       addVertex(c);
+                                       addVertex(d);
+                                       const nextIndex = verticesArray.length / 3;
+                                       const uvs = uvgen.generateSideWallUV(scope, verticesArray, nextIndex - 6, nextIndex - 3, nextIndex - 2, nextIndex - 1);
+                                       addUV(uvs[0]);
+                                       addUV(uvs[1]);
+                                       addUV(uvs[3]);
+                                       addUV(uvs[1]);
+                                       addUV(uvs[2]);
+                                       addUV(uvs[3]);
+                               }
+
+                               function addVertex(index) {
+                                       verticesArray.push(placeholder[index * 3 + 0]);
+                                       verticesArray.push(placeholder[index * 3 + 1]);
+                                       verticesArray.push(placeholder[index * 3 + 2]);
+                               }
+
+                               function addUV(vector2) {
+                                       uvArray.push(vector2.x);
+                                       uvArray.push(vector2.y);
+                               }
+                       }
+               }
+
+               toJSON() {
+                       const data = super.toJSON();
+                       const shapes = this.parameters.shapes;
+                       const options = this.parameters.options;
+                       return toJSON$1(shapes, options, data);
+               }
+
+               static fromJSON(data, shapes) {
+                       const geometryShapes = [];
+
+                       for (let j = 0, jl = data.shapes.length; j < jl; j++) {
+                               const shape = shapes[data.shapes[j]];
+                               geometryShapes.push(shape);
+                       }
+
+                       const extrudePath = data.options.extrudePath;
+
+                       if (extrudePath !== undefined) {
+                               data.options.extrudePath = new Curves[extrudePath.type]().fromJSON(extrudePath);
+                       }
+
+                       return new ExtrudeGeometry(geometryShapes, data.options);
+               }
+
+       }
+
+       const WorldUVGenerator = {
+               generateTopUV: function (geometry, vertices, indexA, indexB, indexC) {
+                       const a_x = vertices[indexA * 3];
+                       const a_y = vertices[indexA * 3 + 1];
+                       const b_x = vertices[indexB * 3];
+                       const b_y = vertices[indexB * 3 + 1];
+                       const c_x = vertices[indexC * 3];
+                       const c_y = vertices[indexC * 3 + 1];
+                       return [new Vector2(a_x, a_y), new Vector2(b_x, b_y), new Vector2(c_x, c_y)];
+               },
+               generateSideWallUV: function (geometry, vertices, indexA, indexB, indexC, indexD) {
+                       const a_x = vertices[indexA * 3];
+                       const a_y = vertices[indexA * 3 + 1];
+                       const a_z = vertices[indexA * 3 + 2];
+                       const b_x = vertices[indexB * 3];
+                       const b_y = vertices[indexB * 3 + 1];
+                       const b_z = vertices[indexB * 3 + 2];
+                       const c_x = vertices[indexC * 3];
+                       const c_y = vertices[indexC * 3 + 1];
+                       const c_z = vertices[indexC * 3 + 2];
+                       const d_x = vertices[indexD * 3];
+                       const d_y = vertices[indexD * 3 + 1];
+                       const d_z = vertices[indexD * 3 + 2];
+
+                       if (Math.abs(a_y - b_y) < Math.abs(a_x - b_x)) {
+                               return [new Vector2(a_x, 1 - a_z), new Vector2(b_x, 1 - b_z), new Vector2(c_x, 1 - c_z), new Vector2(d_x, 1 - d_z)];
+                       } else {
+                               return [new Vector2(a_y, 1 - a_z), new Vector2(b_y, 1 - b_z), new Vector2(c_y, 1 - c_z), new Vector2(d_y, 1 - d_z)];
+                       }
+               }
+       };
+
+       function toJSON$1(shapes, options, data) {
+               data.shapes = [];
+
+               if (Array.isArray(shapes)) {
+                       for (let i = 0, l = shapes.length; i < l; i++) {
+                               const shape = shapes[i];
+                               data.shapes.push(shape.uuid);
+                       }
+               } else {
+                       data.shapes.push(shapes.uuid);
+               }
+
+               if (options.extrudePath !== undefined) data.options.extrudePath = options.extrudePath.toJSON();
+               return data;
+       }
+
+       class IcosahedronGeometry extends PolyhedronGeometry {
+               constructor(radius = 1, detail = 0) {
+                       const t = (1 + Math.sqrt(5)) / 2;
+                       const vertices = [-1, t, 0, 1, t, 0, -1, -t, 0, 1, -t, 0, 0, -1, t, 0, 1, t, 0, -1, -t, 0, 1, -t, t, 0, -1, t, 0, 1, -t, 0, -1, -t, 0, 1];
+                       const indices = [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(vertices, indices, radius, detail);
+                       this.type = 'IcosahedronGeometry';
+                       this.parameters = {
+                               radius: radius,
+                               detail: detail
+                       };
+               }
+
+               static fromJSON(data) {
+                       return new IcosahedronGeometry(data.radius, data.detail);
+               }
+
+       }
+
+       class LatheGeometry extends BufferGeometry {
+               constructor(points, segments = 12, phiStart = 0, phiLength = Math.PI * 2) {
+                       super();
+                       this.type = 'LatheGeometry';
+                       this.parameters = {
+                               points: points,
+                               segments: segments,
+                               phiStart: phiStart,
+                               phiLength: phiLength
+                       };
+                       segments = Math.floor(segments); // clamp phiLength so it's in range of [ 0, 2PI ]
+
+                       phiLength = clamp(phiLength, 0, Math.PI * 2); // buffers
+
+                       const indices = [];
+                       const vertices = [];
+                       const uvs = []; // helper variables
+
+                       const inverseSegments = 1.0 / segments;
+                       const vertex = new Vector3();
+                       const uv = new Vector2(); // generate vertices and uvs
+
+                       for (let i = 0; i <= segments; i++) {
+                               const phi = phiStart + i * inverseSegments * phiLength;
+                               const sin = Math.sin(phi);
+                               const cos = Math.cos(phi);
+
+                               for (let j = 0; j <= points.length - 1; j++) {
+                                       // vertex
+                                       vertex.x = points[j].x * sin;
+                                       vertex.y = points[j].y;
+                                       vertex.z = points[j].x * cos;
+                                       vertices.push(vertex.x, vertex.y, vertex.z); // uv
+
+                                       uv.x = i / segments;
+                                       uv.y = j / (points.length - 1);
+                                       uvs.push(uv.x, uv.y);
+                               }
+                       } // indices
+
+
+                       for (let i = 0; i < segments; i++) {
+                               for (let j = 0; j < points.length - 1; j++) {
+                                       const base = j + i * points.length;
+                                       const a = base;
+                                       const b = base + points.length;
+                                       const c = base + points.length + 1;
+                                       const d = base + 1; // faces
+
+                                       indices.push(a, b, d);
+                                       indices.push(b, c, d);
+                               }
+                       } // build geometry
+
+
+                       this.setIndex(indices);
+                       this.setAttribute('position', new Float32BufferAttribute(vertices, 3));
+                       this.setAttribute('uv', new Float32BufferAttribute(uvs, 2)); // generate normals
+
+                       this.computeVertexNormals(); // if the geometry is closed, we need to average the normals along the seam.
+                       // because the corresponding vertices are identical (but still have different UVs).
+
+                       if (phiLength === Math.PI * 2) {
+                               const normals = this.attributes.normal.array;
+                               const n1 = new Vector3();
+                               const n2 = new Vector3();
+                               const n = new Vector3(); // this is the buffer offset for the last line of vertices
+
+                               const base = segments * points.length * 3;
+
+                               for (let i = 0, j = 0; i < points.length; i++, j += 3) {
+                                       // select the normal of the vertex in the first line
+                                       n1.x = normals[j + 0];
+                                       n1.y = normals[j + 1];
+                                       n1.z = normals[j + 2]; // select the normal of the vertex in the last line
+
+                                       n2.x = normals[base + j + 0];
+                                       n2.y = normals[base + j + 1];
+                                       n2.z = normals[base + j + 2]; // average normals
+
+                                       n.addVectors(n1, n2).normalize(); // assign the new values to both normals
+
+                                       normals[j + 0] = normals[base + j + 0] = n.x;
+                                       normals[j + 1] = normals[base + j + 1] = n.y;
+                                       normals[j + 2] = normals[base + j + 2] = n.z;
+                               }
+                       }
+               }
+
+               static fromJSON(data) {
+                       return new LatheGeometry(data.points, data.segments, data.phiStart, data.phiLength);
+               }
+
+       }
+
+       class OctahedronGeometry extends PolyhedronGeometry {
+               constructor(radius = 1, detail = 0) {
+                       const vertices = [1, 0, 0, -1, 0, 0, 0, 1, 0, 0, -1, 0, 0, 0, 1, 0, 0, -1];
+                       const indices = [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(vertices, indices, radius, detail);
+                       this.type = 'OctahedronGeometry';
+                       this.parameters = {
+                               radius: radius,
+                               detail: detail
+                       };
+               }
+
+               static fromJSON(data) {
+                       return new OctahedronGeometry(data.radius, data.detail);
+               }
+
+       }
+
+       /**
+        * Parametric Surfaces Geometry
+        * based on the brilliant article by @prideout https://prideout.net/blog/old/blog/index.html@p=44.html
+        */
+
+       class ParametricGeometry extends BufferGeometry {
+               constructor(func, slices, stacks) {
+                       super();
+                       this.type = 'ParametricGeometry';
+                       this.parameters = {
+                               func: func,
+                               slices: slices,
+                               stacks: stacks
+                       }; // buffers
+
+                       const indices = [];
+                       const vertices = [];
+                       const normals = [];
+                       const uvs = [];
+                       const EPS = 0.00001;
+                       const normal = new Vector3();
+                       const p0 = new Vector3(),
+                                               p1 = new Vector3();
+                       const pu = new Vector3(),
+                                               pv = new Vector3();
+
+                       if (func.length < 3) {
+                               console.error('THREE.ParametricGeometry: Function must now modify a Vector3 as third parameter.');
+                       } // generate vertices, normals and uvs
+
+
+                       const sliceCount = slices + 1;
+
+                       for (let i = 0; i <= stacks; i++) {
+                               const v = i / stacks;
+
+                               for (let j = 0; j <= slices; j++) {
+                                       const u = j / slices; // vertex
+
+                                       func(u, v, p0);
+                                       vertices.push(p0.x, p0.y, p0.z); // normal
+                                       // approximate tangent vectors via finite differences
+
+                                       if (u - EPS >= 0) {
+                                               func(u - EPS, v, p1);
+                                               pu.subVectors(p0, p1);
+                                       } else {
+                                               func(u + EPS, v, p1);
+                                               pu.subVectors(p1, p0);
+                                       }
+
+                                       if (v - EPS >= 0) {
+                                               func(u, v - EPS, p1);
+                                               pv.subVectors(p0, p1);
+                                       } else {
+                                               func(u, v + EPS, p1);
+                                               pv.subVectors(p1, p0);
+                                       } // cross product of tangent vectors returns surface normal
+
+
+                                       normal.crossVectors(pu, pv).normalize();
+                                       normals.push(normal.x, normal.y, normal.z); // uv
+
+                                       uvs.push(u, v);
+                               }
+                       } // generate indices
+
+
+                       for (let i = 0; i < stacks; i++) {
+                               for (let j = 0; j < slices; j++) {
+                                       const a = i * sliceCount + j;
+                                       const b = i * sliceCount + j + 1;
+                                       const c = (i + 1) * sliceCount + j + 1;
+                                       const d = (i + 1) * sliceCount + j; // faces one and two
+
+                                       indices.push(a, b, d);
+                                       indices.push(b, c, d);
+                               }
+                       } // build geometry
+
+
+                       this.setIndex(indices);
+                       this.setAttribute('position', new Float32BufferAttribute(vertices, 3));
+                       this.setAttribute('normal', new Float32BufferAttribute(normals, 3));
+                       this.setAttribute('uv', new Float32BufferAttribute(uvs, 2));
+               }
+
+       }
+
+       class RingGeometry extends BufferGeometry {
+               constructor(innerRadius = 0.5, outerRadius = 1, thetaSegments = 8, phiSegments = 1, thetaStart = 0, thetaLength = Math.PI * 2) {
+                       super();
+                       this.type = 'RingGeometry';
+                       this.parameters = {
+                               innerRadius: innerRadius,
+                               outerRadius: outerRadius,
+                               thetaSegments: thetaSegments,
+                               phiSegments: phiSegments,
+                               thetaStart: thetaStart,
+                               thetaLength: thetaLength
+                       };
+                       thetaSegments = Math.max(3, thetaSegments);
+                       phiSegments = Math.max(1, phiSegments); // buffers
+
+                       const indices = [];
+                       const vertices = [];
+                       const normals = [];
+                       const uvs = []; // some helper variables
+
+                       let radius = innerRadius;
+                       const radiusStep = (outerRadius - innerRadius) / phiSegments;
+                       const vertex = new Vector3();
+                       const uv = new Vector2(); // generate vertices, normals and uvs
+
+                       for (let j = 0; j <= phiSegments; j++) {
+                               for (let i = 0; i <= thetaSegments; i++) {
+                                       // values are generate from the inside of the ring to the outside
+                                       const segment = thetaStart + i / thetaSegments * thetaLength; // vertex
+
+                                       vertex.x = radius * Math.cos(segment);
+                                       vertex.y = radius * Math.sin(segment);
+                                       vertices.push(vertex.x, vertex.y, vertex.z); // normal
+
+                                       normals.push(0, 0, 1); // uv
+
+                                       uv.x = (vertex.x / outerRadius + 1) / 2;
+                                       uv.y = (vertex.y / outerRadius + 1) / 2;
+                                       uvs.push(uv.x, uv.y);
+                               } // increase the radius for next row of vertices
+
+
+                               radius += radiusStep;
+                       } // indices
+
+
+                       for (let j = 0; j < phiSegments; j++) {
+                               const thetaSegmentLevel = j * (thetaSegments + 1);
+
+                               for (let i = 0; i < thetaSegments; i++) {
+                                       const segment = i + thetaSegmentLevel;
+                                       const a = segment;
+                                       const b = segment + thetaSegments + 1;
+                                       const c = segment + thetaSegments + 2;
+                                       const d = segment + 1; // faces
+
+                                       indices.push(a, b, d);
+                                       indices.push(b, c, d);
+                               }
+                       } // build geometry
+
+
+                       this.setIndex(indices);
+                       this.setAttribute('position', new Float32BufferAttribute(vertices, 3));
+                       this.setAttribute('normal', new Float32BufferAttribute(normals, 3));
+                       this.setAttribute('uv', new Float32BufferAttribute(uvs, 2));
+               }
+
+               static fromJSON(data) {
+                       return new RingGeometry(data.innerRadius, data.outerRadius, data.thetaSegments, data.phiSegments, data.thetaStart, data.thetaLength);
+               }
+
+       }
+
+       class ShapeGeometry extends BufferGeometry {
+               constructor(shapes, curveSegments = 12) {
+                       super();
+                       this.type = 'ShapeGeometry';
+                       this.parameters = {
+                               shapes: shapes,
+                               curveSegments: curveSegments
+                       }; // buffers
+
+                       const indices = [];
+                       const vertices = [];
+                       const normals = [];
+                       const uvs = []; // helper variables
+
+                       let groupStart = 0;
+                       let groupCount = 0; // allow single and array values for "shapes" parameter
+
+                       if (Array.isArray(shapes) === false) {
+                               addShape(shapes);
+                       } else {
+                               for (let i = 0; i < shapes.length; i++) {
+                                       addShape(shapes[i]);
+                                       this.addGroup(groupStart, groupCount, i); // enables MultiMaterial support
+
+                                       groupStart += groupCount;
+                                       groupCount = 0;
+                               }
+                       } // build geometry
+
+
+                       this.setIndex(indices);
+                       this.setAttribute('position', new Float32BufferAttribute(vertices, 3));
+                       this.setAttribute('normal', new Float32BufferAttribute(normals, 3));
+                       this.setAttribute('uv', new Float32BufferAttribute(uvs, 2)); // helper functions
+
+                       function addShape(shape) {
+                               const indexOffset = vertices.length / 3;
+                               const points = shape.extractPoints(curveSegments);
+                               let shapeVertices = points.shape;
+                               const shapeHoles = points.holes; // check direction of vertices
+
+                               if (ShapeUtils.isClockWise(shapeVertices) === false) {
+                                       shapeVertices = shapeVertices.reverse();
+                               }
+
+                               for (let i = 0, l = shapeHoles.length; i < l; i++) {
+                                       const shapeHole = shapeHoles[i];
+
+                                       if (ShapeUtils.isClockWise(shapeHole) === true) {
+                                               shapeHoles[i] = shapeHole.reverse();
+                                       }
+                               }
+
+                               const faces = ShapeUtils.triangulateShape(shapeVertices, shapeHoles); // join vertices of inner and outer paths to a single array
+
+                               for (let i = 0, l = shapeHoles.length; i < l; i++) {
+                                       const shapeHole = shapeHoles[i];
+                                       shapeVertices = shapeVertices.concat(shapeHole);
+                               } // vertices, normals, uvs
+
+
+                               for (let i = 0, l = shapeVertices.length; i < l; i++) {
+                                       const vertex = shapeVertices[i];
+                                       vertices.push(vertex.x, vertex.y, 0);
+                                       normals.push(0, 0, 1);
+                                       uvs.push(vertex.x, vertex.y); // world uvs
+                               } // incides
+
+
+                               for (let i = 0, l = faces.length; i < l; i++) {
+                                       const face = faces[i];
+                                       const a = face[0] + indexOffset;
+                                       const b = face[1] + indexOffset;
+                                       const c = face[2] + indexOffset;
+                                       indices.push(a, b, c);
+                                       groupCount += 3;
+                               }
+                       }
+               }
+
+               toJSON() {
+                       const data = super.toJSON();
+                       const shapes = this.parameters.shapes;
+                       return toJSON(shapes, data);
+               }
+
+               static fromJSON(data, shapes) {
+                       const geometryShapes = [];
+
+                       for (let j = 0, jl = data.shapes.length; j < jl; j++) {
+                               const shape = shapes[data.shapes[j]];
+                               geometryShapes.push(shape);
+                       }
+
+                       return new ShapeGeometry(geometryShapes, data.curveSegments);
+               }
+
+       }
+
+       function toJSON(shapes, data) {
+               data.shapes = [];
+
+               if (Array.isArray(shapes)) {
+                       for (let i = 0, l = shapes.length; i < l; i++) {
+                               const shape = shapes[i];
+                               data.shapes.push(shape.uuid);
+                       }
+               } else {
+                       data.shapes.push(shapes.uuid);
+               }
+
+               return data;
+       }
+
+       class SphereGeometry extends BufferGeometry {
+               constructor(radius = 1, widthSegments = 32, heightSegments = 16, phiStart = 0, phiLength = Math.PI * 2, thetaStart = 0, thetaLength = Math.PI) {
+                       super();
+                       this.type = 'SphereGeometry';
+                       this.parameters = {
+                               radius: radius,
+                               widthSegments: widthSegments,
+                               heightSegments: heightSegments,
+                               phiStart: phiStart,
+                               phiLength: phiLength,
+                               thetaStart: thetaStart,
+                               thetaLength: thetaLength
+                       };
+                       widthSegments = Math.max(3, Math.floor(widthSegments));
+                       heightSegments = Math.max(2, Math.floor(heightSegments));
+                       const thetaEnd = Math.min(thetaStart + thetaLength, Math.PI);
+                       let index = 0;
+                       const grid = [];
+                       const vertex = new Vector3();
+                       const normal = new Vector3(); // buffers
+
+                       const indices = [];
+                       const vertices = [];
+                       const normals = [];
+                       const uvs = []; // generate vertices, normals and uvs
+
+                       for (let iy = 0; iy <= heightSegments; iy++) {
+                               const verticesRow = [];
+                               const v = iy / heightSegments; // special case for the poles
+
+                               let uOffset = 0;
+
+                               if (iy == 0 && thetaStart == 0) {
+                                       uOffset = 0.5 / widthSegments;
+                               } else if (iy == heightSegments && thetaEnd == Math.PI) {
+                                       uOffset = -0.5 / widthSegments;
+                               }
+
+                               for (let ix = 0; ix <= widthSegments; ix++) {
+                                       const u = ix / widthSegments; // vertex
+
+                                       vertex.x = -radius * Math.cos(phiStart + u * phiLength) * Math.sin(thetaStart + v * thetaLength);
+                                       vertex.y = radius * Math.cos(thetaStart + v * thetaLength);
+                                       vertex.z = radius * Math.sin(phiStart + u * phiLength) * Math.sin(thetaStart + v * thetaLength);
+                                       vertices.push(vertex.x, vertex.y, vertex.z); // normal
+
+                                       normal.copy(vertex).normalize();
+                                       normals.push(normal.x, normal.y, normal.z); // uv
+
+                                       uvs.push(u + uOffset, 1 - v);
+                                       verticesRow.push(index++);
+                               }
+
+                               grid.push(verticesRow);
+                       } // indices
+
+
+                       for (let iy = 0; iy < heightSegments; iy++) {
+                               for (let ix = 0; ix < widthSegments; ix++) {
+                                       const a = grid[iy][ix + 1];
+                                       const b = grid[iy][ix];
+                                       const c = grid[iy + 1][ix];
+                                       const d = grid[iy + 1][ix + 1];
+                                       if (iy !== 0 || thetaStart > 0) indices.push(a, b, d);
+                                       if (iy !== heightSegments - 1 || thetaEnd < Math.PI) indices.push(b, c, d);
+                               }
+                       } // build geometry
+
+
+                       this.setIndex(indices);
+                       this.setAttribute('position', new Float32BufferAttribute(vertices, 3));
+                       this.setAttribute('normal', new Float32BufferAttribute(normals, 3));
+                       this.setAttribute('uv', new Float32BufferAttribute(uvs, 2));
+               }
+
+               static fromJSON(data) {
+                       return new SphereGeometry(data.radius, data.widthSegments, data.heightSegments, data.phiStart, data.phiLength, data.thetaStart, data.thetaLength);
+               }
+
+       }
+
+       class TetrahedronGeometry extends PolyhedronGeometry {
+               constructor(radius = 1, detail = 0) {
+                       const vertices = [1, 1, 1, -1, -1, 1, -1, 1, -1, 1, -1, -1];
+                       const indices = [2, 1, 0, 0, 3, 2, 1, 3, 0, 2, 3, 1];
+                       super(vertices, indices, radius, detail);
+                       this.type = 'TetrahedronGeometry';
+                       this.parameters = {
+                               radius: radius,
+                               detail: detail
+                       };
+               }
+
+               static fromJSON(data) {
+                       return new TetrahedronGeometry(data.radius, data.detail);
+               }
+
+       }
+
+       /**
+        * Text = 3D Text
+        *
+        * parameters = {
+        *      font: <THREE.Font>, // font
+        *
+        *      size: <float>, // size of the text
+        *      height: <float>, // thickness to extrude text
+        *      curveSegments: <int>, // number of points on the curves
+        *
+        *      bevelEnabled: <bool>, // turn on bevel
+        *      bevelThickness: <float>, // how deep into text bevel goes
+        *      bevelSize: <float>, // how far from text outline (including bevelOffset) is bevel
+        *      bevelOffset: <float> // how far from text outline does bevel start
+        * }
+        */
+
+       class TextGeometry extends ExtrudeGeometry {
+               constructor(text, parameters = {}) {
+                       const font = parameters.font;
+
+                       if (!(font && font.isFont)) {
+                               console.error('THREE.TextGeometry: font parameter is not an instance of THREE.Font.');
+                               return new BufferGeometry();
+                       }
+
+                       const shapes = font.generateShapes(text, parameters.size); // translate parameters to ExtrudeGeometry API
+
+                       parameters.depth = parameters.height !== undefined ? parameters.height : 50; // defaults
+
+                       if (parameters.bevelThickness === undefined) parameters.bevelThickness = 10;
+                       if (parameters.bevelSize === undefined) parameters.bevelSize = 8;
+                       if (parameters.bevelEnabled === undefined) parameters.bevelEnabled = false;
+                       super(shapes, parameters);
+                       this.type = 'TextGeometry';
+               }
+
+       }
+
+       class TorusGeometry extends BufferGeometry {
+               constructor(radius = 1, tube = 0.4, radialSegments = 8, tubularSegments = 6, arc = Math.PI * 2) {
+                       super();
+                       this.type = 'TorusGeometry';
+                       this.parameters = {
+                               radius: radius,
+                               tube: tube,
+                               radialSegments: radialSegments,
+                               tubularSegments: tubularSegments,
+                               arc: arc
+                       };
+                       radialSegments = Math.floor(radialSegments);
+                       tubularSegments = Math.floor(tubularSegments); // buffers
+
+                       const indices = [];
+                       const vertices = [];
+                       const normals = [];
+                       const uvs = []; // helper variables
+
+                       const center = new Vector3();
+                       const vertex = new Vector3();
+                       const normal = new Vector3(); // generate vertices, normals and uvs
+
+                       for (let j = 0; j <= radialSegments; j++) {
+                               for (let i = 0; i <= tubularSegments; i++) {
+                                       const u = i / tubularSegments * arc;
+                                       const v = j / radialSegments * Math.PI * 2; // vertex
+
+                                       vertex.x = (radius + tube * Math.cos(v)) * Math.cos(u);
+                                       vertex.y = (radius + tube * Math.cos(v)) * Math.sin(u);
+                                       vertex.z = tube * Math.sin(v);
+                                       vertices.push(vertex.x, vertex.y, vertex.z); // normal
+
+                                       center.x = radius * Math.cos(u);
+                                       center.y = radius * Math.sin(u);
+                                       normal.subVectors(vertex, center).normalize();
+                                       normals.push(normal.x, normal.y, normal.z); // uv
+
+                                       uvs.push(i / tubularSegments);
+                                       uvs.push(j / radialSegments);
+                               }
+                       } // generate indices
+
+
+                       for (let j = 1; j <= radialSegments; j++) {
+                               for (let i = 1; i <= tubularSegments; i++) {
+                                       // indices
+                                       const a = (tubularSegments + 1) * j + i - 1;
+                                       const b = (tubularSegments + 1) * (j - 1) + i - 1;
+                                       const c = (tubularSegments + 1) * (j - 1) + i;
+                                       const d = (tubularSegments + 1) * j + i; // faces
+
+                                       indices.push(a, b, d);
+                                       indices.push(b, c, d);
+                               }
+                       } // build geometry
+
+
+                       this.setIndex(indices);
+                       this.setAttribute('position', new Float32BufferAttribute(vertices, 3));
+                       this.setAttribute('normal', new Float32BufferAttribute(normals, 3));
+                       this.setAttribute('uv', new Float32BufferAttribute(uvs, 2));
+               }
+
+               static fromJSON(data) {
+                       return new TorusGeometry(data.radius, data.tube, data.radialSegments, data.tubularSegments, data.arc);
+               }
+
+       }
+
+       class TorusKnotGeometry extends BufferGeometry {
+               constructor(radius = 1, tube = 0.4, tubularSegments = 64, radialSegments = 8, p = 2, q = 3) {
+                       super();
+                       this.type = 'TorusKnotGeometry';
+                       this.parameters = {
+                               radius: radius,
+                               tube: tube,
+                               tubularSegments: tubularSegments,
+                               radialSegments: radialSegments,
+                               p: p,
+                               q: q
+                       };
+                       tubularSegments = Math.floor(tubularSegments);
+                       radialSegments = Math.floor(radialSegments); // buffers
+
+                       const indices = [];
+                       const vertices = [];
+                       const normals = [];
+                       const uvs = []; // helper variables
+
+                       const vertex = new Vector3();
+                       const normal = new Vector3();
+                       const P1 = new Vector3();
+                       const P2 = new Vector3();
+                       const B = new Vector3();
+                       const T = new Vector3();
+                       const N = new Vector3(); // generate vertices, normals and uvs
+
+                       for (let i = 0; i <= tubularSegments; ++i) {
+                               // the radian "u" is used to calculate the position on the torus curve of the current tubular segement
+                               const u = i / tubularSegments * p * Math.PI * 2; // now we calculate two points. P1 is our current position on the curve, P2 is a little farther ahead.
+                               // these points are used to create a special "coordinate space", which is necessary to calculate the correct vertex positions
+
+                               calculatePositionOnCurve(u, p, q, radius, P1);
+                               calculatePositionOnCurve(u + 0.01, p, q, radius, P2); // calculate orthonormal basis
+
+                               T.subVectors(P2, P1);
+                               N.addVectors(P2, P1);
+                               B.crossVectors(T, N);
+                               N.crossVectors(B, T); // normalize B, N. T can be ignored, we don't use it
+
+                               B.normalize();
+                               N.normalize();
+
+                               for (let j = 0; j <= radialSegments; ++j) {
+                                       // now calculate the vertices. they are nothing more than an extrusion of the torus curve.
+                                       // because we extrude a shape in the xy-plane, there is no need to calculate a z-value.
+                                       const v = j / radialSegments * Math.PI * 2;
+                                       const cx = -tube * Math.cos(v);
+                                       const cy = tube * Math.sin(v); // now calculate the final vertex position.
+                                       // first we orient the extrusion with our basis vectos, then we add it to the current position on the curve
+
+                                       vertex.x = P1.x + (cx * N.x + cy * B.x);
+                                       vertex.y = P1.y + (cx * N.y + cy * B.y);
+                                       vertex.z = P1.z + (cx * N.z + cy * B.z);
+                                       vertices.push(vertex.x, vertex.y, vertex.z); // normal (P1 is always the center/origin of the extrusion, thus we can use it to calculate the normal)
+
+                                       normal.subVectors(vertex, P1).normalize();
+                                       normals.push(normal.x, normal.y, normal.z); // uv
+
+                                       uvs.push(i / tubularSegments);
+                                       uvs.push(j / radialSegments);
+                               }
+                       } // generate indices
+
+
+                       for (let j = 1; j <= tubularSegments; j++) {
+                               for (let i = 1; i <= radialSegments; i++) {
+                                       // indices
+                                       const a = (radialSegments + 1) * (j - 1) + (i - 1);
+                                       const b = (radialSegments + 1) * j + (i - 1);
+                                       const c = (radialSegments + 1) * j + i;
+                                       const d = (radialSegments + 1) * (j - 1) + i; // faces
+
+                                       indices.push(a, b, d);
+                                       indices.push(b, c, d);
+                               }
+                       } // build geometry
+
+
+                       this.setIndex(indices);
+                       this.setAttribute('position', new Float32BufferAttribute(vertices, 3));
+                       this.setAttribute('normal', new Float32BufferAttribute(normals, 3));
+                       this.setAttribute('uv', new Float32BufferAttribute(uvs, 2)); // this function calculates the current position on the torus curve
+
+                       function calculatePositionOnCurve(u, p, q, radius, position) {
+                               const cu = Math.cos(u);
+                               const su = Math.sin(u);
+                               const quOverP = q / p * u;
+                               const cs = Math.cos(quOverP);
+                               position.x = radius * (2 + cs) * 0.5 * cu;
+                               position.y = radius * (2 + cs) * su * 0.5;
+                               position.z = radius * Math.sin(quOverP) * 0.5;
+                       }
+               }
+
+               static fromJSON(data) {
+                       return new TorusKnotGeometry(data.radius, data.tube, data.tubularSegments, data.radialSegments, data.p, data.q);
+               }
+
+       }
+
+       class TubeGeometry extends BufferGeometry {
+               constructor(path, tubularSegments = 64, radius = 1, radialSegments = 8, closed = false) {
+                       super();
+                       this.type = 'TubeGeometry';
+                       this.parameters = {
+                               path: path,
+                               tubularSegments: tubularSegments,
+                               radius: radius,
+                               radialSegments: radialSegments,
+                               closed: closed
+                       };
+                       const frames = path.computeFrenetFrames(tubularSegments, closed); // expose internals
+
+                       this.tangents = frames.tangents;
+                       this.normals = frames.normals;
+                       this.binormals = frames.binormals; // helper variables
+
+                       const vertex = new Vector3();
+                       const normal = new Vector3();
+                       const uv = new Vector2();
+                       let P = new Vector3(); // buffer
+
+                       const vertices = [];
+                       const normals = [];
+                       const uvs = [];
+                       const indices = []; // create buffer data
+
+                       generateBufferData(); // build geometry
+
+                       this.setIndex(indices);
+                       this.setAttribute('position', new Float32BufferAttribute(vertices, 3));
+                       this.setAttribute('normal', new Float32BufferAttribute(normals, 3));
+                       this.setAttribute('uv', new Float32BufferAttribute(uvs, 2)); // functions
+
+                       function generateBufferData() {
+                               for (let i = 0; i < tubularSegments; i++) {
+                                       generateSegment(i);
+                               } // if the geometry is not closed, generate the last row of vertices and normals
+                               // at the regular position on the given path
+                               //
+                               // if the geometry is closed, duplicate the first row of vertices and normals (uvs will differ)
+
+
+                               generateSegment(closed === false ? tubularSegments : 0); // uvs are generated in a separate function.
+                               // this makes it easy compute correct values for closed geometries
+
+                               generateUVs(); // finally create faces
+
+                               generateIndices();
+                       }
+
+                       function generateSegment(i) {
+                               // we use getPointAt to sample evenly distributed points from the given path
+                               P = path.getPointAt(i / tubularSegments, P); // retrieve corresponding normal and binormal
+
+                               const N = frames.normals[i];
+                               const B = frames.binormals[i]; // generate normals and vertices for the current segment
+
+                               for (let j = 0; j <= radialSegments; j++) {
+                                       const v = j / radialSegments * Math.PI * 2;
+                                       const sin = Math.sin(v);
+                                       const cos = -Math.cos(v); // normal
+
+                                       normal.x = cos * N.x + sin * B.x;
+                                       normal.y = cos * N.y + sin * B.y;
+                                       normal.z = cos * N.z + sin * B.z;
+                                       normal.normalize();
+                                       normals.push(normal.x, normal.y, normal.z); // vertex
+
+                                       vertex.x = P.x + radius * normal.x;
+                                       vertex.y = P.y + radius * normal.y;
+                                       vertex.z = P.z + radius * normal.z;
+                                       vertices.push(vertex.x, vertex.y, vertex.z);
+                               }
+                       }
+
+                       function generateIndices() {
+                               for (let j = 1; j <= tubularSegments; j++) {
+                                       for (let i = 1; i <= radialSegments; i++) {
+                                               const a = (radialSegments + 1) * (j - 1) + (i - 1);
+                                               const b = (radialSegments + 1) * j + (i - 1);
+                                               const c = (radialSegments + 1) * j + i;
+                                               const d = (radialSegments + 1) * (j - 1) + i; // faces
+
+                                               indices.push(a, b, d);
+                                               indices.push(b, c, d);
+                                       }
+                               }
+                       }
+
+                       function generateUVs() {
+                               for (let i = 0; i <= tubularSegments; i++) {
+                                       for (let j = 0; j <= radialSegments; j++) {
+                                               uv.x = i / tubularSegments;
+                                               uv.y = j / radialSegments;
+                                               uvs.push(uv.x, uv.y);
+                                       }
+                               }
+                       }
+               }
+
+               toJSON() {
+                       const data = super.toJSON();
+                       data.path = this.parameters.path.toJSON();
+                       return data;
+               }
+
+               static fromJSON(data) {
+                       // This only works for built-in curves (e.g. CatmullRomCurve3).
+                       // User defined curves or instances of CurvePath will not be deserialized.
+                       return new TubeGeometry(new Curves[data.path.type]().fromJSON(data.path), data.tubularSegments, data.radius, data.radialSegments, data.closed);
+               }
+
+       }
+
+       class WireframeGeometry extends BufferGeometry {
+               constructor(geometry) {
+                       super();
+                       this.type = 'WireframeGeometry';
+
+                       if (geometry.isGeometry === true) {
+                               console.error('THREE.WireframeGeometry no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.');
+                               return;
+                       } // buffer
+
+
+                       const vertices = [];
+                       const edges = new Set(); // helper variables
+
+                       const start = new Vector3();
+                       const end = new Vector3();
+
+                       if (geometry.index !== null) {
+                               // indexed BufferGeometry
+                               const position = geometry.attributes.position;
+                               const indices = geometry.index;
+                               let groups = geometry.groups;
+
+                               if (groups.length === 0) {
+                                       groups = [{
+                                               start: 0,
+                                               count: indices.count,
+                                               materialIndex: 0
+                                       }];
+                               } // create a data structure that contains all eges without duplicates
+
+
+                               for (let o = 0, ol = groups.length; o < ol; ++o) {
+                                       const group = groups[o];
+                                       const groupStart = group.start;
+                                       const groupCount = group.count;
+
+                                       for (let i = groupStart, l = groupStart + groupCount; i < l; i += 3) {
+                                               for (let j = 0; j < 3; j++) {
+                                                       const index1 = indices.getX(i + j);
+                                                       const index2 = indices.getX(i + (j + 1) % 3);
+                                                       start.fromBufferAttribute(position, index1);
+                                                       end.fromBufferAttribute(position, index2);
+
+                                                       if (isUniqueEdge(start, end, edges) === true) {
+                                                               vertices.push(start.x, start.y, start.z);
+                                                               vertices.push(end.x, end.y, end.z);
+                                                       }
+                                               }
+                                       }
+                               }
+                       } else {
+                               // non-indexed BufferGeometry
+                               const position = geometry.attributes.position;
+
+                               for (let i = 0, l = position.count / 3; i < l; i++) {
+                                       for (let j = 0; j < 3; j++) {
+                                               // three edges per triangle, an edge is represented as (index1, index2)
+                                               // e.g. the first triangle has the following edges: (0,1),(1,2),(2,0)
+                                               const index1 = 3 * i + j;
+                                               const index2 = 3 * i + (j + 1) % 3;
+                                               start.fromBufferAttribute(position, index1);
+                                               end.fromBufferAttribute(position, index2);
+
+                                               if (isUniqueEdge(start, end, edges) === true) {
+                                                       vertices.push(start.x, start.y, start.z);
+                                                       vertices.push(end.x, end.y, end.z);
+                                               }
+                                       }
+                               }
+                       } // build geometry
+
+
+                       this.setAttribute('position', new Float32BufferAttribute(vertices, 3));
+               }
+
+       }
+
+       function isUniqueEdge(start, end, edges) {
+               const hash1 = `${start.x},${start.y},${start.z}-${end.x},${end.y},${end.z}`;
+               const hash2 = `${end.x},${end.y},${end.z}-${start.x},${start.y},${start.z}`; // coincident edge
+
+               if (edges.has(hash1) === true || edges.has(hash2) === true) {
+                       return false;
+               } else {
+                       edges.add(hash1, hash2);
+                       return true;
+               }
+       }
+
+       var Geometries = /*#__PURE__*/Object.freeze({
+               __proto__: null,
+               BoxGeometry: BoxGeometry,
+               BoxBufferGeometry: BoxGeometry,
+               CircleGeometry: CircleGeometry,
+               CircleBufferGeometry: CircleGeometry,
+               ConeGeometry: ConeGeometry,
+               ConeBufferGeometry: ConeGeometry,
+               CylinderGeometry: CylinderGeometry,
+               CylinderBufferGeometry: CylinderGeometry,
+               DodecahedronGeometry: DodecahedronGeometry,
+               DodecahedronBufferGeometry: DodecahedronGeometry,
+               EdgesGeometry: EdgesGeometry,
+               ExtrudeGeometry: ExtrudeGeometry,
+               ExtrudeBufferGeometry: ExtrudeGeometry,
+               IcosahedronGeometry: IcosahedronGeometry,
+               IcosahedronBufferGeometry: IcosahedronGeometry,
+               LatheGeometry: LatheGeometry,
+               LatheBufferGeometry: LatheGeometry,
+               OctahedronGeometry: OctahedronGeometry,
+               OctahedronBufferGeometry: OctahedronGeometry,
+               ParametricGeometry: ParametricGeometry,
+               ParametricBufferGeometry: ParametricGeometry,
+               PlaneGeometry: PlaneGeometry,
+               PlaneBufferGeometry: PlaneGeometry,
+               PolyhedronGeometry: PolyhedronGeometry,
+               PolyhedronBufferGeometry: PolyhedronGeometry,
+               RingGeometry: RingGeometry,
+               RingBufferGeometry: RingGeometry,
+               ShapeGeometry: ShapeGeometry,
+               ShapeBufferGeometry: ShapeGeometry,
+               SphereGeometry: SphereGeometry,
+               SphereBufferGeometry: SphereGeometry,
+               TetrahedronGeometry: TetrahedronGeometry,
+               TetrahedronBufferGeometry: TetrahedronGeometry,
+               TextGeometry: TextGeometry,
+               TextBufferGeometry: TextGeometry,
+               TorusGeometry: TorusGeometry,
+               TorusBufferGeometry: TorusGeometry,
+               TorusKnotGeometry: TorusKnotGeometry,
+               TorusKnotBufferGeometry: TorusKnotGeometry,
+               TubeGeometry: TubeGeometry,
+               TubeBufferGeometry: TubeGeometry,
+               WireframeGeometry: WireframeGeometry
+       });
+
+       /**
+        * parameters = {
+        *      color: <THREE.Color>
+        * }
+        */
+
+       class ShadowMaterial extends Material {
+               constructor(parameters) {
+                       super();
+                       this.type = 'ShadowMaterial';
+                       this.color = new Color(0x000000);
+                       this.transparent = true;
+                       this.setValues(parameters);
+               }
+
+               copy(source) {
+                       super.copy(source);
+                       this.color.copy(source.color);
+                       return this;
+               }
+
+       }
+
+       ShadowMaterial.prototype.isShadowMaterial = true;
+
+       /**
+        * parameters = {
+        *      color: <hex>,
+        *      roughness: <float>,
+        *      metalness: <float>,
+        *      opacity: <float>,
+        *
+        *      map: new THREE.Texture( <Image> ),
+        *
+        *      lightMap: new THREE.Texture( <Image> ),
+        *      lightMapIntensity: <float>
+        *
+        *      aoMap: new THREE.Texture( <Image> ),
+        *      aoMapIntensity: <float>
+        *
+        *      emissive: <hex>,
+        *      emissiveIntensity: <float>
+        *      emissiveMap: new THREE.Texture( <Image> ),
+        *
+        *      bumpMap: new THREE.Texture( <Image> ),
+        *      bumpScale: <float>,
+        *
+        *      normalMap: new THREE.Texture( <Image> ),
+        *      normalMapType: THREE.TangentSpaceNormalMap,
+        *      normalScale: <Vector2>,
+        *
+        *      displacementMap: new THREE.Texture( <Image> ),
+        *      displacementScale: <float>,
+        *      displacementBias: <float>,
+        *
+        *      roughnessMap: new THREE.Texture( <Image> ),
+        *
+        *      metalnessMap: new THREE.Texture( <Image> ),
+        *
+        *      alphaMap: new THREE.Texture( <Image> ),
+        *
+        *      envMap: new THREE.CubeTexture( [posx, negx, posy, negy, posz, negz] ),
+        *      envMapIntensity: <float>
+        *
+        *      refractionRatio: <float>,
+        *
+        *      wireframe: <boolean>,
+        *      wireframeLinewidth: <float>,
+        *
+        *      flatShading: <bool>
+        * }
+        */
+
+       class MeshStandardMaterial extends Material {
+               constructor(parameters) {
+                       super();
+                       this.defines = {
+                               'STANDARD': ''
+                       };
+                       this.type = 'MeshStandardMaterial';
+                       this.color = new Color(0xffffff); // diffuse
+
+                       this.roughness = 1.0;
+                       this.metalness = 0.0;
+                       this.map = null;
+                       this.lightMap = null;
+                       this.lightMapIntensity = 1.0;
+                       this.aoMap = null;
+                       this.aoMapIntensity = 1.0;
+                       this.emissive = new Color(0x000000);
+                       this.emissiveIntensity = 1.0;
+                       this.emissiveMap = null;
+                       this.bumpMap = null;
+                       this.bumpScale = 1;
+                       this.normalMap = null;
+                       this.normalMapType = TangentSpaceNormalMap;
+                       this.normalScale = new Vector2(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.0;
+                       this.refractionRatio = 0.98;
+                       this.wireframe = false;
+                       this.wireframeLinewidth = 1;
+                       this.wireframeLinecap = 'round';
+                       this.wireframeLinejoin = 'round';
+                       this.flatShading = false;
+                       this.setValues(parameters);
+               }
+
+               copy(source) {
+                       super.copy(source);
+                       this.defines = {
+                               'STANDARD': ''
+                       };
+                       this.color.copy(source.color);
+                       this.roughness = source.roughness;
+                       this.metalness = source.metalness;
+                       this.map = source.map;
+                       this.lightMap = source.lightMap;
+                       this.lightMapIntensity = source.lightMapIntensity;
+                       this.aoMap = source.aoMap;
+                       this.aoMapIntensity = source.aoMapIntensity;
+                       this.emissive.copy(source.emissive);
+                       this.emissiveMap = source.emissiveMap;
+                       this.emissiveIntensity = source.emissiveIntensity;
+                       this.bumpMap = source.bumpMap;
+                       this.bumpScale = source.bumpScale;
+                       this.normalMap = source.normalMap;
+                       this.normalMapType = source.normalMapType;
+                       this.normalScale.copy(source.normalScale);
+                       this.displacementMap = source.displacementMap;
+                       this.displacementScale = source.displacementScale;
+                       this.displacementBias = source.displacementBias;
+                       this.roughnessMap = source.roughnessMap;
+                       this.metalnessMap = source.metalnessMap;
+                       this.alphaMap = source.alphaMap;
+                       this.envMap = source.envMap;
+                       this.envMapIntensity = source.envMapIntensity;
+                       this.refractionRatio = source.refractionRatio;
+                       this.wireframe = source.wireframe;
+                       this.wireframeLinewidth = source.wireframeLinewidth;
+                       this.wireframeLinecap = source.wireframeLinecap;
+                       this.wireframeLinejoin = source.wireframeLinejoin;
+                       this.flatShading = source.flatShading;
+                       return this;
+               }
+
+       }
+
+       MeshStandardMaterial.prototype.isMeshStandardMaterial = true;
+
+       /**
+        * parameters = {
+        *      clearcoat: <float>,
+        *      clearcoatMap: new THREE.Texture( <Image> ),
+        *      clearcoatRoughness: <float>,
+        *      clearcoatRoughnessMap: new THREE.Texture( <Image> ),
+        *      clearcoatNormalScale: <Vector2>,
+        *      clearcoatNormalMap: new THREE.Texture( <Image> ),
+        *
+        *      ior: <float>,
+        *      reflectivity: <float>,
+        *
+        *      sheenTint: <Color>,
+        *
+        *      transmission: <float>,
+        *      transmissionMap: new THREE.Texture( <Image> ),
+        *
+        *      thickness: <float>,
+        *      thicknessMap: new THREE.Texture( <Image> ),
+        *      attenuationDistance: <float>,
+        *      attenuationTint: <Color>,
+        *
+        *      specularIntensity: <float>,
+        *      specularIntensityhMap: new THREE.Texture( <Image> ),
+        *      specularTint: <Color>,
+        *      specularTintMap: new THREE.Texture( <Image> )
+        * }
+        */
+
+       class MeshPhysicalMaterial extends MeshStandardMaterial {
+               constructor(parameters) {
+                       super();
+                       this.defines = {
+                               'STANDARD': '',
+                               'PHYSICAL': ''
+                       };
+                       this.type = 'MeshPhysicalMaterial';
+                       this.clearcoatMap = null;
+                       this.clearcoatRoughness = 0.0;
+                       this.clearcoatRoughnessMap = null;
+                       this.clearcoatNormalScale = new Vector2(1, 1);
+                       this.clearcoatNormalMap = null;
+                       this.ior = 1.5;
+                       Object.defineProperty(this, 'reflectivity', {
+                               get: function () {
+                                       return clamp(2.5 * (this.ior - 1) / (this.ior + 1), 0, 1);
+                               },
+                               set: function (reflectivity) {
+                                       this.ior = (1 + 0.4 * reflectivity) / (1 - 0.4 * reflectivity);
+                               }
+                       });
+                       this.sheenTint = new Color(0x000000);
+                       this.transmission = 0.0;
+                       this.transmissionMap = null;
+                       this.thickness = 0.01;
+                       this.thicknessMap = null;
+                       this.attenuationDistance = 0.0;
+                       this.attenuationTint = new Color(1, 1, 1);
+                       this.specularIntensity = 1.0;
+                       this.specularIntensityMap = null;
+                       this.specularTint = new Color(1, 1, 1);
+                       this.specularTintMap = null;
+                       this._clearcoat = 0;
+                       this._transmission = 0;
+                       this.setValues(parameters);
+               }
+
+               get clearcoat() {
+                       return this._clearcoat;
+               }
+
+               set clearcoat(value) {
+                       if (this._clearcoat > 0 !== value > 0) {
+                               this.version++;
+                       }
+
+                       this._clearcoat = value;
+               }
+
+               get transmission() {
+                       return this._transmission;
+               }
+
+               set transmission(value) {
+                       if (this._transmission > 0 !== value > 0) {
+                               this.version++;
+                       }
+
+                       this._transmission = value;
+               }
+
+               copy(source) {
+                       super.copy(source);
+                       this.defines = {
+                               'STANDARD': '',
+                               'PHYSICAL': ''
+                       };
+                       this.clearcoat = source.clearcoat;
+                       this.clearcoatMap = source.clearcoatMap;
+                       this.clearcoatRoughness = source.clearcoatRoughness;
+                       this.clearcoatRoughnessMap = source.clearcoatRoughnessMap;
+                       this.clearcoatNormalMap = source.clearcoatNormalMap;
+                       this.clearcoatNormalScale.copy(source.clearcoatNormalScale);
+                       this.ior = source.ior;
+                       this.sheenTint.copy(source.sheenTint);
+                       this.transmission = source.transmission;
+                       this.transmissionMap = source.transmissionMap;
+                       this.thickness = source.thickness;
+                       this.thicknessMap = source.thicknessMap;
+                       this.attenuationDistance = source.attenuationDistance;
+                       this.attenuationTint.copy(source.attenuationTint);
+                       this.specularIntensity = source.specularIntensity;
+                       this.specularIntensityMap = source.specularIntensityMap;
+                       this.specularTint.copy(source.specularTint);
+                       this.specularTintMap = source.specularTintMap;
+                       return this;
+               }
+
+       }
+
+       MeshPhysicalMaterial.prototype.isMeshPhysicalMaterial = true;
+
+       /**
+        * parameters = {
+        *      color: <hex>,
+        *      specular: <hex>,
+        *      shininess: <float>,
+        *      opacity: <float>,
+        *
+        *      map: new THREE.Texture( <Image> ),
+        *
+        *      lightMap: new THREE.Texture( <Image> ),
+        *      lightMapIntensity: <float>
+        *
+        *      aoMap: new THREE.Texture( <Image> ),
+        *      aoMapIntensity: <float>
+        *
+        *      emissive: <hex>,
+        *      emissiveIntensity: <float>
+        *      emissiveMap: new THREE.Texture( <Image> ),
+        *
+        *      bumpMap: new THREE.Texture( <Image> ),
+        *      bumpScale: <float>,
+        *
+        *      normalMap: new THREE.Texture( <Image> ),
+        *      normalMapType: THREE.TangentSpaceNormalMap,
+        *      normalScale: <Vector2>,
+        *
+        *      displacementMap: new THREE.Texture( <Image> ),
+        *      displacementScale: <float>,
+        *      displacementBias: <float>,
+        *
+        *      specularMap: new THREE.Texture( <Image> ),
+        *
+        *      alphaMap: new THREE.Texture( <Image> ),
+        *
+        *      envMap: new THREE.CubeTexture( [posx, negx, posy, negy, posz, negz] ),
+        *      combine: THREE.MultiplyOperation,
+        *      reflectivity: <float>,
+        *      refractionRatio: <float>,
+        *
+        *      wireframe: <boolean>,
+        *      wireframeLinewidth: <float>,
+        *
+        *      flatShading: <bool>
+        * }
+        */
+
+       class MeshPhongMaterial extends Material {
+               constructor(parameters) {
+                       super();
+                       this.type = 'MeshPhongMaterial';
+                       this.color = new Color(0xffffff); // diffuse
+
+                       this.specular = new Color(0x111111);
+                       this.shininess = 30;
+                       this.map = null;
+                       this.lightMap = null;
+                       this.lightMapIntensity = 1.0;
+                       this.aoMap = null;
+                       this.aoMapIntensity = 1.0;
+                       this.emissive = new Color(0x000000);
+                       this.emissiveIntensity = 1.0;
+                       this.emissiveMap = null;
+                       this.bumpMap = null;
+                       this.bumpScale = 1;
+                       this.normalMap = null;
+                       this.normalMapType = TangentSpaceNormalMap;
+                       this.normalScale = new Vector2(1, 1);
+                       this.displacementMap = null;
+                       this.displacementScale = 1;
+                       this.displacementBias = 0;
+                       this.specularMap = null;
+                       this.alphaMap = null;
+                       this.envMap = null;
+                       this.combine = MultiplyOperation;
+                       this.reflectivity = 1;
+                       this.refractionRatio = 0.98;
+                       this.wireframe = false;
+                       this.wireframeLinewidth = 1;
+                       this.wireframeLinecap = 'round';
+                       this.wireframeLinejoin = 'round';
+                       this.flatShading = false;
+                       this.setValues(parameters);
+               }
+
+               copy(source) {
+                       super.copy(source);
+                       this.color.copy(source.color);
+                       this.specular.copy(source.specular);
+                       this.shininess = source.shininess;
+                       this.map = source.map;
+                       this.lightMap = source.lightMap;
+                       this.lightMapIntensity = source.lightMapIntensity;
+                       this.aoMap = source.aoMap;
+                       this.aoMapIntensity = source.aoMapIntensity;
+                       this.emissive.copy(source.emissive);
+                       this.emissiveMap = source.emissiveMap;
+                       this.emissiveIntensity = source.emissiveIntensity;
+                       this.bumpMap = source.bumpMap;
+                       this.bumpScale = source.bumpScale;
+                       this.normalMap = source.normalMap;
+                       this.normalMapType = source.normalMapType;
+                       this.normalScale.copy(source.normalScale);
+                       this.displacementMap = source.displacementMap;
+                       this.displacementScale = source.displacementScale;
+                       this.displacementBias = source.displacementBias;
+                       this.specularMap = source.specularMap;
+                       this.alphaMap = source.alphaMap;
+                       this.envMap = source.envMap;
+                       this.combine = source.combine;
+                       this.reflectivity = source.reflectivity;
+                       this.refractionRatio = source.refractionRatio;
+                       this.wireframe = source.wireframe;
+                       this.wireframeLinewidth = source.wireframeLinewidth;
+                       this.wireframeLinecap = source.wireframeLinecap;
+                       this.wireframeLinejoin = source.wireframeLinejoin;
+                       this.flatShading = source.flatShading;
+                       return this;
+               }
+
+       }
+
+       MeshPhongMaterial.prototype.isMeshPhongMaterial = true;
+
+       /**
+        * parameters = {
+        *      color: <hex>,
+        *
+        *      map: new THREE.Texture( <Image> ),
+        *      gradientMap: new THREE.Texture( <Image> ),
+        *
+        *      lightMap: new THREE.Texture( <Image> ),
+        *      lightMapIntensity: <float>
+        *
+        *      aoMap: new THREE.Texture( <Image> ),
+        *      aoMapIntensity: <float>
+        *
+        *      emissive: <hex>,
+        *      emissiveIntensity: <float>
+        *      emissiveMap: new THREE.Texture( <Image> ),
+        *
+        *      bumpMap: new THREE.Texture( <Image> ),
+        *      bumpScale: <float>,
+        *
+        *      normalMap: new THREE.Texture( <Image> ),
+        *      normalMapType: THREE.TangentSpaceNormalMap,
+        *      normalScale: <Vector2>,
+        *
+        *      displacementMap: new THREE.Texture( <Image> ),
+        *      displacementScale: <float>,
+        *      displacementBias: <float>,
+        *
+        *      alphaMap: new THREE.Texture( <Image> ),
+        *
+        *      wireframe: <boolean>,
+        *      wireframeLinewidth: <float>,
+        *
+        * }
+        */
+
+       class MeshToonMaterial extends Material {
+               constructor(parameters) {
+                       super();
+                       this.defines = {
+                               'TOON': ''
+                       };
+                       this.type = 'MeshToonMaterial';
+                       this.color = new Color(0xffffff);
+                       this.map = null;
+                       this.gradientMap = null;
+                       this.lightMap = null;
+                       this.lightMapIntensity = 1.0;
+                       this.aoMap = null;
+                       this.aoMapIntensity = 1.0;
+                       this.emissive = new Color(0x000000);
+                       this.emissiveIntensity = 1.0;
+                       this.emissiveMap = null;
+                       this.bumpMap = null;
+                       this.bumpScale = 1;
+                       this.normalMap = null;
+                       this.normalMapType = TangentSpaceNormalMap;
+                       this.normalScale = new Vector2(1, 1);
+                       this.displacementMap = null;
+                       this.displacementScale = 1;
+                       this.displacementBias = 0;
+                       this.alphaMap = null;
+                       this.wireframe = false;
+                       this.wireframeLinewidth = 1;
+                       this.wireframeLinecap = 'round';
+                       this.wireframeLinejoin = 'round';
+                       this.setValues(parameters);
+               }
+
+               copy(source) {
+                       super.copy(source);
+                       this.color.copy(source.color);
+                       this.map = source.map;
+                       this.gradientMap = source.gradientMap;
+                       this.lightMap = source.lightMap;
+                       this.lightMapIntensity = source.lightMapIntensity;
+                       this.aoMap = source.aoMap;
+                       this.aoMapIntensity = source.aoMapIntensity;
+                       this.emissive.copy(source.emissive);
+                       this.emissiveMap = source.emissiveMap;
+                       this.emissiveIntensity = source.emissiveIntensity;
+                       this.bumpMap = source.bumpMap;
+                       this.bumpScale = source.bumpScale;
+                       this.normalMap = source.normalMap;
+                       this.normalMapType = source.normalMapType;
+                       this.normalScale.copy(source.normalScale);
+                       this.displacementMap = source.displacementMap;
+                       this.displacementScale = source.displacementScale;
+                       this.displacementBias = source.displacementBias;
+                       this.alphaMap = source.alphaMap;
+                       this.wireframe = source.wireframe;
+                       this.wireframeLinewidth = source.wireframeLinewidth;
+                       this.wireframeLinecap = source.wireframeLinecap;
+                       this.wireframeLinejoin = source.wireframeLinejoin;
+                       return this;
+               }
+
+       }
+
+       MeshToonMaterial.prototype.isMeshToonMaterial = true;
+
+       /**
+        * parameters = {
+        *      opacity: <float>,
+        *
+        *      bumpMap: new THREE.Texture( <Image> ),
+        *      bumpScale: <float>,
+        *
+        *      normalMap: new THREE.Texture( <Image> ),
+        *      normalMapType: THREE.TangentSpaceNormalMap,
+        *      normalScale: <Vector2>,
+        *
+        *      displacementMap: new THREE.Texture( <Image> ),
+        *      displacementScale: <float>,
+        *      displacementBias: <float>,
+        *
+        *      wireframe: <boolean>,
+        *      wireframeLinewidth: <float>
+        *
+        *      flatShading: <bool>
+        * }
+        */
+
+       class MeshNormalMaterial extends Material {
+               constructor(parameters) {
+                       super();
+                       this.type = 'MeshNormalMaterial';
+                       this.bumpMap = null;
+                       this.bumpScale = 1;
+                       this.normalMap = null;
+                       this.normalMapType = TangentSpaceNormalMap;
+                       this.normalScale = new Vector2(1, 1);
+                       this.displacementMap = null;
+                       this.displacementScale = 1;
+                       this.displacementBias = 0;
+                       this.wireframe = false;
+                       this.wireframeLinewidth = 1;
+                       this.fog = false;
+                       this.flatShading = false;
+                       this.setValues(parameters);
+               }
+
+               copy(source) {
+                       super.copy(source);
+                       this.bumpMap = source.bumpMap;
+                       this.bumpScale = source.bumpScale;
+                       this.normalMap = source.normalMap;
+                       this.normalMapType = source.normalMapType;
+                       this.normalScale.copy(source.normalScale);
+                       this.displacementMap = source.displacementMap;
+                       this.displacementScale = source.displacementScale;
+                       this.displacementBias = source.displacementBias;
+                       this.wireframe = source.wireframe;
+                       this.wireframeLinewidth = source.wireframeLinewidth;
+                       this.flatShading = source.flatShading;
+                       return this;
+               }
+
+       }
+
+       MeshNormalMaterial.prototype.isMeshNormalMaterial = true;
+
+       /**
+        * parameters = {
+        *      color: <hex>,
+        *      opacity: <float>,
+        *
+        *      map: new THREE.Texture( <Image> ),
+        *
+        *      lightMap: new THREE.Texture( <Image> ),
+        *      lightMapIntensity: <float>
+        *
+        *      aoMap: new THREE.Texture( <Image> ),
+        *      aoMapIntensity: <float>
+        *
+        *      emissive: <hex>,
+        *      emissiveIntensity: <float>
+        *      emissiveMap: new THREE.Texture( <Image> ),
+        *
+        *      specularMap: new THREE.Texture( <Image> ),
+        *
+        *      alphaMap: new THREE.Texture( <Image> ),
+        *
+        *      envMap: new THREE.CubeTexture( [posx, negx, posy, negy, posz, negz] ),
+        *      combine: THREE.Multiply,
+        *      reflectivity: <float>,
+        *      refractionRatio: <float>,
+        *
+        *      wireframe: <boolean>,
+        *      wireframeLinewidth: <float>,
+        *
+        * }
+        */
+
+       class MeshLambertMaterial extends Material {
+               constructor(parameters) {
+                       super();
+                       this.type = 'MeshLambertMaterial';
+                       this.color = new Color(0xffffff); // diffuse
+
+                       this.map = null;
+                       this.lightMap = null;
+                       this.lightMapIntensity = 1.0;
+                       this.aoMap = null;
+                       this.aoMapIntensity = 1.0;
+                       this.emissive = new Color(0x000000);
+                       this.emissiveIntensity = 1.0;
+                       this.emissiveMap = null;
+                       this.specularMap = null;
+                       this.alphaMap = null;
+                       this.envMap = null;
+                       this.combine = MultiplyOperation;
+                       this.reflectivity = 1;
+                       this.refractionRatio = 0.98;
+                       this.wireframe = false;
+                       this.wireframeLinewidth = 1;
+                       this.wireframeLinecap = 'round';
+                       this.wireframeLinejoin = 'round';
+                       this.setValues(parameters);
+               }
+
+               copy(source) {
+                       super.copy(source);
+                       this.color.copy(source.color);
+                       this.map = source.map;
+                       this.lightMap = source.lightMap;
+                       this.lightMapIntensity = source.lightMapIntensity;
+                       this.aoMap = source.aoMap;
+                       this.aoMapIntensity = source.aoMapIntensity;
+                       this.emissive.copy(source.emissive);
+                       this.emissiveMap = source.emissiveMap;
+                       this.emissiveIntensity = source.emissiveIntensity;
+                       this.specularMap = source.specularMap;
+                       this.alphaMap = source.alphaMap;
+                       this.envMap = source.envMap;
+                       this.combine = source.combine;
+                       this.reflectivity = source.reflectivity;
+                       this.refractionRatio = source.refractionRatio;
+                       this.wireframe = source.wireframe;
+                       this.wireframeLinewidth = source.wireframeLinewidth;
+                       this.wireframeLinecap = source.wireframeLinecap;
+                       this.wireframeLinejoin = source.wireframeLinejoin;
+                       return this;
+               }
+
+       }
+
+       MeshLambertMaterial.prototype.isMeshLambertMaterial = true;
+
+       /**
+        * parameters = {
+        *      color: <hex>,
+        *      opacity: <float>,
+        *
+        *      matcap: new THREE.Texture( <Image> ),
+        *
+        *      map: new THREE.Texture( <Image> ),
+        *
+        *      bumpMap: new THREE.Texture( <Image> ),
+        *      bumpScale: <float>,
+        *
+        *      normalMap: new THREE.Texture( <Image> ),
+        *      normalMapType: THREE.TangentSpaceNormalMap,
+        *      normalScale: <Vector2>,
+        *
+        *      displacementMap: new THREE.Texture( <Image> ),
+        *      displacementScale: <float>,
+        *      displacementBias: <float>,
+        *
+        *      alphaMap: new THREE.Texture( <Image> ),
+        *
+        *      flatShading: <bool>
+        * }
+        */
+
+       class MeshMatcapMaterial extends Material {
+               constructor(parameters) {
+                       super();
+                       this.defines = {
+                               'MATCAP': ''
+                       };
+                       this.type = 'MeshMatcapMaterial';
+                       this.color = new Color(0xffffff); // diffuse
+
+                       this.matcap = null;
+                       this.map = null;
+                       this.bumpMap = null;
+                       this.bumpScale = 1;
+                       this.normalMap = null;
+                       this.normalMapType = TangentSpaceNormalMap;
+                       this.normalScale = new Vector2(1, 1);
+                       this.displacementMap = null;
+                       this.displacementScale = 1;
+                       this.displacementBias = 0;
+                       this.alphaMap = null;
+                       this.flatShading = false;
+                       this.setValues(parameters);
+               }
+
+               copy(source) {
+                       super.copy(source);
+                       this.defines = {
+                               'MATCAP': ''
+                       };
+                       this.color.copy(source.color);
+                       this.matcap = source.matcap;
+                       this.map = source.map;
+                       this.bumpMap = source.bumpMap;
+                       this.bumpScale = source.bumpScale;
+                       this.normalMap = source.normalMap;
+                       this.normalMapType = source.normalMapType;
+                       this.normalScale.copy(source.normalScale);
+                       this.displacementMap = source.displacementMap;
+                       this.displacementScale = source.displacementScale;
+                       this.displacementBias = source.displacementBias;
+                       this.alphaMap = source.alphaMap;
+                       this.flatShading = source.flatShading;
+                       return this;
+               }
+
+       }
+
+       MeshMatcapMaterial.prototype.isMeshMatcapMaterial = true;
+
+       /**
+        * parameters = {
+        *      color: <hex>,
+        *      opacity: <float>,
+        *
+        *      linewidth: <float>,
+        *
+        *      scale: <float>,
+        *      dashSize: <float>,
+        *      gapSize: <float>
+        * }
+        */
+
+       class LineDashedMaterial extends LineBasicMaterial {
+               constructor(parameters) {
+                       super();
+                       this.type = 'LineDashedMaterial';
+                       this.scale = 1;
+                       this.dashSize = 3;
+                       this.gapSize = 1;
+                       this.setValues(parameters);
+               }
+
+               copy(source) {
+                       super.copy(source);
+                       this.scale = source.scale;
+                       this.dashSize = source.dashSize;
+                       this.gapSize = source.gapSize;
+                       return this;
+               }
+
+       }
+
+       LineDashedMaterial.prototype.isLineDashedMaterial = true;
+
+       var Materials = /*#__PURE__*/Object.freeze({
+               __proto__: null,
+               ShadowMaterial: ShadowMaterial,
+               SpriteMaterial: SpriteMaterial,
+               RawShaderMaterial: RawShaderMaterial,
+               ShaderMaterial: ShaderMaterial,
+               PointsMaterial: PointsMaterial,
+               MeshPhysicalMaterial: MeshPhysicalMaterial,
+               MeshStandardMaterial: MeshStandardMaterial,
+               MeshPhongMaterial: MeshPhongMaterial,
+               MeshToonMaterial: MeshToonMaterial,
+               MeshNormalMaterial: MeshNormalMaterial,
+               MeshLambertMaterial: MeshLambertMaterial,
+               MeshDepthMaterial: MeshDepthMaterial,
+               MeshDistanceMaterial: MeshDistanceMaterial,
+               MeshBasicMaterial: MeshBasicMaterial,
+               MeshMatcapMaterial: MeshMatcapMaterial,
+               LineDashedMaterial: LineDashedMaterial,
+               LineBasicMaterial: LineBasicMaterial,
+               Material: Material
+       });
+
+       const AnimationUtils = {
+               // same as Array.prototype.slice, but also works on typed arrays
+               arraySlice: function (array, from, to) {
+                       if (AnimationUtils.isTypedArray(array)) {
+                               // in ios9 array.subarray(from, undefined) will return empty array
+                               // but array.subarray(from) or array.subarray(from, len) is correct
+                               return new array.constructor(array.subarray(from, to !== undefined ? to : array.length));
+                       }
+
+                       return array.slice(from, to);
+               },
+               // converts an array to a specific type
+               convertArray: function (array, type, forceClone) {
+                       if (!array || // let 'undefined' and 'null' pass
+                       !forceClone && array.constructor === type) return array;
+
+                       if (typeof type.BYTES_PER_ELEMENT === 'number') {
+                               return new type(array); // create typed array
+                       }
+
+                       return Array.prototype.slice.call(array); // create Array
+               },
+               isTypedArray: function (object) {
+                       return ArrayBuffer.isView(object) && !(object instanceof DataView);
+               },
+               // returns an array by which times and values can be sorted
+               getKeyframeOrder: function (times) {
+                       function compareTime(i, j) {
+                               return times[i] - times[j];
+                       }
+
+                       const n = times.length;
+                       const result = new Array(n);
+
+                       for (let i = 0; i !== n; ++i) result[i] = i;
+
+                       result.sort(compareTime);
+                       return result;
+               },
+               // uses the array previously returned by 'getKeyframeOrder' to sort data
+               sortedArray: function (values, stride, order) {
+                       const nValues = values.length;
+                       const result = new values.constructor(nValues);
+
+                       for (let i = 0, dstOffset = 0; dstOffset !== nValues; ++i) {
+                               const srcOffset = order[i] * stride;
+
+                               for (let j = 0; j !== stride; ++j) {
+                                       result[dstOffset++] = values[srcOffset + j];
+                               }
+                       }
+
+                       return result;
+               },
+               // function for parsing AOS keyframe formats
+               flattenJSON: function (jsonKeys, times, values, valuePropertyName) {
+                       let i = 1,
+                                       key = jsonKeys[0];
+
+                       while (key !== undefined && key[valuePropertyName] === undefined) {
+                               key = jsonKeys[i++];
+                       }
+
+                       if (key === undefined) return; // no data
+
+                       let value = key[valuePropertyName];
+                       if (value === undefined) return; // no data
+
+                       if (Array.isArray(value)) {
+                               do {
+                                       value = key[valuePropertyName];
+
+                                       if (value !== undefined) {
+                                               times.push(key.time);
+                                               values.push.apply(values, value); // push all elements
+                                       }
+
+                                       key = jsonKeys[i++];
+                               } while (key !== undefined);
+                       } else if (value.toArray !== undefined) {
+                               // ...assume THREE.Math-ish
+                               do {
+                                       value = key[valuePropertyName];
+
+                                       if (value !== undefined) {
+                                               times.push(key.time);
+                                               value.toArray(values, values.length);
+                                       }
+
+                                       key = jsonKeys[i++];
+                               } while (key !== undefined);
+                       } else {
+                               // otherwise push as-is
+                               do {
+                                       value = key[valuePropertyName];
+
+                                       if (value !== undefined) {
+                                               times.push(key.time);
+                                               values.push(value);
+                                       }
+
+                                       key = jsonKeys[i++];
+                               } while (key !== undefined);
+                       }
+               },
+               subclip: function (sourceClip, name, startFrame, endFrame, fps = 30) {
+                       const clip = sourceClip.clone();
+                       clip.name = name;
+                       const tracks = [];
+
+                       for (let i = 0; i < clip.tracks.length; ++i) {
+                               const track = clip.tracks[i];
+                               const valueSize = track.getValueSize();
+                               const times = [];
+                               const values = [];
+
+                               for (let j = 0; j < track.times.length; ++j) {
+                                       const frame = track.times[j] * fps;
+                                       if (frame < startFrame || frame >= endFrame) continue;
+                                       times.push(track.times[j]);
+
+                                       for (let k = 0; k < valueSize; ++k) {
+                                               values.push(track.values[j * valueSize + k]);
+                                       }
+                               }
+
+                               if (times.length === 0) continue;
+                               track.times = AnimationUtils.convertArray(times, track.times.constructor);
+                               track.values = AnimationUtils.convertArray(values, track.values.constructor);
+                               tracks.push(track);
+                       }
+
+                       clip.tracks = tracks; // find minimum .times value across all tracks in the trimmed clip
+
+                       let minStartTime = Infinity;
+
+                       for (let i = 0; i < clip.tracks.length; ++i) {
+                               if (minStartTime > clip.tracks[i].times[0]) {
+                                       minStartTime = clip.tracks[i].times[0];
+                               }
+                       } // shift all tracks such that clip begins at t=0
+
+
+                       for (let i = 0; i < clip.tracks.length; ++i) {
+                               clip.tracks[i].shift(-1 * minStartTime);
+                       }
+
+                       clip.resetDuration();
+                       return clip;
+               },
+               makeClipAdditive: function (targetClip, referenceFrame = 0, referenceClip = targetClip, fps = 30) {
+                       if (fps <= 0) fps = 30;
+                       const numTracks = referenceClip.tracks.length;
+                       const referenceTime = referenceFrame / fps; // Make each track's values relative to the values at the reference frame
+
+                       for (let i = 0; i < numTracks; ++i) {
+                               const referenceTrack = referenceClip.tracks[i];
+                               const referenceTrackType = referenceTrack.ValueTypeName; // Skip this track if it's non-numeric
+
+                               if (referenceTrackType === 'bool' || referenceTrackType === 'string') continue; // Find the track in the target clip whose name and type matches the reference track
+
+                               const targetTrack = targetClip.tracks.find(function (track) {
+                                       return track.name === referenceTrack.name && track.ValueTypeName === referenceTrackType;
+                               });
+                               if (targetTrack === undefined) continue;
+                               let referenceOffset = 0;
+                               const referenceValueSize = referenceTrack.getValueSize();
+
+                               if (referenceTrack.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline) {
+                                       referenceOffset = referenceValueSize / 3;
+                               }
+
+                               let targetOffset = 0;
+                               const targetValueSize = targetTrack.getValueSize();
+
+                               if (targetTrack.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline) {
+                                       targetOffset = targetValueSize / 3;
+                               }
+
+                               const lastIndex = referenceTrack.times.length - 1;
+                               let referenceValue; // Find the value to subtract out of the track
+
+                               if (referenceTime <= referenceTrack.times[0]) {
+                                       // Reference frame is earlier than the first keyframe, so just use the first keyframe
+                                       const startIndex = referenceOffset;
+                                       const endIndex = referenceValueSize - referenceOffset;
+                                       referenceValue = AnimationUtils.arraySlice(referenceTrack.values, startIndex, endIndex);
+                               } else if (referenceTime >= referenceTrack.times[lastIndex]) {
+                                       // Reference frame is after the last keyframe, so just use the last keyframe
+                                       const startIndex = lastIndex * referenceValueSize + referenceOffset;
+                                       const endIndex = startIndex + referenceValueSize - referenceOffset;
+                                       referenceValue = AnimationUtils.arraySlice(referenceTrack.values, startIndex, endIndex);
+                               } else {
+                                       // Interpolate to the reference value
+                                       const interpolant = referenceTrack.createInterpolant();
+                                       const startIndex = referenceOffset;
+                                       const endIndex = referenceValueSize - referenceOffset;
+                                       interpolant.evaluate(referenceTime);
+                                       referenceValue = AnimationUtils.arraySlice(interpolant.resultBuffer, startIndex, endIndex);
+                               } // Conjugate the quaternion
+
+
+                               if (referenceTrackType === 'quaternion') {
+                                       const referenceQuat = new Quaternion().fromArray(referenceValue).normalize().conjugate();
+                                       referenceQuat.toArray(referenceValue);
+                               } // Subtract the reference value from all of the track values
+
+
+                               const numTimes = targetTrack.times.length;
+
+                               for (let j = 0; j < numTimes; ++j) {
+                                       const valueStart = j * targetValueSize + targetOffset;
+
+                                       if (referenceTrackType === 'quaternion') {
+                                               // Multiply the conjugate for quaternion track types
+                                               Quaternion.multiplyQuaternionsFlat(targetTrack.values, valueStart, referenceValue, 0, targetTrack.values, valueStart);
+                                       } else {
+                                               const valueEnd = targetValueSize - targetOffset * 2; // Subtract each value for all other numeric track types
+
+                                               for (let k = 0; k < valueEnd; ++k) {
+                                                       targetTrack.values[valueStart + k] -= referenceValue[k];
+                                               }
+                                       }
+                               }
+                       }
+
+                       targetClip.blendMode = AdditiveAnimationBlendMode;
+                       return targetClip;
+               }
+       };
+
+       /**
+        * Abstract base class of interpolants over parametric samples.
+        *
+        * The parameter domain is one dimensional, typically the time or a path
+        * along a curve defined by the data.
+        *
+        * The sample values can have any dimensionality and derived classes may
+        * apply special interpretations to the data.
+        *
+        * This class provides the interval seek in a Template Method, deferring
+        * the actual interpolation to derived classes.
+        *
+        * Time complexity is O(1) for linear access crossing at most two points
+        * and O(log N) for random access, where N is the number of positions.
+        *
+        * References:
+        *
+        *              http://www.oodesign.com/template-method-pattern.html
+        *
+        */
+       class Interpolant {
+               constructor(parameterPositions, sampleValues, sampleSize, resultBuffer) {
+                       this.parameterPositions = parameterPositions;
+                       this._cachedIndex = 0;
+                       this.resultBuffer = resultBuffer !== undefined ? resultBuffer : new sampleValues.constructor(sampleSize);
+                       this.sampleValues = sampleValues;
+                       this.valueSize = sampleSize;
+                       this.settings = null;
+                       this.DefaultSettings_ = {};
+               }
+
+               evaluate(t) {
+                       const pp = this.parameterPositions;
+                       let i1 = this._cachedIndex,
+                                       t1 = pp[i1],
+                                       t0 = pp[i1 - 1];
+
+                       validate_interval: {
+                               seek: {
+                                       let right;
+
+                                       linear_scan: {
+                                               //- See http://jsperf.com/comparison-to-undefined/3
+                                               //- slower code:
+                                               //-
+                                               //-                             if ( t >= t1 || t1 === undefined ) {
+                                               forward_scan: if (!(t < t1)) {
+                                                       for (let giveUpAt = i1 + 2;;) {
+                                                               if (t1 === undefined) {
+                                                                       if (t < t0) break forward_scan; // after end
+
+                                                                       i1 = pp.length;
+                                                                       this._cachedIndex = i1;
+                                                                       return this.afterEnd_(i1 - 1, t, t0);
+                                                               }
+
+                                                               if (i1 === giveUpAt) break; // this loop
+
+                                                               t0 = t1;
+                                                               t1 = pp[++i1];
+
+                                                               if (t < t1) {
+                                                                       // we have arrived at the sought interval
+                                                                       break seek;
+                                                               }
+                                                       } // prepare binary search on the right side of the index
+
+
+                                                       right = pp.length;
+                                                       break linear_scan;
+                                               } //- slower code:
+                                               //-                                     if ( t < t0 || t0 === undefined ) {
+
+
+                                               if (!(t >= t0)) {
+                                                       // looping?
+                                                       const t1global = pp[1];
+
+                                                       if (t < t1global) {
+                                                               i1 = 2; // + 1, using the scan for the details
+
+                                                               t0 = t1global;
+                                                       } // linear reverse scan
+
+
+                                                       for (let giveUpAt = i1 - 2;;) {
+                                                               if (t0 === undefined) {
+                                                                       // before start
+                                                                       this._cachedIndex = 0;
+                                                                       return this.beforeStart_(0, t, t1);
+                                                               }
+
+                                                               if (i1 === giveUpAt) break; // this loop
+
+                                                               t1 = t0;
+                                                               t0 = pp[--i1 - 1];
+
+                                                               if (t >= t0) {
+                                                                       // we have arrived at the sought interval
+                                                                       break seek;
+                                                               }
+                                                       } // prepare binary search on the left side of the index
+
+
+                                                       right = i1;
+                                                       i1 = 0;
+                                                       break linear_scan;
+                                               } // the interval is valid
+
+
+                                               break validate_interval;
+                                       } // linear scan
+                                       // binary search
+
+
+                                       while (i1 < right) {
+                                               const mid = i1 + right >>> 1;
+
+                                               if (t < pp[mid]) {
+                                                       right = mid;
+                                               } else {
+                                                       i1 = mid + 1;
+                                               }
+                                       }
+
+                                       t1 = pp[i1];
+                                       t0 = pp[i1 - 1]; // check boundary cases, again
+
+                                       if (t0 === undefined) {
+                                               this._cachedIndex = 0;
+                                               return this.beforeStart_(0, t, t1);
+                                       }
+
+                                       if (t1 === undefined) {
+                                               i1 = pp.length;
+                                               this._cachedIndex = i1;
+                                               return this.afterEnd_(i1 - 1, t0, t);
+                                       }
+                               } // seek
+
+
+                               this._cachedIndex = i1;
+                               this.intervalChanged_(i1, t0, t1);
+                       } // validate_interval
+
+
+                       return this.interpolate_(i1, t0, t, t1);
+               }
+
+               getSettings_() {
+                       return this.settings || this.DefaultSettings_;
+               }
+
+               copySampleValue_(index) {
+                       // copies a sample value to the result buffer
+                       const result = this.resultBuffer,
+                                               values = this.sampleValues,
+                                               stride = this.valueSize,
+                                               offset = index * stride;
+
+                       for (let i = 0; i !== stride; ++i) {
+                               result[i] = values[offset + i];
+                       }
+
+                       return result;
+               } // Template methods for derived classes:
+
+
+               interpolate_() {
+                       throw new Error('call to abstract method'); // implementations shall return this.resultBuffer
+               }
+
+               intervalChanged_() {// empty
+               }
+
+       } // ALIAS DEFINITIONS
+
+
+       Interpolant.prototype.beforeStart_ = Interpolant.prototype.copySampleValue_;
+       Interpolant.prototype.afterEnd_ = Interpolant.prototype.copySampleValue_;
+
+       /**
+        * Fast and simple cubic spline interpolant.
+        *
+        * It was derived from a Hermitian construction setting the first derivative
+        * at each sample position to the linear slope between neighboring positions
+        * over their parameter interval.
+        */
+
+       class CubicInterpolant extends Interpolant {
+               constructor(parameterPositions, sampleValues, sampleSize, resultBuffer) {
+                       super(parameterPositions, sampleValues, sampleSize, resultBuffer);
+                       this._weightPrev = -0;
+                       this._offsetPrev = -0;
+                       this._weightNext = -0;
+                       this._offsetNext = -0;
+                       this.DefaultSettings_ = {
+                               endingStart: ZeroCurvatureEnding,
+                               endingEnd: ZeroCurvatureEnding
+                       };
+               }
+
+               intervalChanged_(i1, t0, t1) {
+                       const pp = this.parameterPositions;
+                       let iPrev = i1 - 2,
+                                       iNext = i1 + 1,
+                                       tPrev = pp[iPrev],
+                                       tNext = pp[iNext];
+
+                       if (tPrev === undefined) {
+                               switch (this.getSettings_().endingStart) {
+                                       case ZeroSlopeEnding:
+                                               // f'(t0) = 0
+                                               iPrev = i1;
+                                               tPrev = 2 * t0 - t1;
+                                               break;
+
+                                       case WrapAroundEnding:
+                                               // use the other end of the curve
+                                               iPrev = pp.length - 2;
+                                               tPrev = t0 + pp[iPrev] - pp[iPrev + 1];
+                                               break;
+
+                                       default:
+                                               // ZeroCurvatureEnding
+                                               // f''(t0) = 0 a.k.a. Natural Spline
+                                               iPrev = i1;
+                                               tPrev = t1;
+                               }
+                       }
+
+                       if (tNext === undefined) {
+                               switch (this.getSettings_().endingEnd) {
+                                       case ZeroSlopeEnding:
+                                               // f'(tN) = 0
+                                               iNext = i1;
+                                               tNext = 2 * t1 - t0;
+                                               break;
+
+                                       case WrapAroundEnding:
+                                               // use the other end of the curve
+                                               iNext = 1;
+                                               tNext = t1 + pp[1] - pp[0];
+                                               break;
+
+                                       default:
+                                               // ZeroCurvatureEnding
+                                               // f''(tN) = 0, a.k.a. Natural Spline
+                                               iNext = i1 - 1;
+                                               tNext = t0;
+                               }
+                       }
+
+                       const halfDt = (t1 - t0) * 0.5,
+                                               stride = this.valueSize;
+                       this._weightPrev = halfDt / (t0 - tPrev);
+                       this._weightNext = halfDt / (tNext - t1);
+                       this._offsetPrev = iPrev * stride;
+                       this._offsetNext = iNext * stride;
+               }
+
+               interpolate_(i1, t0, t, t1) {
+                       const result = this.resultBuffer,
+                                               values = this.sampleValues,
+                                               stride = this.valueSize,
+                                               o1 = i1 * stride,
+                                               o0 = o1 - stride,
+                                               oP = this._offsetPrev,
+                                               oN = this._offsetNext,
+                                               wP = this._weightPrev,
+                                               wN = this._weightNext,
+                                               p = (t - t0) / (t1 - t0),
+                                               pp = p * p,
+                                               ppp = pp * p; // evaluate polynomials
+
+                       const sP = -wP * ppp + 2 * wP * pp - wP * p;
+                       const s0 = (1 + wP) * ppp + (-1.5 - 2 * wP) * pp + (-0.5 + wP) * p + 1;
+                       const s1 = (-1 - wN) * ppp + (1.5 + wN) * pp + 0.5 * p;
+                       const sN = wN * ppp - wN * pp; // combine data linearly
+
+                       for (let i = 0; i !== stride; ++i) {
+                               result[i] = sP * values[oP + i] + s0 * values[o0 + i] + s1 * values[o1 + i] + sN * values[oN + i];
+                       }
+
+                       return result;
+               }
+
+       }
+
+       class LinearInterpolant extends Interpolant {
+               constructor(parameterPositions, sampleValues, sampleSize, resultBuffer) {
+                       super(parameterPositions, sampleValues, sampleSize, resultBuffer);
+               }
+
+               interpolate_(i1, t0, t, t1) {
+                       const result = this.resultBuffer,
+                                               values = this.sampleValues,
+                                               stride = this.valueSize,
+                                               offset1 = i1 * stride,
+                                               offset0 = offset1 - stride,
+                                               weight1 = (t - t0) / (t1 - t0),
+                                               weight0 = 1 - weight1;
+
+                       for (let i = 0; i !== stride; ++i) {
+                               result[i] = values[offset0 + i] * weight0 + values[offset1 + i] * weight1;
+                       }
+
+                       return result;
+               }
+
+       }
+
+       /**
+        *
+        * Interpolant that evaluates to the sample value at the position preceeding
+        * the parameter.
+        */
+
+       class DiscreteInterpolant extends Interpolant {
+               constructor(parameterPositions, sampleValues, sampleSize, resultBuffer) {
+                       super(parameterPositions, sampleValues, sampleSize, resultBuffer);
+               }
+
+               interpolate_(i1
+               /*, t0, t, t1 */
+               ) {
+                       return this.copySampleValue_(i1 - 1);
+               }
+
+       }
+
+       class KeyframeTrack {
+               constructor(name, times, values, interpolation) {
+                       if (name === undefined) throw new Error('THREE.KeyframeTrack: track name is undefined');
+                       if (times === undefined || times.length === 0) throw new Error('THREE.KeyframeTrack: no keyframes in track named ' + name);
+                       this.name = name;
+                       this.times = AnimationUtils.convertArray(times, this.TimeBufferType);
+                       this.values = AnimationUtils.convertArray(values, this.ValueBufferType);
+                       this.setInterpolation(interpolation || this.DefaultInterpolation);
+               } // Serialization (in static context, because of constructor invocation
+               // and automatic invocation of .toJSON):
+
+
+               static toJSON(track) {
+                       const trackType = track.constructor;
+                       let json; // derived classes can define a static toJSON method
+
+                       if (trackType.toJSON !== this.toJSON) {
+                               json = trackType.toJSON(track);
+                       } else {
+                               // by default, we assume the data can be serialized as-is
+                               json = {
+                                       'name': track.name,
+                                       'times': AnimationUtils.convertArray(track.times, Array),
+                                       'values': AnimationUtils.convertArray(track.values, Array)
+                               };
+                               const interpolation = track.getInterpolation();
+
+                               if (interpolation !== track.DefaultInterpolation) {
+                                       json.interpolation = interpolation;
+                               }
+                       }
+
+                       json.type = track.ValueTypeName; // mandatory
+
+                       return json;
+               }
+
+               InterpolantFactoryMethodDiscrete(result) {
+                       return new DiscreteInterpolant(this.times, this.values, this.getValueSize(), result);
+               }
+
+               InterpolantFactoryMethodLinear(result) {
+                       return new LinearInterpolant(this.times, this.values, this.getValueSize(), result);
+               }
+
+               InterpolantFactoryMethodSmooth(result) {
+                       return new CubicInterpolant(this.times, this.values, this.getValueSize(), result);
+               }
+
+               setInterpolation(interpolation) {
+                       let factoryMethod;
+
+                       switch (interpolation) {
+                               case InterpolateDiscrete:
+                                       factoryMethod = this.InterpolantFactoryMethodDiscrete;
+                                       break;
+
+                               case InterpolateLinear:
+                                       factoryMethod = this.InterpolantFactoryMethodLinear;
+                                       break;
+
+                               case InterpolateSmooth:
+                                       factoryMethod = this.InterpolantFactoryMethodSmooth;
+                                       break;
+                       }
+
+                       if (factoryMethod === undefined) {
+                               const message = 'unsupported interpolation for ' + this.ValueTypeName + ' keyframe track named ' + this.name;
+
+                               if (this.createInterpolant === undefined) {
+                                       // fall back to default, unless the default itself is messed up
+                                       if (interpolation !== this.DefaultInterpolation) {
+                                               this.setInterpolation(this.DefaultInterpolation);
+                                       } else {
+                                               throw new Error(message); // fatal, in this case
+                                       }
+                               }
+
+                               console.warn('THREE.KeyframeTrack:', message);
+                               return this;
+                       }
+
+                       this.createInterpolant = factoryMethod;
+                       return this;
+               }
+
+               getInterpolation() {
+                       switch (this.createInterpolant) {
+                               case this.InterpolantFactoryMethodDiscrete:
+                                       return InterpolateDiscrete;
+
+                               case this.InterpolantFactoryMethodLinear:
+                                       return InterpolateLinear;
+
+                               case this.InterpolantFactoryMethodSmooth:
+                                       return InterpolateSmooth;
+                       }
+               }
+
+               getValueSize() {
+                       return this.values.length / this.times.length;
+               } // move all keyframes either forwards or backwards in time
+
+
+               shift(timeOffset) {
+                       if (timeOffset !== 0.0) {
+                               const times = this.times;
+
+                               for (let i = 0, n = times.length; i !== n; ++i) {
+                                       times[i] += timeOffset;
+                               }
+                       }
+
+                       return this;
+               } // scale all keyframe times by a factor (useful for frame <-> seconds conversions)
+
+
+               scale(timeScale) {
+                       if (timeScale !== 1.0) {
+                               const times = this.times;
+
+                               for (let i = 0, n = times.length; i !== n; ++i) {
+                                       times[i] *= timeScale;
+                               }
+                       }
+
+                       return this;
+               } // removes keyframes before and after animation without changing any values within the range [startTime, endTime].
+               // IMPORTANT: We do not shift around keys to the start of the track time, because for interpolated keys this will change their values
+
+
+               trim(startTime, endTime) {
+                       const times = this.times,
+                                               nKeys = times.length;
+                       let from = 0,
+                                       to = nKeys - 1;
+
+                       while (from !== nKeys && times[from] < startTime) {
+                               ++from;
+                       }
+
+                       while (to !== -1 && times[to] > endTime) {
+                               --to;
+                       }
+
+                       ++to; // inclusive -> exclusive bound
+
+                       if (from !== 0 || to !== nKeys) {
+                               // empty tracks are forbidden, so keep at least one keyframe
+                               if (from >= to) {
+                                       to = Math.max(to, 1);
+                                       from = to - 1;
+                               }
+
+                               const stride = this.getValueSize();
+                               this.times = AnimationUtils.arraySlice(times, from, to);
+                               this.values = AnimationUtils.arraySlice(this.values, from * stride, to * stride);
+                       }
+
+                       return this;
+               } // ensure we do not get a GarbageInGarbageOut situation, make sure tracks are at least minimally viable
+
+
+               validate() {
+                       let valid = true;
+                       const valueSize = this.getValueSize();
+
+                       if (valueSize - Math.floor(valueSize) !== 0) {
+                               console.error('THREE.KeyframeTrack: Invalid value size in track.', this);
+                               valid = false;
+                       }
+
+                       const times = this.times,
+                                               values = this.values,
+                                               nKeys = times.length;
+
+                       if (nKeys === 0) {
+                               console.error('THREE.KeyframeTrack: Track is empty.', this);
+                               valid = false;
+                       }
+
+                       let prevTime = null;
+
+                       for (let i = 0; i !== nKeys; i++) {
+                               const currTime = times[i];
+
+                               if (typeof currTime === 'number' && isNaN(currTime)) {
+                                       console.error('THREE.KeyframeTrack: Time is not a valid number.', this, i, currTime);
+                                       valid = false;
+                                       break;
+                               }
+
+                               if (prevTime !== null && prevTime > currTime) {
+                                       console.error('THREE.KeyframeTrack: Out of order keys.', this, i, currTime, prevTime);
+                                       valid = false;
+                                       break;
+                               }
+
+                               prevTime = currTime;
+                       }
+
+                       if (values !== undefined) {
+                               if (AnimationUtils.isTypedArray(values)) {
+                                       for (let i = 0, n = values.length; i !== n; ++i) {
+                                               const value = values[i];
+
+                                               if (isNaN(value)) {
+                                                       console.error('THREE.KeyframeTrack: Value is not a valid number.', this, i, value);
+                                                       valid = false;
+                                                       break;
+                                               }
+                                       }
+                               }
+                       }
+
+                       return valid;
+               } // removes equivalent sequential keys as common in morph target sequences
+               // (0,0,0,0,1,1,1,0,0,0,0,0,0,0) --> (0,0,1,1,0,0)
+
+
+               optimize() {
+                       // times or values may be shared with other tracks, so overwriting is unsafe
+                       const times = AnimationUtils.arraySlice(this.times),
+                                               values = AnimationUtils.arraySlice(this.values),
+                                               stride = this.getValueSize(),
+                                               smoothInterpolation = this.getInterpolation() === InterpolateSmooth,
+                                               lastIndex = times.length - 1;
+                       let writeIndex = 1;
+
+                       for (let i = 1; i < lastIndex; ++i) {
+                               let keep = false;
+                               const time = times[i];
+                               const timeNext = times[i + 1]; // remove adjacent keyframes scheduled at the same time
+
+                               if (time !== timeNext && (i !== 1 || time !== times[0])) {
+                                       if (!smoothInterpolation) {
+                                               // remove unnecessary keyframes same as their neighbors
+                                               const offset = i * stride,
+                                                                       offsetP = offset - stride,
+                                                                       offsetN = offset + stride;
+
+                                               for (let j = 0; j !== stride; ++j) {
+                                                       const value = values[offset + j];
+
+                                                       if (value !== values[offsetP + j] || value !== values[offsetN + j]) {
+                                                               keep = true;
+                                                               break;
+                                                       }
+                                               }
+                                       } else {
+                                               keep = true;
+                                       }
+                               } // in-place compaction
+
+
+                               if (keep) {
+                                       if (i !== writeIndex) {
+                                               times[writeIndex] = times[i];
+                                               const readOffset = i * stride,
+                                                                       writeOffset = writeIndex * stride;
+
+                                               for (let j = 0; j !== stride; ++j) {
+                                                       values[writeOffset + j] = values[readOffset + j];
+                                               }
+                                       }
+
+                                       ++writeIndex;
+                               }
+                       } // flush last keyframe (compaction looks ahead)
+
+
+                       if (lastIndex > 0) {
+                               times[writeIndex] = times[lastIndex];
+
+                               for (let readOffset = lastIndex * stride, writeOffset = writeIndex * stride, j = 0; j !== stride; ++j) {
+                                       values[writeOffset + j] = values[readOffset + j];
+                               }
+
+                               ++writeIndex;
+                       }
+
+                       if (writeIndex !== times.length) {
+                               this.times = AnimationUtils.arraySlice(times, 0, writeIndex);
+                               this.values = AnimationUtils.arraySlice(values, 0, writeIndex * stride);
+                       } else {
+                               this.times = times;
+                               this.values = values;
+                       }
+
+                       return this;
+               }
+
+               clone() {
+                       const times = AnimationUtils.arraySlice(this.times, 0);
+                       const values = AnimationUtils.arraySlice(this.values, 0);
+                       const TypedKeyframeTrack = this.constructor;
+                       const track = new TypedKeyframeTrack(this.name, times, values); // Interpolant argument to constructor is not saved, so copy the factory method directly.
+
+                       track.createInterpolant = this.createInterpolant;
+                       return track;
+               }
+
+       }
+
+       KeyframeTrack.prototype.TimeBufferType = Float32Array;
+       KeyframeTrack.prototype.ValueBufferType = Float32Array;
+       KeyframeTrack.prototype.DefaultInterpolation = InterpolateLinear;
+
+       /**
+        * A Track of Boolean keyframe values.
+        */
+
+       class BooleanKeyframeTrack extends KeyframeTrack {}
+
+       BooleanKeyframeTrack.prototype.ValueTypeName = 'bool';
+       BooleanKeyframeTrack.prototype.ValueBufferType = Array;
+       BooleanKeyframeTrack.prototype.DefaultInterpolation = InterpolateDiscrete;
+       BooleanKeyframeTrack.prototype.InterpolantFactoryMethodLinear = undefined;
+       BooleanKeyframeTrack.prototype.InterpolantFactoryMethodSmooth = undefined; // Note: Actually this track could have a optimized / compressed
+
+       /**
+        * A Track of keyframe values that represent color.
+        */
+
+       class ColorKeyframeTrack extends KeyframeTrack {}
+
+       ColorKeyframeTrack.prototype.ValueTypeName = 'color'; // ValueBufferType is inherited
+
+       /**
+        * A Track of numeric keyframe values.
+        */
+
+       class NumberKeyframeTrack extends KeyframeTrack {}
+
+       NumberKeyframeTrack.prototype.ValueTypeName = 'number'; // ValueBufferType is inherited
+
+       /**
+        * Spherical linear unit quaternion interpolant.
+        */
+
+       class QuaternionLinearInterpolant extends Interpolant {
+               constructor(parameterPositions, sampleValues, sampleSize, resultBuffer) {
+                       super(parameterPositions, sampleValues, sampleSize, resultBuffer);
+               }
+
+               interpolate_(i1, t0, t, t1) {
+                       const result = this.resultBuffer,
+                                               values = this.sampleValues,
+                                               stride = this.valueSize,
+                                               alpha = (t - t0) / (t1 - t0);
+                       let offset = i1 * stride;
+
+                       for (let end = offset + stride; offset !== end; offset += 4) {
+                               Quaternion.slerpFlat(result, 0, values, offset - stride, values, offset, alpha);
+                       }
+
+                       return result;
+               }
+
+       }
+
+       /**
+        * A Track of quaternion keyframe values.
+        */
+
+       class QuaternionKeyframeTrack extends KeyframeTrack {
+               InterpolantFactoryMethodLinear(result) {
+                       return new QuaternionLinearInterpolant(this.times, this.values, this.getValueSize(), result);
+               }
+
+       }
+
+       QuaternionKeyframeTrack.prototype.ValueTypeName = 'quaternion'; // ValueBufferType is inherited
+
+       QuaternionKeyframeTrack.prototype.DefaultInterpolation = InterpolateLinear;
+       QuaternionKeyframeTrack.prototype.InterpolantFactoryMethodSmooth = undefined;
+
+       /**
+        * A Track that interpolates Strings
+        */
+
+       class StringKeyframeTrack extends KeyframeTrack {}
+
+       StringKeyframeTrack.prototype.ValueTypeName = 'string';
+       StringKeyframeTrack.prototype.ValueBufferType = Array;
+       StringKeyframeTrack.prototype.DefaultInterpolation = InterpolateDiscrete;
+       StringKeyframeTrack.prototype.InterpolantFactoryMethodLinear = undefined;
+       StringKeyframeTrack.prototype.InterpolantFactoryMethodSmooth = undefined;
+
+       /**
+        * A Track of vectored keyframe values.
+        */
+
+       class VectorKeyframeTrack extends KeyframeTrack {}
+
+       VectorKeyframeTrack.prototype.ValueTypeName = 'vector'; // ValueBufferType is inherited
+
+       class AnimationClip {
+               constructor(name, duration = -1, tracks, blendMode = NormalAnimationBlendMode) {
+                       this.name = name;
+                       this.tracks = tracks;
+                       this.duration = duration;
+                       this.blendMode = blendMode;
+                       this.uuid = generateUUID(); // this means it should figure out its duration by scanning the tracks
+
+                       if (this.duration < 0) {
+                               this.resetDuration();
+                       }
+               }
+
+               static parse(json) {
+                       const tracks = [],
+                                               jsonTracks = json.tracks,
+                                               frameTime = 1.0 / (json.fps || 1.0);
+
+                       for (let i = 0, n = jsonTracks.length; i !== n; ++i) {
+                               tracks.push(parseKeyframeTrack(jsonTracks[i]).scale(frameTime));
+                       }
+
+                       const clip = new this(json.name, json.duration, tracks, json.blendMode);
+                       clip.uuid = json.uuid;
+                       return clip;
+               }
+
+               static toJSON(clip) {
+                       const tracks = [],
+                                               clipTracks = clip.tracks;
+                       const json = {
+                               'name': clip.name,
+                               'duration': clip.duration,
+                               'tracks': tracks,
+                               'uuid': clip.uuid,
+                               'blendMode': clip.blendMode
+                       };
+
+                       for (let i = 0, n = clipTracks.length; i !== n; ++i) {
+                               tracks.push(KeyframeTrack.toJSON(clipTracks[i]));
+                       }
+
+                       return json;
+               }
+
+               static CreateFromMorphTargetSequence(name, morphTargetSequence, fps, noLoop) {
+                       const numMorphTargets = morphTargetSequence.length;
+                       const tracks = [];
+
+                       for (let i = 0; i < numMorphTargets; i++) {
+                               let times = [];
+                               let values = [];
+                               times.push((i + numMorphTargets - 1) % numMorphTargets, i, (i + 1) % numMorphTargets);
+                               values.push(0, 1, 0);
+                               const order = AnimationUtils.getKeyframeOrder(times);
+                               times = AnimationUtils.sortedArray(times, 1, order);
+                               values = AnimationUtils.sortedArray(values, 1, order); // if there is a key at the first frame, duplicate it as the
+                               // last frame as well for perfect loop.
+
+                               if (!noLoop && times[0] === 0) {
+                                       times.push(numMorphTargets);
+                                       values.push(values[0]);
+                               }
+
+                               tracks.push(new NumberKeyframeTrack('.morphTargetInfluences[' + morphTargetSequence[i].name + ']', times, values).scale(1.0 / fps));
+                       }
+
+                       return new this(name, -1, tracks);
+               }
+
+               static findByName(objectOrClipArray, name) {
+                       let clipArray = objectOrClipArray;
+
+                       if (!Array.isArray(objectOrClipArray)) {
+                               const o = objectOrClipArray;
+                               clipArray = o.geometry && o.geometry.animations || o.animations;
+                       }
+
+                       for (let i = 0; i < clipArray.length; i++) {
+                               if (clipArray[i].name === name) {
+                                       return clipArray[i];
+                               }
+                       }
+
+                       return null;
+               }
+
+               static CreateClipsFromMorphTargetSequences(morphTargets, fps, noLoop) {
+                       const animationToMorphTargets = {}; // tested with https://regex101.com/ on trick sequences
+                       // such flamingo_flyA_003, flamingo_run1_003, crdeath0059
+
+                       const pattern = /^([\w-]*?)([\d]+)$/; // sort morph target names into animation groups based
+                       // patterns like Walk_001, Walk_002, Run_001, Run_002
+
+                       for (let i = 0, il = morphTargets.length; i < il; i++) {
+                               const morphTarget = morphTargets[i];
+                               const parts = morphTarget.name.match(pattern);
+
+                               if (parts && parts.length > 1) {
+                                       const name = parts[1];
+                                       let animationMorphTargets = animationToMorphTargets[name];
+
+                                       if (!animationMorphTargets) {
+                                               animationToMorphTargets[name] = animationMorphTargets = [];
+                                       }
+
+                                       animationMorphTargets.push(morphTarget);
+                               }
+                       }
+
+                       const clips = [];
+
+                       for (const name in animationToMorphTargets) {
+                               clips.push(this.CreateFromMorphTargetSequence(name, animationToMorphTargets[name], fps, noLoop));
+                       }
+
+                       return clips;
+               } // parse the animation.hierarchy format
+
+
+               static parseAnimation(animation, bones) {
+                       if (!animation) {
+                               console.error('THREE.AnimationClip: No animation in JSONLoader data.');
+                               return null;
+                       }
+
+                       const addNonemptyTrack = function (trackType, trackName, animationKeys, propertyName, destTracks) {
+                               // only return track if there are actually keys.
+                               if (animationKeys.length !== 0) {
+                                       const times = [];
+                                       const values = [];
+                                       AnimationUtils.flattenJSON(animationKeys, times, values, propertyName); // empty keys are filtered out, so check again
+
+                                       if (times.length !== 0) {
+                                               destTracks.push(new trackType(trackName, times, values));
+                                       }
+                               }
+                       };
+
+                       const tracks = [];
+                       const clipName = animation.name || 'default';
+                       const fps = animation.fps || 30;
+                       const blendMode = animation.blendMode; // automatic length determination in AnimationClip.
+
+                       let duration = animation.length || -1;
+                       const hierarchyTracks = animation.hierarchy || [];
+
+                       for (let h = 0; h < hierarchyTracks.length; h++) {
+                               const animationKeys = hierarchyTracks[h].keys; // skip empty tracks
+
+                               if (!animationKeys || animationKeys.length === 0) continue; // process morph targets
+
+                               if (animationKeys[0].morphTargets) {
+                                       // figure out all morph targets used in this track
+                                       const morphTargetNames = {};
+                                       let k;
+
+                                       for (k = 0; k < animationKeys.length; k++) {
+                                               if (animationKeys[k].morphTargets) {
+                                                       for (let m = 0; m < animationKeys[k].morphTargets.length; m++) {
+                                                               morphTargetNames[animationKeys[k].morphTargets[m]] = -1;
+                                                       }
+                                               }
+                                       } // create a track for each morph target with all zero
+                                       // morphTargetInfluences except for the keys in which
+                                       // the morphTarget is named.
+
+
+                                       for (const morphTargetName in morphTargetNames) {
+                                               const times = [];
+                                               const values = [];
+
+                                               for (let m = 0; m !== animationKeys[k].morphTargets.length; ++m) {
+                                                       const animationKey = animationKeys[k];
+                                                       times.push(animationKey.time);
+                                                       values.push(animationKey.morphTarget === morphTargetName ? 1 : 0);
+                                               }
+
+                                               tracks.push(new NumberKeyframeTrack('.morphTargetInfluence[' + morphTargetName + ']', times, values));
+                                       }
+
+                                       duration = morphTargetNames.length * (fps || 1.0);
+                               } else {
+                                       // ...assume skeletal animation
+                                       const boneName = '.bones[' + bones[h].name + ']';
+                                       addNonemptyTrack(VectorKeyframeTrack, boneName + '.position', animationKeys, 'pos', tracks);
+                                       addNonemptyTrack(QuaternionKeyframeTrack, boneName + '.quaternion', animationKeys, 'rot', tracks);
+                                       addNonemptyTrack(VectorKeyframeTrack, boneName + '.scale', animationKeys, 'scl', tracks);
+                               }
+                       }
+
+                       if (tracks.length === 0) {
+                               return null;
+                       }
+
+                       const clip = new this(clipName, duration, tracks, blendMode);
+                       return clip;
+               }
+
+               resetDuration() {
+                       const tracks = this.tracks;
+                       let duration = 0;
+
+                       for (let i = 0, n = tracks.length; i !== n; ++i) {
+                               const track = this.tracks[i];
+                               duration = Math.max(duration, track.times[track.times.length - 1]);
+                       }
+
+                       this.duration = duration;
+                       return this;
+               }
+
+               trim() {
+                       for (let i = 0; i < this.tracks.length; i++) {
+                               this.tracks[i].trim(0, this.duration);
+                       }
+
+                       return this;
+               }
+
+               validate() {
+                       let valid = true;
+
+                       for (let i = 0; i < this.tracks.length; i++) {
+                               valid = valid && this.tracks[i].validate();
+                       }
+
+                       return valid;
+               }
+
+               optimize() {
+                       for (let i = 0; i < this.tracks.length; i++) {
+                               this.tracks[i].optimize();
+                       }
+
+                       return this;
+               }
+
+               clone() {
+                       const tracks = [];
+
+                       for (let i = 0; i < this.tracks.length; i++) {
+                               tracks.push(this.tracks[i].clone());
+                       }
+
+                       return new this.constructor(this.name, this.duration, tracks, this.blendMode);
+               }
+
+               toJSON() {
+                       return this.constructor.toJSON(this);
+               }
+
+       }
+
+       function getTrackTypeForValueTypeName(typeName) {
+               switch (typeName.toLowerCase()) {
+                       case 'scalar':
+                       case 'double':
+                       case 'float':
+                       case 'number':
+                       case 'integer':
+                               return NumberKeyframeTrack;
+
+                       case 'vector':
+                       case 'vector2':
+                       case 'vector3':
+                       case 'vector4':
+                               return VectorKeyframeTrack;
+
+                       case 'color':
+                               return ColorKeyframeTrack;
+
+                       case 'quaternion':
+                               return QuaternionKeyframeTrack;
+
+                       case 'bool':
+                       case 'boolean':
+                               return BooleanKeyframeTrack;
+
+                       case 'string':
+                               return StringKeyframeTrack;
+               }
+
+               throw new Error('THREE.KeyframeTrack: Unsupported typeName: ' + typeName);
+       }
+
+       function parseKeyframeTrack(json) {
+               if (json.type === undefined) {
+                       throw new Error('THREE.KeyframeTrack: track type undefined, can not parse');
+               }
+
+               const trackType = getTrackTypeForValueTypeName(json.type);
+
+               if (json.times === undefined) {
+                       const times = [],
+                                               values = [];
+                       AnimationUtils.flattenJSON(json.keys, times, values, 'value');
+                       json.times = times;
+                       json.values = values;
+               } // derived classes can define a static parse method
+
+
+               if (trackType.parse !== undefined) {
+                       return trackType.parse(json);
+               } else {
+                       // by default, we assume a constructor compatible with the base
+                       return new trackType(json.name, json.times, json.values, json.interpolation);
+               }
+       }
+
+       const Cache = {
+               enabled: false,
+               files: {},
+               add: function (key, file) {
+                       if (this.enabled === false) return; // console.log( 'THREE.Cache', 'Adding key:', key );
+
+                       this.files[key] = file;
+               },
+               get: function (key) {
+                       if (this.enabled === false) return; // console.log( 'THREE.Cache', 'Checking key:', key );
+
+                       return this.files[key];
+               },
+               remove: function (key) {
+                       delete this.files[key];
+               },
+               clear: function () {
+                       this.files = {};
+               }
+       };
+
+       class LoadingManager {
+               constructor(onLoad, onProgress, onError) {
+                       const scope = this;
+                       let isLoading = false;
+                       let itemsLoaded = 0;
+                       let itemsTotal = 0;
+                       let urlModifier = undefined;
+                       const handlers = []; // Refer to #5689 for the reason why we don't set .onStart
+                       // in the constructor
+
+                       this.onStart = undefined;
+                       this.onLoad = onLoad;
+                       this.onProgress = onProgress;
+                       this.onError = onError;
+
+                       this.itemStart = function (url) {
+                               itemsTotal++;
+
+                               if (isLoading === false) {
+                                       if (scope.onStart !== undefined) {
+                                               scope.onStart(url, itemsLoaded, itemsTotal);
+                                       }
+                               }
+
+                               isLoading = true;
+                       };
+
+                       this.itemEnd = function (url) {
+                               itemsLoaded++;
+
+                               if (scope.onProgress !== undefined) {
+                                       scope.onProgress(url, itemsLoaded, itemsTotal);
+                               }
+
+                               if (itemsLoaded === itemsTotal) {
+                                       isLoading = false;
+
+                                       if (scope.onLoad !== undefined) {
+                                               scope.onLoad();
+                                       }
+                               }
+                       };
+
+                       this.itemError = function (url) {
+                               if (scope.onError !== undefined) {
+                                       scope.onError(url);
+                               }
+                       };
+
+                       this.resolveURL = function (url) {
+                               if (urlModifier) {
+                                       return urlModifier(url);
+                               }
+
+                               return url;
+                       };
+
+                       this.setURLModifier = function (transform) {
+                               urlModifier = transform;
+                               return this;
+                       };
+
+                       this.addHandler = function (regex, loader) {
+                               handlers.push(regex, loader);
+                               return this;
+                       };
+
+                       this.removeHandler = function (regex) {
+                               const index = handlers.indexOf(regex);
+
+                               if (index !== -1) {
+                                       handlers.splice(index, 2);
+                               }
+
+                               return this;
+                       };
+
+                       this.getHandler = function (file) {
+                               for (let i = 0, l = handlers.length; i < l; i += 2) {
+                                       const regex = handlers[i];
+                                       const loader = handlers[i + 1];
+                                       if (regex.global) regex.lastIndex = 0; // see #17920
+
+                                       if (regex.test(file)) {
+                                               return loader;
+                                       }
+                               }
+
+                               return null;
+                       };
+               }
+
+       }
+
+       const DefaultLoadingManager = new LoadingManager();
+
+       class Loader {
+               constructor(manager) {
+                       this.manager = manager !== undefined ? manager : DefaultLoadingManager;
+                       this.crossOrigin = 'anonymous';
+                       this.withCredentials = false;
+                       this.path = '';
+                       this.resourcePath = '';
+                       this.requestHeader = {};
+               }
+
+               load() {}
+
+               loadAsync(url, onProgress) {
+                       const scope = this;
+                       return new Promise(function (resolve, reject) {
+                               scope.load(url, resolve, onProgress, reject);
+                       });
+               }
+
+               parse() {}
+
+               setCrossOrigin(crossOrigin) {
+                       this.crossOrigin = crossOrigin;
+                       return this;
+               }
+
+               setWithCredentials(value) {
+                       this.withCredentials = value;
+                       return this;
+               }
+
+               setPath(path) {
+                       this.path = path;
+                       return this;
+               }
+
+               setResourcePath(resourcePath) {
+                       this.resourcePath = resourcePath;
+                       return this;
+               }
+
+               setRequestHeader(requestHeader) {
+                       this.requestHeader = requestHeader;
+                       return this;
+               }
+
+       }
+
+       const loading = {};
+
+       class FileLoader extends Loader {
+               constructor(manager) {
+                       super(manager);
+               }
+
+               load(url, onLoad, onProgress, onError) {
+                       if (url === undefined) url = '';
+                       if (this.path !== undefined) url = this.path + url;
+                       url = this.manager.resolveURL(url);
+                       const scope = this;
+                       const cached = Cache.get(url);
+
+                       if (cached !== undefined) {
+                               scope.manager.itemStart(url);
+                               setTimeout(function () {
+                                       if (onLoad) onLoad(cached);
+                                       scope.manager.itemEnd(url);
+                               }, 0);
+                               return cached;
+                       } // Check if request is duplicate
+
+
+                       if (loading[url] !== undefined) {
+                               loading[url].push({
+                                       onLoad: onLoad,
+                                       onProgress: onProgress,
+                                       onError: onError
+                               });
+                               return;
+                       } // Check for data: URI
+
+
+                       const dataUriRegex = /^data:(.*?)(;base64)?,(.*)$/;
+                       const dataUriRegexResult = url.match(dataUriRegex);
+                       let request; // Safari can not handle Data URIs through XMLHttpRequest so process manually
+
+                       if (dataUriRegexResult) {
+                               const mimeType = dataUriRegexResult[1];
+                               const isBase64 = !!dataUriRegexResult[2];
+                               let data = dataUriRegexResult[3];
+                               data = decodeURIComponent(data);
+                               if (isBase64) data = atob(data);
+
+                               try {
+                                       let response;
+                                       const responseType = (this.responseType || '').toLowerCase();
+
+                                       switch (responseType) {
+                                               case 'arraybuffer':
+                                               case 'blob':
+                                                       const view = new Uint8Array(data.length);
+
+                                                       for (let i = 0; i < data.length; i++) {
+                                                               view[i] = data.charCodeAt(i);
+                                                       }
+
+                                                       if (responseType === 'blob') {
+                                                               response = new Blob([view.buffer], {
+                                                                       type: mimeType
+                                                               });
+                                                       } else {
+                                                               response = view.buffer;
+                                                       }
+
+                                                       break;
+
+                                               case 'document':
+                                                       const parser = new DOMParser();
+                                                       response = parser.parseFromString(data, mimeType);
+                                                       break;
+
+                                               case 'json':
+                                                       response = JSON.parse(data);
+                                                       break;
+
+                                               default:
+                                                       // 'text' or other
+                                                       response = data;
+                                                       break;
+                                       } // Wait for next browser tick like standard XMLHttpRequest event dispatching does
+
+
+                                       setTimeout(function () {
+                                               if (onLoad) onLoad(response);
+                                               scope.manager.itemEnd(url);
+                                       }, 0);
+                               } catch (error) {
+                                       // Wait for next browser tick like standard XMLHttpRequest event dispatching does
+                                       setTimeout(function () {
+                                               if (onError) onError(error);
+                                               scope.manager.itemError(url);
+                                               scope.manager.itemEnd(url);
+                                       }, 0);
+                               }
+                       } else {
+                               // Initialise array for duplicate requests
+                               loading[url] = [];
+                               loading[url].push({
+                                       onLoad: onLoad,
+                                       onProgress: onProgress,
+                                       onError: onError
+                               });
+                               request = new XMLHttpRequest();
+                               request.open('GET', url, true);
+                               request.addEventListener('load', function (event) {
+                                       const response = this.response;
+                                       const callbacks = loading[url];
+                                       delete loading[url];
+
+                                       if (this.status === 200 || this.status === 0) {
+                                               // Some browsers return HTTP Status 0 when using non-http protocol
+                                               // e.g. 'file://' or 'data://'. Handle as success.
+                                               if (this.status === 0) console.warn('THREE.FileLoader: HTTP Status 0 received.'); // Add to cache only on HTTP success, so that we do not cache
+                                               // error response bodies as proper responses to requests.
+
+                                               Cache.add(url, response);
+
+                                               for (let i = 0, il = callbacks.length; i < il; i++) {
+                                                       const callback = callbacks[i];
+                                                       if (callback.onLoad) callback.onLoad(response);
+                                               }
+
+                                               scope.manager.itemEnd(url);
+                                       } else {
+                                               for (let i = 0, il = callbacks.length; i < il; i++) {
+                                                       const callback = callbacks[i];
+                                                       if (callback.onError) callback.onError(event);
+                                               }
+
+                                               scope.manager.itemError(url);
+                                               scope.manager.itemEnd(url);
+                                       }
+                               }, false);
+                               request.addEventListener('progress', function (event) {
+                                       const callbacks = loading[url];
+
+                                       for (let i = 0, il = callbacks.length; i < il; i++) {
+                                               const callback = callbacks[i];
+                                               if (callback.onProgress) callback.onProgress(event);
+                                       }
+                               }, false);
+                               request.addEventListener('error', function (event) {
+                                       const callbacks = loading[url];
+                                       delete loading[url];
+
+                                       for (let i = 0, il = callbacks.length; i < il; i++) {
+                                               const callback = callbacks[i];
+                                               if (callback.onError) callback.onError(event);
+                                       }
+
+                                       scope.manager.itemError(url);
+                                       scope.manager.itemEnd(url);
+                               }, false);
+                               request.addEventListener('abort', function (event) {
+                                       const callbacks = loading[url];
+                                       delete loading[url];
+
+                                       for (let i = 0, il = callbacks.length; i < il; i++) {
+                                               const callback = callbacks[i];
+                                               if (callback.onError) callback.onError(event);
+                                       }
+
+                                       scope.manager.itemError(url);
+                                       scope.manager.itemEnd(url);
+                               }, false);
+                               if (this.responseType !== undefined) request.responseType = this.responseType;
+                               if (this.withCredentials !== undefined) request.withCredentials = this.withCredentials;
+                               if (request.overrideMimeType) request.overrideMimeType(this.mimeType !== undefined ? this.mimeType : 'text/plain');
+
+                               for (const header in this.requestHeader) {
+                                       request.setRequestHeader(header, this.requestHeader[header]);
+                               }
+
+                               request.send(null);
+                       }
+
+                       scope.manager.itemStart(url);
+                       return request;
+               }
+
+               setResponseType(value) {
+                       this.responseType = value;
+                       return this;
+               }
+
+               setMimeType(value) {
+                       this.mimeType = value;
+                       return this;
+               }
+
+       }
+
+       class AnimationLoader extends Loader {
+               constructor(manager) {
+                       super(manager);
+               }
+
+               load(url, onLoad, onProgress, onError) {
+                       const scope = this;
+                       const loader = new FileLoader(this.manager);
+                       loader.setPath(this.path);
+                       loader.setRequestHeader(this.requestHeader);
+                       loader.setWithCredentials(this.withCredentials);
+                       loader.load(url, function (text) {
+                               try {
+                                       onLoad(scope.parse(JSON.parse(text)));
+                               } catch (e) {
+                                       if (onError) {
+                                               onError(e);
+                                       } else {
+                                               console.error(e);
+                                       }
+
+                                       scope.manager.itemError(url);
+                               }
+                       }, onProgress, onError);
+               }
+
+               parse(json) {
+                       const animations = [];
+
+                       for (let i = 0; i < json.length; i++) {
+                               const clip = AnimationClip.parse(json[i]);
+                               animations.push(clip);
+                       }
+
+                       return animations;
+               }
+
+       }
+
+       /**
+        * Abstract Base class to block based textures loader (dds, pvr, ...)
+        *
+        * Sub classes have to implement the parse() method which will be used in load().
+        */
+
+       class CompressedTextureLoader extends Loader {
+               constructor(manager) {
+                       super(manager);
+               }
+
+               load(url, onLoad, onProgress, onError) {
+                       const scope = this;
+                       const images = [];
+                       const texture = new CompressedTexture();
+                       const loader = new FileLoader(this.manager);
+                       loader.setPath(this.path);
+                       loader.setResponseType('arraybuffer');
+                       loader.setRequestHeader(this.requestHeader);
+                       loader.setWithCredentials(scope.withCredentials);
+                       let loaded = 0;
+
+                       function loadTexture(i) {
+                               loader.load(url[i], function (buffer) {
+                                       const texDatas = scope.parse(buffer, true);
+                                       images[i] = {
+                                               width: texDatas.width,
+                                               height: texDatas.height,
+                                               format: texDatas.format,
+                                               mipmaps: texDatas.mipmaps
+                                       };
+                                       loaded += 1;
+
+                                       if (loaded === 6) {
+                                               if (texDatas.mipmapCount === 1) texture.minFilter = LinearFilter;
+                                               texture.image = images;
+                                               texture.format = texDatas.format;
+                                               texture.needsUpdate = true;
+                                               if (onLoad) onLoad(texture);
+                                       }
+                               }, onProgress, onError);
+                       }
+
+                       if (Array.isArray(url)) {
+                               for (let i = 0, il = url.length; i < il; ++i) {
+                                       loadTexture(i);
+                               }
+                       } else {
+                               // compressed cubemap texture stored in a single DDS file
+                               loader.load(url, function (buffer) {
+                                       const texDatas = scope.parse(buffer, true);
+
+                                       if (texDatas.isCubemap) {
+                                               const faces = texDatas.mipmaps.length / texDatas.mipmapCount;
+
+                                               for (let f = 0; f < faces; f++) {
+                                                       images[f] = {
+                                                               mipmaps: []
+                                                       };
+
+                                                       for (let i = 0; i < texDatas.mipmapCount; i++) {
+                                                               images[f].mipmaps.push(texDatas.mipmaps[f * texDatas.mipmapCount + i]);
+                                                               images[f].format = texDatas.format;
+                                                               images[f].width = texDatas.width;
+                                                               images[f].height = texDatas.height;
+                                                       }
+                                               }
+
+                                               texture.image = images;
+                                       } else {
+                                               texture.image.width = texDatas.width;
+                                               texture.image.height = texDatas.height;
+                                               texture.mipmaps = texDatas.mipmaps;
+                                       }
+
+                                       if (texDatas.mipmapCount === 1) {
+                                               texture.minFilter = LinearFilter;
+                                       }
+
+                                       texture.format = texDatas.format;
+                                       texture.needsUpdate = true;
+                                       if (onLoad) onLoad(texture);
+                               }, onProgress, onError);
+                       }
+
+                       return texture;
+               }
+
+       }
+
+       class ImageLoader extends Loader {
+               constructor(manager) {
+                       super(manager);
+               }
+
+               load(url, onLoad, onProgress, onError) {
+                       if (this.path !== undefined) url = this.path + url;
+                       url = this.manager.resolveURL(url);
+                       const scope = this;
+                       const cached = Cache.get(url);
+
+                       if (cached !== undefined) {
+                               scope.manager.itemStart(url);
+                               setTimeout(function () {
+                                       if (onLoad) onLoad(cached);
+                                       scope.manager.itemEnd(url);
+                               }, 0);
+                               return cached;
+                       }
+
+                       const image = document.createElementNS('http://www.w3.org/1999/xhtml', 'img');
+
+                       function onImageLoad() {
+                               image.removeEventListener('load', onImageLoad, false);
+                               image.removeEventListener('error', onImageError, false);
+                               Cache.add(url, this);
+                               if (onLoad) onLoad(this);
+                               scope.manager.itemEnd(url);
+                       }
+
+                       function onImageError(event) {
+                               image.removeEventListener('load', onImageLoad, false);
+                               image.removeEventListener('error', onImageError, false);
+                               if (onError) onError(event);
+                               scope.manager.itemError(url);
+                               scope.manager.itemEnd(url);
+                       }
+
+                       image.addEventListener('load', onImageLoad, false);
+                       image.addEventListener('error', onImageError, false);
+
+                       if (url.substr(0, 5) !== 'data:') {
+                               if (this.crossOrigin !== undefined) image.crossOrigin = this.crossOrigin;
+                       }
+
+                       scope.manager.itemStart(url);
+                       image.src = url;
+                       return image;
+               }
+
+       }
+
+       class CubeTextureLoader extends Loader {
+               constructor(manager) {
+                       super(manager);
+               }
+
+               load(urls, onLoad, onProgress, onError) {
+                       const texture = new CubeTexture();
+                       const loader = new ImageLoader(this.manager);
+                       loader.setCrossOrigin(this.crossOrigin);
+                       loader.setPath(this.path);
+                       let loaded = 0;
+
+                       function loadTexture(i) {
+                               loader.load(urls[i], function (image) {
+                                       texture.images[i] = image;
+                                       loaded++;
+
+                                       if (loaded === 6) {
+                                               texture.needsUpdate = true;
+                                               if (onLoad) onLoad(texture);
+                                       }
+                               }, undefined, onError);
+                       }
+
+                       for (let i = 0; i < urls.length; ++i) {
+                               loadTexture(i);
+                       }
+
+                       return texture;
+               }
+
+       }
+
+       /**
+        * Abstract Base class to load generic binary textures formats (rgbe, hdr, ...)
+        *
+        * Sub classes have to implement the parse() method which will be used in load().
+        */
+
+       class DataTextureLoader extends Loader {
+               constructor(manager) {
+                       super(manager);
+               }
+
+               load(url, onLoad, onProgress, onError) {
+                       const scope = this;
+                       const texture = new DataTexture();
+                       const loader = new FileLoader(this.manager);
+                       loader.setResponseType('arraybuffer');
+                       loader.setRequestHeader(this.requestHeader);
+                       loader.setPath(this.path);
+                       loader.setWithCredentials(scope.withCredentials);
+                       loader.load(url, function (buffer) {
+                               const texData = scope.parse(buffer);
+                               if (!texData) return;
+
+                               if (texData.image !== undefined) {
+                                       texture.image = texData.image;
+                               } else if (texData.data !== undefined) {
+                                       texture.image.width = texData.width;
+                                       texture.image.height = texData.height;
+                                       texture.image.data = texData.data;
+                               }
+
+                               texture.wrapS = texData.wrapS !== undefined ? texData.wrapS : ClampToEdgeWrapping;
+                               texture.wrapT = texData.wrapT !== undefined ? texData.wrapT : ClampToEdgeWrapping;
+                               texture.magFilter = texData.magFilter !== undefined ? texData.magFilter : LinearFilter;
+                               texture.minFilter = texData.minFilter !== undefined ? texData.minFilter : LinearFilter;
+                               texture.anisotropy = texData.anisotropy !== undefined ? texData.anisotropy : 1;
+
+                               if (texData.encoding !== undefined) {
+                                       texture.encoding = texData.encoding;
+                               }
+
+                               if (texData.flipY !== undefined) {
+                                       texture.flipY = texData.flipY;
+                               }
+
+                               if (texData.format !== undefined) {
+                                       texture.format = texData.format;
+                               }
+
+                               if (texData.type !== undefined) {
+                                       texture.type = texData.type;
+                               }
+
+                               if (texData.mipmaps !== undefined) {
+                                       texture.mipmaps = texData.mipmaps;
+                                       texture.minFilter = LinearMipmapLinearFilter; // presumably...
+                               }
+
+                               if (texData.mipmapCount === 1) {
+                                       texture.minFilter = LinearFilter;
+                               }
+
+                               if (texData.generateMipmaps !== undefined) {
+                                       texture.generateMipmaps = texData.generateMipmaps;
+                               }
+
+                               texture.needsUpdate = true;
+                               if (onLoad) onLoad(texture, texData);
+                       }, onProgress, onError);
+                       return texture;
+               }
+
+       }
+
+       class TextureLoader extends Loader {
+               constructor(manager) {
+                       super(manager);
+               }
+
+               load(url, onLoad, onProgress, onError) {
+                       const texture = new Texture();
+                       const loader = new ImageLoader(this.manager);
+                       loader.setCrossOrigin(this.crossOrigin);
+                       loader.setPath(this.path);
+                       loader.load(url, function (image) {
+                               texture.image = image; // JPEGs can't have an alpha channel, so memory can be saved by storing them as RGB.
+
+                               const isJPEG = url.search(/\.jpe?g($|\?)/i) > 0 || url.search(/^data\:image\/jpeg/) === 0;
+                               texture.format = isJPEG ? RGBFormat : RGBAFormat;
+                               texture.needsUpdate = true;
+
+                               if (onLoad !== undefined) {
+                                       onLoad(texture);
+                               }
+                       }, onProgress, onError);
+                       return texture;
+               }
+
+       }
+
+       /**************************************************************
+        *      Curved Path - a curve path is simply a array of connected
+        *      curves, but retains the api of a curve
+        **************************************************************/
+
+       class CurvePath extends Curve {
+               constructor() {
+                       super();
+                       this.type = 'CurvePath';
+                       this.curves = [];
+                       this.autoClose = false; // Automatically closes the path
+               }
+
+               add(curve) {
+                       this.curves.push(curve);
+               }
+
+               closePath() {
+                       // Add a line curve if start and end of lines are not connected
+                       const startPoint = this.curves[0].getPoint(0);
+                       const endPoint = this.curves[this.curves.length - 1].getPoint(1);
+
+                       if (!startPoint.equals(endPoint)) {
+                               this.curves.push(new LineCurve(endPoint, startPoint));
+                       }
+               } // To get accurate point with reference to
+               // entire path distance at time t,
+               // following has to be done:
+               // 1. Length of each sub path have to be known
+               // 2. Locate and identify type of curve
+               // 3. Get t for the curve
+               // 4. Return curve.getPointAt(t')
+
+
+               getPoint(t) {
+                       const d = t * this.getLength();
+                       const curveLengths = this.getCurveLengths();
+                       let i = 0; // To think about boundaries points.
+
+                       while (i < curveLengths.length) {
+                               if (curveLengths[i] >= d) {
+                                       const diff = curveLengths[i] - d;
+                                       const curve = this.curves[i];
+                                       const segmentLength = curve.getLength();
+                                       const u = segmentLength === 0 ? 0 : 1 - diff / segmentLength;
+                                       return curve.getPointAt(u);
+                               }
+
+                               i++;
+                       }
+
+                       return null; // loop where sum != 0, sum > d , sum+1 <d
+               } // We cannot use the default THREE.Curve getPoint() with getLength() because in
+               // THREE.Curve, getLength() depends on getPoint() but in THREE.CurvePath
+               // getPoint() depends on getLength
+
+
+               getLength() {
+                       const lens = this.getCurveLengths();
+                       return lens[lens.length - 1];
+               } // cacheLengths must be recalculated.
+
+
+               updateArcLengths() {
+                       this.needsUpdate = true;
+                       this.cacheLengths = null;
+                       this.getCurveLengths();
+               } // Compute lengths and cache them
+               // We cannot overwrite getLengths() because UtoT mapping uses it.
+
+
+               getCurveLengths() {
+                       // We use cache values if curves and cache array are same length
+                       if (this.cacheLengths && this.cacheLengths.length === this.curves.length) {
+                               return this.cacheLengths;
+                       } // Get length of sub-curve
+                       // Push sums into cached array
+
+
+                       const lengths = [];
+                       let sums = 0;
+
+                       for (let i = 0, l = this.curves.length; i < l; i++) {
+                               sums += this.curves[i].getLength();
+                               lengths.push(sums);
+                       }
+
+                       this.cacheLengths = lengths;
+                       return lengths;
+               }
+
+               getSpacedPoints(divisions = 40) {
+                       const points = [];
+
+                       for (let i = 0; i <= divisions; i++) {
+                               points.push(this.getPoint(i / divisions));
+                       }
+
+                       if (this.autoClose) {
+                               points.push(points[0]);
+                       }
+
+                       return points;
+               }
+
+               getPoints(divisions = 12) {
+                       const points = [];
+                       let last;
+
+                       for (let i = 0, curves = this.curves; i < curves.length; i++) {
+                               const curve = curves[i];
+                               const resolution = curve && curve.isEllipseCurve ? divisions * 2 : curve && (curve.isLineCurve || curve.isLineCurve3) ? 1 : curve && curve.isSplineCurve ? divisions * curve.points.length : divisions;
+                               const pts = curve.getPoints(resolution);
+
+                               for (let j = 0; j < pts.length; j++) {
+                                       const point = pts[j];
+                                       if (last && last.equals(point)) continue; // ensures no consecutive points are duplicates
+
+                                       points.push(point);
+                                       last = point;
+                               }
+                       }
+
+                       if (this.autoClose && points.length > 1 && !points[points.length - 1].equals(points[0])) {
+                               points.push(points[0]);
+                       }
+
+                       return points;
+               }
+
+               copy(source) {
+                       super.copy(source);
+                       this.curves = [];
+
+                       for (let i = 0, l = source.curves.length; i < l; i++) {
+                               const curve = source.curves[i];
+                               this.curves.push(curve.clone());
+                       }
+
+                       this.autoClose = source.autoClose;
+                       return this;
+               }
+
+               toJSON() {
+                       const data = super.toJSON();
+                       data.autoClose = this.autoClose;
+                       data.curves = [];
+
+                       for (let i = 0, l = this.curves.length; i < l; i++) {
+                               const curve = this.curves[i];
+                               data.curves.push(curve.toJSON());
+                       }
+
+                       return data;
+               }
+
+               fromJSON(json) {
+                       super.fromJSON(json);
+                       this.autoClose = json.autoClose;
+                       this.curves = [];
+
+                       for (let i = 0, l = json.curves.length; i < l; i++) {
+                               const curve = json.curves[i];
+                               this.curves.push(new Curves[curve.type]().fromJSON(curve));
+                       }
+
+                       return this;
+               }
+
+       }
+
+       class Path extends CurvePath {
+               constructor(points) {
+                       super();
+                       this.type = 'Path';
+                       this.currentPoint = new Vector2();
+
+                       if (points) {
+                               this.setFromPoints(points);
+                       }
+               }
+
+               setFromPoints(points) {
+                       this.moveTo(points[0].x, points[0].y);
+
+                       for (let i = 1, l = points.length; i < l; i++) {
+                               this.lineTo(points[i].x, points[i].y);
+                       }
+
+                       return this;
+               }
+
+               moveTo(x, y) {
+                       this.currentPoint.set(x, y); // TODO consider referencing vectors instead of copying?
+
+                       return this;
+               }
+
+               lineTo(x, y) {
+                       const curve = new LineCurve(this.currentPoint.clone(), new Vector2(x, y));
+                       this.curves.push(curve);
+                       this.currentPoint.set(x, y);
+                       return this;
+               }
+
+               quadraticCurveTo(aCPx, aCPy, aX, aY) {
+                       const curve = new QuadraticBezierCurve(this.currentPoint.clone(), new Vector2(aCPx, aCPy), new Vector2(aX, aY));
+                       this.curves.push(curve);
+                       this.currentPoint.set(aX, aY);
+                       return this;
+               }
+
+               bezierCurveTo(aCP1x, aCP1y, aCP2x, aCP2y, aX, aY) {
+                       const curve = new CubicBezierCurve(this.currentPoint.clone(), new Vector2(aCP1x, aCP1y), new Vector2(aCP2x, aCP2y), new Vector2(aX, aY));
+                       this.curves.push(curve);
+                       this.currentPoint.set(aX, aY);
+                       return this;
+               }
+
+               splineThru(pts
+               /*Array of Vector*/
+               ) {
+                       const npts = [this.currentPoint.clone()].concat(pts);
+                       const curve = new SplineCurve(npts);
+                       this.curves.push(curve);
+                       this.currentPoint.copy(pts[pts.length - 1]);
+                       return this;
+               }
+
+               arc(aX, aY, aRadius, aStartAngle, aEndAngle, aClockwise) {
+                       const x0 = this.currentPoint.x;
+                       const y0 = this.currentPoint.y;
+                       this.absarc(aX + x0, aY + y0, aRadius, aStartAngle, aEndAngle, aClockwise);
+                       return this;
+               }
+
+               absarc(aX, aY, aRadius, aStartAngle, aEndAngle, aClockwise) {
+                       this.absellipse(aX, aY, aRadius, aRadius, aStartAngle, aEndAngle, aClockwise);
+                       return this;
+               }
+
+               ellipse(aX, aY, xRadius, yRadius, aStartAngle, aEndAngle, aClockwise, aRotation) {
+                       const x0 = this.currentPoint.x;
+                       const y0 = this.currentPoint.y;
+                       this.absellipse(aX + x0, aY + y0, xRadius, yRadius, aStartAngle, aEndAngle, aClockwise, aRotation);
+                       return this;
+               }
+
+               absellipse(aX, aY, xRadius, yRadius, aStartAngle, aEndAngle, aClockwise, aRotation) {
+                       const curve = new EllipseCurve(aX, aY, xRadius, yRadius, aStartAngle, aEndAngle, aClockwise, aRotation);
+
+                       if (this.curves.length > 0) {
+                               // if a previous curve is present, attempt to join
+                               const firstPoint = curve.getPoint(0);
+
+                               if (!firstPoint.equals(this.currentPoint)) {
+                                       this.lineTo(firstPoint.x, firstPoint.y);
+                               }
+                       }
+
+                       this.curves.push(curve);
+                       const lastPoint = curve.getPoint(1);
+                       this.currentPoint.copy(lastPoint);
+                       return this;
+               }
+
+               copy(source) {
+                       super.copy(source);
+                       this.currentPoint.copy(source.currentPoint);
+                       return this;
+               }
+
+               toJSON() {
+                       const data = super.toJSON();
+                       data.currentPoint = this.currentPoint.toArray();
+                       return data;
+               }
+
+               fromJSON(json) {
+                       super.fromJSON(json);
+                       this.currentPoint.fromArray(json.currentPoint);
+                       return this;
+               }
+
+       }
+
+       class Shape extends Path {
+               constructor(points) {
+                       super(points);
+                       this.uuid = generateUUID();
+                       this.type = 'Shape';
+                       this.holes = [];
+               }
+
+               getPointsHoles(divisions) {
+                       const holesPts = [];
+
+                       for (let i = 0, l = this.holes.length; i < l; i++) {
+                               holesPts[i] = this.holes[i].getPoints(divisions);
+                       }
+
+                       return holesPts;
+               } // get points of shape and holes (keypoints based on segments parameter)
+
+
+               extractPoints(divisions) {
+                       return {
+                               shape: this.getPoints(divisions),
+                               holes: this.getPointsHoles(divisions)
+                       };
+               }
+
+               copy(source) {
+                       super.copy(source);
+                       this.holes = [];
+
+                       for (let i = 0, l = source.holes.length; i < l; i++) {
+                               const hole = source.holes[i];
+                               this.holes.push(hole.clone());
+                       }
+
+                       return this;
+               }
+
+               toJSON() {
+                       const data = super.toJSON();
+                       data.uuid = this.uuid;
+                       data.holes = [];
+
+                       for (let i = 0, l = this.holes.length; i < l; i++) {
+                               const hole = this.holes[i];
+                               data.holes.push(hole.toJSON());
+                       }
+
+                       return data;
+               }
+
+               fromJSON(json) {
+                       super.fromJSON(json);
+                       this.uuid = json.uuid;
+                       this.holes = [];
+
+                       for (let i = 0, l = json.holes.length; i < l; i++) {
+                               const hole = json.holes[i];
+                               this.holes.push(new Path().fromJSON(hole));
+                       }
+
+                       return this;
+               }
+
+       }
+
+       class Light extends Object3D {
+               constructor(color, intensity = 1) {
+                       super();
+                       this.type = 'Light';
+                       this.color = new Color(color);
+                       this.intensity = intensity;
+               }
+
+               dispose() {// Empty here in base class; some subclasses override.
+               }
+
+               copy(source) {
+                       super.copy(source);
+                       this.color.copy(source.color);
+                       this.intensity = source.intensity;
+                       return this;
+               }
+
+               toJSON(meta) {
+                       const data = super.toJSON(meta);
+                       data.object.color = this.color.getHex();
+                       data.object.intensity = this.intensity;
+                       if (this.groundColor !== undefined) data.object.groundColor = this.groundColor.getHex();
+                       if (this.distance !== undefined) data.object.distance = this.distance;
+                       if (this.angle !== undefined) data.object.angle = this.angle;
+                       if (this.decay !== undefined) data.object.decay = this.decay;
+                       if (this.penumbra !== undefined) data.object.penumbra = this.penumbra;
+                       if (this.shadow !== undefined) data.object.shadow = this.shadow.toJSON();
+                       return data;
+               }
+
+       }
+
+       Light.prototype.isLight = true;
+
+       class HemisphereLight extends Light {
+               constructor(skyColor, groundColor, intensity) {
+                       super(skyColor, intensity);
+                       this.type = 'HemisphereLight';
+                       this.position.copy(Object3D.DefaultUp);
+                       this.updateMatrix();
+                       this.groundColor = new Color(groundColor);
+               }
+
+               copy(source) {
+                       Light.prototype.copy.call(this, source);
+                       this.groundColor.copy(source.groundColor);
+                       return this;
+               }
+
+       }
+
+       HemisphereLight.prototype.isHemisphereLight = true;
+
+       const _projScreenMatrix$1 = /*@__PURE__*/new Matrix4();
+
+       const _lightPositionWorld$1 = /*@__PURE__*/new Vector3();
+
+       const _lookTarget$1 = /*@__PURE__*/new Vector3();
+
+       class LightShadow {
+               constructor(camera) {
+                       this.camera = camera;
+                       this.bias = 0;
+                       this.normalBias = 0;
+                       this.radius = 1;
+                       this.blurSamples = 8;
+                       this.mapSize = new Vector2(512, 512);
+                       this.map = null;
+                       this.mapPass = null;
+                       this.matrix = new Matrix4();
+                       this.autoUpdate = true;
+                       this.needsUpdate = false;
+                       this._frustum = new Frustum();
+                       this._frameExtents = new Vector2(1, 1);
+                       this._viewportCount = 1;
+                       this._viewports = [new Vector4(0, 0, 1, 1)];
+               }
+
+               getViewportCount() {
+                       return this._viewportCount;
+               }
+
+               getFrustum() {
+                       return this._frustum;
+               }
+
+               updateMatrices(light) {
+                       const shadowCamera = this.camera;
+                       const shadowMatrix = this.matrix;
+
+                       _lightPositionWorld$1.setFromMatrixPosition(light.matrixWorld);
+
+                       shadowCamera.position.copy(_lightPositionWorld$1);
+
+                       _lookTarget$1.setFromMatrixPosition(light.target.matrixWorld);
+
+                       shadowCamera.lookAt(_lookTarget$1);
+                       shadowCamera.updateMatrixWorld();
+
+                       _projScreenMatrix$1.multiplyMatrices(shadowCamera.projectionMatrix, shadowCamera.matrixWorldInverse);
+
+                       this._frustum.setFromProjectionMatrix(_projScreenMatrix$1);
+
+                       shadowMatrix.set(0.5, 0.0, 0.0, 0.5, 0.0, 0.5, 0.0, 0.5, 0.0, 0.0, 0.5, 0.5, 0.0, 0.0, 0.0, 1.0);
+                       shadowMatrix.multiply(shadowCamera.projectionMatrix);
+                       shadowMatrix.multiply(shadowCamera.matrixWorldInverse);
+               }
+
+               getViewport(viewportIndex) {
+                       return this._viewports[viewportIndex];
+               }
+
+               getFrameExtents() {
+                       return this._frameExtents;
+               }
+
+               dispose() {
+                       if (this.map) {
+                               this.map.dispose();
+                       }
+
+                       if (this.mapPass) {
+                               this.mapPass.dispose();
+                       }
+               }
+
+               copy(source) {
+                       this.camera = source.camera.clone();
+                       this.bias = source.bias;
+                       this.radius = source.radius;
+                       this.mapSize.copy(source.mapSize);
+                       return this;
+               }
+
+               clone() {
+                       return new this.constructor().copy(this);
+               }
+
+               toJSON() {
+                       const object = {};
+                       if (this.bias !== 0) object.bias = this.bias;
+                       if (this.normalBias !== 0) object.normalBias = this.normalBias;
+                       if (this.radius !== 1) object.radius = this.radius;
+                       if (this.mapSize.x !== 512 || this.mapSize.y !== 512) object.mapSize = this.mapSize.toArray();
+                       object.camera = this.camera.toJSON(false).object;
+                       delete object.camera.matrix;
+                       return object;
+               }
+
+       }
+
+       class SpotLightShadow extends LightShadow {
+               constructor() {
+                       super(new PerspectiveCamera(50, 1, 0.5, 500));
+                       this.focus = 1;
+               }
+
+               updateMatrices(light) {
+                       const camera = this.camera;
+                       const fov = RAD2DEG * 2 * light.angle * this.focus;
+                       const aspect = this.mapSize.width / this.mapSize.height;
+                       const far = light.distance || camera.far;
+
+                       if (fov !== camera.fov || aspect !== camera.aspect || far !== camera.far) {
+                               camera.fov = fov;
+                               camera.aspect = aspect;
+                               camera.far = far;
+                               camera.updateProjectionMatrix();
+                       }
+
+                       super.updateMatrices(light);
+               }
+
+               copy(source) {
+                       super.copy(source);
+                       this.focus = source.focus;
+                       return this;
+               }
+
+       }
+
+       SpotLightShadow.prototype.isSpotLightShadow = true;
+
+       class SpotLight extends Light {
+               constructor(color, intensity, distance = 0, angle = Math.PI / 3, penumbra = 0, decay = 1) {
+                       super(color, intensity);
+                       this.type = 'SpotLight';
+                       this.position.copy(Object3D.DefaultUp);
+                       this.updateMatrix();
+                       this.target = new Object3D();
+                       this.distance = distance;
+                       this.angle = angle;
+                       this.penumbra = penumbra;
+                       this.decay = decay; // for physically correct lights, should be 2.
+
+                       this.shadow = new SpotLightShadow();
+               }
+
+               get power() {
+                       // compute the light's luminous power (in lumens) from its intensity (in candela)
+                       // by convention for a spotlight, luminous power (lm) = Ï€ * luminous intensity (cd)
+                       return this.intensity * Math.PI;
+               }
+
+               set power(power) {
+                       // set the light's intensity (in candela) from the desired luminous power (in lumens)
+                       this.intensity = power / Math.PI;
+               }
+
+               dispose() {
+                       this.shadow.dispose();
+               }
+
+               copy(source) {
+                       super.copy(source);
+                       this.distance = source.distance;
+                       this.angle = source.angle;
+                       this.penumbra = source.penumbra;
+                       this.decay = source.decay;
+                       this.target = source.target.clone();
+                       this.shadow = source.shadow.clone();
+                       return this;
+               }
+
+       }
+
+       SpotLight.prototype.isSpotLight = true;
+
+       const _projScreenMatrix = /*@__PURE__*/new Matrix4();
+
+       const _lightPositionWorld = /*@__PURE__*/new Vector3();
+
+       const _lookTarget = /*@__PURE__*/new Vector3();
+
+       class PointLightShadow extends LightShadow {
+               constructor() {
+                       super(new PerspectiveCamera(90, 1, 0.5, 500));
+                       this._frameExtents = new Vector2(4, 2);
+                       this._viewportCount = 6;
+                       this._viewports = [// These viewports map a cube-map onto a 2D texture with the
+                       // following orientation:
+                       //
+                       //      xzXZ
+                       //       y Y
+                       //
+                       // X - Positive x direction
+                       // x - Negative x direction
+                       // Y - Positive y direction
+                       // y - Negative y direction
+                       // Z - Positive z direction
+                       // z - Negative z direction
+                       // positive X
+                       new Vector4(2, 1, 1, 1), // negative X
+                       new Vector4(0, 1, 1, 1), // positive Z
+                       new Vector4(3, 1, 1, 1), // negative Z
+                       new Vector4(1, 1, 1, 1), // positive Y
+                       new Vector4(3, 0, 1, 1), // negative Y
+                       new Vector4(1, 0, 1, 1)];
+                       this._cubeDirections = [new Vector3(1, 0, 0), new Vector3(-1, 0, 0), new Vector3(0, 0, 1), new Vector3(0, 0, -1), new Vector3(0, 1, 0), new Vector3(0, -1, 0)];
+                       this._cubeUps = [new Vector3(0, 1, 0), new Vector3(0, 1, 0), new Vector3(0, 1, 0), new Vector3(0, 1, 0), new Vector3(0, 0, 1), new Vector3(0, 0, -1)];
+               }
+
+               updateMatrices(light, viewportIndex = 0) {
+                       const camera = this.camera;
+                       const shadowMatrix = this.matrix;
+                       const far = light.distance || camera.far;
+
+                       if (far !== camera.far) {
+                               camera.far = far;
+                               camera.updateProjectionMatrix();
+                       }
+
+                       _lightPositionWorld.setFromMatrixPosition(light.matrixWorld);
+
+                       camera.position.copy(_lightPositionWorld);
+
+                       _lookTarget.copy(camera.position);
+
+                       _lookTarget.add(this._cubeDirections[viewportIndex]);
+
+                       camera.up.copy(this._cubeUps[viewportIndex]);
+                       camera.lookAt(_lookTarget);
+                       camera.updateMatrixWorld();
+                       shadowMatrix.makeTranslation(-_lightPositionWorld.x, -_lightPositionWorld.y, -_lightPositionWorld.z);
+
+                       _projScreenMatrix.multiplyMatrices(camera.projectionMatrix, camera.matrixWorldInverse);
+
+                       this._frustum.setFromProjectionMatrix(_projScreenMatrix);
+               }
+
+       }
+
+       PointLightShadow.prototype.isPointLightShadow = true;
+
+       class PointLight extends Light {
+               constructor(color, intensity, distance = 0, decay = 1) {
+                       super(color, intensity);
+                       this.type = 'PointLight';
+                       this.distance = distance;
+                       this.decay = decay; // for physically correct lights, should be 2.
+
+                       this.shadow = new PointLightShadow();
+               }
+
+               get power() {
+                       // compute the light's luminous power (in lumens) from its intensity (in candela)
+                       // for an isotropic light source, luminous power (lm) = 4 Ï€ luminous intensity (cd)
+                       return this.intensity * 4 * Math.PI;
+               }
+
+               set power(power) {
+                       // set the light's intensity (in candela) from the desired luminous power (in lumens)
+                       this.intensity = power / (4 * Math.PI);
+               }
+
+               dispose() {
+                       this.shadow.dispose();
+               }
+
+               copy(source) {
+                       super.copy(source);
+                       this.distance = source.distance;
+                       this.decay = source.decay;
+                       this.shadow = source.shadow.clone();
+                       return this;
+               }
+
+       }
+
+       PointLight.prototype.isPointLight = true;
+
+       class DirectionalLightShadow extends LightShadow {
+               constructor() {
+                       super(new OrthographicCamera(-5, 5, 5, -5, 0.5, 500));
+               }
+
+       }
+
+       DirectionalLightShadow.prototype.isDirectionalLightShadow = true;
+
+       class DirectionalLight extends Light {
+               constructor(color, intensity) {
+                       super(color, intensity);
+                       this.type = 'DirectionalLight';
+                       this.position.copy(Object3D.DefaultUp);
+                       this.updateMatrix();
+                       this.target = new Object3D();
+                       this.shadow = new DirectionalLightShadow();
+               }
+
+               dispose() {
+                       this.shadow.dispose();
+               }
+
+               copy(source) {
+                       super.copy(source);
+                       this.target = source.target.clone();
+                       this.shadow = source.shadow.clone();
+                       return this;
+               }
+
+       }
+
+       DirectionalLight.prototype.isDirectionalLight = true;
+
+       class AmbientLight extends Light {
+               constructor(color, intensity) {
+                       super(color, intensity);
+                       this.type = 'AmbientLight';
+               }
+
+       }
+
+       AmbientLight.prototype.isAmbientLight = true;
+
+       class RectAreaLight extends Light {
+               constructor(color, intensity, width = 10, height = 10) {
+                       super(color, intensity);
+                       this.type = 'RectAreaLight';
+                       this.width = width;
+                       this.height = height;
+               }
+
+               get power() {
+                       // compute the light's luminous power (in lumens) from its intensity (in nits)
+                       return this.intensity * this.width * this.height * Math.PI;
+               }
+
+               set power(power) {
+                       // set the light's intensity (in nits) from the desired luminous power (in lumens)
+                       this.intensity = power / (this.width * this.height * Math.PI);
+               }
+
+               copy(source) {
+                       super.copy(source);
+                       this.width = source.width;
+                       this.height = source.height;
+                       return this;
+               }
+
+               toJSON(meta) {
+                       const data = super.toJSON(meta);
+                       data.object.width = this.width;
+                       data.object.height = this.height;
+                       return data;
+               }
+
+       }
+
+       RectAreaLight.prototype.isRectAreaLight = true;
+
+       /**
+        * Primary reference:
+        *       https://graphics.stanford.edu/papers/envmap/envmap.pdf
+        *
+        * Secondary reference:
+        *       https://www.ppsloan.org/publications/StupidSH36.pdf
+        */
+       // 3-band SH defined by 9 coefficients
+
+       class SphericalHarmonics3 {
+               constructor() {
+                       this.coefficients = [];
+
+                       for (let i = 0; i < 9; i++) {
+                               this.coefficients.push(new Vector3());
+                       }
+               }
+
+               set(coefficients) {
+                       for (let i = 0; i < 9; i++) {
+                               this.coefficients[i].copy(coefficients[i]);
+                       }
+
+                       return this;
+               }
+
+               zero() {
+                       for (let i = 0; i < 9; i++) {
+                               this.coefficients[i].set(0, 0, 0);
+                       }
+
+                       return this;
+               } // get the radiance in the direction of the normal
+               // target is a Vector3
+
+
+               getAt(normal, target) {
+                       // normal is assumed to be unit length
+                       const x = normal.x,
+                                               y = normal.y,
+                                               z = normal.z;
+                       const coeff = this.coefficients; // band 0
+
+                       target.copy(coeff[0]).multiplyScalar(0.282095); // band 1
+
+                       target.addScaledVector(coeff[1], 0.488603 * y);
+                       target.addScaledVector(coeff[2], 0.488603 * z);
+                       target.addScaledVector(coeff[3], 0.488603 * x); // band 2
+
+                       target.addScaledVector(coeff[4], 1.092548 * (x * y));
+                       target.addScaledVector(coeff[5], 1.092548 * (y * z));
+                       target.addScaledVector(coeff[6], 0.315392 * (3.0 * z * z - 1.0));
+                       target.addScaledVector(coeff[7], 1.092548 * (x * z));
+                       target.addScaledVector(coeff[8], 0.546274 * (x * x - y * y));
+                       return target;
+               } // get the irradiance (radiance convolved with cosine lobe) in the direction of the normal
+               // target is a Vector3
+               // https://graphics.stanford.edu/papers/envmap/envmap.pdf
+
+
+               getIrradianceAt(normal, target) {
+                       // normal is assumed to be unit length
+                       const x = normal.x,
+                                               y = normal.y,
+                                               z = normal.z;
+                       const coeff = this.coefficients; // band 0
+
+                       target.copy(coeff[0]).multiplyScalar(0.886227); // Ï€ * 0.282095
+                       // band 1
+
+                       target.addScaledVector(coeff[1], 2.0 * 0.511664 * y); // ( 2 * Ï€ / 3 ) * 0.488603
+
+                       target.addScaledVector(coeff[2], 2.0 * 0.511664 * z);
+                       target.addScaledVector(coeff[3], 2.0 * 0.511664 * x); // band 2
+
+                       target.addScaledVector(coeff[4], 2.0 * 0.429043 * x * y); // ( Ï€ / 4 ) * 1.092548
+
+                       target.addScaledVector(coeff[5], 2.0 * 0.429043 * y * z);
+                       target.addScaledVector(coeff[6], 0.743125 * z * z - 0.247708); // ( Ï€ / 4 ) * 0.315392 * 3
+
+                       target.addScaledVector(coeff[7], 2.0 * 0.429043 * x * z);
+                       target.addScaledVector(coeff[8], 0.429043 * (x * x - y * y)); // ( Ï€ / 4 ) * 0.546274
+
+                       return target;
+               }
+
+               add(sh) {
+                       for (let i = 0; i < 9; i++) {
+                               this.coefficients[i].add(sh.coefficients[i]);
+                       }
+
+                       return this;
+               }
+
+               addScaledSH(sh, s) {
+                       for (let i = 0; i < 9; i++) {
+                               this.coefficients[i].addScaledVector(sh.coefficients[i], s);
+                       }
+
+                       return this;
+               }
+
+               scale(s) {
+                       for (let i = 0; i < 9; i++) {
+                               this.coefficients[i].multiplyScalar(s);
+                       }
+
+                       return this;
+               }
+
+               lerp(sh, alpha) {
+                       for (let i = 0; i < 9; i++) {
+                               this.coefficients[i].lerp(sh.coefficients[i], alpha);
+                       }
+
+                       return this;
+               }
+
+               equals(sh) {
+                       for (let i = 0; i < 9; i++) {
+                               if (!this.coefficients[i].equals(sh.coefficients[i])) {
+                                       return false;
+                               }
+                       }
+
+                       return true;
+               }
+
+               copy(sh) {
+                       return this.set(sh.coefficients);
+               }
+
+               clone() {
+                       return new this.constructor().copy(this);
+               }
+
+               fromArray(array, offset = 0) {
+                       const coefficients = this.coefficients;
+
+                       for (let i = 0; i < 9; i++) {
+                               coefficients[i].fromArray(array, offset + i * 3);
+                       }
+
+                       return this;
+               }
+
+               toArray(array = [], offset = 0) {
+                       const coefficients = this.coefficients;
+
+                       for (let i = 0; i < 9; i++) {
+                               coefficients[i].toArray(array, offset + i * 3);
+                       }
+
+                       return array;
+               } // evaluate the basis functions
+               // shBasis is an Array[ 9 ]
+
+
+               static getBasisAt(normal, shBasis) {
+                       // normal is assumed to be unit length
+                       const x = normal.x,
+                                               y = normal.y,
+                                               z = normal.z; // band 0
+
+                       shBasis[0] = 0.282095; // band 1
+
+                       shBasis[1] = 0.488603 * y;
+                       shBasis[2] = 0.488603 * z;
+                       shBasis[3] = 0.488603 * x; // band 2
+
+                       shBasis[4] = 1.092548 * x * y;
+                       shBasis[5] = 1.092548 * y * z;
+                       shBasis[6] = 0.315392 * (3 * z * z - 1);
+                       shBasis[7] = 1.092548 * x * z;
+                       shBasis[8] = 0.546274 * (x * x - y * y);
+               }
+
+       }
+
+       SphericalHarmonics3.prototype.isSphericalHarmonics3 = true;
+
+       class LightProbe extends Light {
+               constructor(sh = new SphericalHarmonics3(), intensity = 1) {
+                       super(undefined, intensity);
+                       this.sh = sh;
+               }
+
+               copy(source) {
+                       super.copy(source);
+                       this.sh.copy(source.sh);
+                       return this;
+               }
+
+               fromJSON(json) {
+                       this.intensity = json.intensity; // TODO: Move this bit to Light.fromJSON();
+
+                       this.sh.fromArray(json.sh);
+                       return this;
+               }
+
+               toJSON(meta) {
+                       const data = super.toJSON(meta);
+                       data.object.sh = this.sh.toArray();
+                       return data;
+               }
+
+       }
+
+       LightProbe.prototype.isLightProbe = true;
+
+       class MaterialLoader extends Loader {
+               constructor(manager) {
+                       super(manager);
+                       this.textures = {};
+               }
+
+               load(url, onLoad, onProgress, onError) {
+                       const scope = this;
+                       const loader = new FileLoader(scope.manager);
+                       loader.setPath(scope.path);
+                       loader.setRequestHeader(scope.requestHeader);
+                       loader.setWithCredentials(scope.withCredentials);
+                       loader.load(url, function (text) {
+                               try {
+                                       onLoad(scope.parse(JSON.parse(text)));
+                               } catch (e) {
+                                       if (onError) {
+                                               onError(e);
+                                       } else {
+                                               console.error(e);
+                                       }
+
+                                       scope.manager.itemError(url);
+                               }
+                       }, onProgress, onError);
+               }
+
+               parse(json) {
+                       const textures = this.textures;
+
+                       function getTexture(name) {
+                               if (textures[name] === undefined) {
+                                       console.warn('THREE.MaterialLoader: Undefined texture', name);
+                               }
+
+                               return textures[name];
+                       }
+
+                       const material = new Materials[json.type]();
+                       if (json.uuid !== undefined) material.uuid = json.uuid;
+                       if (json.name !== undefined) material.name = json.name;
+                       if (json.color !== undefined && material.color !== undefined) material.color.setHex(json.color);
+                       if (json.roughness !== undefined) material.roughness = json.roughness;
+                       if (json.metalness !== undefined) material.metalness = json.metalness;
+                       if (json.sheenTint !== undefined) material.sheenTint = new Color().setHex(json.sheenTint);
+                       if (json.emissive !== undefined && material.emissive !== undefined) material.emissive.setHex(json.emissive);
+                       if (json.specular !== undefined && material.specular !== undefined) material.specular.setHex(json.specular);
+                       if (json.specularIntensity !== undefined) material.specularIntensity = json.specularIntensity;
+                       if (json.specularTint !== undefined && material.specularTint !== undefined) material.specularTint.setHex(json.specularTint);
+                       if (json.shininess !== undefined) material.shininess = json.shininess;
+                       if (json.clearcoat !== undefined) material.clearcoat = json.clearcoat;
+                       if (json.clearcoatRoughness !== undefined) material.clearcoatRoughness = json.clearcoatRoughness;
+                       if (json.transmission !== undefined) material.transmission = json.transmission;
+                       if (json.thickness !== undefined) material.thickness = json.thickness;
+                       if (json.attenuationDistance !== undefined) material.attenuationDistance = json.attenuationDistance;
+                       if (json.attenuationTint !== undefined && material.attenuationTint !== undefined) material.attenuationTint.setHex(json.attenuationTint);
+                       if (json.fog !== undefined) material.fog = json.fog;
+                       if (json.flatShading !== undefined) material.flatShading = json.flatShading;
+                       if (json.blending !== undefined) material.blending = json.blending;
+                       if (json.combine !== undefined) material.combine = json.combine;
+                       if (json.side !== undefined) material.side = json.side;
+                       if (json.shadowSide !== undefined) material.shadowSide = json.shadowSide;
+                       if (json.opacity !== undefined) material.opacity = json.opacity;
+                       if (json.format !== undefined) material.format = json.format;
+                       if (json.transparent !== undefined) material.transparent = json.transparent;
+                       if (json.alphaTest !== undefined) material.alphaTest = json.alphaTest;
+                       if (json.depthTest !== undefined) material.depthTest = json.depthTest;
+                       if (json.depthWrite !== undefined) material.depthWrite = json.depthWrite;
+                       if (json.colorWrite !== undefined) material.colorWrite = json.colorWrite;
+                       if (json.stencilWrite !== undefined) material.stencilWrite = json.stencilWrite;
+                       if (json.stencilWriteMask !== undefined) material.stencilWriteMask = json.stencilWriteMask;
+                       if (json.stencilFunc !== undefined) material.stencilFunc = json.stencilFunc;
+                       if (json.stencilRef !== undefined) material.stencilRef = json.stencilRef;
+                       if (json.stencilFuncMask !== undefined) material.stencilFuncMask = json.stencilFuncMask;
+                       if (json.stencilFail !== undefined) material.stencilFail = json.stencilFail;
+                       if (json.stencilZFail !== undefined) material.stencilZFail = json.stencilZFail;
+                       if (json.stencilZPass !== undefined) material.stencilZPass = json.stencilZPass;
+                       if (json.wireframe !== undefined) material.wireframe = json.wireframe;
+                       if (json.wireframeLinewidth !== undefined) material.wireframeLinewidth = json.wireframeLinewidth;
+                       if (json.wireframeLinecap !== undefined) material.wireframeLinecap = json.wireframeLinecap;
+                       if (json.wireframeLinejoin !== undefined) material.wireframeLinejoin = json.wireframeLinejoin;
+                       if (json.rotation !== undefined) material.rotation = json.rotation;
+                       if (json.linewidth !== 1) material.linewidth = json.linewidth;
+                       if (json.dashSize !== undefined) material.dashSize = json.dashSize;
+                       if (json.gapSize !== undefined) material.gapSize = json.gapSize;
+                       if (json.scale !== undefined) material.scale = json.scale;
+                       if (json.polygonOffset !== undefined) material.polygonOffset = json.polygonOffset;
+                       if (json.polygonOffsetFactor !== undefined) material.polygonOffsetFactor = json.polygonOffsetFactor;
+                       if (json.polygonOffsetUnits !== undefined) material.polygonOffsetUnits = json.polygonOffsetUnits;
+                       if (json.dithering !== undefined) material.dithering = json.dithering;
+                       if (json.alphaToCoverage !== undefined) material.alphaToCoverage = json.alphaToCoverage;
+                       if (json.premultipliedAlpha !== undefined) material.premultipliedAlpha = json.premultipliedAlpha;
+                       if (json.visible !== undefined) material.visible = json.visible;
+                       if (json.toneMapped !== undefined) material.toneMapped = json.toneMapped;
+                       if (json.userData !== undefined) material.userData = json.userData;
+
+                       if (json.vertexColors !== undefined) {
+                               if (typeof json.vertexColors === 'number') {
+                                       material.vertexColors = json.vertexColors > 0 ? true : false;
+                               } else {
+                                       material.vertexColors = json.vertexColors;
+                               }
+                       } // Shader Material
+
+
+                       if (json.uniforms !== undefined) {
+                               for (const name in json.uniforms) {
+                                       const uniform = json.uniforms[name];
+                                       material.uniforms[name] = {};
+
+                                       switch (uniform.type) {
+                                               case 't':
+                                                       material.uniforms[name].value = getTexture(uniform.value);
+                                                       break;
+
+                                               case 'c':
+                                                       material.uniforms[name].value = new Color().setHex(uniform.value);
+                                                       break;
+
+                                               case 'v2':
+                                                       material.uniforms[name].value = new Vector2().fromArray(uniform.value);
+                                                       break;
+
+                                               case 'v3':
+                                                       material.uniforms[name].value = new Vector3().fromArray(uniform.value);
+                                                       break;
+
+                                               case 'v4':
+                                                       material.uniforms[name].value = new Vector4().fromArray(uniform.value);
+                                                       break;
+
+                                               case 'm3':
+                                                       material.uniforms[name].value = new Matrix3().fromArray(uniform.value);
+                                                       break;
+
+                                               case 'm4':
+                                                       material.uniforms[name].value = new Matrix4().fromArray(uniform.value);
+                                                       break;
+
+                                               default:
+                                                       material.uniforms[name].value = uniform.value;
+                                       }
+                               }
+                       }
+
+                       if (json.defines !== undefined) material.defines = json.defines;
+                       if (json.vertexShader !== undefined) material.vertexShader = json.vertexShader;
+                       if (json.fragmentShader !== undefined) material.fragmentShader = json.fragmentShader;
+
+                       if (json.extensions !== undefined) {
+                               for (const key in json.extensions) {
+                                       material.extensions[key] = json.extensions[key];
+                               }
+                       } // Deprecated
+
+
+                       if (json.shading !== undefined) material.flatShading = json.shading === 1; // THREE.FlatShading
+                       // for PointsMaterial
+
+                       if (json.size !== undefined) material.size = json.size;
+                       if (json.sizeAttenuation !== undefined) material.sizeAttenuation = json.sizeAttenuation; // maps
+
+                       if (json.map !== undefined) material.map = getTexture(json.map);
+                       if (json.matcap !== undefined) material.matcap = getTexture(json.matcap);
+                       if (json.alphaMap !== undefined) material.alphaMap = getTexture(json.alphaMap);
+                       if (json.bumpMap !== undefined) material.bumpMap = getTexture(json.bumpMap);
+                       if (json.bumpScale !== undefined) material.bumpScale = json.bumpScale;
+                       if (json.normalMap !== undefined) material.normalMap = getTexture(json.normalMap);
+                       if (json.normalMapType !== undefined) material.normalMapType = json.normalMapType;
+
+                       if (json.normalScale !== undefined) {
+                               let normalScale = json.normalScale;
+
+                               if (Array.isArray(normalScale) === false) {
+                                       // Blender exporter used to export a scalar. See #7459
+                                       normalScale = [normalScale, normalScale];
+                               }
+
+                               material.normalScale = new Vector2().fromArray(normalScale);
+                       }
+
+                       if (json.displacementMap !== undefined) material.displacementMap = getTexture(json.displacementMap);
+                       if (json.displacementScale !== undefined) material.displacementScale = json.displacementScale;
+                       if (json.displacementBias !== undefined) material.displacementBias = json.displacementBias;
+                       if (json.roughnessMap !== undefined) material.roughnessMap = getTexture(json.roughnessMap);
+                       if (json.metalnessMap !== undefined) material.metalnessMap = getTexture(json.metalnessMap);
+                       if (json.emissiveMap !== undefined) material.emissiveMap = getTexture(json.emissiveMap);
+                       if (json.emissiveIntensity !== undefined) material.emissiveIntensity = json.emissiveIntensity;
+                       if (json.specularMap !== undefined) material.specularMap = getTexture(json.specularMap);
+                       if (json.specularIntensityMap !== undefined) material.specularIntensityMap = getTexture(json.specularIntensityMap);
+                       if (json.specularTintMap !== undefined) material.specularTintMap = getTexture(json.specularTintMap);
+                       if (json.envMap !== undefined) material.envMap = getTexture(json.envMap);
+                       if (json.envMapIntensity !== undefined) material.envMapIntensity = json.envMapIntensity;
+                       if (json.reflectivity !== undefined) material.reflectivity = json.reflectivity;
+                       if (json.refractionRatio !== undefined) material.refractionRatio = json.refractionRatio;
+                       if (json.lightMap !== undefined) material.lightMap = getTexture(json.lightMap);
+                       if (json.lightMapIntensity !== undefined) material.lightMapIntensity = json.lightMapIntensity;
+                       if (json.aoMap !== undefined) material.aoMap = getTexture(json.aoMap);
+                       if (json.aoMapIntensity !== undefined) material.aoMapIntensity = json.aoMapIntensity;
+                       if (json.gradientMap !== undefined) material.gradientMap = getTexture(json.gradientMap);
+                       if (json.clearcoatMap !== undefined) material.clearcoatMap = getTexture(json.clearcoatMap);
+                       if (json.clearcoatRoughnessMap !== undefined) material.clearcoatRoughnessMap = getTexture(json.clearcoatRoughnessMap);
+                       if (json.clearcoatNormalMap !== undefined) material.clearcoatNormalMap = getTexture(json.clearcoatNormalMap);
+                       if (json.clearcoatNormalScale !== undefined) material.clearcoatNormalScale = new Vector2().fromArray(json.clearcoatNormalScale);
+                       if (json.transmissionMap !== undefined) material.transmissionMap = getTexture(json.transmissionMap);
+                       if (json.thicknessMap !== undefined) material.thicknessMap = getTexture(json.thicknessMap);
+                       return material;
+               }
+
+               setTextures(value) {
+                       this.textures = value;
+                       return this;
+               }
+
+       }
+
+       class LoaderUtils {
+               static decodeText(array) {
+                       if (typeof TextDecoder !== 'undefined') {
+                               return new TextDecoder().decode(array);
+                       } // Avoid the String.fromCharCode.apply(null, array) shortcut, which
+                       // throws a "maximum call stack size exceeded" error for large arrays.
+
+
+                       let s = '';
+
+                       for (let i = 0, il = array.length; i < il; i++) {
+                               // Implicitly assumes little-endian.
+                               s += String.fromCharCode(array[i]);
+                       }
+
+                       try {
+                               // merges multi-byte utf-8 characters.
+                               return decodeURIComponent(escape(s));
+                       } catch (e) {
+                               // see #16358
+                               return s;
+                       }
+               }
+
+               static extractUrlBase(url) {
+                       const index = url.lastIndexOf('/');
+                       if (index === -1) return './';
+                       return url.substr(0, index + 1);
+               }
+
+       }
+
+       class InstancedBufferGeometry extends BufferGeometry {
+               constructor() {
+                       super();
+                       this.type = 'InstancedBufferGeometry';
+                       this.instanceCount = Infinity;
+               }
+
+               copy(source) {
+                       super.copy(source);
+                       this.instanceCount = source.instanceCount;
+                       return this;
+               }
+
+               clone() {
+                       return new this.constructor().copy(this);
+               }
+
+               toJSON() {
+                       const data = super.toJSON(this);
+                       data.instanceCount = this.instanceCount;
+                       data.isInstancedBufferGeometry = true;
+                       return data;
+               }
+
+       }
+
+       InstancedBufferGeometry.prototype.isInstancedBufferGeometry = true;
+
+       class BufferGeometryLoader extends Loader {
+               constructor(manager) {
+                       super(manager);
+               }
+
+               load(url, onLoad, onProgress, onError) {
+                       const scope = this;
+                       const loader = new FileLoader(scope.manager);
+                       loader.setPath(scope.path);
+                       loader.setRequestHeader(scope.requestHeader);
+                       loader.setWithCredentials(scope.withCredentials);
+                       loader.load(url, function (text) {
+                               try {
+                                       onLoad(scope.parse(JSON.parse(text)));
+                               } catch (e) {
+                                       if (onError) {
+                                               onError(e);
+                                       } else {
+                                               console.error(e);
+                                       }
+
+                                       scope.manager.itemError(url);
+                               }
+                       }, onProgress, onError);
+               }
+
+               parse(json) {
+                       const interleavedBufferMap = {};
+                       const arrayBufferMap = {};
+
+                       function getInterleavedBuffer(json, uuid) {
+                               if (interleavedBufferMap[uuid] !== undefined) return interleavedBufferMap[uuid];
+                               const interleavedBuffers = json.interleavedBuffers;
+                               const interleavedBuffer = interleavedBuffers[uuid];
+                               const buffer = getArrayBuffer(json, interleavedBuffer.buffer);
+                               const array = getTypedArray(interleavedBuffer.type, buffer);
+                               const ib = new InterleavedBuffer(array, interleavedBuffer.stride);
+                               ib.uuid = interleavedBuffer.uuid;
+                               interleavedBufferMap[uuid] = ib;
+                               return ib;
+                       }
+
+                       function getArrayBuffer(json, uuid) {
+                               if (arrayBufferMap[uuid] !== undefined) return arrayBufferMap[uuid];
+                               const arrayBuffers = json.arrayBuffers;
+                               const arrayBuffer = arrayBuffers[uuid];
+                               const ab = new Uint32Array(arrayBuffer).buffer;
+                               arrayBufferMap[uuid] = ab;
+                               return ab;
+                       }
+
+                       const geometry = json.isInstancedBufferGeometry ? new InstancedBufferGeometry() : new BufferGeometry();
+                       const index = json.data.index;
+
+                       if (index !== undefined) {
+                               const typedArray = getTypedArray(index.type, index.array);
+                               geometry.setIndex(new BufferAttribute(typedArray, 1));
+                       }
+
+                       const attributes = json.data.attributes;
+
+                       for (const key in attributes) {
+                               const attribute = attributes[key];
+                               let bufferAttribute;
+
+                               if (attribute.isInterleavedBufferAttribute) {
+                                       const interleavedBuffer = getInterleavedBuffer(json.data, attribute.data);
+                                       bufferAttribute = new InterleavedBufferAttribute(interleavedBuffer, attribute.itemSize, attribute.offset, attribute.normalized);
+                               } else {
+                                       const typedArray = getTypedArray(attribute.type, attribute.array);
+                                       const bufferAttributeConstr = attribute.isInstancedBufferAttribute ? InstancedBufferAttribute : BufferAttribute;
+                                       bufferAttribute = new bufferAttributeConstr(typedArray, attribute.itemSize, attribute.normalized);
+                               }
+
+                               if (attribute.name !== undefined) bufferAttribute.name = attribute.name;
+                               if (attribute.usage !== undefined) bufferAttribute.setUsage(attribute.usage);
+
+                               if (attribute.updateRange !== undefined) {
+                                       bufferAttribute.updateRange.offset = attribute.updateRange.offset;
+                                       bufferAttribute.updateRange.count = attribute.updateRange.count;
+                               }
+
+                               geometry.setAttribute(key, bufferAttribute);
+                       }
+
+                       const morphAttributes = json.data.morphAttributes;
+
+                       if (morphAttributes) {
+                               for (const key in morphAttributes) {
+                                       const attributeArray = morphAttributes[key];
+                                       const array = [];
+
+                                       for (let i = 0, il = attributeArray.length; i < il; i++) {
+                                               const attribute = attributeArray[i];
+                                               let bufferAttribute;
+
+                                               if (attribute.isInterleavedBufferAttribute) {
+                                                       const interleavedBuffer = getInterleavedBuffer(json.data, attribute.data);
+                                                       bufferAttribute = new InterleavedBufferAttribute(interleavedBuffer, attribute.itemSize, attribute.offset, attribute.normalized);
+                                               } else {
+                                                       const typedArray = getTypedArray(attribute.type, attribute.array);
+                                                       bufferAttribute = new BufferAttribute(typedArray, attribute.itemSize, attribute.normalized);
+                                               }
+
+                                               if (attribute.name !== undefined) bufferAttribute.name = attribute.name;
+                                               array.push(bufferAttribute);
+                                       }
+
+                                       geometry.morphAttributes[key] = array;
+                               }
+                       }
+
+                       const morphTargetsRelative = json.data.morphTargetsRelative;
+
+                       if (morphTargetsRelative) {
+                               geometry.morphTargetsRelative = true;
+                       }
+
+                       const groups = json.data.groups || json.data.drawcalls || json.data.offsets;
+
+                       if (groups !== undefined) {
+                               for (let i = 0, n = groups.length; i !== n; ++i) {
+                                       const group = groups[i];
+                                       geometry.addGroup(group.start, group.count, group.materialIndex);
+                               }
+                       }
+
+                       const boundingSphere = json.data.boundingSphere;
+
+                       if (boundingSphere !== undefined) {
+                               const center = new Vector3();
+
+                               if (boundingSphere.center !== undefined) {
+                                       center.fromArray(boundingSphere.center);
+                               }
+
+                               geometry.boundingSphere = new Sphere(center, boundingSphere.radius);
+                       }
+
+                       if (json.name) geometry.name = json.name;
+                       if (json.userData) geometry.userData = json.userData;
+                       return geometry;
+               }
+
+       }
+
+       class ObjectLoader extends Loader {
+               constructor(manager) {
+                       super(manager);
+               }
+
+               load(url, onLoad, onProgress, onError) {
+                       const scope = this;
+                       const path = this.path === '' ? LoaderUtils.extractUrlBase(url) : this.path;
+                       this.resourcePath = this.resourcePath || path;
+                       const loader = new FileLoader(this.manager);
+                       loader.setPath(this.path);
+                       loader.setRequestHeader(this.requestHeader);
+                       loader.setWithCredentials(this.withCredentials);
+                       loader.load(url, function (text) {
+                               let json = null;
+
+                               try {
+                                       json = JSON.parse(text);
+                               } catch (error) {
+                                       if (onError !== undefined) onError(error);
+                                       console.error('THREE:ObjectLoader: Can\'t parse ' + url + '.', error.message);
+                                       return;
+                               }
+
+                               const metadata = json.metadata;
+
+                               if (metadata === undefined || metadata.type === undefined || metadata.type.toLowerCase() === 'geometry') {
+                                       console.error('THREE.ObjectLoader: Can\'t load ' + url);
+                                       return;
+                               }
+
+                               scope.parse(json, onLoad);
+                       }, onProgress, onError);
+               }
+
+               async loadAsync(url, onProgress) {
+                       const scope = this;
+                       const path = this.path === '' ? LoaderUtils.extractUrlBase(url) : this.path;
+                       this.resourcePath = this.resourcePath || path;
+                       const loader = new FileLoader(this.manager);
+                       loader.setPath(this.path);
+                       loader.setRequestHeader(this.requestHeader);
+                       loader.setWithCredentials(this.withCredentials);
+                       const text = await loader.loadAsync(url, onProgress);
+                       const json = JSON.parse(text);
+                       const metadata = json.metadata;
+
+                       if (metadata === undefined || metadata.type === undefined || metadata.type.toLowerCase() === 'geometry') {
+                               throw new Error('THREE.ObjectLoader: Can\'t load ' + url);
+                       }
+
+                       return await scope.parseAsync(json);
+               }
+
+               parse(json, onLoad) {
+                       const animations = this.parseAnimations(json.animations);
+                       const shapes = this.parseShapes(json.shapes);
+                       const geometries = this.parseGeometries(json.geometries, shapes);
+                       const images = this.parseImages(json.images, function () {
+                               if (onLoad !== undefined) onLoad(object);
+                       });
+                       const textures = this.parseTextures(json.textures, images);
+                       const materials = this.parseMaterials(json.materials, textures);
+                       const object = this.parseObject(json.object, geometries, materials, textures, animations);
+                       const skeletons = this.parseSkeletons(json.skeletons, object);
+                       this.bindSkeletons(object, skeletons); //
+
+                       if (onLoad !== undefined) {
+                               let hasImages = false;
+
+                               for (const uuid in images) {
+                                       if (images[uuid] instanceof HTMLImageElement) {
+                                               hasImages = true;
+                                               break;
+                                       }
+                               }
+
+                               if (hasImages === false) onLoad(object);
+                       }
+
+                       return object;
+               }
+
+               async parseAsync(json) {
+                       const animations = this.parseAnimations(json.animations);
+                       const shapes = this.parseShapes(json.shapes);
+                       const geometries = this.parseGeometries(json.geometries, shapes);
+                       const images = await this.parseImagesAsync(json.images);
+                       const textures = this.parseTextures(json.textures, images);
+                       const materials = this.parseMaterials(json.materials, textures);
+                       const object = this.parseObject(json.object, geometries, materials, textures, animations);
+                       const skeletons = this.parseSkeletons(json.skeletons, object);
+                       this.bindSkeletons(object, skeletons);
+                       return object;
+               }
+
+               parseShapes(json) {
+                       const shapes = {};
+
+                       if (json !== undefined) {
+                               for (let i = 0, l = json.length; i < l; i++) {
+                                       const shape = new Shape().fromJSON(json[i]);
+                                       shapes[shape.uuid] = shape;
+                               }
+                       }
+
+                       return shapes;
+               }
+
+               parseSkeletons(json, object) {
+                       const skeletons = {};
+                       const bones = {}; // generate bone lookup table
+
+                       object.traverse(function (child) {
+                               if (child.isBone) bones[child.uuid] = child;
+                       }); // create skeletons
+
+                       if (json !== undefined) {
+                               for (let i = 0, l = json.length; i < l; i++) {
+                                       const skeleton = new Skeleton().fromJSON(json[i], bones);
+                                       skeletons[skeleton.uuid] = skeleton;
+                               }
+                       }
+
+                       return skeletons;
+               }
+
+               parseGeometries(json, shapes) {
+                       const geometries = {};
+
+                       if (json !== undefined) {
+                               const bufferGeometryLoader = new BufferGeometryLoader();
+
+                               for (let i = 0, l = json.length; i < l; i++) {
+                                       let geometry;
+                                       const data = json[i];
+
+                                       switch (data.type) {
+                                               case 'BufferGeometry':
+                                               case 'InstancedBufferGeometry':
+                                                       geometry = bufferGeometryLoader.parse(data);
+                                                       break;
+
+                                               case 'Geometry':
+                                                       console.error('THREE.ObjectLoader: The legacy Geometry type is no longer supported.');
+                                                       break;
+
+                                               default:
+                                                       if (data.type in Geometries) {
+                                                               geometry = Geometries[data.type].fromJSON(data, shapes);
+                                                       } else {
+                                                               console.warn(`THREE.ObjectLoader: Unsupported geometry type "${data.type}"`);
+                                                       }
+
+                                       }
+
+                                       geometry.uuid = data.uuid;
+                                       if (data.name !== undefined) geometry.name = data.name;
+                                       if (geometry.isBufferGeometry === true && data.userData !== undefined) geometry.userData = data.userData;
+                                       geometries[data.uuid] = geometry;
+                               }
+                       }
+
+                       return geometries;
+               }
+
+               parseMaterials(json, textures) {
+                       const cache = {}; // MultiMaterial
+
+                       const materials = {};
+
+                       if (json !== undefined) {
+                               const loader = new MaterialLoader();
+                               loader.setTextures(textures);
+
+                               for (let i = 0, l = json.length; i < l; i++) {
+                                       const data = json[i];
+
+                                       if (data.type === 'MultiMaterial') {
+                                               // Deprecated
+                                               const array = [];
+
+                                               for (let j = 0; j < data.materials.length; j++) {
+                                                       const material = data.materials[j];
+
+                                                       if (cache[material.uuid] === undefined) {
+                                                               cache[material.uuid] = loader.parse(material);
+                                                       }
+
+                                                       array.push(cache[material.uuid]);
+                                               }
+
+                                               materials[data.uuid] = array;
+                                       } else {
+                                               if (cache[data.uuid] === undefined) {
+                                                       cache[data.uuid] = loader.parse(data);
+                                               }
+
+                                               materials[data.uuid] = cache[data.uuid];
+                                       }
+                               }
+                       }
+
+                       return materials;
+               }
+
+               parseAnimations(json) {
+                       const animations = {};
+
+                       if (json !== undefined) {
+                               for (let i = 0; i < json.length; i++) {
+                                       const data = json[i];
+                                       const clip = AnimationClip.parse(data);
+                                       animations[clip.uuid] = clip;
+                               }
+                       }
+
+                       return animations;
+               }
+
+               parseImages(json, onLoad) {
+                       const scope = this;
+                       const images = {};
+                       let loader;
+
+                       function loadImage(url) {
+                               scope.manager.itemStart(url);
+                               return loader.load(url, function () {
+                                       scope.manager.itemEnd(url);
+                               }, undefined, function () {
+                                       scope.manager.itemError(url);
+                                       scope.manager.itemEnd(url);
+                               });
+                       }
+
+                       function deserializeImage(image) {
+                               if (typeof image === 'string') {
+                                       const url = image;
+                                       const path = /^(\/\/)|([a-z]+:(\/\/)?)/i.test(url) ? url : scope.resourcePath + url;
+                                       return loadImage(path);
+                               } else {
+                                       if (image.data) {
+                                               return {
+                                                       data: getTypedArray(image.type, image.data),
+                                                       width: image.width,
+                                                       height: image.height
+                                               };
+                                       } else {
+                                               return null;
+                                       }
+                               }
+                       }
+
+                       if (json !== undefined && json.length > 0) {
+                               const manager = new LoadingManager(onLoad);
+                               loader = new ImageLoader(manager);
+                               loader.setCrossOrigin(this.crossOrigin);
+
+                               for (let i = 0, il = json.length; i < il; i++) {
+                                       const image = json[i];
+                                       const url = image.url;
+
+                                       if (Array.isArray(url)) {
+                                               // load array of images e.g CubeTexture
+                                               images[image.uuid] = [];
+
+                                               for (let j = 0, jl = url.length; j < jl; j++) {
+                                                       const currentUrl = url[j];
+                                                       const deserializedImage = deserializeImage(currentUrl);
+
+                                                       if (deserializedImage !== null) {
+                                                               if (deserializedImage instanceof HTMLImageElement) {
+                                                                       images[image.uuid].push(deserializedImage);
+                                                               } else {
+                                                                       // special case: handle array of data textures for cube textures
+                                                                       images[image.uuid].push(new DataTexture(deserializedImage.data, deserializedImage.width, deserializedImage.height));
+                                                               }
+                                                       }
+                                               }
+                                       } else {
+                                               // load single image
+                                               const deserializedImage = deserializeImage(image.url);
+
+                                               if (deserializedImage !== null) {
+                                                       images[image.uuid] = deserializedImage;
+                                               }
+                                       }
+                               }
+                       }
+
+                       return images;
+               }
+
+               async parseImagesAsync(json) {
+                       const scope = this;
+                       const images = {};
+                       let loader;
+
+                       async function deserializeImage(image) {
+                               if (typeof image === 'string') {
+                                       const url = image;
+                                       const path = /^(\/\/)|([a-z]+:(\/\/)?)/i.test(url) ? url : scope.resourcePath + url;
+                                       return await loader.loadAsync(path);
+                               } else {
+                                       if (image.data) {
+                                               return {
+                                                       data: getTypedArray(image.type, image.data),
+                                                       width: image.width,
+                                                       height: image.height
+                                               };
+                                       } else {
+                                               return null;
+                                       }
+                               }
+                       }
+
+                       if (json !== undefined && json.length > 0) {
+                               loader = new ImageLoader(this.manager);
+                               loader.setCrossOrigin(this.crossOrigin);
+
+                               for (let i = 0, il = json.length; i < il; i++) {
+                                       const image = json[i];
+                                       const url = image.url;
+
+                                       if (Array.isArray(url)) {
+                                               // load array of images e.g CubeTexture
+                                               images[image.uuid] = [];
+
+                                               for (let j = 0, jl = url.length; j < jl; j++) {
+                                                       const currentUrl = url[j];
+                                                       const deserializedImage = await deserializeImage(currentUrl);
+
+                                                       if (deserializedImage !== null) {
+                                                               if (deserializedImage instanceof HTMLImageElement) {
+                                                                       images[image.uuid].push(deserializedImage);
+                                                               } else {
+                                                                       // special case: handle array of data textures for cube textures
+                                                                       images[image.uuid].push(new DataTexture(deserializedImage.data, deserializedImage.width, deserializedImage.height));
+                                                               }
+                                                       }
+                                               }
+                                       } else {
+                                               // load single image
+                                               const deserializedImage = await deserializeImage(image.url);
+
+                                               if (deserializedImage !== null) {
+                                                       images[image.uuid] = deserializedImage;
+                                               }
+                                       }
+                               }
+                       }
+
+                       return images;
+               }
+
+               parseTextures(json, images) {
+                       function parseConstant(value, type) {
+                               if (typeof value === 'number') return value;
+                               console.warn('THREE.ObjectLoader.parseTexture: Constant should be in numeric form.', value);
+                               return type[value];
+                       }
+
+                       const textures = {};
+
+                       if (json !== undefined) {
+                               for (let i = 0, l = json.length; i < l; i++) {
+                                       const data = json[i];
+
+                                       if (data.image === undefined) {
+                                               console.warn('THREE.ObjectLoader: No "image" specified for', data.uuid);
+                                       }
+
+                                       if (images[data.image] === undefined) {
+                                               console.warn('THREE.ObjectLoader: Undefined image', data.image);
+                                       }
+
+                                       let texture;
+                                       const image = images[data.image];
+
+                                       if (Array.isArray(image)) {
+                                               texture = new CubeTexture(image);
+                                               if (image.length === 6) texture.needsUpdate = true;
+                                       } else {
+                                               if (image && image.data) {
+                                                       texture = new DataTexture(image.data, image.width, image.height);
+                                               } else {
+                                                       texture = new Texture(image);
+                                               }
+
+                                               if (image) texture.needsUpdate = true; // textures can have undefined image data
+                                       }
+
+                                       texture.uuid = data.uuid;
+                                       if (data.name !== undefined) texture.name = data.name;
+                                       if (data.mapping !== undefined) texture.mapping = parseConstant(data.mapping, TEXTURE_MAPPING);
+                                       if (data.offset !== undefined) texture.offset.fromArray(data.offset);
+                                       if (data.repeat !== undefined) texture.repeat.fromArray(data.repeat);
+                                       if (data.center !== undefined) texture.center.fromArray(data.center);
+                                       if (data.rotation !== undefined) texture.rotation = data.rotation;
+
+                                       if (data.wrap !== undefined) {
+                                               texture.wrapS = parseConstant(data.wrap[0], TEXTURE_WRAPPING);
+                                               texture.wrapT = parseConstant(data.wrap[1], TEXTURE_WRAPPING);
+                                       }
+
+                                       if (data.format !== undefined) texture.format = data.format;
+                                       if (data.type !== undefined) texture.type = data.type;
+                                       if (data.encoding !== undefined) texture.encoding = data.encoding;
+                                       if (data.minFilter !== undefined) texture.minFilter = parseConstant(data.minFilter, TEXTURE_FILTER);
+                                       if (data.magFilter !== undefined) texture.magFilter = parseConstant(data.magFilter, TEXTURE_FILTER);
+                                       if (data.anisotropy !== undefined) texture.anisotropy = data.anisotropy;
+                                       if (data.flipY !== undefined) texture.flipY = data.flipY;
+                                       if (data.premultiplyAlpha !== undefined) texture.premultiplyAlpha = data.premultiplyAlpha;
+                                       if (data.unpackAlignment !== undefined) texture.unpackAlignment = data.unpackAlignment;
+                                       textures[data.uuid] = texture;
+                               }
+                       }
+
+                       return textures;
+               }
+
+               parseObject(data, geometries, materials, textures, animations) {
+                       let object;
+
+                       function getGeometry(name) {
+                               if (geometries[name] === undefined) {
+                                       console.warn('THREE.ObjectLoader: Undefined geometry', name);
+                               }
+
+                               return geometries[name];
+                       }
+
+                       function getMaterial(name) {
+                               if (name === undefined) return undefined;
+
+                               if (Array.isArray(name)) {
+                                       const array = [];
+
+                                       for (let i = 0, l = name.length; i < l; i++) {
+                                               const uuid = name[i];
+
+                                               if (materials[uuid] === undefined) {
+                                                       console.warn('THREE.ObjectLoader: Undefined material', uuid);
+                                               }
+
+                                               array.push(materials[uuid]);
+                                       }
+
+                                       return array;
+                               }
+
+                               if (materials[name] === undefined) {
+                                       console.warn('THREE.ObjectLoader: Undefined material', name);
+                               }
+
+                               return materials[name];
+                       }
+
+                       function getTexture(uuid) {
+                               if (textures[uuid] === undefined) {
+                                       console.warn('THREE.ObjectLoader: Undefined texture', uuid);
+                               }
+
+                               return textures[uuid];
+                       }
+
+                       let geometry, material;
+
+                       switch (data.type) {
+                               case 'Scene':
+                                       object = new Scene();
+
+                                       if (data.background !== undefined) {
+                                               if (Number.isInteger(data.background)) {
+                                                       object.background = new Color(data.background);
+                                               } else {
+                                                       object.background = getTexture(data.background);
+                                               }
+                                       }
+
+                                       if (data.environment !== undefined) {
+                                               object.environment = getTexture(data.environment);
+                                       }
+
+                                       if (data.fog !== undefined) {
+                                               if (data.fog.type === 'Fog') {
+                                                       object.fog = new Fog(data.fog.color, data.fog.near, data.fog.far);
+                                               } else if (data.fog.type === 'FogExp2') {
+                                                       object.fog = new FogExp2(data.fog.color, data.fog.density);
+                                               }
+                                       }
+
+                                       break;
+
+                               case 'PerspectiveCamera':
+                                       object = new PerspectiveCamera(data.fov, data.aspect, data.near, data.far);
+                                       if (data.focus !== undefined) object.focus = data.focus;
+                                       if (data.zoom !== undefined) object.zoom = data.zoom;
+                                       if (data.filmGauge !== undefined) object.filmGauge = data.filmGauge;
+                                       if (data.filmOffset !== undefined) object.filmOffset = data.filmOffset;
+                                       if (data.view !== undefined) object.view = Object.assign({}, data.view);
+                                       break;
+
+                               case 'OrthographicCamera':
+                                       object = new OrthographicCamera(data.left, data.right, data.top, data.bottom, data.near, data.far);
+                                       if (data.zoom !== undefined) object.zoom = data.zoom;
+                                       if (data.view !== undefined) object.view = Object.assign({}, data.view);
+                                       break;
+
+                               case 'AmbientLight':
+                                       object = new AmbientLight(data.color, data.intensity);
+                                       break;
+
+                               case 'DirectionalLight':
+                                       object = new DirectionalLight(data.color, data.intensity);
+                                       break;
+
+                               case 'PointLight':
+                                       object = new PointLight(data.color, data.intensity, data.distance, data.decay);
+                                       break;
+
+                               case 'RectAreaLight':
+                                       object = new RectAreaLight(data.color, data.intensity, data.width, data.height);
+                                       break;
+
+                               case 'SpotLight':
+                                       object = new SpotLight(data.color, data.intensity, data.distance, data.angle, data.penumbra, data.decay);
+                                       break;
+
+                               case 'HemisphereLight':
+                                       object = new HemisphereLight(data.color, data.groundColor, data.intensity);
+                                       break;
+
+                               case 'LightProbe':
+                                       object = new LightProbe().fromJSON(data);
+                                       break;
+
+                               case 'SkinnedMesh':
+                                       geometry = getGeometry(data.geometry);
+                                       material = getMaterial(data.material);
+                                       object = new SkinnedMesh(geometry, material);
+                                       if (data.bindMode !== undefined) object.bindMode = data.bindMode;
+                                       if (data.bindMatrix !== undefined) object.bindMatrix.fromArray(data.bindMatrix);
+                                       if (data.skeleton !== undefined) object.skeleton = data.skeleton;
+                                       break;
+
+                               case 'Mesh':
+                                       geometry = getGeometry(data.geometry);
+                                       material = getMaterial(data.material);
+                                       object = new Mesh(geometry, material);
+                                       break;
+
+                               case 'InstancedMesh':
+                                       geometry = getGeometry(data.geometry);
+                                       material = getMaterial(data.material);
+                                       const count = data.count;
+                                       const instanceMatrix = data.instanceMatrix;
+                                       const instanceColor = data.instanceColor;
+                                       object = new InstancedMesh(geometry, material, count);
+                                       object.instanceMatrix = new InstancedBufferAttribute(new Float32Array(instanceMatrix.array), 16);
+                                       if (instanceColor !== undefined) object.instanceColor = new InstancedBufferAttribute(new Float32Array(instanceColor.array), instanceColor.itemSize);
+                                       break;
+
+                               case 'LOD':
+                                       object = new LOD();
+                                       break;
+
+                               case 'Line':
+                                       object = new Line(getGeometry(data.geometry), getMaterial(data.material));
+                                       break;
+
+                               case 'LineLoop':
+                                       object = new LineLoop(getGeometry(data.geometry), getMaterial(data.material));
+                                       break;
+
+                               case 'LineSegments':
+                                       object = new LineSegments(getGeometry(data.geometry), getMaterial(data.material));
+                                       break;
+
+                               case 'PointCloud':
+                               case 'Points':
+                                       object = new Points(getGeometry(data.geometry), getMaterial(data.material));
+                                       break;
+
+                               case 'Sprite':
+                                       object = new Sprite(getMaterial(data.material));
+                                       break;
+
+                               case 'Group':
+                                       object = new Group();
+                                       break;
+
+                               case 'Bone':
+                                       object = new Bone();
+                                       break;
+
+                               default:
+                                       object = new Object3D();
+                       }
+
+                       object.uuid = data.uuid;
+                       if (data.name !== undefined) object.name = data.name;
+
+                       if (data.matrix !== undefined) {
+                               object.matrix.fromArray(data.matrix);
+                               if (data.matrixAutoUpdate !== undefined) object.matrixAutoUpdate = data.matrixAutoUpdate;
+                               if (object.matrixAutoUpdate) object.matrix.decompose(object.position, object.quaternion, object.scale);
+                       } else {
+                               if (data.position !== undefined) object.position.fromArray(data.position);
+                               if (data.rotation !== undefined) object.rotation.fromArray(data.rotation);
+                               if (data.quaternion !== undefined) object.quaternion.fromArray(data.quaternion);
+                               if (data.scale !== undefined) object.scale.fromArray(data.scale);
+                       }
+
+                       if (data.castShadow !== undefined) object.castShadow = data.castShadow;
+                       if (data.receiveShadow !== undefined) object.receiveShadow = data.receiveShadow;
+
+                       if (data.shadow) {
+                               if (data.shadow.bias !== undefined) object.shadow.bias = data.shadow.bias;
+                               if (data.shadow.normalBias !== undefined) object.shadow.normalBias = data.shadow.normalBias;
+                               if (data.shadow.radius !== undefined) object.shadow.radius = data.shadow.radius;
+                               if (data.shadow.mapSize !== undefined) object.shadow.mapSize.fromArray(data.shadow.mapSize);
+                               if (data.shadow.camera !== undefined) object.shadow.camera = this.parseObject(data.shadow.camera);
+                       }
+
+                       if (data.visible !== undefined) object.visible = data.visible;
+                       if (data.frustumCulled !== undefined) object.frustumCulled = data.frustumCulled;
+                       if (data.renderOrder !== undefined) object.renderOrder = data.renderOrder;
+                       if (data.userData !== undefined) object.userData = data.userData;
+                       if (data.layers !== undefined) object.layers.mask = data.layers;
+
+                       if (data.children !== undefined) {
+                               const children = data.children;
+
+                               for (let i = 0; i < children.length; i++) {
+                                       object.add(this.parseObject(children[i], geometries, materials, textures, animations));
+                               }
+                       }
+
+                       if (data.animations !== undefined) {
+                               const objectAnimations = data.animations;
+
+                               for (let i = 0; i < objectAnimations.length; i++) {
+                                       const uuid = objectAnimations[i];
+                                       object.animations.push(animations[uuid]);
+                               }
+                       }
+
+                       if (data.type === 'LOD') {
+                               if (data.autoUpdate !== undefined) object.autoUpdate = data.autoUpdate;
+                               const levels = data.levels;
+
+                               for (let l = 0; l < levels.length; l++) {
+                                       const level = levels[l];
+                                       const child = object.getObjectByProperty('uuid', level.object);
+
+                                       if (child !== undefined) {
+                                               object.addLevel(child, level.distance);
+                                       }
+                               }
+                       }
+
+                       return object;
+               }
+
+               bindSkeletons(object, skeletons) {
+                       if (Object.keys(skeletons).length === 0) return;
+                       object.traverse(function (child) {
+                               if (child.isSkinnedMesh === true && child.skeleton !== undefined) {
+                                       const skeleton = skeletons[child.skeleton];
+
+                                       if (skeleton === undefined) {
+                                               console.warn('THREE.ObjectLoader: No skeleton found with UUID:', child.skeleton);
+                                       } else {
+                                               child.bind(skeleton, child.bindMatrix);
+                                       }
+                               }
+                       });
+               }
+               /* DEPRECATED */
+
+
+               setTexturePath(value) {
+                       console.warn('THREE.ObjectLoader: .setTexturePath() has been renamed to .setResourcePath().');
+                       return this.setResourcePath(value);
+               }
+
+       }
+
+       const TEXTURE_MAPPING = {
+               UVMapping: UVMapping,
+               CubeReflectionMapping: CubeReflectionMapping,
+               CubeRefractionMapping: CubeRefractionMapping,
+               EquirectangularReflectionMapping: EquirectangularReflectionMapping,
+               EquirectangularRefractionMapping: EquirectangularRefractionMapping,
+               CubeUVReflectionMapping: CubeUVReflectionMapping,
+               CubeUVRefractionMapping: CubeUVRefractionMapping
+       };
+       const TEXTURE_WRAPPING = {
+               RepeatWrapping: RepeatWrapping,
+               ClampToEdgeWrapping: ClampToEdgeWrapping,
+               MirroredRepeatWrapping: MirroredRepeatWrapping
+       };
+       const TEXTURE_FILTER = {
+               NearestFilter: NearestFilter,
+               NearestMipmapNearestFilter: NearestMipmapNearestFilter,
+               NearestMipmapLinearFilter: NearestMipmapLinearFilter,
+               LinearFilter: LinearFilter,
+               LinearMipmapNearestFilter: LinearMipmapNearestFilter,
+               LinearMipmapLinearFilter: LinearMipmapLinearFilter
+       };
+
+       class ImageBitmapLoader extends Loader {
+               constructor(manager) {
+                       super(manager);
+
+                       if (typeof createImageBitmap === 'undefined') {
+                               console.warn('THREE.ImageBitmapLoader: createImageBitmap() not supported.');
+                       }
+
+                       if (typeof fetch === 'undefined') {
+                               console.warn('THREE.ImageBitmapLoader: fetch() not supported.');
+                       }
+
+                       this.options = {
+                               premultiplyAlpha: 'none'
+                       };
+               }
+
+               setOptions(options) {
+                       this.options = options;
+                       return this;
+               }
+
+               load(url, onLoad, onProgress, onError) {
+                       if (url === undefined) url = '';
+                       if (this.path !== undefined) url = this.path + url;
+                       url = this.manager.resolveURL(url);
+                       const scope = this;
+                       const cached = Cache.get(url);
+
+                       if (cached !== undefined) {
+                               scope.manager.itemStart(url);
+                               setTimeout(function () {
+                                       if (onLoad) onLoad(cached);
+                                       scope.manager.itemEnd(url);
+                               }, 0);
+                               return cached;
+                       }
+
+                       const fetchOptions = {};
+                       fetchOptions.credentials = this.crossOrigin === 'anonymous' ? 'same-origin' : 'include';
+                       fetchOptions.headers = this.requestHeader;
+                       fetch(url, fetchOptions).then(function (res) {
+                               return res.blob();
+                       }).then(function (blob) {
+                               return createImageBitmap(blob, Object.assign(scope.options, {
+                                       colorSpaceConversion: 'none'
+                               }));
+                       }).then(function (imageBitmap) {
+                               Cache.add(url, imageBitmap);
+                               if (onLoad) onLoad(imageBitmap);
+                               scope.manager.itemEnd(url);
+                       }).catch(function (e) {
+                               if (onError) onError(e);
+                               scope.manager.itemError(url);
+                               scope.manager.itemEnd(url);
+                       });
+                       scope.manager.itemStart(url);
+               }
+
+       }
+
+       ImageBitmapLoader.prototype.isImageBitmapLoader = true;
+
+       class ShapePath {
+               constructor() {
+                       this.type = 'ShapePath';
+                       this.color = new Color();
+                       this.subPaths = [];
+                       this.currentPath = null;
+               }
+
+               moveTo(x, y) {
+                       this.currentPath = new Path();
+                       this.subPaths.push(this.currentPath);
+                       this.currentPath.moveTo(x, y);
+                       return this;
+               }
+
+               lineTo(x, y) {
+                       this.currentPath.lineTo(x, y);
+                       return this;
+               }
+
+               quadraticCurveTo(aCPx, aCPy, aX, aY) {
+                       this.currentPath.quadraticCurveTo(aCPx, aCPy, aX, aY);
+                       return this;
+               }
+
+               bezierCurveTo(aCP1x, aCP1y, aCP2x, aCP2y, aX, aY) {
+                       this.currentPath.bezierCurveTo(aCP1x, aCP1y, aCP2x, aCP2y, aX, aY);
+                       return this;
+               }
+
+               splineThru(pts) {
+                       this.currentPath.splineThru(pts);
+                       return this;
+               }
+
+               toShapes(isCCW, noHoles) {
+                       function toShapesNoHoles(inSubpaths) {
+                               const shapes = [];
+
+                               for (let i = 0, l = inSubpaths.length; i < l; i++) {
+                                       const tmpPath = inSubpaths[i];
+                                       const tmpShape = new Shape();
+                                       tmpShape.curves = tmpPath.curves;
+                                       shapes.push(tmpShape);
+                               }
+
+                               return shapes;
+                       }
+
+                       function isPointInsidePolygon(inPt, inPolygon) {
+                               const polyLen = inPolygon.length; // inPt on polygon contour => immediate success               or
+                               // toggling of inside/outside at every single! intersection point of an edge
+                               //      with the horizontal line through inPt, left of inPt
+                               //      not counting lowerY endpoints of edges and whole edges on that line
+
+                               let inside = false;
+
+                               for (let p = polyLen - 1, q = 0; q < polyLen; p = q++) {
+                                       let edgeLowPt = inPolygon[p];
+                                       let edgeHighPt = inPolygon[q];
+                                       let edgeDx = edgeHighPt.x - edgeLowPt.x;
+                                       let edgeDy = edgeHighPt.y - edgeLowPt.y;
+
+                                       if (Math.abs(edgeDy) > Number.EPSILON) {
+                                               // not parallel
+                                               if (edgeDy < 0) {
+                                                       edgeLowPt = inPolygon[q];
+                                                       edgeDx = -edgeDx;
+                                                       edgeHighPt = inPolygon[p];
+                                                       edgeDy = -edgeDy;
+                                               }
+
+                                               if (inPt.y < edgeLowPt.y || inPt.y > edgeHighPt.y) continue;
+
+                                               if (inPt.y === edgeLowPt.y) {
+                                                       if (inPt.x === edgeLowPt.x) return true; // inPt is on contour ?
+                                                       // continue;                            // no intersection or edgeLowPt => doesn't count !!!
+                                               } else {
+                                                       const perpEdge = edgeDy * (inPt.x - edgeLowPt.x) - edgeDx * (inPt.y - edgeLowPt.y);
+                                                       if (perpEdge === 0) return true; // inPt is on contour ?
+
+                                                       if (perpEdge < 0) continue;
+                                                       inside = !inside; // true intersection left of inPt
+                                               }
+                                       } else {
+                                               // parallel or collinear
+                                               if (inPt.y !== edgeLowPt.y) continue; // parallel
+                                               // edge lies on the same horizontal line as inPt
+
+                                               if (edgeHighPt.x <= inPt.x && inPt.x <= edgeLowPt.x || edgeLowPt.x <= inPt.x && inPt.x <= edgeHighPt.x) return true; // inPt: Point on contour !
+                                               // continue;
+                                       }
+                               }
+
+                               return inside;
+                       }
+
+                       const isClockWise = ShapeUtils.isClockWise;
+                       const subPaths = this.subPaths;
+                       if (subPaths.length === 0) return [];
+                       if (noHoles === true) return toShapesNoHoles(subPaths);
+                       let solid, tmpPath, tmpShape;
+                       const shapes = [];
+
+                       if (subPaths.length === 1) {
+                               tmpPath = subPaths[0];
+                               tmpShape = new Shape();
+                               tmpShape.curves = tmpPath.curves;
+                               shapes.push(tmpShape);
+                               return shapes;
+                       }
+
+                       let holesFirst = !isClockWise(subPaths[0].getPoints());
+                       holesFirst = isCCW ? !holesFirst : holesFirst; // console.log("Holes first", holesFirst);
+
+                       const betterShapeHoles = [];
+                       const newShapes = [];
+                       let newShapeHoles = [];
+                       let mainIdx = 0;
+                       let tmpPoints;
+                       newShapes[mainIdx] = undefined;
+                       newShapeHoles[mainIdx] = [];
+
+                       for (let i = 0, l = subPaths.length; i < l; i++) {
+                               tmpPath = subPaths[i];
+                               tmpPoints = tmpPath.getPoints();
+                               solid = isClockWise(tmpPoints);
+                               solid = isCCW ? !solid : solid;
+
+                               if (solid) {
+                                       if (!holesFirst && newShapes[mainIdx]) mainIdx++;
+                                       newShapes[mainIdx] = {
+                                               s: new Shape(),
+                                               p: tmpPoints
+                                       };
+                                       newShapes[mainIdx].s.curves = tmpPath.curves;
+                                       if (holesFirst) mainIdx++;
+                                       newShapeHoles[mainIdx] = []; //console.log('cw', i);
+                               } else {
+                                       newShapeHoles[mainIdx].push({
+                                               h: tmpPath,
+                                               p: tmpPoints[0]
+                                       }); //console.log('ccw', i);
+                               }
+                       } // only Holes? -> probably all Shapes with wrong orientation
+
+
+                       if (!newShapes[0]) return toShapesNoHoles(subPaths);
+
+                       if (newShapes.length > 1) {
+                               let ambiguous = false;
+                               const toChange = [];
+
+                               for (let sIdx = 0, sLen = newShapes.length; sIdx < sLen; sIdx++) {
+                                       betterShapeHoles[sIdx] = [];
+                               }
+
+                               for (let sIdx = 0, sLen = newShapes.length; sIdx < sLen; sIdx++) {
+                                       const sho = newShapeHoles[sIdx];
+
+                                       for (let hIdx = 0; hIdx < sho.length; hIdx++) {
+                                               const ho = sho[hIdx];
+                                               let hole_unassigned = true;
+
+                                               for (let s2Idx = 0; s2Idx < newShapes.length; s2Idx++) {
+                                                       if (isPointInsidePolygon(ho.p, newShapes[s2Idx].p)) {
+                                                               if (sIdx !== s2Idx) toChange.push({
+                                                                       froms: sIdx,
+                                                                       tos: s2Idx,
+                                                                       hole: hIdx
+                                                               });
+
+                                                               if (hole_unassigned) {
+                                                                       hole_unassigned = false;
+                                                                       betterShapeHoles[s2Idx].push(ho);
+                                                               } else {
+                                                                       ambiguous = true;
+                                                               }
+                                                       }
+                                               }
+
+                                               if (hole_unassigned) {
+                                                       betterShapeHoles[sIdx].push(ho);
+                                               }
+                                       }
+                               } // console.log("ambiguous: ", ambiguous);
+
+
+                               if (toChange.length > 0) {
+                                       // console.log("to change: ", toChange);
+                                       if (!ambiguous) newShapeHoles = betterShapeHoles;
+                               }
+                       }
+
+                       let tmpHoles;
+
+                       for (let i = 0, il = newShapes.length; i < il; i++) {
+                               tmpShape = newShapes[i].s;
+                               shapes.push(tmpShape);
+                               tmpHoles = newShapeHoles[i];
+
+                               for (let j = 0, jl = tmpHoles.length; j < jl; j++) {
+                                       tmpShape.holes.push(tmpHoles[j].h);
+                               }
+                       } //console.log("shape", shapes);
+
+
+                       return shapes;
+               }
+
+       }
+
+       class Font {
+               constructor(data) {
+                       this.type = 'Font';
+                       this.data = data;
+               }
+
+               generateShapes(text, size = 100) {
+                       const shapes = [];
+                       const paths = createPaths(text, size, this.data);
+
+                       for (let p = 0, pl = paths.length; p < pl; p++) {
+                               Array.prototype.push.apply(shapes, paths[p].toShapes());
+                       }
+
+                       return shapes;
+               }
+
+       }
+
+       function createPaths(text, size, data) {
+               const chars = Array.from(text);
+               const scale = size / data.resolution;
+               const line_height = (data.boundingBox.yMax - data.boundingBox.yMin + data.underlineThickness) * scale;
+               const paths = [];
+               let offsetX = 0,
+                               offsetY = 0;
+
+               for (let i = 0; i < chars.length; i++) {
+                       const char = chars[i];
+
+                       if (char === '\n') {
+                               offsetX = 0;
+                               offsetY -= line_height;
+                       } else {
+                               const ret = createPath(char, scale, offsetX, offsetY, data);
+                               offsetX += ret.offsetX;
+                               paths.push(ret.path);
+                       }
+               }
+
+               return paths;
+       }
+
+       function createPath(char, scale, offsetX, offsetY, data) {
+               const glyph = data.glyphs[char] || data.glyphs['?'];
+
+               if (!glyph) {
+                       console.error('THREE.Font: character "' + char + '" does not exists in font family ' + data.familyName + '.');
+                       return;
+               }
+
+               const path = new ShapePath();
+               let x, y, cpx, cpy, cpx1, cpy1, cpx2, cpy2;
+
+               if (glyph.o) {
+                       const outline = glyph._cachedOutline || (glyph._cachedOutline = glyph.o.split(' '));
+
+                       for (let i = 0, l = outline.length; i < l;) {
+                               const action = outline[i++];
+
+                               switch (action) {
+                                       case 'm':
+                                               // moveTo
+                                               x = outline[i++] * scale + offsetX;
+                                               y = outline[i++] * scale + offsetY;
+                                               path.moveTo(x, y);
+                                               break;
+
+                                       case 'l':
+                                               // lineTo
+                                               x = outline[i++] * scale + offsetX;
+                                               y = outline[i++] * scale + offsetY;
+                                               path.lineTo(x, y);
+                                               break;
+
+                                       case 'q':
+                                               // quadraticCurveTo
+                                               cpx = outline[i++] * scale + offsetX;
+                                               cpy = outline[i++] * scale + offsetY;
+                                               cpx1 = outline[i++] * scale + offsetX;
+                                               cpy1 = outline[i++] * scale + offsetY;
+                                               path.quadraticCurveTo(cpx1, cpy1, cpx, cpy);
+                                               break;
+
+                                       case 'b':
+                                               // bezierCurveTo
+                                               cpx = outline[i++] * scale + offsetX;
+                                               cpy = outline[i++] * scale + offsetY;
+                                               cpx1 = outline[i++] * scale + offsetX;
+                                               cpy1 = outline[i++] * scale + offsetY;
+                                               cpx2 = outline[i++] * scale + offsetX;
+                                               cpy2 = outline[i++] * scale + offsetY;
+                                               path.bezierCurveTo(cpx1, cpy1, cpx2, cpy2, cpx, cpy);
+                                               break;
+                               }
+                       }
+               }
+
+               return {
+                       offsetX: glyph.ha * scale,
+                       path: path
+               };
+       }
+
+       Font.prototype.isFont = true;
+
+       class FontLoader extends Loader {
+               constructor(manager) {
+                       super(manager);
+               }
+
+               load(url, onLoad, onProgress, onError) {
+                       const scope = this;
+                       const loader = new FileLoader(this.manager);
+                       loader.setPath(this.path);
+                       loader.setRequestHeader(this.requestHeader);
+                       loader.setWithCredentials(scope.withCredentials);
+                       loader.load(url, function (text) {
+                               let json;
+
+                               try {
+                                       json = JSON.parse(text);
+                               } catch (e) {
+                                       console.warn('THREE.FontLoader: typeface.js support is being deprecated. Use typeface.json instead.');
+                                       json = JSON.parse(text.substring(65, text.length - 2));
+                               }
+
+                               const font = scope.parse(json);
+                               if (onLoad) onLoad(font);
+                       }, onProgress, onError);
+               }
+
+               parse(json) {
+                       return new Font(json);
+               }
+
+       }
+
+       let _context;
+
+       const AudioContext = {
+               getContext: function () {
+                       if (_context === undefined) {
+                               _context = new (window.AudioContext || window.webkitAudioContext)();
+                       }
+
+                       return _context;
+               },
+               setContext: function (value) {
+                       _context = value;
+               }
+       };
+
+       class AudioLoader extends Loader {
+               constructor(manager) {
+                       super(manager);
+               }
+
+               load(url, onLoad, onProgress, onError) {
+                       const scope = this;
+                       const loader = new FileLoader(this.manager);
+                       loader.setResponseType('arraybuffer');
+                       loader.setPath(this.path);
+                       loader.setRequestHeader(this.requestHeader);
+                       loader.setWithCredentials(this.withCredentials);
+                       loader.load(url, function (buffer) {
+                               try {
+                                       // Create a copy of the buffer. The `decodeAudioData` method
+                                       // detaches the buffer when complete, preventing reuse.
+                                       const bufferCopy = buffer.slice(0);
+                                       const context = AudioContext.getContext();
+                                       context.decodeAudioData(bufferCopy, function (audioBuffer) {
+                                               onLoad(audioBuffer);
+                                       });
+                               } catch (e) {
+                                       if (onError) {
+                                               onError(e);
+                                       } else {
+                                               console.error(e);
+                                       }
+
+                                       scope.manager.itemError(url);
+                               }
+                       }, onProgress, onError);
+               }
+
+       }
+
+       class HemisphereLightProbe extends LightProbe {
+               constructor(skyColor, groundColor, intensity = 1) {
+                       super(undefined, intensity);
+                       const color1 = new Color().set(skyColor);
+                       const color2 = new Color().set(groundColor);
+                       const sky = new Vector3(color1.r, color1.g, color1.b);
+                       const ground = new Vector3(color2.r, color2.g, color2.b); // without extra factor of PI in the shader, should = 1 / Math.sqrt( Math.PI );
+
+                       const c0 = Math.sqrt(Math.PI);
+                       const c1 = c0 * Math.sqrt(0.75);
+                       this.sh.coefficients[0].copy(sky).add(ground).multiplyScalar(c0);
+                       this.sh.coefficients[1].copy(sky).sub(ground).multiplyScalar(c1);
+               }
+
+       }
+
+       HemisphereLightProbe.prototype.isHemisphereLightProbe = true;
+
+       class AmbientLightProbe extends LightProbe {
+               constructor(color, intensity = 1) {
+                       super(undefined, intensity);
+                       const color1 = new Color().set(color); // without extra factor of PI in the shader, would be 2 / Math.sqrt( Math.PI );
+
+                       this.sh.coefficients[0].set(color1.r, color1.g, color1.b).multiplyScalar(2 * Math.sqrt(Math.PI));
+               }
+
+       }
+
+       AmbientLightProbe.prototype.isAmbientLightProbe = true;
+
+       const _eyeRight = /*@__PURE__*/new Matrix4();
+
+       const _eyeLeft = /*@__PURE__*/new Matrix4();
+
+       class StereoCamera {
+               constructor() {
+                       this.type = 'StereoCamera';
+                       this.aspect = 1;
+                       this.eyeSep = 0.064;
+                       this.cameraL = new PerspectiveCamera();
+                       this.cameraL.layers.enable(1);
+                       this.cameraL.matrixAutoUpdate = false;
+                       this.cameraR = new PerspectiveCamera();
+                       this.cameraR.layers.enable(2);
+                       this.cameraR.matrixAutoUpdate = false;
+                       this._cache = {
+                               focus: null,
+                               fov: null,
+                               aspect: null,
+                               near: null,
+                               far: null,
+                               zoom: null,
+                               eyeSep: null
+                       };
+               }
+
+               update(camera) {
+                       const cache = this._cache;
+                       const needsUpdate = cache.focus !== camera.focus || cache.fov !== camera.fov || cache.aspect !== camera.aspect * this.aspect || cache.near !== camera.near || cache.far !== camera.far || cache.zoom !== camera.zoom || cache.eyeSep !== this.eyeSep;
+
+                       if (needsUpdate) {
+                               cache.focus = camera.focus;
+                               cache.fov = camera.fov;
+                               cache.aspect = camera.aspect * this.aspect;
+                               cache.near = camera.near;
+                               cache.far = camera.far;
+                               cache.zoom = camera.zoom;
+                               cache.eyeSep = this.eyeSep; // Off-axis stereoscopic effect based on
+                               // http://paulbourke.net/stereographics/stereorender/
+
+                               const projectionMatrix = camera.projectionMatrix.clone();
+                               const eyeSepHalf = cache.eyeSep / 2;
+                               const eyeSepOnProjection = eyeSepHalf * cache.near / cache.focus;
+                               const ymax = cache.near * Math.tan(DEG2RAD * cache.fov * 0.5) / cache.zoom;
+                               let xmin, xmax; // translate xOffset
+
+                               _eyeLeft.elements[12] = -eyeSepHalf;
+                               _eyeRight.elements[12] = eyeSepHalf; // for left eye
+
+                               xmin = -ymax * cache.aspect + eyeSepOnProjection;
+                               xmax = ymax * cache.aspect + eyeSepOnProjection;
+                               projectionMatrix.elements[0] = 2 * cache.near / (xmax - xmin);
+                               projectionMatrix.elements[8] = (xmax + xmin) / (xmax - xmin);
+                               this.cameraL.projectionMatrix.copy(projectionMatrix); // for right eye
+
+                               xmin = -ymax * cache.aspect - eyeSepOnProjection;
+                               xmax = ymax * cache.aspect - eyeSepOnProjection;
+                               projectionMatrix.elements[0] = 2 * cache.near / (xmax - xmin);
+                               projectionMatrix.elements[8] = (xmax + xmin) / (xmax - xmin);
+                               this.cameraR.projectionMatrix.copy(projectionMatrix);
+                       }
+
+                       this.cameraL.matrixWorld.copy(camera.matrixWorld).multiply(_eyeLeft);
+                       this.cameraR.matrixWorld.copy(camera.matrixWorld).multiply(_eyeRight);
+               }
+
+       }
+
+       class Clock {
+               constructor(autoStart = true) {
+                       this.autoStart = autoStart;
+                       this.startTime = 0;
+                       this.oldTime = 0;
+                       this.elapsedTime = 0;
+                       this.running = false;
+               }
+
+               start() {
+                       this.startTime = now();
+                       this.oldTime = this.startTime;
+                       this.elapsedTime = 0;
+                       this.running = true;
+               }
+
+               stop() {
+                       this.getElapsedTime();
+                       this.running = false;
+                       this.autoStart = false;
+               }
+
+               getElapsedTime() {
+                       this.getDelta();
+                       return this.elapsedTime;
+               }
+
+               getDelta() {
+                       let diff = 0;
+
+                       if (this.autoStart && !this.running) {
+                               this.start();
+                               return 0;
+                       }
+
+                       if (this.running) {
+                               const newTime = now();
+                               diff = (newTime - this.oldTime) / 1000;
+                               this.oldTime = newTime;
+                               this.elapsedTime += diff;
+                       }
+
+                       return diff;
+               }
+
+       }
+
+       function now() {
+               return (typeof performance === 'undefined' ? Date : performance).now(); // see #10732
+       }
+
+       const _position$1 = /*@__PURE__*/new Vector3();
+
+       const _quaternion$1 = /*@__PURE__*/new Quaternion();
+
+       const _scale$1 = /*@__PURE__*/new Vector3();
+
+       const _orientation$1 = /*@__PURE__*/new Vector3();
+
+       class AudioListener extends Object3D {
+               constructor() {
+                       super();
+                       this.type = 'AudioListener';
+                       this.context = AudioContext.getContext();
+                       this.gain = this.context.createGain();
+                       this.gain.connect(this.context.destination);
+                       this.filter = null;
+                       this.timeDelta = 0; // private
+
+                       this._clock = new Clock();
+               }
+
+               getInput() {
+                       return this.gain;
+               }
+
+               removeFilter() {
+                       if (this.filter !== null) {
+                               this.gain.disconnect(this.filter);
+                               this.filter.disconnect(this.context.destination);
+                               this.gain.connect(this.context.destination);
+                               this.filter = null;
+                       }
+
+                       return this;
+               }
+
+               getFilter() {
+                       return this.filter;
+               }
+
+               setFilter(value) {
+                       if (this.filter !== null) {
+                               this.gain.disconnect(this.filter);
+                               this.filter.disconnect(this.context.destination);
+                       } else {
+                               this.gain.disconnect(this.context.destination);
+                       }
+
+                       this.filter = value;
+                       this.gain.connect(this.filter);
+                       this.filter.connect(this.context.destination);
+                       return this;
+               }
+
+               getMasterVolume() {
+                       return this.gain.gain.value;
+               }
+
+               setMasterVolume(value) {
+                       this.gain.gain.setTargetAtTime(value, this.context.currentTime, 0.01);
+                       return this;
+               }
+
+               updateMatrixWorld(force) {
+                       super.updateMatrixWorld(force);
+                       const listener = this.context.listener;
+                       const up = this.up;
+                       this.timeDelta = this._clock.getDelta();
+                       this.matrixWorld.decompose(_position$1, _quaternion$1, _scale$1);
+
+                       _orientation$1.set(0, 0, -1).applyQuaternion(_quaternion$1);
+
+                       if (listener.positionX) {
+                               // code path for Chrome (see #14393)
+                               const endTime = this.context.currentTime + this.timeDelta;
+                               listener.positionX.linearRampToValueAtTime(_position$1.x, endTime);
+                               listener.positionY.linearRampToValueAtTime(_position$1.y, endTime);
+                               listener.positionZ.linearRampToValueAtTime(_position$1.z, endTime);
+                               listener.forwardX.linearRampToValueAtTime(_orientation$1.x, endTime);
+                               listener.forwardY.linearRampToValueAtTime(_orientation$1.y, endTime);
+                               listener.forwardZ.linearRampToValueAtTime(_orientation$1.z, endTime);
+                               listener.upX.linearRampToValueAtTime(up.x, endTime);
+                               listener.upY.linearRampToValueAtTime(up.y, endTime);
+                               listener.upZ.linearRampToValueAtTime(up.z, endTime);
+                       } else {
+                               listener.setPosition(_position$1.x, _position$1.y, _position$1.z);
+                               listener.setOrientation(_orientation$1.x, _orientation$1.y, _orientation$1.z, up.x, up.y, up.z);
+                       }
+               }
+
+       }
+
+       class Audio extends Object3D {
+               constructor(listener) {
+                       super();
+                       this.type = 'Audio';
+                       this.listener = listener;
+                       this.context = listener.context;
+                       this.gain = this.context.createGain();
+                       this.gain.connect(listener.getInput());
+                       this.autoplay = false;
+                       this.buffer = null;
+                       this.detune = 0;
+                       this.loop = false;
+                       this.loopStart = 0;
+                       this.loopEnd = 0;
+                       this.offset = 0;
+                       this.duration = undefined;
+                       this.playbackRate = 1;
+                       this.isPlaying = false;
+                       this.hasPlaybackControl = true;
+                       this.source = null;
+                       this.sourceType = 'empty';
+                       this._startedAt = 0;
+                       this._progress = 0;
+                       this._connected = false;
+                       this.filters = [];
+               }
+
+               getOutput() {
+                       return this.gain;
+               }
+
+               setNodeSource(audioNode) {
+                       this.hasPlaybackControl = false;
+                       this.sourceType = 'audioNode';
+                       this.source = audioNode;
+                       this.connect();
+                       return this;
+               }
+
+               setMediaElementSource(mediaElement) {
+                       this.hasPlaybackControl = false;
+                       this.sourceType = 'mediaNode';
+                       this.source = this.context.createMediaElementSource(mediaElement);
+                       this.connect();
+                       return this;
+               }
+
+               setMediaStreamSource(mediaStream) {
+                       this.hasPlaybackControl = false;
+                       this.sourceType = 'mediaStreamNode';
+                       this.source = this.context.createMediaStreamSource(mediaStream);
+                       this.connect();
+                       return this;
+               }
+
+               setBuffer(audioBuffer) {
+                       this.buffer = audioBuffer;
+                       this.sourceType = 'buffer';
+                       if (this.autoplay) this.play();
+                       return this;
+               }
+
+               play(delay = 0) {
+                       if (this.isPlaying === true) {
+                               console.warn('THREE.Audio: Audio is already playing.');
+                               return;
+                       }
+
+                       if (this.hasPlaybackControl === false) {
+                               console.warn('THREE.Audio: this Audio has no playback control.');
+                               return;
+                       }
+
+                       this._startedAt = this.context.currentTime + delay;
+                       const source = this.context.createBufferSource();
+                       source.buffer = this.buffer;
+                       source.loop = this.loop;
+                       source.loopStart = this.loopStart;
+                       source.loopEnd = this.loopEnd;
+                       source.onended = this.onEnded.bind(this);
+                       source.start(this._startedAt, this._progress + this.offset, this.duration);
+                       this.isPlaying = true;
+                       this.source = source;
+                       this.setDetune(this.detune);
+                       this.setPlaybackRate(this.playbackRate);
+                       return this.connect();
+               }
+
+               pause() {
+                       if (this.hasPlaybackControl === false) {
+                               console.warn('THREE.Audio: this Audio has no playback control.');
+                               return;
+                       }
+
+                       if (this.isPlaying === true) {
+                               // update current progress
+                               this._progress += Math.max(this.context.currentTime - this._startedAt, 0) * this.playbackRate;
+
+                               if (this.loop === true) {
+                                       // ensure _progress does not exceed duration with looped audios
+                                       this._progress = this._progress % (this.duration || this.buffer.duration);
+                               }
+
+                               this.source.stop();
+                               this.source.onended = null;
+                               this.isPlaying = false;
+                       }
+
+                       return this;
+               }
+
+               stop() {
+                       if (this.hasPlaybackControl === false) {
+                               console.warn('THREE.Audio: this Audio has no playback control.');
+                               return;
+                       }
+
+                       this._progress = 0;
+                       this.source.stop();
+                       this.source.onended = null;
+                       this.isPlaying = false;
+                       return this;
+               }
+
+               connect() {
+                       if (this.filters.length > 0) {
+                               this.source.connect(this.filters[0]);
+
+                               for (let i = 1, l = this.filters.length; i < l; i++) {
+                                       this.filters[i - 1].connect(this.filters[i]);
+                               }
+
+                               this.filters[this.filters.length - 1].connect(this.getOutput());
+                       } else {
+                               this.source.connect(this.getOutput());
+                       }
+
+                       this._connected = true;
+                       return this;
+               }
+
+               disconnect() {
+                       if (this.filters.length > 0) {
+                               this.source.disconnect(this.filters[0]);
+
+                               for (let i = 1, l = this.filters.length; i < l; i++) {
+                                       this.filters[i - 1].disconnect(this.filters[i]);
+                               }
+
+                               this.filters[this.filters.length - 1].disconnect(this.getOutput());
+                       } else {
+                               this.source.disconnect(this.getOutput());
+                       }
+
+                       this._connected = false;
+                       return this;
+               }
+
+               getFilters() {
+                       return this.filters;
+               }
+
+               setFilters(value) {
+                       if (!value) value = [];
+
+                       if (this._connected === true) {
+                               this.disconnect();
+                               this.filters = value.slice();
+                               this.connect();
+                       } else {
+                               this.filters = value.slice();
+                       }
+
+                       return this;
+               }
+
+               setDetune(value) {
+                       this.detune = value;
+                       if (this.source.detune === undefined) return; // only set detune when available
+
+                       if (this.isPlaying === true) {
+                               this.source.detune.setTargetAtTime(this.detune, this.context.currentTime, 0.01);
+                       }
+
+                       return this;
+               }
+
+               getDetune() {
+                       return this.detune;
+               }
+
+               getFilter() {
+                       return this.getFilters()[0];
+               }
+
+               setFilter(filter) {
+                       return this.setFilters(filter ? [filter] : []);
+               }
+
+               setPlaybackRate(value) {
+                       if (this.hasPlaybackControl === false) {
+                               console.warn('THREE.Audio: this Audio has no playback control.');
+                               return;
+                       }
+
+                       this.playbackRate = value;
+
+                       if (this.isPlaying === true) {
+                               this.source.playbackRate.setTargetAtTime(this.playbackRate, this.context.currentTime, 0.01);
+                       }
+
+                       return this;
+               }
+
+               getPlaybackRate() {
+                       return this.playbackRate;
+               }
+
+               onEnded() {
+                       this.isPlaying = false;
+               }
+
+               getLoop() {
+                       if (this.hasPlaybackControl === false) {
+                               console.warn('THREE.Audio: this Audio has no playback control.');
+                               return false;
+                       }
+
+                       return this.loop;
+               }
+
+               setLoop(value) {
+                       if (this.hasPlaybackControl === false) {
+                               console.warn('THREE.Audio: this Audio has no playback control.');
+                               return;
+                       }
+
+                       this.loop = value;
+
+                       if (this.isPlaying === true) {
+                               this.source.loop = this.loop;
+                       }
+
+                       return this;
+               }
+
+               setLoopStart(value) {
+                       this.loopStart = value;
+                       return this;
+               }
+
+               setLoopEnd(value) {
+                       this.loopEnd = value;
+                       return this;
+               }
+
+               getVolume() {
+                       return this.gain.gain.value;
+               }
+
+               setVolume(value) {
+                       this.gain.gain.setTargetAtTime(value, this.context.currentTime, 0.01);
+                       return this;
+               }
+
+       }
+
+       const _position = /*@__PURE__*/new Vector3();
+
+       const _quaternion = /*@__PURE__*/new Quaternion();
+
+       const _scale = /*@__PURE__*/new Vector3();
+
+       const _orientation = /*@__PURE__*/new Vector3();
+
+       class PositionalAudio extends Audio {
+               constructor(listener) {
+                       super(listener);
+                       this.panner = this.context.createPanner();
+                       this.panner.panningModel = 'HRTF';
+                       this.panner.connect(this.gain);
+               }
+
+               getOutput() {
+                       return this.panner;
+               }
+
+               getRefDistance() {
+                       return this.panner.refDistance;
+               }
+
+               setRefDistance(value) {
+                       this.panner.refDistance = value;
+                       return this;
+               }
+
+               getRolloffFactor() {
+                       return this.panner.rolloffFactor;
+               }
+
+               setRolloffFactor(value) {
+                       this.panner.rolloffFactor = value;
+                       return this;
+               }
+
+               getDistanceModel() {
+                       return this.panner.distanceModel;
+               }
+
+               setDistanceModel(value) {
+                       this.panner.distanceModel = value;
+                       return this;
+               }
+
+               getMaxDistance() {
+                       return this.panner.maxDistance;
+               }
+
+               setMaxDistance(value) {
+                       this.panner.maxDistance = value;
+                       return this;
+               }
+
+               setDirectionalCone(coneInnerAngle, coneOuterAngle, coneOuterGain) {
+                       this.panner.coneInnerAngle = coneInnerAngle;
+                       this.panner.coneOuterAngle = coneOuterAngle;
+                       this.panner.coneOuterGain = coneOuterGain;
+                       return this;
+               }
+
+               updateMatrixWorld(force) {
+                       super.updateMatrixWorld(force);
+                       if (this.hasPlaybackControl === true && this.isPlaying === false) return;
+                       this.matrixWorld.decompose(_position, _quaternion, _scale);
+
+                       _orientation.set(0, 0, 1).applyQuaternion(_quaternion);
+
+                       const panner = this.panner;
+
+                       if (panner.positionX) {
+                               // code path for Chrome and Firefox (see #14393)
+                               const endTime = this.context.currentTime + this.listener.timeDelta;
+                               panner.positionX.linearRampToValueAtTime(_position.x, endTime);
+                               panner.positionY.linearRampToValueAtTime(_position.y, endTime);
+                               panner.positionZ.linearRampToValueAtTime(_position.z, endTime);
+                               panner.orientationX.linearRampToValueAtTime(_orientation.x, endTime);
+                               panner.orientationY.linearRampToValueAtTime(_orientation.y, endTime);
+                               panner.orientationZ.linearRampToValueAtTime(_orientation.z, endTime);
+                       } else {
+                               panner.setPosition(_position.x, _position.y, _position.z);
+                               panner.setOrientation(_orientation.x, _orientation.y, _orientation.z);
+                       }
+               }
+
+       }
+
+       class AudioAnalyser {
+               constructor(audio, fftSize = 2048) {
+                       this.analyser = audio.context.createAnalyser();
+                       this.analyser.fftSize = fftSize;
+                       this.data = new Uint8Array(this.analyser.frequencyBinCount);
+                       audio.getOutput().connect(this.analyser);
+               }
+
+               getFrequencyData() {
+                       this.analyser.getByteFrequencyData(this.data);
+                       return this.data;
+               }
+
+               getAverageFrequency() {
+                       let value = 0;
+                       const data = this.getFrequencyData();
+
+                       for (let i = 0; i < data.length; i++) {
+                               value += data[i];
+                       }
+
+                       return value / data.length;
+               }
+
+       }
+
+       class PropertyMixer {
+               constructor(binding, typeName, valueSize) {
+                       this.binding = binding;
+                       this.valueSize = valueSize;
+                       let mixFunction, mixFunctionAdditive, setIdentity; // buffer layout: [ incoming | accu0 | accu1 | orig | addAccu | (optional work) ]
+                       //
+                       // interpolators can use .buffer as their .result
+                       // the data then goes to 'incoming'
+                       //
+                       // 'accu0' and 'accu1' are used frame-interleaved for
+                       // the cumulative result and are compared to detect
+                       // changes
+                       //
+                       // 'orig' stores the original state of the property
+                       //
+                       // 'add' is used for additive cumulative results
+                       //
+                       // 'work' is optional and is only present for quaternion types. It is used
+                       // to store intermediate quaternion multiplication results
+
+                       switch (typeName) {
+                               case 'quaternion':
+                                       mixFunction = this._slerp;
+                                       mixFunctionAdditive = this._slerpAdditive;
+                                       setIdentity = this._setAdditiveIdentityQuaternion;
+                                       this.buffer = new Float64Array(valueSize * 6);
+                                       this._workIndex = 5;
+                                       break;
+
+                               case 'string':
+                               case 'bool':
+                                       mixFunction = this._select; // Use the regular mix function and for additive on these types,
+                                       // additive is not relevant for non-numeric types
+
+                                       mixFunctionAdditive = this._select;
+                                       setIdentity = this._setAdditiveIdentityOther;
+                                       this.buffer = new Array(valueSize * 5);
+                                       break;
+
+                               default:
+                                       mixFunction = this._lerp;
+                                       mixFunctionAdditive = this._lerpAdditive;
+                                       setIdentity = this._setAdditiveIdentityNumeric;
+                                       this.buffer = new Float64Array(valueSize * 5);
+                       }
+
+                       this._mixBufferRegion = mixFunction;
+                       this._mixBufferRegionAdditive = mixFunctionAdditive;
+                       this._setIdentity = setIdentity;
+                       this._origIndex = 3;
+                       this._addIndex = 4;
+                       this.cumulativeWeight = 0;
+                       this.cumulativeWeightAdditive = 0;
+                       this.useCount = 0;
+                       this.referenceCount = 0;
+               } // accumulate data in the 'incoming' region into 'accu<i>'
+
+
+               accumulate(accuIndex, weight) {
+                       // note: happily accumulating nothing when weight = 0, the caller knows
+                       // the weight and shouldn't have made the call in the first place
+                       const buffer = this.buffer,
+                                               stride = this.valueSize,
+                                               offset = accuIndex * stride + stride;
+                       let currentWeight = this.cumulativeWeight;
+
+                       if (currentWeight === 0) {
+                               // accuN := incoming * weight
+                               for (let i = 0; i !== stride; ++i) {
+                                       buffer[offset + i] = buffer[i];
+                               }
+
+                               currentWeight = weight;
+                       } else {
+                               // accuN := accuN + incoming * weight
+                               currentWeight += weight;
+                               const mix = weight / currentWeight;
+
+                               this._mixBufferRegion(buffer, offset, 0, mix, stride);
+                       }
+
+                       this.cumulativeWeight = currentWeight;
+               } // accumulate data in the 'incoming' region into 'add'
+
+
+               accumulateAdditive(weight) {
+                       const buffer = this.buffer,
+                                               stride = this.valueSize,
+                                               offset = stride * this._addIndex;
+
+                       if (this.cumulativeWeightAdditive === 0) {
+                               // add = identity
+                               this._setIdentity();
+                       } // add := add + incoming * weight
+
+
+                       this._mixBufferRegionAdditive(buffer, offset, 0, weight, stride);
+
+                       this.cumulativeWeightAdditive += weight;
+               } // apply the state of 'accu<i>' to the binding when accus differ
+
+
+               apply(accuIndex) {
+                       const stride = this.valueSize,
+                                               buffer = this.buffer,
+                                               offset = accuIndex * stride + stride,
+                                               weight = this.cumulativeWeight,
+                                               weightAdditive = this.cumulativeWeightAdditive,
+                                               binding = this.binding;
+                       this.cumulativeWeight = 0;
+                       this.cumulativeWeightAdditive = 0;
+
+                       if (weight < 1) {
+                               // accuN := accuN + original * ( 1 - cumulativeWeight )
+                               const originalValueOffset = stride * this._origIndex;
+
+                               this._mixBufferRegion(buffer, offset, originalValueOffset, 1 - weight, stride);
+                       }
+
+                       if (weightAdditive > 0) {
+                               // accuN := accuN + additive accuN
+                               this._mixBufferRegionAdditive(buffer, offset, this._addIndex * stride, 1, stride);
+                       }
+
+                       for (let i = stride, e = stride + stride; i !== e; ++i) {
+                               if (buffer[i] !== buffer[i + stride]) {
+                                       // value has changed -> update scene graph
+                                       binding.setValue(buffer, offset);
+                                       break;
+                               }
+                       }
+               } // remember the state of the bound property and copy it to both accus
+
+
+               saveOriginalState() {
+                       const binding = this.binding;
+                       const buffer = this.buffer,
+                                               stride = this.valueSize,
+                                               originalValueOffset = stride * this._origIndex;
+                       binding.getValue(buffer, originalValueOffset); // accu[0..1] := orig -- initially detect changes against the original
+
+                       for (let i = stride, e = originalValueOffset; i !== e; ++i) {
+                               buffer[i] = buffer[originalValueOffset + i % stride];
+                       } // Add to identity for additive
+
+
+                       this._setIdentity();
+
+                       this.cumulativeWeight = 0;
+                       this.cumulativeWeightAdditive = 0;
+               } // apply the state previously taken via 'saveOriginalState' to the binding
+
+
+               restoreOriginalState() {
+                       const originalValueOffset = this.valueSize * 3;
+                       this.binding.setValue(this.buffer, originalValueOffset);
+               }
+
+               _setAdditiveIdentityNumeric() {
+                       const startIndex = this._addIndex * this.valueSize;
+                       const endIndex = startIndex + this.valueSize;
+
+                       for (let i = startIndex; i < endIndex; i++) {
+                               this.buffer[i] = 0;
+                       }
+               }
+
+               _setAdditiveIdentityQuaternion() {
+                       this._setAdditiveIdentityNumeric();
+
+                       this.buffer[this._addIndex * this.valueSize + 3] = 1;
+               }
+
+               _setAdditiveIdentityOther() {
+                       const startIndex = this._origIndex * this.valueSize;
+                       const targetIndex = this._addIndex * this.valueSize;
+
+                       for (let i = 0; i < this.valueSize; i++) {
+                               this.buffer[targetIndex + i] = this.buffer[startIndex + i];
+                       }
+               } // mix functions
+
+
+               _select(buffer, dstOffset, srcOffset, t, stride) {
+                       if (t >= 0.5) {
+                               for (let i = 0; i !== stride; ++i) {
+                                       buffer[dstOffset + i] = buffer[srcOffset + i];
+                               }
+                       }
+               }
+
+               _slerp(buffer, dstOffset, srcOffset, t) {
+                       Quaternion.slerpFlat(buffer, dstOffset, buffer, dstOffset, buffer, srcOffset, t);
+               }
+
+               _slerpAdditive(buffer, dstOffset, srcOffset, t, stride) {
+                       const workOffset = this._workIndex * stride; // Store result in intermediate buffer offset
+
+                       Quaternion.multiplyQuaternionsFlat(buffer, workOffset, buffer, dstOffset, buffer, srcOffset); // Slerp to the intermediate result
+
+                       Quaternion.slerpFlat(buffer, dstOffset, buffer, dstOffset, buffer, workOffset, t);
+               }
+
+               _lerp(buffer, dstOffset, srcOffset, t, stride) {
+                       const s = 1 - t;
+
+                       for (let i = 0; i !== stride; ++i) {
+                               const j = dstOffset + i;
+                               buffer[j] = buffer[j] * s + buffer[srcOffset + i] * t;
+                       }
+               }
+
+               _lerpAdditive(buffer, dstOffset, srcOffset, t, stride) {
+                       for (let i = 0; i !== stride; ++i) {
+                               const j = dstOffset + i;
+                               buffer[j] = buffer[j] + buffer[srcOffset + i] * t;
+                       }
+               }
+
+       }
+
+       // Characters [].:/ are reserved for track binding syntax.
+       const _RESERVED_CHARS_RE = '\\[\\]\\.:\\/';
+
+       const _reservedRe = new RegExp('[' + _RESERVED_CHARS_RE + ']', 'g'); // Attempts to allow node names from any language. ES5's `\w` regexp matches
+       // only latin characters, and the unicode \p{L} is not yet supported. So
+       // instead, we exclude reserved characters and match everything else.
+
+
+       const _wordChar = '[^' + _RESERVED_CHARS_RE + ']';
+
+       const _wordCharOrDot = '[^' + _RESERVED_CHARS_RE.replace('\\.', '') + ']'; // Parent directories, delimited by '/' or ':'. Currently unused, but must
+       // be matched to parse the rest of the track name.
+
+
+       const _directoryRe = /((?:WC+[\/:])*)/.source.replace('WC', _wordChar); // Target node. May contain word characters (a-zA-Z0-9_) and '.' or '-'.
+
+
+       const _nodeRe = /(WCOD+)?/.source.replace('WCOD', _wordCharOrDot); // Object on target node, and accessor. May not contain reserved
+       // characters. Accessor may contain any character except closing bracket.
+
+
+       const _objectRe = /(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace('WC', _wordChar); // Property and accessor. May not contain reserved characters. Accessor may
+       // contain any non-bracket characters.
+
+
+       const _propertyRe = /\.(WC+)(?:\[(.+)\])?/.source.replace('WC', _wordChar);
+
+       const _trackRe = new RegExp('' + '^' + _directoryRe + _nodeRe + _objectRe + _propertyRe + '$');
+
+       const _supportedObjectNames = ['material', 'materials', 'bones'];
+
+       class Composite {
+               constructor(targetGroup, path, optionalParsedPath) {
+                       const parsedPath = optionalParsedPath || PropertyBinding.parseTrackName(path);
+                       this._targetGroup = targetGroup;
+                       this._bindings = targetGroup.subscribe_(path, parsedPath);
+               }
+
+               getValue(array, offset) {
+                       this.bind(); // bind all binding
+
+                       const firstValidIndex = this._targetGroup.nCachedObjects_,
+                                               binding = this._bindings[firstValidIndex]; // and only call .getValue on the first
+
+                       if (binding !== undefined) binding.getValue(array, offset);
+               }
+
+               setValue(array, offset) {
+                       const bindings = this._bindings;
+
+                       for (let i = this._targetGroup.nCachedObjects_, n = bindings.length; i !== n; ++i) {
+                               bindings[i].setValue(array, offset);
+                       }
+               }
+
+               bind() {
+                       const bindings = this._bindings;
+
+                       for (let i = this._targetGroup.nCachedObjects_, n = bindings.length; i !== n; ++i) {
+                               bindings[i].bind();
+                       }
+               }
+
+               unbind() {
+                       const bindings = this._bindings;
+
+                       for (let i = this._targetGroup.nCachedObjects_, n = bindings.length; i !== n; ++i) {
+                               bindings[i].unbind();
+                       }
+               }
+
+       } // Note: This class uses a State pattern on a per-method basis:
+       // 'bind' sets 'this.getValue' / 'setValue' and shadows the
+       // prototype version of these methods with one that represents
+       // the bound state. When the property is not found, the methods
+       // become no-ops.
+
+
+       class PropertyBinding {
+               constructor(rootNode, path, parsedPath) {
+                       this.path = path;
+                       this.parsedPath = parsedPath || PropertyBinding.parseTrackName(path);
+                       this.node = PropertyBinding.findNode(rootNode, this.parsedPath.nodeName) || rootNode;
+                       this.rootNode = rootNode; // initial state of these methods that calls 'bind'
+
+                       this.getValue = this._getValue_unbound;
+                       this.setValue = this._setValue_unbound;
+               }
+
+               static create(root, path, parsedPath) {
+                       if (!(root && root.isAnimationObjectGroup)) {
+                               return new PropertyBinding(root, path, parsedPath);
+                       } else {
+                               return new PropertyBinding.Composite(root, path, parsedPath);
+                       }
+               }
+               /**
+                * Replaces spaces with underscores and removes unsupported characters from
+                * node names, to ensure compatibility with parseTrackName().
+                *
+                * @param {string} name Node name to be sanitized.
+                * @return {string}
+                */
+
+
+               static sanitizeNodeName(name) {
+                       return name.replace(/\s/g, '_').replace(_reservedRe, '');
+               }
+
+               static parseTrackName(trackName) {
+                       const matches = _trackRe.exec(trackName);
+
+                       if (!matches) {
+                               throw new Error('PropertyBinding: Cannot parse trackName: ' + trackName);
+                       }
+
+                       const results = {
+                               // directoryName: matches[ 1 ], // (tschw) currently unused
+                               nodeName: matches[2],
+                               objectName: matches[3],
+                               objectIndex: matches[4],
+                               propertyName: matches[5],
+                               // required
+                               propertyIndex: matches[6]
+                       };
+                       const lastDot = results.nodeName && results.nodeName.lastIndexOf('.');
+
+                       if (lastDot !== undefined && lastDot !== -1) {
+                               const objectName = results.nodeName.substring(lastDot + 1); // Object names must be checked against an allowlist. Otherwise, there
+                               // is no way to parse 'foo.bar.baz': 'baz' must be a property, but
+                               // 'bar' could be the objectName, or part of a nodeName (which can
+                               // include '.' characters).
+
+                               if (_supportedObjectNames.indexOf(objectName) !== -1) {
+                                       results.nodeName = results.nodeName.substring(0, lastDot);
+                                       results.objectName = objectName;
+                               }
+                       }
+
+                       if (results.propertyName === null || results.propertyName.length === 0) {
+                               throw new Error('PropertyBinding: can not parse propertyName from trackName: ' + trackName);
+                       }
+
+                       return results;
+               }
+
+               static findNode(root, nodeName) {
+                       if (!nodeName || nodeName === '' || nodeName === '.' || nodeName === -1 || nodeName === root.name || nodeName === root.uuid) {
+                               return root;
+                       } // search into skeleton bones.
+
+
+                       if (root.skeleton) {
+                               const bone = root.skeleton.getBoneByName(nodeName);
+
+                               if (bone !== undefined) {
+                                       return bone;
+                               }
+                       } // search into node subtree.
+
+
+                       if (root.children) {
+                               const searchNodeSubtree = function (children) {
+                                       for (let i = 0; i < children.length; i++) {
+                                               const childNode = children[i];
+
+                                               if (childNode.name === nodeName || childNode.uuid === nodeName) {
+                                                       return childNode;
+                                               }
+
+                                               const result = searchNodeSubtree(childNode.children);
+                                               if (result) return result;
+                                       }
+
+                                       return null;
+                               };
+
+                               const subTreeNode = searchNodeSubtree(root.children);
+
+                               if (subTreeNode) {
+                                       return subTreeNode;
+                               }
+                       }
+
+                       return null;
+               } // these are used to "bind" a nonexistent property
+
+
+               _getValue_unavailable() {}
+
+               _setValue_unavailable() {} // Getters
+
+
+               _getValue_direct(buffer, offset) {
+                       buffer[offset] = this.targetObject[this.propertyName];
+               }
+
+               _getValue_array(buffer, offset) {
+                       const source = this.resolvedProperty;
+
+                       for (let i = 0, n = source.length; i !== n; ++i) {
+                               buffer[offset++] = source[i];
+                       }
+               }
+
+               _getValue_arrayElement(buffer, offset) {
+                       buffer[offset] = this.resolvedProperty[this.propertyIndex];
+               }
+
+               _getValue_toArray(buffer, offset) {
+                       this.resolvedProperty.toArray(buffer, offset);
+               } // Direct
+
+
+               _setValue_direct(buffer, offset) {
+                       this.targetObject[this.propertyName] = buffer[offset];
+               }
+
+               _setValue_direct_setNeedsUpdate(buffer, offset) {
+                       this.targetObject[this.propertyName] = buffer[offset];
+                       this.targetObject.needsUpdate = true;
+               }
+
+               _setValue_direct_setMatrixWorldNeedsUpdate(buffer, offset) {
+                       this.targetObject[this.propertyName] = buffer[offset];
+                       this.targetObject.matrixWorldNeedsUpdate = true;
+               } // EntireArray
+
+
+               _setValue_array(buffer, offset) {
+                       const dest = this.resolvedProperty;
+
+                       for (let i = 0, n = dest.length; i !== n; ++i) {
+                               dest[i] = buffer[offset++];
+                       }
+               }
+
+               _setValue_array_setNeedsUpdate(buffer, offset) {
+                       const dest = this.resolvedProperty;
+
+                       for (let i = 0, n = dest.length; i !== n; ++i) {
+                               dest[i] = buffer[offset++];
+                       }
+
+                       this.targetObject.needsUpdate = true;
+               }
+
+               _setValue_array_setMatrixWorldNeedsUpdate(buffer, offset) {
+                       const dest = this.resolvedProperty;
+
+                       for (let i = 0, n = dest.length; i !== n; ++i) {
+                               dest[i] = buffer[offset++];
+                       }
+
+                       this.targetObject.matrixWorldNeedsUpdate = true;
+               } // ArrayElement
+
+
+               _setValue_arrayElement(buffer, offset) {
+                       this.resolvedProperty[this.propertyIndex] = buffer[offset];
+               }
+
+               _setValue_arrayElement_setNeedsUpdate(buffer, offset) {
+                       this.resolvedProperty[this.propertyIndex] = buffer[offset];
+                       this.targetObject.needsUpdate = true;
+               }
+
+               _setValue_arrayElement_setMatrixWorldNeedsUpdate(buffer, offset) {
+                       this.resolvedProperty[this.propertyIndex] = buffer[offset];
+                       this.targetObject.matrixWorldNeedsUpdate = true;
+               } // HasToFromArray
+
+
+               _setValue_fromArray(buffer, offset) {
+                       this.resolvedProperty.fromArray(buffer, offset);
+               }
+
+               _setValue_fromArray_setNeedsUpdate(buffer, offset) {
+                       this.resolvedProperty.fromArray(buffer, offset);
+                       this.targetObject.needsUpdate = true;
+               }
+
+               _setValue_fromArray_setMatrixWorldNeedsUpdate(buffer, offset) {
+                       this.resolvedProperty.fromArray(buffer, offset);
+                       this.targetObject.matrixWorldNeedsUpdate = true;
+               }
+
+               _getValue_unbound(targetArray, offset) {
+                       this.bind();
+                       this.getValue(targetArray, offset);
+               }
+
+               _setValue_unbound(sourceArray, offset) {
+                       this.bind();
+                       this.setValue(sourceArray, offset);
+               } // create getter / setter pair for a property in the scene graph
+
+
+               bind() {
+                       let targetObject = this.node;
+                       const parsedPath = this.parsedPath;
+                       const objectName = parsedPath.objectName;
+                       const propertyName = parsedPath.propertyName;
+                       let propertyIndex = parsedPath.propertyIndex;
+
+                       if (!targetObject) {
+                               targetObject = PropertyBinding.findNode(this.rootNode, parsedPath.nodeName) || this.rootNode;
+                               this.node = targetObject;
+                       } // set fail state so we can just 'return' on error
+
+
+                       this.getValue = this._getValue_unavailable;
+                       this.setValue = this._setValue_unavailable; // ensure there is a value node
+
+                       if (!targetObject) {
+                               console.error('THREE.PropertyBinding: Trying to update node for track: ' + this.path + ' but it wasn\'t found.');
+                               return;
+                       }
+
+                       if (objectName) {
+                               let objectIndex = parsedPath.objectIndex; // special cases were we need to reach deeper into the hierarchy to get the face materials....
+
+                               switch (objectName) {
+                                       case 'materials':
+                                               if (!targetObject.material) {
+                                                       console.error('THREE.PropertyBinding: Can not bind to material as node does not have a material.', this);
+                                                       return;
+                                               }
+
+                                               if (!targetObject.material.materials) {
+                                                       console.error('THREE.PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.', this);
+                                                       return;
+                                               }
+
+                                               targetObject = targetObject.material.materials;
+                                               break;
+
+                                       case 'bones':
+                                               if (!targetObject.skeleton) {
+                                                       console.error('THREE.PropertyBinding: Can not bind to bones as node does not have a skeleton.', this);
+                                                       return;
+                                               } // potential future optimization: skip this if propertyIndex is already an integer
+                                               // and convert the integer string to a true integer.
+
+
+                                               targetObject = targetObject.skeleton.bones; // support resolving morphTarget names into indices.
+
+                                               for (let i = 0; i < targetObject.length; i++) {
+                                                       if (targetObject[i].name === objectIndex) {
+                                                               objectIndex = i;
+                                                               break;
+                                                       }
+                                               }
+
+                                               break;
+
+                                       default:
+                                               if (targetObject[objectName] === undefined) {
+                                                       console.error('THREE.PropertyBinding: Can not bind to objectName of node undefined.', this);
+                                                       return;
+                                               }
+
+                                               targetObject = targetObject[objectName];
+                               }
+
+                               if (objectIndex !== undefined) {
+                                       if (targetObject[objectIndex] === undefined) {
+                                               console.error('THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.', this, targetObject);
+                                               return;
+                                       }
+
+                                       targetObject = targetObject[objectIndex];
+                               }
+                       } // resolve property
+
+
+                       const nodeProperty = targetObject[propertyName];
+
+                       if (nodeProperty === undefined) {
+                               const nodeName = parsedPath.nodeName;
+                               console.error('THREE.PropertyBinding: Trying to update property for track: ' + nodeName + '.' + propertyName + ' but it wasn\'t found.', targetObject);
+                               return;
+                       } // determine versioning scheme
+
+
+                       let versioning = this.Versioning.None;
+                       this.targetObject = targetObject;
+
+                       if (targetObject.needsUpdate !== undefined) {
+                               // material
+                               versioning = this.Versioning.NeedsUpdate;
+                       } else if (targetObject.matrixWorldNeedsUpdate !== undefined) {
+                               // node transform
+                               versioning = this.Versioning.MatrixWorldNeedsUpdate;
+                       } // determine how the property gets bound
+
+
+                       let bindingType = this.BindingType.Direct;
+
+                       if (propertyIndex !== undefined) {
+                               // access a sub element of the property array (only primitives are supported right now)
+                               if (propertyName === 'morphTargetInfluences') {
+                                       // potential optimization, skip this if propertyIndex is already an integer, and convert the integer string to a true integer.
+                                       // support resolving morphTarget names into indices.
+                                       if (!targetObject.geometry) {
+                                               console.error('THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.', this);
+                                               return;
+                                       }
+
+                                       if (targetObject.geometry.isBufferGeometry) {
+                                               if (!targetObject.geometry.morphAttributes) {
+                                                       console.error('THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.', this);
+                                                       return;
+                                               }
+
+                                               if (targetObject.morphTargetDictionary[propertyIndex] !== undefined) {
+                                                       propertyIndex = targetObject.morphTargetDictionary[propertyIndex];
+                                               }
+                                       } else {
+                                               console.error('THREE.PropertyBinding: Can not bind to morphTargetInfluences on THREE.Geometry. Use THREE.BufferGeometry instead.', this);
+                                               return;
+                                       }
+                               }
+
+                               bindingType = this.BindingType.ArrayElement;
+                               this.resolvedProperty = nodeProperty;
+                               this.propertyIndex = propertyIndex;
+                       } else if (nodeProperty.fromArray !== undefined && nodeProperty.toArray !== undefined) {
+                               // must use copy for Object3D.Euler/Quaternion
+                               bindingType = this.BindingType.HasFromToArray;
+                               this.resolvedProperty = nodeProperty;
+                       } else if (Array.isArray(nodeProperty)) {
+                               bindingType = this.BindingType.EntireArray;
+                               this.resolvedProperty = nodeProperty;
+                       } else {
+                               this.propertyName = propertyName;
+                       } // select getter / setter
+
+
+                       this.getValue = this.GetterByBindingType[bindingType];
+                       this.setValue = this.SetterByBindingTypeAndVersioning[bindingType][versioning];
+               }
+
+               unbind() {
+                       this.node = null; // back to the prototype version of getValue / setValue
+                       // note: avoiding to mutate the shape of 'this' via 'delete'
+
+                       this.getValue = this._getValue_unbound;
+                       this.setValue = this._setValue_unbound;
+               }
+
+       }
+
+       PropertyBinding.Composite = Composite;
+       PropertyBinding.prototype.BindingType = {
+               Direct: 0,
+               EntireArray: 1,
+               ArrayElement: 2,
+               HasFromToArray: 3
+       };
+       PropertyBinding.prototype.Versioning = {
+               None: 0,
+               NeedsUpdate: 1,
+               MatrixWorldNeedsUpdate: 2
+       };
+       PropertyBinding.prototype.GetterByBindingType = [PropertyBinding.prototype._getValue_direct, PropertyBinding.prototype._getValue_array, PropertyBinding.prototype._getValue_arrayElement, PropertyBinding.prototype._getValue_toArray];
+       PropertyBinding.prototype.SetterByBindingTypeAndVersioning = [[// Direct
+       PropertyBinding.prototype._setValue_direct, PropertyBinding.prototype._setValue_direct_setNeedsUpdate, PropertyBinding.prototype._setValue_direct_setMatrixWorldNeedsUpdate], [// EntireArray
+       PropertyBinding.prototype._setValue_array, PropertyBinding.prototype._setValue_array_setNeedsUpdate, PropertyBinding.prototype._setValue_array_setMatrixWorldNeedsUpdate], [// ArrayElement
+       PropertyBinding.prototype._setValue_arrayElement, PropertyBinding.prototype._setValue_arrayElement_setNeedsUpdate, PropertyBinding.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate], [// HasToFromArray
+       PropertyBinding.prototype._setValue_fromArray, PropertyBinding.prototype._setValue_fromArray_setNeedsUpdate, PropertyBinding.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];
+
+       /**
+        *
+        * A group of objects that receives a shared animation state.
+        *
+        * Usage:
+        *
+        *      - Add objects you would otherwise pass as 'root' to the
+        *              constructor or the .clipAction method of AnimationMixer.
+        *
+        *      - Instead pass this object as 'root'.
+        *
+        *      - You can also add and remove objects later when the mixer
+        *              is running.
+        *
+        * Note:
+        *
+        *              Objects of this class appear as one object to the mixer,
+        *              so cache control of the individual objects must be done
+        *              on the group.
+        *
+        * Limitation:
+        *
+        *      - The animated properties must be compatible among the
+        *              all objects in the group.
+        *
+        *      - A single property can either be controlled through a
+        *              target group or directly, but not both.
+        */
+
+       class AnimationObjectGroup {
+               constructor() {
+                       this.uuid = generateUUID(); // cached objects followed by the active ones
+
+                       this._objects = Array.prototype.slice.call(arguments);
+                       this.nCachedObjects_ = 0; // threshold
+                       // note: read by PropertyBinding.Composite
+
+                       const indices = {};
+                       this._indicesByUUID = indices; // for bookkeeping
+
+                       for (let i = 0, n = arguments.length; i !== n; ++i) {
+                               indices[arguments[i].uuid] = i;
+                       }
+
+                       this._paths = []; // inside: string
+
+                       this._parsedPaths = []; // inside: { we don't care, here }
+
+                       this._bindings = []; // inside: Array< PropertyBinding >
+
+                       this._bindingsIndicesByPath = {}; // inside: indices in these arrays
+
+                       const scope = this;
+                       this.stats = {
+                               objects: {
+                                       get total() {
+                                               return scope._objects.length;
+                                       },
+
+                                       get inUse() {
+                                               return this.total - scope.nCachedObjects_;
+                                       }
+
+                               },
+
+                               get bindingsPerObject() {
+                                       return scope._bindings.length;
+                               }
+
+                       };
+               }
+
+               add() {
+                       const objects = this._objects,
+                                               indicesByUUID = this._indicesByUUID,
+                                               paths = this._paths,
+                                               parsedPaths = this._parsedPaths,
+                                               bindings = this._bindings,
+                                               nBindings = bindings.length;
+                       let knownObject = undefined,
+                                       nObjects = objects.length,
+                                       nCachedObjects = this.nCachedObjects_;
+
+                       for (let i = 0, n = arguments.length; i !== n; ++i) {
+                               const object = arguments[i],
+                                                       uuid = object.uuid;
+                               let index = indicesByUUID[uuid];
+
+                               if (index === undefined) {
+                                       // unknown object -> add it to the ACTIVE region
+                                       index = nObjects++;
+                                       indicesByUUID[uuid] = index;
+                                       objects.push(object); // accounting is done, now do the same for all bindings
+
+                                       for (let j = 0, m = nBindings; j !== m; ++j) {
+                                               bindings[j].push(new PropertyBinding(object, paths[j], parsedPaths[j]));
+                                       }
+                               } else if (index < nCachedObjects) {
+                                       knownObject = objects[index]; // move existing object to the ACTIVE region
+
+                                       const firstActiveIndex = --nCachedObjects,
+                                                               lastCachedObject = objects[firstActiveIndex];
+                                       indicesByUUID[lastCachedObject.uuid] = index;
+                                       objects[index] = lastCachedObject;
+                                       indicesByUUID[uuid] = firstActiveIndex;
+                                       objects[firstActiveIndex] = object; // accounting is done, now do the same for all bindings
+
+                                       for (let j = 0, m = nBindings; j !== m; ++j) {
+                                               const bindingsForPath = bindings[j],
+                                                                       lastCached = bindingsForPath[firstActiveIndex];
+                                               let binding = bindingsForPath[index];
+                                               bindingsForPath[index] = lastCached;
+
+                                               if (binding === undefined) {
+                                                       // since we do not bother to create new bindings
+                                                       // for objects that are cached, the binding may
+                                                       // or may not exist
+                                                       binding = new PropertyBinding(object, paths[j], parsedPaths[j]);
+                                               }
+
+                                               bindingsForPath[firstActiveIndex] = binding;
+                                       }
+                               } else if (objects[index] !== knownObject) {
+                                       console.error('THREE.AnimationObjectGroup: Different objects with the same UUID ' + 'detected. Clean the caches or recreate your infrastructure when reloading scenes.');
+                               } // else the object is already where we want it to be
+
+                       } // for arguments
+
+
+                       this.nCachedObjects_ = nCachedObjects;
+               }
+
+               remove() {
+                       const objects = this._objects,
+                                               indicesByUUID = this._indicesByUUID,
+                                               bindings = this._bindings,
+                                               nBindings = bindings.length;
+                       let nCachedObjects = this.nCachedObjects_;
+
+                       for (let i = 0, n = arguments.length; i !== n; ++i) {
+                               const object = arguments[i],
+                                                       uuid = object.uuid,
+                                                       index = indicesByUUID[uuid];
+
+                               if (index !== undefined && index >= nCachedObjects) {
+                                       // move existing object into the CACHED region
+                                       const lastCachedIndex = nCachedObjects++,
+                                                               firstActiveObject = objects[lastCachedIndex];
+                                       indicesByUUID[firstActiveObject.uuid] = index;
+                                       objects[index] = firstActiveObject;
+                                       indicesByUUID[uuid] = lastCachedIndex;
+                                       objects[lastCachedIndex] = object; // accounting is done, now do the same for all bindings
+
+                                       for (let j = 0, m = nBindings; j !== m; ++j) {
+                                               const bindingsForPath = bindings[j],
+                                                                       firstActive = bindingsForPath[lastCachedIndex],
+                                                                       binding = bindingsForPath[index];
+                                               bindingsForPath[index] = firstActive;
+                                               bindingsForPath[lastCachedIndex] = binding;
+                                       }
+                               }
+                       } // for arguments
+
+
+                       this.nCachedObjects_ = nCachedObjects;
+               } // remove & forget
+
+
+               uncache() {
+                       const objects = this._objects,
+                                               indicesByUUID = this._indicesByUUID,
+                                               bindings = this._bindings,
+                                               nBindings = bindings.length;
+                       let nCachedObjects = this.nCachedObjects_,
+                                       nObjects = objects.length;
+
+                       for (let i = 0, n = arguments.length; i !== n; ++i) {
+                               const object = arguments[i],
+                                                       uuid = object.uuid,
+                                                       index = indicesByUUID[uuid];
+
+                               if (index !== undefined) {
+                                       delete indicesByUUID[uuid];
+
+                                       if (index < nCachedObjects) {
+                                               // object is cached, shrink the CACHED region
+                                               const firstActiveIndex = --nCachedObjects,
+                                                                       lastCachedObject = objects[firstActiveIndex],
+                                                                       lastIndex = --nObjects,
+                                                                       lastObject = objects[lastIndex]; // last cached object takes this object's place
+
+                                               indicesByUUID[lastCachedObject.uuid] = index;
+                                               objects[index] = lastCachedObject; // last object goes to the activated slot and pop
+
+                                               indicesByUUID[lastObject.uuid] = firstActiveIndex;
+                                               objects[firstActiveIndex] = lastObject;
+                                               objects.pop(); // accounting is done, now do the same for all bindings
+
+                                               for (let j = 0, m = nBindings; j !== m; ++j) {
+                                                       const bindingsForPath = bindings[j],
+                                                                               lastCached = bindingsForPath[firstActiveIndex],
+                                                                               last = bindingsForPath[lastIndex];
+                                                       bindingsForPath[index] = lastCached;
+                                                       bindingsForPath[firstActiveIndex] = last;
+                                                       bindingsForPath.pop();
+                                               }
+                                       } else {
+                                               // object is active, just swap with the last and pop
+                                               const lastIndex = --nObjects,
+                                                                       lastObject = objects[lastIndex];
+
+                                               if (lastIndex > 0) {
+                                                       indicesByUUID[lastObject.uuid] = index;
+                                               }
+
+                                               objects[index] = lastObject;
+                                               objects.pop(); // accounting is done, now do the same for all bindings
+
+                                               for (let j = 0, m = nBindings; j !== m; ++j) {
+                                                       const bindingsForPath = bindings[j];
+                                                       bindingsForPath[index] = bindingsForPath[lastIndex];
+                                                       bindingsForPath.pop();
+                                               }
+                                       } // cached or active
+
+                               } // if object is known
+
+                       } // for arguments
+
+
+                       this.nCachedObjects_ = nCachedObjects;
+               } // Internal interface used by befriended PropertyBinding.Composite:
+
+
+               subscribe_(path, parsedPath) {
+                       // returns an array of bindings for the given path that is changed
+                       // according to the contained objects in the group
+                       const indicesByPath = this._bindingsIndicesByPath;
+                       let index = indicesByPath[path];
+                       const bindings = this._bindings;
+                       if (index !== undefined) return bindings[index];
+                       const paths = this._paths,
+                                               parsedPaths = this._parsedPaths,
+                                               objects = this._objects,
+                                               nObjects = objects.length,
+                                               nCachedObjects = this.nCachedObjects_,
+                                               bindingsForPath = new Array(nObjects);
+                       index = bindings.length;
+                       indicesByPath[path] = index;
+                       paths.push(path);
+                       parsedPaths.push(parsedPath);
+                       bindings.push(bindingsForPath);
+
+                       for (let i = nCachedObjects, n = objects.length; i !== n; ++i) {
+                               const object = objects[i];
+                               bindingsForPath[i] = new PropertyBinding(object, path, parsedPath);
+                       }
+
+                       return bindingsForPath;
+               }
+
+               unsubscribe_(path) {
+                       // tells the group to forget about a property path and no longer
+                       // update the array previously obtained with 'subscribe_'
+                       const indicesByPath = this._bindingsIndicesByPath,
+                                               index = indicesByPath[path];
+
+                       if (index !== undefined) {
+                               const paths = this._paths,
+                                                       parsedPaths = this._parsedPaths,
+                                                       bindings = this._bindings,
+                                                       lastBindingsIndex = bindings.length - 1,
+                                                       lastBindings = bindings[lastBindingsIndex],
+                                                       lastBindingsPath = path[lastBindingsIndex];
+                               indicesByPath[lastBindingsPath] = index;
+                               bindings[index] = lastBindings;
+                               bindings.pop();
+                               parsedPaths[index] = parsedPaths[lastBindingsIndex];
+                               parsedPaths.pop();
+                               paths[index] = paths[lastBindingsIndex];
+                               paths.pop();
+                       }
+               }
+
+       }
+
+       AnimationObjectGroup.prototype.isAnimationObjectGroup = true;
+
+       class AnimationAction {
+               constructor(mixer, clip, localRoot = null, blendMode = clip.blendMode) {
+                       this._mixer = mixer;
+                       this._clip = clip;
+                       this._localRoot = localRoot;
+                       this.blendMode = blendMode;
+                       const tracks = clip.tracks,
+                                               nTracks = tracks.length,
+                                               interpolants = new Array(nTracks);
+                       const interpolantSettings = {
+                               endingStart: ZeroCurvatureEnding,
+                               endingEnd: ZeroCurvatureEnding
+                       };
+
+                       for (let i = 0; i !== nTracks; ++i) {
+                               const interpolant = tracks[i].createInterpolant(null);
+                               interpolants[i] = interpolant;
+                               interpolant.settings = interpolantSettings;
+                       }
+
+                       this._interpolantSettings = interpolantSettings;
+                       this._interpolants = interpolants; // bound by the mixer
+                       // inside: PropertyMixer (managed by the mixer)
+
+                       this._propertyBindings = new Array(nTracks);
+                       this._cacheIndex = null; // for the memory manager
+
+                       this._byClipCacheIndex = null; // for the memory manager
+
+                       this._timeScaleInterpolant = null;
+                       this._weightInterpolant = null;
+                       this.loop = LoopRepeat;
+                       this._loopCount = -1; // global mixer time when the action is to be started
+                       // it's set back to 'null' upon start of the action
+
+                       this._startTime = null; // scaled local time of the action
+                       // gets clamped or wrapped to 0..clip.duration according to loop
+
+                       this.time = 0;
+                       this.timeScale = 1;
+                       this._effectiveTimeScale = 1;
+                       this.weight = 1;
+                       this._effectiveWeight = 1;
+                       this.repetitions = Infinity; // no. of repetitions when looping
+
+                       this.paused = false; // true -> zero effective time scale
+
+                       this.enabled = true; // false -> zero effective weight
+
+                       this.clampWhenFinished = false; // keep feeding the last frame?
+
+                       this.zeroSlopeAtStart = true; // for smooth interpolation w/o separate
+
+                       this.zeroSlopeAtEnd = true; // clips for start, loop and end
+               } // State & Scheduling
+
+
+               play() {
+                       this._mixer._activateAction(this);
+
+                       return this;
+               }
+
+               stop() {
+                       this._mixer._deactivateAction(this);
+
+                       return this.reset();
+               }
+
+               reset() {
+                       this.paused = false;
+                       this.enabled = true;
+                       this.time = 0; // restart clip
+
+                       this._loopCount = -1; // forget previous loops
+
+                       this._startTime = null; // forget scheduling
+
+                       return this.stopFading().stopWarping();
+               }
+
+               isRunning() {
+                       return this.enabled && !this.paused && this.timeScale !== 0 && this._startTime === null && this._mixer._isActiveAction(this);
+               } // return true when play has been called
+
+
+               isScheduled() {
+                       return this._mixer._isActiveAction(this);
+               }
+
+               startAt(time) {
+                       this._startTime = time;
+                       return this;
+               }
+
+               setLoop(mode, repetitions) {
+                       this.loop = mode;
+                       this.repetitions = repetitions;
+                       return this;
+               } // Weight
+               // set the weight stopping any scheduled fading
+               // although .enabled = false yields an effective weight of zero, this
+               // method does *not* change .enabled, because it would be confusing
+
+
+               setEffectiveWeight(weight) {
+                       this.weight = weight; // note: same logic as when updated at runtime
+
+                       this._effectiveWeight = this.enabled ? weight : 0;
+                       return this.stopFading();
+               } // return the weight considering fading and .enabled
+
+
+               getEffectiveWeight() {
+                       return this._effectiveWeight;
+               }
+
+               fadeIn(duration) {
+                       return this._scheduleFading(duration, 0, 1);
+               }
+
+               fadeOut(duration) {
+                       return this._scheduleFading(duration, 1, 0);
+               }
+
+               crossFadeFrom(fadeOutAction, duration, warp) {
+                       fadeOutAction.fadeOut(duration);
+                       this.fadeIn(duration);
+
+                       if (warp) {
+                               const fadeInDuration = this._clip.duration,
+                                                       fadeOutDuration = fadeOutAction._clip.duration,
+                                                       startEndRatio = fadeOutDuration / fadeInDuration,
+                                                       endStartRatio = fadeInDuration / fadeOutDuration;
+                               fadeOutAction.warp(1.0, startEndRatio, duration);
+                               this.warp(endStartRatio, 1.0, duration);
+                       }
+
+                       return this;
+               }
+
+               crossFadeTo(fadeInAction, duration, warp) {
+                       return fadeInAction.crossFadeFrom(this, duration, warp);
+               }
+
+               stopFading() {
+                       const weightInterpolant = this._weightInterpolant;
+
+                       if (weightInterpolant !== null) {
+                               this._weightInterpolant = null;
+
+                               this._mixer._takeBackControlInterpolant(weightInterpolant);
+                       }
+
+                       return this;
+               } // Time Scale Control
+               // set the time scale stopping any scheduled warping
+               // although .paused = true yields an effective time scale of zero, this
+               // method does *not* change .paused, because it would be confusing
+
+
+               setEffectiveTimeScale(timeScale) {
+                       this.timeScale = timeScale;
+                       this._effectiveTimeScale = this.paused ? 0 : timeScale;
+                       return this.stopWarping();
+               } // return the time scale considering warping and .paused
+
+
+               getEffectiveTimeScale() {
+                       return this._effectiveTimeScale;
+               }
+
+               setDuration(duration) {
+                       this.timeScale = this._clip.duration / duration;
+                       return this.stopWarping();
+               }
+
+               syncWith(action) {
+                       this.time = action.time;
+                       this.timeScale = action.timeScale;
+                       return this.stopWarping();
+               }
+
+               halt(duration) {
+                       return this.warp(this._effectiveTimeScale, 0, duration);
+               }
+
+               warp(startTimeScale, endTimeScale, duration) {
+                       const mixer = this._mixer,
+                                               now = mixer.time,
+                                               timeScale = this.timeScale;
+                       let interpolant = this._timeScaleInterpolant;
+
+                       if (interpolant === null) {
+                               interpolant = mixer._lendControlInterpolant();
+                               this._timeScaleInterpolant = interpolant;
+                       }
+
+                       const times = interpolant.parameterPositions,
+                                               values = interpolant.sampleValues;
+                       times[0] = now;
+                       times[1] = now + duration;
+                       values[0] = startTimeScale / timeScale;
+                       values[1] = endTimeScale / timeScale;
+                       return this;
+               }
+
+               stopWarping() {
+                       const timeScaleInterpolant = this._timeScaleInterpolant;
+
+                       if (timeScaleInterpolant !== null) {
+                               this._timeScaleInterpolant = null;
+
+                               this._mixer._takeBackControlInterpolant(timeScaleInterpolant);
+                       }
+
+                       return this;
+               } // Object Accessors
+
+
+               getMixer() {
+                       return this._mixer;
+               }
+
+               getClip() {
+                       return this._clip;
+               }
+
+               getRoot() {
+                       return this._localRoot || this._mixer._root;
+               } // Interna
+
+
+               _update(time, deltaTime, timeDirection, accuIndex) {
+                       // called by the mixer
+                       if (!this.enabled) {
+                               // call ._updateWeight() to update ._effectiveWeight
+                               this._updateWeight(time);
+
+                               return;
+                       }
+
+                       const startTime = this._startTime;
+
+                       if (startTime !== null) {
+                               // check for scheduled start of action
+                               const timeRunning = (time - startTime) * timeDirection;
+
+                               if (timeRunning < 0 || timeDirection === 0) {
+                                       return; // yet to come / don't decide when delta = 0
+                               } // start
+
+
+                               this._startTime = null; // unschedule
+
+                               deltaTime = timeDirection * timeRunning;
+                       } // apply time scale and advance time
+
+
+                       deltaTime *= this._updateTimeScale(time);
+
+                       const clipTime = this._updateTime(deltaTime); // note: _updateTime may disable the action resulting in
+                       // an effective weight of 0
+
+
+                       const weight = this._updateWeight(time);
+
+                       if (weight > 0) {
+                               const interpolants = this._interpolants;
+                               const propertyMixers = this._propertyBindings;
+
+                               switch (this.blendMode) {
+                                       case AdditiveAnimationBlendMode:
+                                               for (let j = 0, m = interpolants.length; j !== m; ++j) {
+                                                       interpolants[j].evaluate(clipTime);
+                                                       propertyMixers[j].accumulateAdditive(weight);
+                                               }
+
+                                               break;
+
+                                       case NormalAnimationBlendMode:
+                                       default:
+                                               for (let j = 0, m = interpolants.length; j !== m; ++j) {
+                                                       interpolants[j].evaluate(clipTime);
+                                                       propertyMixers[j].accumulate(accuIndex, weight);
+                                               }
+
+                               }
+                       }
+               }
+
+               _updateWeight(time) {
+                       let weight = 0;
+
+                       if (this.enabled) {
+                               weight = this.weight;
+                               const interpolant = this._weightInterpolant;
+
+                               if (interpolant !== null) {
+                                       const interpolantValue = interpolant.evaluate(time)[0];
+                                       weight *= interpolantValue;
+
+                                       if (time > interpolant.parameterPositions[1]) {
+                                               this.stopFading();
+
+                                               if (interpolantValue === 0) {
+                                                       // faded out, disable
+                                                       this.enabled = false;
+                                               }
+                                       }
+                               }
+                       }
+
+                       this._effectiveWeight = weight;
+                       return weight;
+               }
+
+               _updateTimeScale(time) {
+                       let timeScale = 0;
+
+                       if (!this.paused) {
+                               timeScale = this.timeScale;
+                               const interpolant = this._timeScaleInterpolant;
+
+                               if (interpolant !== null) {
+                                       const interpolantValue = interpolant.evaluate(time)[0];
+                                       timeScale *= interpolantValue;
+
+                                       if (time > interpolant.parameterPositions[1]) {
+                                               this.stopWarping();
+
+                                               if (timeScale === 0) {
+                                                       // motion has halted, pause
+                                                       this.paused = true;
+                                               } else {
+                                                       // warp done - apply final time scale
+                                                       this.timeScale = timeScale;
+                                               }
+                                       }
+                               }
+                       }
+
+                       this._effectiveTimeScale = timeScale;
+                       return timeScale;
+               }
+
+               _updateTime(deltaTime) {
+                       const duration = this._clip.duration;
+                       const loop = this.loop;
+                       let time = this.time + deltaTime;
+                       let loopCount = this._loopCount;
+                       const pingPong = loop === LoopPingPong;
+
+                       if (deltaTime === 0) {
+                               if (loopCount === -1) return time;
+                               return pingPong && (loopCount & 1) === 1 ? duration - time : time;
+                       }
+
+                       if (loop === LoopOnce) {
+                               if (loopCount === -1) {
+                                       // just started
+                                       this._loopCount = 0;
+
+                                       this._setEndings(true, true, false);
+                               }
+
+                               handle_stop: {
+                                       if (time >= duration) {
+                                               time = duration;
+                                       } else if (time < 0) {
+                                               time = 0;
+                                       } else {
+                                               this.time = time;
+                                               break handle_stop;
+                                       }
+
+                                       if (this.clampWhenFinished) this.paused = true;else this.enabled = false;
+                                       this.time = time;
+
+                                       this._mixer.dispatchEvent({
+                                               type: 'finished',
+                                               action: this,
+                                               direction: deltaTime < 0 ? -1 : 1
+                                       });
+                               }
+                       } else {
+                               // repetitive Repeat or PingPong
+                               if (loopCount === -1) {
+                                       // just started
+                                       if (deltaTime >= 0) {
+                                               loopCount = 0;
+
+                                               this._setEndings(true, this.repetitions === 0, pingPong);
+                                       } else {
+                                               // when looping in reverse direction, the initial
+                                               // transition through zero counts as a repetition,
+                                               // so leave loopCount at -1
+                                               this._setEndings(this.repetitions === 0, true, pingPong);
+                                       }
+                               }
+
+                               if (time >= duration || time < 0) {
+                                       // wrap around
+                                       const loopDelta = Math.floor(time / duration); // signed
+
+                                       time -= duration * loopDelta;
+                                       loopCount += Math.abs(loopDelta);
+                                       const pending = this.repetitions - loopCount;
+
+                                       if (pending <= 0) {
+                                               // have to stop (switch state, clamp time, fire event)
+                                               if (this.clampWhenFinished) this.paused = true;else this.enabled = false;
+                                               time = deltaTime > 0 ? duration : 0;
+                                               this.time = time;
+
+                                               this._mixer.dispatchEvent({
+                                                       type: 'finished',
+                                                       action: this,
+                                                       direction: deltaTime > 0 ? 1 : -1
+                                               });
+                                       } else {
+                                               // keep running
+                                               if (pending === 1) {
+                                                       // entering the last round
+                                                       const atStart = deltaTime < 0;
+
+                                                       this._setEndings(atStart, !atStart, pingPong);
+                                               } else {
+                                                       this._setEndings(false, false, pingPong);
+                                               }
+
+                                               this._loopCount = loopCount;
+                                               this.time = time;
+
+                                               this._mixer.dispatchEvent({
+                                                       type: 'loop',
+                                                       action: this,
+                                                       loopDelta: loopDelta
+                                               });
+                                       }
+                               } else {
+                                       this.time = time;
+                               }
+
+                               if (pingPong && (loopCount & 1) === 1) {
+                                       // invert time for the "pong round"
+                                       return duration - time;
+                               }
+                       }
+
+                       return time;
+               }
+
+               _setEndings(atStart, atEnd, pingPong) {
+                       const settings = this._interpolantSettings;
+
+                       if (pingPong) {
+                               settings.endingStart = ZeroSlopeEnding;
+                               settings.endingEnd = ZeroSlopeEnding;
+                       } else {
+                               // assuming for LoopOnce atStart == atEnd == true
+                               if (atStart) {
+                                       settings.endingStart = this.zeroSlopeAtStart ? ZeroSlopeEnding : ZeroCurvatureEnding;
+                               } else {
+                                       settings.endingStart = WrapAroundEnding;
+                               }
+
+                               if (atEnd) {
+                                       settings.endingEnd = this.zeroSlopeAtEnd ? ZeroSlopeEnding : ZeroCurvatureEnding;
+                               } else {
+                                       settings.endingEnd = WrapAroundEnding;
+                               }
+                       }
+               }
+
+               _scheduleFading(duration, weightNow, weightThen) {
+                       const mixer = this._mixer,
+                                               now = mixer.time;
+                       let interpolant = this._weightInterpolant;
+
+                       if (interpolant === null) {
+                               interpolant = mixer._lendControlInterpolant();
+                               this._weightInterpolant = interpolant;
+                       }
+
+                       const times = interpolant.parameterPositions,
+                                               values = interpolant.sampleValues;
+                       times[0] = now;
+                       values[0] = weightNow;
+                       times[1] = now + duration;
+                       values[1] = weightThen;
+                       return this;
+               }
+
+       }
+
+       class AnimationMixer extends EventDispatcher {
+               constructor(root) {
+                       super();
+                       this._root = root;
+
+                       this._initMemoryManager();
+
+                       this._accuIndex = 0;
+                       this.time = 0;
+                       this.timeScale = 1.0;
+               }
+
+               _bindAction(action, prototypeAction) {
+                       const root = action._localRoot || this._root,
+                                               tracks = action._clip.tracks,
+                                               nTracks = tracks.length,
+                                               bindings = action._propertyBindings,
+                                               interpolants = action._interpolants,
+                                               rootUuid = root.uuid,
+                                               bindingsByRoot = this._bindingsByRootAndName;
+                       let bindingsByName = bindingsByRoot[rootUuid];
+
+                       if (bindingsByName === undefined) {
+                               bindingsByName = {};
+                               bindingsByRoot[rootUuid] = bindingsByName;
+                       }
+
+                       for (let i = 0; i !== nTracks; ++i) {
+                               const track = tracks[i],
+                                                       trackName = track.name;
+                               let binding = bindingsByName[trackName];
+
+                               if (binding !== undefined) {
+                                       bindings[i] = binding;
+                               } else {
+                                       binding = bindings[i];
+
+                                       if (binding !== undefined) {
+                                               // existing binding, make sure the cache knows
+                                               if (binding._cacheIndex === null) {
+                                                       ++binding.referenceCount;
+
+                                                       this._addInactiveBinding(binding, rootUuid, trackName);
+                                               }
+
+                                               continue;
+                                       }
+
+                                       const path = prototypeAction && prototypeAction._propertyBindings[i].binding.parsedPath;
+                                       binding = new PropertyMixer(PropertyBinding.create(root, trackName, path), track.ValueTypeName, track.getValueSize());
+                                       ++binding.referenceCount;
+
+                                       this._addInactiveBinding(binding, rootUuid, trackName);
+
+                                       bindings[i] = binding;
+                               }
+
+                               interpolants[i].resultBuffer = binding.buffer;
+                       }
+               }
+
+               _activateAction(action) {
+                       if (!this._isActiveAction(action)) {
+                               if (action._cacheIndex === null) {
+                                       // this action has been forgotten by the cache, but the user
+                                       // appears to be still using it -> rebind
+                                       const rootUuid = (action._localRoot || this._root).uuid,
+                                                               clipUuid = action._clip.uuid,
+                                                               actionsForClip = this._actionsByClip[clipUuid];
+
+                                       this._bindAction(action, actionsForClip && actionsForClip.knownActions[0]);
+
+                                       this._addInactiveAction(action, clipUuid, rootUuid);
+                               }
+
+                               const bindings = action._propertyBindings; // increment reference counts / sort out state
+
+                               for (let i = 0, n = bindings.length; i !== n; ++i) {
+                                       const binding = bindings[i];
+
+                                       if (binding.useCount++ === 0) {
+                                               this._lendBinding(binding);
+
+                                               binding.saveOriginalState();
+                                       }
+                               }
+
+                               this._lendAction(action);
+                       }
+               }
+
+               _deactivateAction(action) {
+                       if (this._isActiveAction(action)) {
+                               const bindings = action._propertyBindings; // decrement reference counts / sort out state
+
+                               for (let i = 0, n = bindings.length; i !== n; ++i) {
+                                       const binding = bindings[i];
+
+                                       if (--binding.useCount === 0) {
+                                               binding.restoreOriginalState();
+
+                                               this._takeBackBinding(binding);
+                                       }
+                               }
+
+                               this._takeBackAction(action);
+                       }
+               } // Memory manager
+
+
+               _initMemoryManager() {
+                       this._actions = []; // 'nActiveActions' followed by inactive ones
+
+                       this._nActiveActions = 0;
+                       this._actionsByClip = {}; // inside:
+                       // {
+                       //      knownActions: Array< AnimationAction > - used as prototypes
+                       //      actionByRoot: AnimationAction - lookup
+                       // }
+
+                       this._bindings = []; // 'nActiveBindings' followed by inactive ones
+
+                       this._nActiveBindings = 0;
+                       this._bindingsByRootAndName = {}; // inside: Map< name, PropertyMixer >
+
+                       this._controlInterpolants = []; // same game as above
+
+                       this._nActiveControlInterpolants = 0;
+                       const scope = this;
+                       this.stats = {
+                               actions: {
+                                       get total() {
+                                               return scope._actions.length;
+                                       },
+
+                                       get inUse() {
+                                               return scope._nActiveActions;
+                                       }
+
+                               },
+                               bindings: {
+                                       get total() {
+                                               return scope._bindings.length;
+                                       },
+
+                                       get inUse() {
+                                               return scope._nActiveBindings;
+                                       }
+
+                               },
+                               controlInterpolants: {
+                                       get total() {
+                                               return scope._controlInterpolants.length;
+                                       },
+
+                                       get inUse() {
+                                               return scope._nActiveControlInterpolants;
+                                       }
+
+                               }
+                       };
+               } // Memory management for AnimationAction objects
+
+
+               _isActiveAction(action) {
+                       const index = action._cacheIndex;
+                       return index !== null && index < this._nActiveActions;
+               }
+
+               _addInactiveAction(action, clipUuid, rootUuid) {
+                       const actions = this._actions,
+                                               actionsByClip = this._actionsByClip;
+                       let actionsForClip = actionsByClip[clipUuid];
+
+                       if (actionsForClip === undefined) {
+                               actionsForClip = {
+                                       knownActions: [action],
+                                       actionByRoot: {}
+                               };
+                               action._byClipCacheIndex = 0;
+                               actionsByClip[clipUuid] = actionsForClip;
+                       } else {
+                               const knownActions = actionsForClip.knownActions;
+                               action._byClipCacheIndex = knownActions.length;
+                               knownActions.push(action);
+                       }
+
+                       action._cacheIndex = actions.length;
+                       actions.push(action);
+                       actionsForClip.actionByRoot[rootUuid] = action;
+               }
+
+               _removeInactiveAction(action) {
+                       const actions = this._actions,
+                                               lastInactiveAction = actions[actions.length - 1],
+                                               cacheIndex = action._cacheIndex;
+                       lastInactiveAction._cacheIndex = cacheIndex;
+                       actions[cacheIndex] = lastInactiveAction;
+                       actions.pop();
+                       action._cacheIndex = null;
+                       const clipUuid = action._clip.uuid,
+                                               actionsByClip = this._actionsByClip,
+                                               actionsForClip = actionsByClip[clipUuid],
+                                               knownActionsForClip = actionsForClip.knownActions,
+                                               lastKnownAction = knownActionsForClip[knownActionsForClip.length - 1],
+                                               byClipCacheIndex = action._byClipCacheIndex;
+                       lastKnownAction._byClipCacheIndex = byClipCacheIndex;
+                       knownActionsForClip[byClipCacheIndex] = lastKnownAction;
+                       knownActionsForClip.pop();
+                       action._byClipCacheIndex = null;
+                       const actionByRoot = actionsForClip.actionByRoot,
+                                               rootUuid = (action._localRoot || this._root).uuid;
+                       delete actionByRoot[rootUuid];
+
+                       if (knownActionsForClip.length === 0) {
+                               delete actionsByClip[clipUuid];
+                       }
+
+                       this._removeInactiveBindingsForAction(action);
+               }
+
+               _removeInactiveBindingsForAction(action) {
+                       const bindings = action._propertyBindings;
+
+                       for (let i = 0, n = bindings.length; i !== n; ++i) {
+                               const binding = bindings[i];
+
+                               if (--binding.referenceCount === 0) {
+                                       this._removeInactiveBinding(binding);
+                               }
+                       }
+               }
+
+               _lendAction(action) {
+                       // [ active actions |   inactive actions        ]
+                       // [    active actions >| inactive actions ]
+                       //                                                               s                              a
+                       //                                                                      <-swap->
+                       //                                                               a                              s
+                       const actions = this._actions,
+                                               prevIndex = action._cacheIndex,
+                                               lastActiveIndex = this._nActiveActions++,
+                                               firstInactiveAction = actions[lastActiveIndex];
+                       action._cacheIndex = lastActiveIndex;
+                       actions[lastActiveIndex] = action;
+                       firstInactiveAction._cacheIndex = prevIndex;
+                       actions[prevIndex] = firstInactiveAction;
+               }
+
+               _takeBackAction(action) {
+                       // [    active actions  | inactive actions ]
+                       // [ active actions |< inactive actions ]
+                       //                              a                               s
+                       //                               <-swap->
+                       //                              s                               a
+                       const actions = this._actions,
+                                               prevIndex = action._cacheIndex,
+                                               firstInactiveIndex = --this._nActiveActions,
+                                               lastActiveAction = actions[firstInactiveIndex];
+                       action._cacheIndex = firstInactiveIndex;
+                       actions[firstInactiveIndex] = action;
+                       lastActiveAction._cacheIndex = prevIndex;
+                       actions[prevIndex] = lastActiveAction;
+               } // Memory management for PropertyMixer objects
+
+
+               _addInactiveBinding(binding, rootUuid, trackName) {
+                       const bindingsByRoot = this._bindingsByRootAndName,
+                                               bindings = this._bindings;
+                       let bindingByName = bindingsByRoot[rootUuid];
+
+                       if (bindingByName === undefined) {
+                               bindingByName = {};
+                               bindingsByRoot[rootUuid] = bindingByName;
+                       }
+
+                       bindingByName[trackName] = binding;
+                       binding._cacheIndex = bindings.length;
+                       bindings.push(binding);
+               }
+
+               _removeInactiveBinding(binding) {
+                       const bindings = this._bindings,
+                                               propBinding = binding.binding,
+                                               rootUuid = propBinding.rootNode.uuid,
+                                               trackName = propBinding.path,
+                                               bindingsByRoot = this._bindingsByRootAndName,
+                                               bindingByName = bindingsByRoot[rootUuid],
+                                               lastInactiveBinding = bindings[bindings.length - 1],
+                                               cacheIndex = binding._cacheIndex;
+                       lastInactiveBinding._cacheIndex = cacheIndex;
+                       bindings[cacheIndex] = lastInactiveBinding;
+                       bindings.pop();
+                       delete bindingByName[trackName];
+
+                       if (Object.keys(bindingByName).length === 0) {
+                               delete bindingsByRoot[rootUuid];
+                       }
+               }
+
+               _lendBinding(binding) {
+                       const bindings = this._bindings,
+                                               prevIndex = binding._cacheIndex,
+                                               lastActiveIndex = this._nActiveBindings++,
+                                               firstInactiveBinding = bindings[lastActiveIndex];
+                       binding._cacheIndex = lastActiveIndex;
+                       bindings[lastActiveIndex] = binding;
+                       firstInactiveBinding._cacheIndex = prevIndex;
+                       bindings[prevIndex] = firstInactiveBinding;
+               }
+
+               _takeBackBinding(binding) {
+                       const bindings = this._bindings,
+                                               prevIndex = binding._cacheIndex,
+                                               firstInactiveIndex = --this._nActiveBindings,
+                                               lastActiveBinding = bindings[firstInactiveIndex];
+                       binding._cacheIndex = firstInactiveIndex;
+                       bindings[firstInactiveIndex] = binding;
+                       lastActiveBinding._cacheIndex = prevIndex;
+                       bindings[prevIndex] = lastActiveBinding;
+               } // Memory management of Interpolants for weight and time scale
+
+
+               _lendControlInterpolant() {
+                       const interpolants = this._controlInterpolants,
+                                               lastActiveIndex = this._nActiveControlInterpolants++;
+                       let interpolant = interpolants[lastActiveIndex];
+
+                       if (interpolant === undefined) {
+                               interpolant = new LinearInterpolant(new Float32Array(2), new Float32Array(2), 1, this._controlInterpolantsResultBuffer);
+                               interpolant.__cacheIndex = lastActiveIndex;
+                               interpolants[lastActiveIndex] = interpolant;
+                       }
+
+                       return interpolant;
+               }
+
+               _takeBackControlInterpolant(interpolant) {
+                       const interpolants = this._controlInterpolants,
+                                               prevIndex = interpolant.__cacheIndex,
+                                               firstInactiveIndex = --this._nActiveControlInterpolants,
+                                               lastActiveInterpolant = interpolants[firstInactiveIndex];
+                       interpolant.__cacheIndex = firstInactiveIndex;
+                       interpolants[firstInactiveIndex] = interpolant;
+                       lastActiveInterpolant.__cacheIndex = prevIndex;
+                       interpolants[prevIndex] = lastActiveInterpolant;
+               } // return an action for a clip optionally using a custom root target
+               // object (this method allocates a lot of dynamic memory in case a
+               // previously unknown clip/root combination is specified)
+
+
+               clipAction(clip, optionalRoot, blendMode) {
+                       const root = optionalRoot || this._root,
+                                               rootUuid = root.uuid;
+                       let clipObject = typeof clip === 'string' ? AnimationClip.findByName(root, clip) : clip;
+                       const clipUuid = clipObject !== null ? clipObject.uuid : clip;
+                       const actionsForClip = this._actionsByClip[clipUuid];
+                       let prototypeAction = null;
+
+                       if (blendMode === undefined) {
+                               if (clipObject !== null) {
+                                       blendMode = clipObject.blendMode;
+                               } else {
+                                       blendMode = NormalAnimationBlendMode;
+                               }
+                       }
+
+                       if (actionsForClip !== undefined) {
+                               const existingAction = actionsForClip.actionByRoot[rootUuid];
+
+                               if (existingAction !== undefined && existingAction.blendMode === blendMode) {
+                                       return existingAction;
+                               } // we know the clip, so we don't have to parse all
+                               // the bindings again but can just copy
+
+
+                               prototypeAction = actionsForClip.knownActions[0]; // also, take the clip from the prototype action
+
+                               if (clipObject === null) clipObject = prototypeAction._clip;
+                       } // clip must be known when specified via string
+
+
+                       if (clipObject === null) return null; // allocate all resources required to run it
+
+                       const newAction = new AnimationAction(this, clipObject, optionalRoot, blendMode);
+
+                       this._bindAction(newAction, prototypeAction); // and make the action known to the memory manager
+
+
+                       this._addInactiveAction(newAction, clipUuid, rootUuid);
+
+                       return newAction;
+               } // get an existing action
+
+
+               existingAction(clip, optionalRoot) {
+                       const root = optionalRoot || this._root,
+                                               rootUuid = root.uuid,
+                                               clipObject = typeof clip === 'string' ? AnimationClip.findByName(root, clip) : clip,
+                                               clipUuid = clipObject ? clipObject.uuid : clip,
+                                               actionsForClip = this._actionsByClip[clipUuid];
+
+                       if (actionsForClip !== undefined) {
+                               return actionsForClip.actionByRoot[rootUuid] || null;
+                       }
+
+                       return null;
+               } // deactivates all previously scheduled actions
+
+
+               stopAllAction() {
+                       const actions = this._actions,
+                                               nActions = this._nActiveActions;
+
+                       for (let i = nActions - 1; i >= 0; --i) {
+                               actions[i].stop();
+                       }
+
+                       return this;
+               } // advance the time and update apply the animation
+
+
+               update(deltaTime) {
+                       deltaTime *= this.timeScale;
+                       const actions = this._actions,
+                                               nActions = this._nActiveActions,
+                                               time = this.time += deltaTime,
+                                               timeDirection = Math.sign(deltaTime),
+                                               accuIndex = this._accuIndex ^= 1; // run active actions
+
+                       for (let i = 0; i !== nActions; ++i) {
+                               const action = actions[i];
+
+                               action._update(time, deltaTime, timeDirection, accuIndex);
+                       } // update scene graph
+
+
+                       const bindings = this._bindings,
+                                               nBindings = this._nActiveBindings;
+
+                       for (let i = 0; i !== nBindings; ++i) {
+                               bindings[i].apply(accuIndex);
+                       }
+
+                       return this;
+               } // Allows you to seek to a specific time in an animation.
+
+
+               setTime(timeInSeconds) {
+                       this.time = 0; // Zero out time attribute for AnimationMixer object;
+
+                       for (let i = 0; i < this._actions.length; i++) {
+                               this._actions[i].time = 0; // Zero out time attribute for all associated AnimationAction objects.
+                       }
+
+                       return this.update(timeInSeconds); // Update used to set exact time. Returns "this" AnimationMixer object.
+               } // return this mixer's root target object
+
+
+               getRoot() {
+                       return this._root;
+               } // free all resources specific to a particular clip
+
+
+               uncacheClip(clip) {
+                       const actions = this._actions,
+                                               clipUuid = clip.uuid,
+                                               actionsByClip = this._actionsByClip,
+                                               actionsForClip = actionsByClip[clipUuid];
+
+                       if (actionsForClip !== undefined) {
+                               // note: just calling _removeInactiveAction would mess up the
+                               // iteration state and also require updating the state we can
+                               // just throw away
+                               const actionsToRemove = actionsForClip.knownActions;
+
+                               for (let i = 0, n = actionsToRemove.length; i !== n; ++i) {
+                                       const action = actionsToRemove[i];
+
+                                       this._deactivateAction(action);
+
+                                       const cacheIndex = action._cacheIndex,
+                                                               lastInactiveAction = actions[actions.length - 1];
+                                       action._cacheIndex = null;
+                                       action._byClipCacheIndex = null;
+                                       lastInactiveAction._cacheIndex = cacheIndex;
+                                       actions[cacheIndex] = lastInactiveAction;
+                                       actions.pop();
+
+                                       this._removeInactiveBindingsForAction(action);
+                               }
+
+                               delete actionsByClip[clipUuid];
+                       }
+               } // free all resources specific to a particular root target object
+
+
+               uncacheRoot(root) {
+                       const rootUuid = root.uuid,
+                                               actionsByClip = this._actionsByClip;
+
+                       for (const clipUuid in actionsByClip) {
+                               const actionByRoot = actionsByClip[clipUuid].actionByRoot,
+                                                       action = actionByRoot[rootUuid];
+
+                               if (action !== undefined) {
+                                       this._deactivateAction(action);
+
+                                       this._removeInactiveAction(action);
+                               }
+                       }
+
+                       const bindingsByRoot = this._bindingsByRootAndName,
+                                               bindingByName = bindingsByRoot[rootUuid];
+
+                       if (bindingByName !== undefined) {
+                               for (const trackName in bindingByName) {
+                                       const binding = bindingByName[trackName];
+                                       binding.restoreOriginalState();
+
+                                       this._removeInactiveBinding(binding);
+                               }
+                       }
+               } // remove a targeted clip from the cache
+
+
+               uncacheAction(clip, optionalRoot) {
+                       const action = this.existingAction(clip, optionalRoot);
+
+                       if (action !== null) {
+                               this._deactivateAction(action);
+
+                               this._removeInactiveAction(action);
+                       }
+               }
+
+       }
+
+       AnimationMixer.prototype._controlInterpolantsResultBuffer = new Float32Array(1);
+
+       class Uniform {
+               constructor(value) {
+                       if (typeof value === 'string') {
+                               console.warn('THREE.Uniform: Type parameter is no longer needed.');
+                               value = arguments[1];
+                       }
+
+                       this.value = value;
+               }
+
+               clone() {
+                       return new Uniform(this.value.clone === undefined ? this.value : this.value.clone());
+               }
+
+       }
+
+       class InstancedInterleavedBuffer extends InterleavedBuffer {
+               constructor(array, stride, meshPerAttribute = 1) {
+                       super(array, stride);
+                       this.meshPerAttribute = meshPerAttribute;
+               }
+
+               copy(source) {
+                       super.copy(source);
+                       this.meshPerAttribute = source.meshPerAttribute;
+                       return this;
+               }
+
+               clone(data) {
+                       const ib = super.clone(data);
+                       ib.meshPerAttribute = this.meshPerAttribute;
+                       return ib;
+               }
+
+               toJSON(data) {
+                       const json = super.toJSON(data);
+                       json.isInstancedInterleavedBuffer = true;
+                       json.meshPerAttribute = this.meshPerAttribute;
+                       return json;
+               }
+
+       }
+
+       InstancedInterleavedBuffer.prototype.isInstancedInterleavedBuffer = true;
+
+       class GLBufferAttribute {
+               constructor(buffer, type, itemSize, elementSize, count) {
+                       this.buffer = buffer;
+                       this.type = type;
+                       this.itemSize = itemSize;
+                       this.elementSize = elementSize;
+                       this.count = count;
+                       this.version = 0;
+               }
+
+               set needsUpdate(value) {
+                       if (value === true) this.version++;
+               }
+
+               setBuffer(buffer) {
+                       this.buffer = buffer;
+                       return this;
+               }
+
+               setType(type, elementSize) {
+                       this.type = type;
+                       this.elementSize = elementSize;
+                       return this;
+               }
+
+               setItemSize(itemSize) {
+                       this.itemSize = itemSize;
+                       return this;
+               }
+
+               setCount(count) {
+                       this.count = count;
+                       return this;
+               }
+
+       }
+
+       GLBufferAttribute.prototype.isGLBufferAttribute = true;
+
+       class Raycaster {
+               constructor(origin, direction, near = 0, far = Infinity) {
+                       this.ray = new Ray(origin, direction); // direction is assumed to be normalized (for accurate distance calculations)
+
+                       this.near = near;
+                       this.far = far;
+                       this.camera = null;
+                       this.layers = new Layers();
+                       this.params = {
+                               Mesh: {},
+                               Line: {
+                                       threshold: 1
+                               },
+                               LOD: {},
+                               Points: {
+                                       threshold: 1
+                               },
+                               Sprite: {}
+                       };
+               }
+
+               set(origin, direction) {
+                       // direction is assumed to be normalized (for accurate distance calculations)
+                       this.ray.set(origin, direction);
+               }
+
+               setFromCamera(coords, camera) {
+                       if (camera && camera.isPerspectiveCamera) {
+                               this.ray.origin.setFromMatrixPosition(camera.matrixWorld);
+                               this.ray.direction.set(coords.x, coords.y, 0.5).unproject(camera).sub(this.ray.origin).normalize();
+                               this.camera = camera;
+                       } else if (camera && camera.isOrthographicCamera) {
+                               this.ray.origin.set(coords.x, coords.y, (camera.near + camera.far) / (camera.near - camera.far)).unproject(camera); // set origin in plane of camera
+
+                               this.ray.direction.set(0, 0, -1).transformDirection(camera.matrixWorld);
+                               this.camera = camera;
+                       } else {
+                               console.error('THREE.Raycaster: Unsupported camera type: ' + camera.type);
+                       }
+               }
+
+               intersectObject(object, recursive = false, intersects = []) {
+                       intersectObject(object, this, intersects, recursive);
+                       intersects.sort(ascSort);
+                       return intersects;
+               }
+
+               intersectObjects(objects, recursive = false, intersects = []) {
+                       for (let i = 0, l = objects.length; i < l; i++) {
+                               intersectObject(objects[i], this, intersects, recursive);
+                       }
+
+                       intersects.sort(ascSort);
+                       return intersects;
+               }
+
+       }
+
+       function ascSort(a, b) {
+               return a.distance - b.distance;
+       }
+
+       function intersectObject(object, raycaster, intersects, recursive) {
+               if (object.layers.test(raycaster.layers)) {
+                       object.raycast(raycaster, intersects);
+               }
+
+               if (recursive === true) {
+                       const children = object.children;
+
+                       for (let i = 0, l = children.length; i < l; i++) {
+                               intersectObject(children[i], raycaster, intersects, true);
+                       }
+               }
+       }
+
+       /**
+        * Ref: https://en.wikipedia.org/wiki/Spherical_coordinate_system
+        *
+        * The polar angle (phi) is measured from the positive y-axis. The positive y-axis is up.
+        * The azimuthal angle (theta) is measured from the positive z-axis.
+        */
+
+       class Spherical {
+               constructor(radius = 1, phi = 0, theta = 0) {
+                       this.radius = radius;
+                       this.phi = phi; // polar angle
+
+                       this.theta = theta; // azimuthal angle
+
+                       return this;
+               }
+
+               set(radius, phi, theta) {
+                       this.radius = radius;
+                       this.phi = phi;
+                       this.theta = theta;
+                       return this;
+               }
+
+               copy(other) {
+                       this.radius = other.radius;
+                       this.phi = other.phi;
+                       this.theta = other.theta;
+                       return this;
+               } // restrict phi to be betwee EPS and PI-EPS
+
+
+               makeSafe() {
+                       const EPS = 0.000001;
+                       this.phi = Math.max(EPS, Math.min(Math.PI - EPS, this.phi));
+                       return this;
+               }
+
+               setFromVector3(v) {
+                       return this.setFromCartesianCoords(v.x, v.y, v.z);
+               }
+
+               setFromCartesianCoords(x, y, z) {
+                       this.radius = Math.sqrt(x * x + y * y + z * z);
+
+                       if (this.radius === 0) {
+                               this.theta = 0;
+                               this.phi = 0;
+                       } else {
+                               this.theta = Math.atan2(x, z);
+                               this.phi = Math.acos(clamp(y / this.radius, -1, 1));
+                       }
+
+                       return this;
+               }
+
+               clone() {
+                       return new this.constructor().copy(this);
+               }
+
+       }
+
+       /**
+        * Ref: https://en.wikipedia.org/wiki/Cylindrical_coordinate_system
+        */
+       class Cylindrical {
+               constructor(radius = 1, theta = 0, y = 0) {
+                       this.radius = radius; // distance from the origin to a point in the x-z plane
+
+                       this.theta = theta; // counterclockwise angle in the x-z plane measured in radians from the positive z-axis
+
+                       this.y = y; // height above the x-z plane
+
+                       return this;
+               }
+
+               set(radius, theta, y) {
+                       this.radius = radius;
+                       this.theta = theta;
+                       this.y = y;
+                       return this;
+               }
+
+               copy(other) {
+                       this.radius = other.radius;
+                       this.theta = other.theta;
+                       this.y = other.y;
+                       return this;
+               }
+
+               setFromVector3(v) {
+                       return this.setFromCartesianCoords(v.x, v.y, v.z);
+               }
+
+               setFromCartesianCoords(x, y, z) {
+                       this.radius = Math.sqrt(x * x + z * z);
+                       this.theta = Math.atan2(x, z);
+                       this.y = y;
+                       return this;
+               }
+
+               clone() {
+                       return new this.constructor().copy(this);
+               }
+
+       }
+
+       const _vector$4 = /*@__PURE__*/new Vector2();
+
+       class Box2 {
+               constructor(min = new Vector2(+Infinity, +Infinity), max = new Vector2(-Infinity, -Infinity)) {
+                       this.min = min;
+                       this.max = max;
+               }
+
+               set(min, max) {
+                       this.min.copy(min);
+                       this.max.copy(max);
+                       return this;
+               }
+
+               setFromPoints(points) {
+                       this.makeEmpty();
+
+                       for (let i = 0, il = points.length; i < il; i++) {
+                               this.expandByPoint(points[i]);
+                       }
+
+                       return this;
+               }
+
+               setFromCenterAndSize(center, size) {
+                       const halfSize = _vector$4.copy(size).multiplyScalar(0.5);
+
+                       this.min.copy(center).sub(halfSize);
+                       this.max.copy(center).add(halfSize);
+                       return this;
+               }
+
+               clone() {
+                       return new this.constructor().copy(this);
+               }
+
+               copy(box) {
+                       this.min.copy(box.min);
+                       this.max.copy(box.max);
+                       return this;
+               }
+
+               makeEmpty() {
+                       this.min.x = this.min.y = +Infinity;
+                       this.max.x = this.max.y = -Infinity;
+                       return this;
+               }
+
+               isEmpty() {
+                       // this is a more robust check for empty than ( volume <= 0 ) because volume can get positive with two negative axes
+                       return this.max.x < this.min.x || this.max.y < this.min.y;
+               }
+
+               getCenter(target) {
+                       return this.isEmpty() ? target.set(0, 0) : target.addVectors(this.min, this.max).multiplyScalar(0.5);
+               }
+
+               getSize(target) {
+                       return this.isEmpty() ? target.set(0, 0) : target.subVectors(this.max, this.min);
+               }
+
+               expandByPoint(point) {
+                       this.min.min(point);
+                       this.max.max(point);
+                       return this;
+               }
+
+               expandByVector(vector) {
+                       this.min.sub(vector);
+                       this.max.add(vector);
+                       return this;
+               }
+
+               expandByScalar(scalar) {
+                       this.min.addScalar(-scalar);
+                       this.max.addScalar(scalar);
+                       return this;
+               }
+
+               containsPoint(point) {
+                       return point.x < this.min.x || point.x > this.max.x || point.y < this.min.y || point.y > this.max.y ? false : true;
+               }
+
+               containsBox(box) {
+                       return this.min.x <= box.min.x && box.max.x <= this.max.x && this.min.y <= box.min.y && box.max.y <= this.max.y;
+               }
+
+               getParameter(point, target) {
+                       // This can potentially have a divide by zero if the box
+                       // has a size dimension of 0.
+                       return target.set((point.x - this.min.x) / (this.max.x - this.min.x), (point.y - this.min.y) / (this.max.y - this.min.y));
+               }
+
+               intersectsBox(box) {
+                       // using 4 splitting planes to rule out intersections
+                       return box.max.x < this.min.x || box.min.x > this.max.x || box.max.y < this.min.y || box.min.y > this.max.y ? false : true;
+               }
+
+               clampPoint(point, target) {
+                       return target.copy(point).clamp(this.min, this.max);
+               }
+
+               distanceToPoint(point) {
+                       const clampedPoint = _vector$4.copy(point).clamp(this.min, this.max);
+
+                       return clampedPoint.sub(point).length();
+               }
+
+               intersect(box) {
+                       this.min.max(box.min);
+                       this.max.min(box.max);
+                       return this;
+               }
+
+               union(box) {
+                       this.min.min(box.min);
+                       this.max.max(box.max);
+                       return this;
+               }
+
+               translate(offset) {
+                       this.min.add(offset);
+                       this.max.add(offset);
+                       return this;
+               }
+
+               equals(box) {
+                       return box.min.equals(this.min) && box.max.equals(this.max);
+               }
+
+       }
+
+       Box2.prototype.isBox2 = true;
+
+       const _startP = /*@__PURE__*/new Vector3();
+
+       const _startEnd = /*@__PURE__*/new Vector3();
+
+       class Line3 {
+               constructor(start = new Vector3(), end = new Vector3()) {
+                       this.start = start;
+                       this.end = end;
+               }
+
+               set(start, end) {
+                       this.start.copy(start);
+                       this.end.copy(end);
+                       return this;
+               }
+
+               copy(line) {
+                       this.start.copy(line.start);
+                       this.end.copy(line.end);
+                       return this;
+               }
+
+               getCenter(target) {
+                       return target.addVectors(this.start, this.end).multiplyScalar(0.5);
+               }
+
+               delta(target) {
+                       return target.subVectors(this.end, this.start);
+               }
+
+               distanceSq() {
+                       return this.start.distanceToSquared(this.end);
+               }
+
+               distance() {
+                       return this.start.distanceTo(this.end);
+               }
+
+               at(t, target) {
+                       return this.delta(target).multiplyScalar(t).add(this.start);
+               }
+
+               closestPointToPointParameter(point, clampToLine) {
+                       _startP.subVectors(point, this.start);
+
+                       _startEnd.subVectors(this.end, this.start);
+
+                       const startEnd2 = _startEnd.dot(_startEnd);
+
+                       const startEnd_startP = _startEnd.dot(_startP);
+
+                       let t = startEnd_startP / startEnd2;
+
+                       if (clampToLine) {
+                               t = clamp(t, 0, 1);
+                       }
+
+                       return t;
+               }
+
+               closestPointToPoint(point, clampToLine, target) {
+                       const t = this.closestPointToPointParameter(point, clampToLine);
+                       return this.delta(target).multiplyScalar(t).add(this.start);
+               }
+
+               applyMatrix4(matrix) {
+                       this.start.applyMatrix4(matrix);
+                       this.end.applyMatrix4(matrix);
+                       return this;
+               }
+
+               equals(line) {
+                       return line.start.equals(this.start) && line.end.equals(this.end);
+               }
+
+               clone() {
+                       return new this.constructor().copy(this);
+               }
+
+       }
+
+       class ImmediateRenderObject extends Object3D {
+               constructor(material) {
+                       super();
+                       this.material = material;
+
+                       this.render = function () {};
+
+                       this.hasPositions = false;
+                       this.hasNormals = false;
+                       this.hasColors = false;
+                       this.hasUvs = false;
+                       this.positionArray = null;
+                       this.normalArray = null;
+                       this.colorArray = null;
+                       this.uvArray = null;
+                       this.count = 0;
+               }
+
+       }
+
+       ImmediateRenderObject.prototype.isImmediateRenderObject = true;
+
+       const _vector$3 = /*@__PURE__*/new Vector3();
+
+       class SpotLightHelper extends Object3D {
+               constructor(light, color) {
+                       super();
+                       this.light = light;
+                       this.light.updateMatrixWorld();
+                       this.matrix = light.matrixWorld;
+                       this.matrixAutoUpdate = false;
+                       this.color = color;
+                       const geometry = new BufferGeometry();
+                       const positions = [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 i = 0, j = 1, l = 32; i < l; i++, j++) {
+                               const p1 = i / l * Math.PI * 2;
+                               const p2 = j / l * Math.PI * 2;
+                               positions.push(Math.cos(p1), Math.sin(p1), 1, Math.cos(p2), Math.sin(p2), 1);
+                       }
+
+                       geometry.setAttribute('position', new Float32BufferAttribute(positions, 3));
+                       const material = new LineBasicMaterial({
+                               fog: false,
+                               toneMapped: false
+                       });
+                       this.cone = new LineSegments(geometry, material);
+                       this.add(this.cone);
+                       this.update();
+               }
+
+               dispose() {
+                       this.cone.geometry.dispose();
+                       this.cone.material.dispose();
+               }
+
+               update() {
+                       this.light.updateMatrixWorld();
+                       const coneLength = this.light.distance ? this.light.distance : 1000;
+                       const coneWidth = coneLength * Math.tan(this.light.angle);
+                       this.cone.scale.set(coneWidth, coneWidth, coneLength);
+
+                       _vector$3.setFromMatrixPosition(this.light.target.matrixWorld);
+
+                       this.cone.lookAt(_vector$3);
+
+                       if (this.color !== undefined) {
+                               this.cone.material.color.set(this.color);
+                       } else {
+                               this.cone.material.color.copy(this.light.color);
+                       }
+               }
+
+       }
+
+       const _vector$2 = /*@__PURE__*/new Vector3();
+
+       const _boneMatrix = /*@__PURE__*/new Matrix4();
+
+       const _matrixWorldInv = /*@__PURE__*/new Matrix4();
+
+       class SkeletonHelper extends LineSegments {
+               constructor(object) {
+                       const bones = getBoneList(object);
+                       const geometry = new BufferGeometry();
+                       const vertices = [];
+                       const colors = [];
+                       const color1 = new Color(0, 0, 1);
+                       const color2 = new Color(0, 1, 0);
+
+                       for (let i = 0; i < bones.length; i++) {
+                               const bone = bones[i];
+
+                               if (bone.parent && bone.parent.isBone) {
+                                       vertices.push(0, 0, 0);
+                                       vertices.push(0, 0, 0);
+                                       colors.push(color1.r, color1.g, color1.b);
+                                       colors.push(color2.r, color2.g, color2.b);
+                               }
+                       }
+
+                       geometry.setAttribute('position', new Float32BufferAttribute(vertices, 3));
+                       geometry.setAttribute('color', new Float32BufferAttribute(colors, 3));
+                       const material = new LineBasicMaterial({
+                               vertexColors: true,
+                               depthTest: false,
+                               depthWrite: false,
+                               toneMapped: false,
+                               transparent: true
+                       });
+                       super(geometry, material);
+                       this.type = 'SkeletonHelper';
+                       this.isSkeletonHelper = true;
+                       this.root = object;
+                       this.bones = bones;
+                       this.matrix = object.matrixWorld;
+                       this.matrixAutoUpdate = false;
+               }
+
+               updateMatrixWorld(force) {
+                       const bones = this.bones;
+                       const geometry = this.geometry;
+                       const position = geometry.getAttribute('position');
+
+                       _matrixWorldInv.copy(this.root.matrixWorld).invert();
+
+                       for (let i = 0, j = 0; i < bones.length; i++) {
+                               const bone = bones[i];
+
+                               if (bone.parent && bone.parent.isBone) {
+                                       _boneMatrix.multiplyMatrices(_matrixWorldInv, bone.matrixWorld);
+
+                                       _vector$2.setFromMatrixPosition(_boneMatrix);
+
+                                       position.setXYZ(j, _vector$2.x, _vector$2.y, _vector$2.z);
+
+                                       _boneMatrix.multiplyMatrices(_matrixWorldInv, bone.parent.matrixWorld);
+
+                                       _vector$2.setFromMatrixPosition(_boneMatrix);
+
+                                       position.setXYZ(j + 1, _vector$2.x, _vector$2.y, _vector$2.z);
+                                       j += 2;
+                               }
+                       }
+
+                       geometry.getAttribute('position').needsUpdate = true;
+                       super.updateMatrixWorld(force);
+               }
+
+       }
+
+       function getBoneList(object) {
+               const boneList = [];
+
+               if (object && object.isBone) {
+                       boneList.push(object);
+               }
+
+               for (let i = 0; i < object.children.length; i++) {
+                       boneList.push.apply(boneList, getBoneList(object.children[i]));
+               }
+
+               return boneList;
+       }
+
+       class PointLightHelper extends Mesh {
+               constructor(light, sphereSize, color) {
+                       const geometry = new SphereGeometry(sphereSize, 4, 2);
+                       const material = new MeshBasicMaterial({
+                               wireframe: true,
+                               fog: false,
+                               toneMapped: false
+                       });
+                       super(geometry, material);
+                       this.light = light;
+                       this.light.updateMatrixWorld();
+                       this.color = color;
+                       this.type = 'PointLightHelper';
+                       this.matrix = this.light.matrixWorld;
+                       this.matrixAutoUpdate = false;
+                       this.update();
+                       /*
+                       // TODO: delete this comment?
+                       const distanceGeometry = new THREE.IcosahedronBufferGeometry( 1, 2 );
+                       const distanceMaterial = new THREE.MeshBasicMaterial( { color: hexColor, fog: false, wireframe: true, opacity: 0.1, transparent: true } );
+                       this.lightSphere = new THREE.Mesh( bulbGeometry, bulbMaterial );
+                       this.lightDistance = new THREE.Mesh( distanceGeometry, distanceMaterial );
+                       const d = light.distance;
+                       if ( d === 0.0 ) {
+                               this.lightDistance.visible = false;
+                       } else {
+                               this.lightDistance.scale.set( d, d, d );
+                       }
+                       this.add( this.lightDistance );
+                       */
+               }
+
+               dispose() {
+                       this.geometry.dispose();
+                       this.material.dispose();
+               }
+
+               update() {
+                       if (this.color !== undefined) {
+                               this.material.color.set(this.color);
+                       } else {
+                               this.material.color.copy(this.light.color);
+                       }
+                       /*
+                       const d = this.light.distance;
+                               if ( d === 0.0 ) {
+                                       this.lightDistance.visible = false;
+                               } else {
+                                       this.lightDistance.visible = true;
+                               this.lightDistance.scale.set( d, d, d );
+                               }
+                       */
+
+               }
+
+       }
+
+       const _vector$1 = /*@__PURE__*/new Vector3();
+
+       const _color1 = /*@__PURE__*/new Color();
+
+       const _color2 = /*@__PURE__*/new Color();
+
+       class HemisphereLightHelper extends Object3D {
+               constructor(light, size, color) {
+                       super();
+                       this.light = light;
+                       this.light.updateMatrixWorld();
+                       this.matrix = light.matrixWorld;
+                       this.matrixAutoUpdate = false;
+                       this.color = color;
+                       const geometry = new OctahedronGeometry(size);
+                       geometry.rotateY(Math.PI * 0.5);
+                       this.material = new MeshBasicMaterial({
+                               wireframe: true,
+                               fog: false,
+                               toneMapped: false
+                       });
+                       if (this.color === undefined) this.material.vertexColors = true;
+                       const position = geometry.getAttribute('position');
+                       const colors = new Float32Array(position.count * 3);
+                       geometry.setAttribute('color', new BufferAttribute(colors, 3));
+                       this.add(new Mesh(geometry, this.material));
+                       this.update();
+               }
+
+               dispose() {
+                       this.children[0].geometry.dispose();
+                       this.children[0].material.dispose();
+               }
+
+               update() {
+                       const mesh = this.children[0];
+
+                       if (this.color !== undefined) {
+                               this.material.color.set(this.color);
+                       } else {
+                               const colors = mesh.geometry.getAttribute('color');
+
+                               _color1.copy(this.light.color);
+
+                               _color2.copy(this.light.groundColor);
+
+                               for (let i = 0, l = colors.count; i < l; i++) {
+                                       const color = i < l / 2 ? _color1 : _color2;
+                                       colors.setXYZ(i, color.r, color.g, color.b);
+                               }
+
+                               colors.needsUpdate = true;
+                       }
+
+                       mesh.lookAt(_vector$1.setFromMatrixPosition(this.light.matrixWorld).negate());
+               }
+
+       }
+
+       class GridHelper extends LineSegments {
+               constructor(size = 10, divisions = 10, color1 = 0x444444, color2 = 0x888888) {
+                       color1 = new Color(color1);
+                       color2 = new Color(color2);
+                       const center = divisions / 2;
+                       const step = size / divisions;
+                       const halfSize = size / 2;
+                       const vertices = [],
+                                               colors = [];
+
+                       for (let i = 0, j = 0, k = -halfSize; i <= divisions; i++, k += step) {
+                               vertices.push(-halfSize, 0, k, halfSize, 0, k);
+                               vertices.push(k, 0, -halfSize, k, 0, halfSize);
+                               const color = i === center ? color1 : color2;
+                               color.toArray(colors, j);
+                               j += 3;
+                               color.toArray(colors, j);
+                               j += 3;
+                               color.toArray(colors, j);
+                               j += 3;
+                               color.toArray(colors, j);
+                               j += 3;
+                       }
+
+                       const geometry = new BufferGeometry();
+                       geometry.setAttribute('position', new Float32BufferAttribute(vertices, 3));
+                       geometry.setAttribute('color', new Float32BufferAttribute(colors, 3));
+                       const material = new LineBasicMaterial({
+                               vertexColors: true,
+                               toneMapped: false
+                       });
+                       super(geometry, material);
+                       this.type = 'GridHelper';
+               }
+
+       }
+
+       class PolarGridHelper extends LineSegments {
+               constructor(radius = 10, radials = 16, circles = 8, divisions = 64, color1 = 0x444444, color2 = 0x888888) {
+                       color1 = new Color(color1);
+                       color2 = new Color(color2);
+                       const vertices = [];
+                       const colors = []; // create the radials
+
+                       for (let i = 0; i <= radials; i++) {
+                               const v = i / radials * (Math.PI * 2);
+                               const x = Math.sin(v) * radius;
+                               const z = Math.cos(v) * radius;
+                               vertices.push(0, 0, 0);
+                               vertices.push(x, 0, z);
+                               const color = i & 1 ? color1 : color2;
+                               colors.push(color.r, color.g, color.b);
+                               colors.push(color.r, color.g, color.b);
+                       } // create the circles
+
+
+                       for (let i = 0; i <= circles; i++) {
+                               const color = i & 1 ? color1 : color2;
+                               const r = radius - radius / circles * i;
+
+                               for (let j = 0; j < divisions; j++) {
+                                       // first vertex
+                                       let v = j / divisions * (Math.PI * 2);
+                                       let x = Math.sin(v) * r;
+                                       let z = Math.cos(v) * r;
+                                       vertices.push(x, 0, z);
+                                       colors.push(color.r, color.g, color.b); // second vertex
+
+                                       v = (j + 1) / divisions * (Math.PI * 2);
+                                       x = Math.sin(v) * r;
+                                       z = Math.cos(v) * r;
+                                       vertices.push(x, 0, z);
+                                       colors.push(color.r, color.g, color.b);
+                               }
+                       }
+
+                       const geometry = new BufferGeometry();
+                       geometry.setAttribute('position', new Float32BufferAttribute(vertices, 3));
+                       geometry.setAttribute('color', new Float32BufferAttribute(colors, 3));
+                       const material = new LineBasicMaterial({
+                               vertexColors: true,
+                               toneMapped: false
+                       });
+                       super(geometry, material);
+                       this.type = 'PolarGridHelper';
+               }
+
+       }
+
+       const _v1 = /*@__PURE__*/new Vector3();
+
+       const _v2 = /*@__PURE__*/new Vector3();
+
+       const _v3 = /*@__PURE__*/new Vector3();
+
+       class DirectionalLightHelper extends Object3D {
+               constructor(light, size, color) {
+                       super();
+                       this.light = light;
+                       this.light.updateMatrixWorld();
+                       this.matrix = light.matrixWorld;
+                       this.matrixAutoUpdate = false;
+                       this.color = color;
+                       if (size === undefined) size = 1;
+                       let geometry = new BufferGeometry();
+                       geometry.setAttribute('position', new Float32BufferAttribute([-size, size, 0, size, size, 0, size, -size, 0, -size, -size, 0, -size, size, 0], 3));
+                       const material = new LineBasicMaterial({
+                               fog: false,
+                               toneMapped: false
+                       });
+                       this.lightPlane = new Line(geometry, material);
+                       this.add(this.lightPlane);
+                       geometry = new BufferGeometry();
+                       geometry.setAttribute('position', new Float32BufferAttribute([0, 0, 0, 0, 0, 1], 3));
+                       this.targetLine = new Line(geometry, material);
+                       this.add(this.targetLine);
+                       this.update();
+               }
+
+               dispose() {
+                       this.lightPlane.geometry.dispose();
+                       this.lightPlane.material.dispose();
+                       this.targetLine.geometry.dispose();
+                       this.targetLine.material.dispose();
+               }
+
+               update() {
+                       _v1.setFromMatrixPosition(this.light.matrixWorld);
+
+                       _v2.setFromMatrixPosition(this.light.target.matrixWorld);
+
+                       _v3.subVectors(_v2, _v1);
+
+                       this.lightPlane.lookAt(_v2);
+
+                       if (this.color !== undefined) {
+                               this.lightPlane.material.color.set(this.color);
+                               this.targetLine.material.color.set(this.color);
+                       } else {
+                               this.lightPlane.material.color.copy(this.light.color);
+                               this.targetLine.material.color.copy(this.light.color);
+                       }
+
+                       this.targetLine.lookAt(_v2);
+                       this.targetLine.scale.z = _v3.length();
+               }
+
+       }
+
+       const _vector = /*@__PURE__*/new Vector3();
+
+       const _camera = /*@__PURE__*/new Camera();
+       /**
+        *      - shows frustum, line of sight and up of the camera
+        *      - suitable for fast updates
+        *      - based on frustum visualization in lightgl.js shadowmap example
+        *              http://evanw.github.com/lightgl.js/tests/shadowmap.html
+        */
+
+
+       class CameraHelper extends LineSegments {
+               constructor(camera) {
+                       const geometry = new BufferGeometry();
+                       const material = new LineBasicMaterial({
+                               color: 0xffffff,
+                               vertexColors: true,
+                               toneMapped: false
+                       });
+                       const vertices = [];
+                       const colors = [];
+                       const pointMap = {}; // colors
+
+                       const colorFrustum = new Color(0xffaa00);
+                       const colorCone = new Color(0xff0000);
+                       const colorUp = new Color(0x00aaff);
+                       const colorTarget = new Color(0xffffff);
+                       const colorCross = new Color(0x333333); // near
+
+                       addLine('n1', 'n2', colorFrustum);
+                       addLine('n2', 'n4', colorFrustum);
+                       addLine('n4', 'n3', colorFrustum);
+                       addLine('n3', 'n1', colorFrustum); // far
+
+                       addLine('f1', 'f2', colorFrustum);
+                       addLine('f2', 'f4', colorFrustum);
+                       addLine('f4', 'f3', colorFrustum);
+                       addLine('f3', 'f1', colorFrustum); // sides
+
+                       addLine('n1', 'f1', colorFrustum);
+                       addLine('n2', 'f2', colorFrustum);
+                       addLine('n3', 'f3', colorFrustum);
+                       addLine('n4', 'f4', colorFrustum); // cone
+
+                       addLine('p', 'n1', colorCone);
+                       addLine('p', 'n2', colorCone);
+                       addLine('p', 'n3', colorCone);
+                       addLine('p', 'n4', colorCone); // up
+
+                       addLine('u1', 'u2', colorUp);
+                       addLine('u2', 'u3', colorUp);
+                       addLine('u3', 'u1', colorUp); // target
+
+                       addLine('c', 't', colorTarget);
+                       addLine('p', 'c', colorCross); // cross
+
+                       addLine('cn1', 'cn2', colorCross);
+                       addLine('cn3', 'cn4', colorCross);
+                       addLine('cf1', 'cf2', colorCross);
+                       addLine('cf3', 'cf4', colorCross);
+
+                       function addLine(a, b, color) {
+                               addPoint(a, color);
+                               addPoint(b, color);
+                       }
+
+                       function addPoint(id, color) {
+                               vertices.push(0, 0, 0);
+                               colors.push(color.r, color.g, color.b);
+
+                               if (pointMap[id] === undefined) {
+                                       pointMap[id] = [];
+                               }
+
+                               pointMap[id].push(vertices.length / 3 - 1);
+                       }
+
+                       geometry.setAttribute('position', new Float32BufferAttribute(vertices, 3));
+                       geometry.setAttribute('color', new Float32BufferAttribute(colors, 3));
+                       super(geometry, material);
+                       this.type = 'CameraHelper';
+                       this.camera = camera;
+                       if (this.camera.updateProjectionMatrix) this.camera.updateProjectionMatrix();
+                       this.matrix = camera.matrixWorld;
+                       this.matrixAutoUpdate = false;
+                       this.pointMap = pointMap;
+                       this.update();
+               }
+
+               update() {
+                       const geometry = this.geometry;
+                       const pointMap = this.pointMap;
+                       const w = 1,
+                                               h = 1; // we need just camera projection matrix inverse
+                       // world matrix must be identity
+
+                       _camera.projectionMatrixInverse.copy(this.camera.projectionMatrixInverse); // center / target
+
+
+                       setPoint('c', pointMap, geometry, _camera, 0, 0, -1);
+                       setPoint('t', pointMap, geometry, _camera, 0, 0, 1); // near
+
+                       setPoint('n1', pointMap, geometry, _camera, -w, -h, -1);
+                       setPoint('n2', pointMap, geometry, _camera, w, -h, -1);
+                       setPoint('n3', pointMap, geometry, _camera, -w, h, -1);
+                       setPoint('n4', pointMap, geometry, _camera, w, h, -1); // far
+
+                       setPoint('f1', pointMap, geometry, _camera, -w, -h, 1);
+                       setPoint('f2', pointMap, geometry, _camera, w, -h, 1);
+                       setPoint('f3', pointMap, geometry, _camera, -w, h, 1);
+                       setPoint('f4', pointMap, geometry, _camera, w, h, 1); // up
+
+                       setPoint('u1', pointMap, geometry, _camera, w * 0.7, h * 1.1, -1);
+                       setPoint('u2', pointMap, geometry, _camera, -w * 0.7, h * 1.1, -1);
+                       setPoint('u3', pointMap, geometry, _camera, 0, h * 2, -1); // cross
+
+                       setPoint('cf1', pointMap, geometry, _camera, -w, 0, 1);
+                       setPoint('cf2', pointMap, geometry, _camera, w, 0, 1);
+                       setPoint('cf3', pointMap, geometry, _camera, 0, -h, 1);
+                       setPoint('cf4', pointMap, geometry, _camera, 0, h, 1);
+                       setPoint('cn1', pointMap, geometry, _camera, -w, 0, -1);
+                       setPoint('cn2', pointMap, geometry, _camera, w, 0, -1);
+                       setPoint('cn3', pointMap, geometry, _camera, 0, -h, -1);
+                       setPoint('cn4', pointMap, geometry, _camera, 0, h, -1);
+                       geometry.getAttribute('position').needsUpdate = true;
+               }
+
+               dispose() {
+                       this.geometry.dispose();
+                       this.material.dispose();
+               }
+
+       }
+
+       function setPoint(point, pointMap, geometry, camera, x, y, z) {
+               _vector.set(x, y, z).unproject(camera);
+
+               const points = pointMap[point];
+
+               if (points !== undefined) {
+                       const position = geometry.getAttribute('position');
+
+                       for (let i = 0, l = points.length; i < l; i++) {
+                               position.setXYZ(points[i], _vector.x, _vector.y, _vector.z);
+                       }
+               }
+       }
+
+       const _box = /*@__PURE__*/new Box3();
+
+       class BoxHelper extends LineSegments {
+               constructor(object, color = 0xffff00) {
+                       const indices = 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]);
+                       const positions = new Float32Array(8 * 3);
+                       const geometry = new BufferGeometry();
+                       geometry.setIndex(new BufferAttribute(indices, 1));
+                       geometry.setAttribute('position', new BufferAttribute(positions, 3));
+                       super(geometry, new LineBasicMaterial({
+                               color: color,
+                               toneMapped: false
+                       }));
+                       this.object = object;
+                       this.type = 'BoxHelper';
+                       this.matrixAutoUpdate = false;
+                       this.update();
+               }
+
+               update(object) {
+                       if (object !== undefined) {
+                               console.warn('THREE.BoxHelper: .update() has no longer arguments.');
+                       }
+
+                       if (this.object !== undefined) {
+                               _box.setFromObject(this.object);
+                       }
+
+                       if (_box.isEmpty()) return;
+                       const min = _box.min;
+                       const max = _box.max;
+                       /*
+                               5____4
+                       1/___0/|
+                       | 6__|_7
+                       2/___3/
+                               0: max.x, max.y, max.z
+                       1: min.x, max.y, max.z
+                       2: min.x, min.y, max.z
+                       3: max.x, min.y, max.z
+                       4: max.x, max.y, min.z
+                       5: min.x, max.y, min.z
+                       6: min.x, min.y, min.z
+                       7: max.x, min.y, min.z
+                       */
+
+                       const position = this.geometry.attributes.position;
+                       const array = position.array;
+                       array[0] = max.x;
+                       array[1] = max.y;
+                       array[2] = max.z;
+                       array[3] = min.x;
+                       array[4] = max.y;
+                       array[5] = max.z;
+                       array[6] = min.x;
+                       array[7] = min.y;
+                       array[8] = max.z;
+                       array[9] = max.x;
+                       array[10] = min.y;
+                       array[11] = max.z;
+                       array[12] = max.x;
+                       array[13] = max.y;
+                       array[14] = min.z;
+                       array[15] = min.x;
+                       array[16] = max.y;
+                       array[17] = min.z;
+                       array[18] = min.x;
+                       array[19] = min.y;
+                       array[20] = min.z;
+                       array[21] = max.x;
+                       array[22] = min.y;
+                       array[23] = min.z;
+                       position.needsUpdate = true;
+                       this.geometry.computeBoundingSphere();
+               }
+
+               setFromObject(object) {
+                       this.object = object;
+                       this.update();
+                       return this;
+               }
+
+               copy(source) {
+                       LineSegments.prototype.copy.call(this, source);
+                       this.object = source.object;
+                       return this;
+               }
+
+       }
+
+       class Box3Helper extends LineSegments {
+               constructor(box, color = 0xffff00) {
+                       const indices = 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]);
+                       const positions = [1, 1, 1, -1, 1, 1, -1, -1, 1, 1, -1, 1, 1, 1, -1, -1, 1, -1, -1, -1, -1, 1, -1, -1];
+                       const geometry = new BufferGeometry();
+                       geometry.setIndex(new BufferAttribute(indices, 1));
+                       geometry.setAttribute('position', new Float32BufferAttribute(positions, 3));
+                       super(geometry, new LineBasicMaterial({
+                               color: color,
+                               toneMapped: false
+                       }));
+                       this.box = box;
+                       this.type = 'Box3Helper';
+                       this.geometry.computeBoundingSphere();
+               }
+
+               updateMatrixWorld(force) {
+                       const box = this.box;
+                       if (box.isEmpty()) return;
+                       box.getCenter(this.position);
+                       box.getSize(this.scale);
+                       this.scale.multiplyScalar(0.5);
+                       super.updateMatrixWorld(force);
+               }
+
+       }
+
+       class PlaneHelper extends Line {
+               constructor(plane, size = 1, hex = 0xffff00) {
+                       const color = hex;
+                       const positions = [1, -1, 1, -1, 1, 1, -1, -1, 1, 1, 1, 1, -1, 1, 1, -1, -1, 1, 1, -1, 1, 1, 1, 1, 0, 0, 1, 0, 0, 0];
+                       const geometry = new BufferGeometry();
+                       geometry.setAttribute('position', new Float32BufferAttribute(positions, 3));
+                       geometry.computeBoundingSphere();
+                       super(geometry, new LineBasicMaterial({
+                               color: color,
+                               toneMapped: false
+                       }));
+                       this.type = 'PlaneHelper';
+                       this.plane = plane;
+                       this.size = size;
+                       const positions2 = [1, 1, 1, -1, 1, 1, -1, -1, 1, 1, 1, 1, -1, -1, 1, 1, -1, 1];
+                       const geometry2 = new BufferGeometry();
+                       geometry2.setAttribute('position', new Float32BufferAttribute(positions2, 3));
+                       geometry2.computeBoundingSphere();
+                       this.add(new Mesh(geometry2, new MeshBasicMaterial({
+                               color: color,
+                               opacity: 0.2,
+                               transparent: true,
+                               depthWrite: false,
+                               toneMapped: false
+                       })));
+               }
+
+               updateMatrixWorld(force) {
+                       let scale = -this.plane.constant;
+                       if (Math.abs(scale) < 1e-8) scale = 1e-8; // sign does not matter
+
+                       this.scale.set(0.5 * this.size, 0.5 * this.size, scale);
+                       this.children[0].material.side = scale < 0 ? BackSide : FrontSide; // renderer flips side when determinant < 0; flipping not wanted here
+
+                       this.lookAt(this.plane.normal);
+                       super.updateMatrixWorld(force);
+               }
+
+       }
+
+       const _axis = /*@__PURE__*/new Vector3();
+
+       let _lineGeometry, _coneGeometry;
+
+       class ArrowHelper extends Object3D {
+               // dir is assumed to be normalized
+               constructor(dir = new Vector3(0, 0, 1), origin = new Vector3(0, 0, 0), length = 1, color = 0xffff00, headLength = length * 0.2, headWidth = headLength * 0.2) {
+                       super();
+                       this.type = 'ArrowHelper';
+
+                       if (_lineGeometry === undefined) {
+                               _lineGeometry = new BufferGeometry();
+
+                               _lineGeometry.setAttribute('position', new Float32BufferAttribute([0, 0, 0, 0, 1, 0], 3));
+
+                               _coneGeometry = new CylinderGeometry(0, 0.5, 1, 5, 1);
+
+                               _coneGeometry.translate(0, -0.5, 0);
+                       }
+
+                       this.position.copy(origin);
+                       this.line = new Line(_lineGeometry, new LineBasicMaterial({
+                               color: color,
+                               toneMapped: false
+                       }));
+                       this.line.matrixAutoUpdate = false;
+                       this.add(this.line);
+                       this.cone = new Mesh(_coneGeometry, new MeshBasicMaterial({
+                               color: color,
+                               toneMapped: false
+                       }));
+                       this.cone.matrixAutoUpdate = false;
+                       this.add(this.cone);
+                       this.setDirection(dir);
+                       this.setLength(length, headLength, headWidth);
+               }
+
+               setDirection(dir) {
+                       // dir is assumed to be normalized
+                       if (dir.y > 0.99999) {
+                               this.quaternion.set(0, 0, 0, 1);
+                       } else if (dir.y < -0.99999) {
+                               this.quaternion.set(1, 0, 0, 0);
+                       } else {
+                               _axis.set(dir.z, 0, -dir.x).normalize();
+
+                               const radians = Math.acos(dir.y);
+                               this.quaternion.setFromAxisAngle(_axis, radians);
+                       }
+               }
+
+               setLength(length, headLength = length * 0.2, headWidth = headLength * 0.2) {
+                       this.line.scale.set(1, Math.max(0.0001, length - headLength), 1); // see #17458
+
+                       this.line.updateMatrix();
+                       this.cone.scale.set(headWidth, headLength, headWidth);
+                       this.cone.position.y = length;
+                       this.cone.updateMatrix();
+               }
+
+               setColor(color) {
+                       this.line.material.color.set(color);
+                       this.cone.material.color.set(color);
+               }
+
+               copy(source) {
+                       super.copy(source, false);
+                       this.line.copy(source.line);
+                       this.cone.copy(source.cone);
+                       return this;
+               }
+
+       }
+
+       class AxesHelper extends LineSegments {
+               constructor(size = 1) {
+                       const vertices = [0, 0, 0, size, 0, 0, 0, 0, 0, 0, size, 0, 0, 0, 0, 0, 0, size];
+                       const colors = [1, 0, 0, 1, 0.6, 0, 0, 1, 0, 0.6, 1, 0, 0, 0, 1, 0, 0.6, 1];
+                       const geometry = new BufferGeometry();
+                       geometry.setAttribute('position', new Float32BufferAttribute(vertices, 3));
+                       geometry.setAttribute('color', new Float32BufferAttribute(colors, 3));
+                       const material = new LineBasicMaterial({
+                               vertexColors: true,
+                               toneMapped: false
+                       });
+                       super(geometry, material);
+                       this.type = 'AxesHelper';
+               }
+
+               setColors(xAxisColor, yAxisColor, zAxisColor) {
+                       const color = new Color();
+                       const array = this.geometry.attributes.color.array;
+                       color.set(xAxisColor);
+                       color.toArray(array, 0);
+                       color.toArray(array, 3);
+                       color.set(yAxisColor);
+                       color.toArray(array, 6);
+                       color.toArray(array, 9);
+                       color.set(zAxisColor);
+                       color.toArray(array, 12);
+                       color.toArray(array, 15);
+                       this.geometry.attributes.color.needsUpdate = true;
+                       return this;
+               }
+
+               dispose() {
+                       this.geometry.dispose();
+                       this.material.dispose();
+               }
+
+       }
+
+       const _floatView = new Float32Array(1);
+
+       const _int32View = new Int32Array(_floatView.buffer);
+
+       class DataUtils {
+               // Converts float32 to float16 (stored as uint16 value).
+               static toHalfFloat(val) {
+                       // Source: http://gamedev.stackexchange.com/questions/17326/conversion-of-a-number-from-single-precision-floating-point-representation-to-a/17410#17410
+
+                       /* This method is faster than the OpenEXR implementation (very often
+                       * used, eg. in Ogre), with the additional benefit of rounding, inspired
+                       * by James Tursa?s half-precision code. */
+                       _floatView[0] = val;
+                       const x = _int32View[0];
+                       let bits = x >> 16 & 0x8000;
+                       /* Get the sign */
+
+                       let m = x >> 12 & 0x07ff;
+                       /* Keep one extra bit for rounding */
+
+                       const e = x >> 23 & 0xff;
+                       /* Using int is faster here */
+
+                       /* If zero, or denormal, or exponent underflows too much for a denormal
+                               * half, return signed zero. */
+
+                       if (e < 103) return bits;
+                       /* If NaN, return NaN. If Inf or exponent overflow, return Inf. */
+
+                       if (e > 142) {
+                               bits |= 0x7c00;
+                               /* If exponent was 0xff and one mantissa bit was set, it means NaN,
+                                                       * not Inf, so make sure we set one mantissa bit too. */
+
+                               bits |= (e == 255 ? 0 : 1) && x & 0x007fffff;
+                               return bits;
+                       }
+                       /* If exponent underflows but not too much, return a denormal */
+
+
+                       if (e < 113) {
+                               m |= 0x0800;
+                               /* Extra rounding may overflow and set mantissa to 0 and exponent
+                                       * to 1, which is OK. */
+
+                               bits |= (m >> 114 - e) + (m >> 113 - e & 1);
+                               return bits;
+                       }
+
+                       bits |= e - 112 << 10 | m >> 1;
+                       /* Extra rounding. An overflow will set mantissa to 0 and increment
+                               * the exponent, which is OK. */
+
+                       bits += m & 1;
+                       return bits;
+               }
+
+       }
+
+       const LineStrip = 0;
+       const LinePieces = 1;
+       const NoColors = 0;
+       const FaceColors = 1;
+       const VertexColors = 2;
+       function MeshFaceMaterial(materials) {
+               console.warn('THREE.MeshFaceMaterial has been removed. Use an Array instead.');
+               return materials;
+       }
+       function MultiMaterial(materials = []) {
+               console.warn('THREE.MultiMaterial has been removed. Use an Array instead.');
+               materials.isMultiMaterial = true;
+               materials.materials = materials;
+
+               materials.clone = function () {
+                       return materials.slice();
+               };
+
+               return materials;
+       }
+       function PointCloud(geometry, material) {
+               console.warn('THREE.PointCloud has been renamed to THREE.Points.');
+               return new Points(geometry, material);
+       }
+       function Particle(material) {
+               console.warn('THREE.Particle has been renamed to THREE.Sprite.');
+               return new Sprite(material);
+       }
+       function ParticleSystem(geometry, material) {
+               console.warn('THREE.ParticleSystem has been renamed to THREE.Points.');
+               return new Points(geometry, material);
+       }
+       function PointCloudMaterial(parameters) {
+               console.warn('THREE.PointCloudMaterial has been renamed to THREE.PointsMaterial.');
+               return new PointsMaterial(parameters);
+       }
+       function ParticleBasicMaterial(parameters) {
+               console.warn('THREE.ParticleBasicMaterial has been renamed to THREE.PointsMaterial.');
+               return new PointsMaterial(parameters);
+       }
+       function ParticleSystemMaterial(parameters) {
+               console.warn('THREE.ParticleSystemMaterial has been renamed to THREE.PointsMaterial.');
+               return new PointsMaterial(parameters);
+       }
+       function Vertex(x, y, z) {
+               console.warn('THREE.Vertex has been removed. Use THREE.Vector3 instead.');
+               return new Vector3(x, y, z);
+       } //
+
+       function DynamicBufferAttribute(array, itemSize) {
+               console.warn('THREE.DynamicBufferAttribute has been removed. Use new THREE.BufferAttribute().setUsage( THREE.DynamicDrawUsage ) instead.');
+               return new BufferAttribute(array, itemSize).setUsage(DynamicDrawUsage);
+       }
+       function Int8Attribute(array, itemSize) {
+               console.warn('THREE.Int8Attribute has been removed. Use new THREE.Int8BufferAttribute() instead.');
+               return new Int8BufferAttribute(array, itemSize);
+       }
+       function Uint8Attribute(array, itemSize) {
+               console.warn('THREE.Uint8Attribute has been removed. Use new THREE.Uint8BufferAttribute() instead.');
+               return new Uint8BufferAttribute(array, itemSize);
+       }
+       function Uint8ClampedAttribute(array, itemSize) {
+               console.warn('THREE.Uint8ClampedAttribute has been removed. Use new THREE.Uint8ClampedBufferAttribute() instead.');
+               return new Uint8ClampedBufferAttribute(array, itemSize);
+       }
+       function Int16Attribute(array, itemSize) {
+               console.warn('THREE.Int16Attribute has been removed. Use new THREE.Int16BufferAttribute() instead.');
+               return new Int16BufferAttribute(array, itemSize);
+       }
+       function Uint16Attribute(array, itemSize) {
+               console.warn('THREE.Uint16Attribute has been removed. Use new THREE.Uint16BufferAttribute() instead.');
+               return new Uint16BufferAttribute(array, itemSize);
+       }
+       function Int32Attribute(array, itemSize) {
+               console.warn('THREE.Int32Attribute has been removed. Use new THREE.Int32BufferAttribute() instead.');
+               return new Int32BufferAttribute(array, itemSize);
+       }
+       function Uint32Attribute(array, itemSize) {
+               console.warn('THREE.Uint32Attribute has been removed. Use new THREE.Uint32BufferAttribute() instead.');
+               return new Uint32BufferAttribute(array, itemSize);
+       }
+       function Float32Attribute(array, itemSize) {
+               console.warn('THREE.Float32Attribute has been removed. Use new THREE.Float32BufferAttribute() instead.');
+               return new Float32BufferAttribute(array, itemSize);
+       }
+       function Float64Attribute(array, itemSize) {
+               console.warn('THREE.Float64Attribute has been removed. Use new THREE.Float64BufferAttribute() instead.');
+               return new Float64BufferAttribute(array, itemSize);
+       } //
+
+       Curve.create = function (construct, getPoint) {
+               console.log('THREE.Curve.create() has been deprecated');
+               construct.prototype = Object.create(Curve.prototype);
+               construct.prototype.constructor = construct;
+               construct.prototype.getPoint = getPoint;
+               return construct;
+       }; //
+
+
+       Path.prototype.fromPoints = function (points) {
+               console.warn('THREE.Path: .fromPoints() has been renamed to .setFromPoints().');
+               return this.setFromPoints(points);
+       }; //
+
+
+       function AxisHelper(size) {
+               console.warn('THREE.AxisHelper has been renamed to THREE.AxesHelper.');
+               return new AxesHelper(size);
+       }
+       function BoundingBoxHelper(object, color) {
+               console.warn('THREE.BoundingBoxHelper has been deprecated. Creating a THREE.BoxHelper instead.');
+               return new BoxHelper(object, color);
+       }
+       function EdgesHelper(object, hex) {
+               console.warn('THREE.EdgesHelper has been removed. Use THREE.EdgesGeometry instead.');
+               return new LineSegments(new EdgesGeometry(object.geometry), new LineBasicMaterial({
+                       color: hex !== undefined ? hex : 0xffffff
+               }));
+       }
+
+       GridHelper.prototype.setColors = function () {
+               console.error('THREE.GridHelper: setColors() has been deprecated, pass them in the constructor instead.');
+       };
+
+       SkeletonHelper.prototype.update = function () {
+               console.error('THREE.SkeletonHelper: update() no longer needs to be called.');
+       };
+
+       function WireframeHelper(object, hex) {
+               console.warn('THREE.WireframeHelper has been removed. Use THREE.WireframeGeometry instead.');
+               return new LineSegments(new WireframeGeometry(object.geometry), new LineBasicMaterial({
+                       color: hex !== undefined ? hex : 0xffffff
+               }));
+       } //
+
+       Loader.prototype.extractUrlBase = function (url) {
+               console.warn('THREE.Loader: .extractUrlBase() has been deprecated. Use THREE.LoaderUtils.extractUrlBase() instead.');
+               return LoaderUtils.extractUrlBase(url);
+       };
+
+       Loader.Handlers = {
+               add: function () {
+                       console.error('THREE.Loader: Handlers.add() has been removed. Use LoadingManager.addHandler() instead.');
+               },
+               get: function () {
+                       console.error('THREE.Loader: Handlers.get() has been removed. Use LoadingManager.getHandler() instead.');
+               }
+       };
+       function XHRLoader(manager) {
+               console.warn('THREE.XHRLoader has been renamed to THREE.FileLoader.');
+               return new FileLoader(manager);
+       }
+       function BinaryTextureLoader(manager) {
+               console.warn('THREE.BinaryTextureLoader has been renamed to THREE.DataTextureLoader.');
+               return new DataTextureLoader(manager);
+       } //
+
+       Box2.prototype.center = function (optionalTarget) {
+               console.warn('THREE.Box2: .center() has been renamed to .getCenter().');
+               return this.getCenter(optionalTarget);
+       };
+
+       Box2.prototype.empty = function () {
+               console.warn('THREE.Box2: .empty() has been renamed to .isEmpty().');
+               return this.isEmpty();
+       };
+
+       Box2.prototype.isIntersectionBox = function (box) {
+               console.warn('THREE.Box2: .isIntersectionBox() has been renamed to .intersectsBox().');
+               return this.intersectsBox(box);
+       };
+
+       Box2.prototype.size = function (optionalTarget) {
+               console.warn('THREE.Box2: .size() has been renamed to .getSize().');
+               return this.getSize(optionalTarget);
+       }; //
+
+
+       Box3.prototype.center = function (optionalTarget) {
+               console.warn('THREE.Box3: .center() has been renamed to .getCenter().');
+               return this.getCenter(optionalTarget);
+       };
+
+       Box3.prototype.empty = function () {
+               console.warn('THREE.Box3: .empty() has been renamed to .isEmpty().');
+               return this.isEmpty();
+       };
+
+       Box3.prototype.isIntersectionBox = function (box) {
+               console.warn('THREE.Box3: .isIntersectionBox() has been renamed to .intersectsBox().');
+               return this.intersectsBox(box);
+       };
+
+       Box3.prototype.isIntersectionSphere = function (sphere) {
+               console.warn('THREE.Box3: .isIntersectionSphere() has been renamed to .intersectsSphere().');
+               return this.intersectsSphere(sphere);
+       };
+
+       Box3.prototype.size = function (optionalTarget) {
+               console.warn('THREE.Box3: .size() has been renamed to .getSize().');
+               return this.getSize(optionalTarget);
+       }; //
+
+
+       Sphere.prototype.empty = function () {
+               console.warn('THREE.Sphere: .empty() has been renamed to .isEmpty().');
+               return this.isEmpty();
+       }; //
+
+
+       Frustum.prototype.setFromMatrix = function (m) {
+               console.warn('THREE.Frustum: .setFromMatrix() has been renamed to .setFromProjectionMatrix().');
+               return this.setFromProjectionMatrix(m);
+       }; //
+
+
+       Line3.prototype.center = function (optionalTarget) {
+               console.warn('THREE.Line3: .center() has been renamed to .getCenter().');
+               return this.getCenter(optionalTarget);
+       }; //
+
+
+       Matrix3.prototype.flattenToArrayOffset = function (array, offset) {
+               console.warn('THREE.Matrix3: .flattenToArrayOffset() has been deprecated. Use .toArray() instead.');
+               return this.toArray(array, offset);
+       };
+
+       Matrix3.prototype.multiplyVector3 = function (vector) {
+               console.warn('THREE.Matrix3: .multiplyVector3() has been removed. Use vector.applyMatrix3( matrix ) instead.');
+               return vector.applyMatrix3(this);
+       };
+
+       Matrix3.prototype.multiplyVector3Array = function () {
+               console.error('THREE.Matrix3: .multiplyVector3Array() has been removed.');
+       };
+
+       Matrix3.prototype.applyToBufferAttribute = function (attribute) {
+               console.warn('THREE.Matrix3: .applyToBufferAttribute() has been removed. Use attribute.applyMatrix3( matrix ) instead.');
+               return attribute.applyMatrix3(this);
+       };
+
+       Matrix3.prototype.applyToVector3Array = function () {
+               console.error('THREE.Matrix3: .applyToVector3Array() has been removed.');
+       };
+
+       Matrix3.prototype.getInverse = function (matrix) {
+               console.warn('THREE.Matrix3: .getInverse() has been removed. Use matrixInv.copy( matrix ).invert(); instead.');
+               return this.copy(matrix).invert();
+       }; //
+
+
+       Matrix4.prototype.extractPosition = function (m) {
+               console.warn('THREE.Matrix4: .extractPosition() has been renamed to .copyPosition().');
+               return this.copyPosition(m);
+       };
+
+       Matrix4.prototype.flattenToArrayOffset = function (array, offset) {
+               console.warn('THREE.Matrix4: .flattenToArrayOffset() has been deprecated. Use .toArray() instead.');
+               return this.toArray(array, offset);
+       };
+
+       Matrix4.prototype.getPosition = function () {
+               console.warn('THREE.Matrix4: .getPosition() has been removed. Use Vector3.setFromMatrixPosition( matrix ) instead.');
+               return new Vector3().setFromMatrixColumn(this, 3);
+       };
+
+       Matrix4.prototype.setRotationFromQuaternion = function (q) {
+               console.warn('THREE.Matrix4: .setRotationFromQuaternion() has been renamed to .makeRotationFromQuaternion().');
+               return this.makeRotationFromQuaternion(q);
+       };
+
+       Matrix4.prototype.multiplyToArray = function () {
+               console.warn('THREE.Matrix4: .multiplyToArray() has been removed.');
+       };
+
+       Matrix4.prototype.multiplyVector3 = function (vector) {
+               console.warn('THREE.Matrix4: .multiplyVector3() has been removed. Use vector.applyMatrix4( matrix ) instead.');
+               return vector.applyMatrix4(this);
+       };
+
+       Matrix4.prototype.multiplyVector4 = function (vector) {
+               console.warn('THREE.Matrix4: .multiplyVector4() has been removed. Use vector.applyMatrix4( matrix ) instead.');
+               return vector.applyMatrix4(this);
+       };
+
+       Matrix4.prototype.multiplyVector3Array = function () {
+               console.error('THREE.Matrix4: .multiplyVector3Array() has been removed.');
+       };
+
+       Matrix4.prototype.rotateAxis = function (v) {
+               console.warn('THREE.Matrix4: .rotateAxis() has been removed. Use Vector3.transformDirection( matrix ) instead.');
+               v.transformDirection(this);
+       };
+
+       Matrix4.prototype.crossVector = function (vector) {
+               console.warn('THREE.Matrix4: .crossVector() has been removed. Use vector.applyMatrix4( matrix ) instead.');
+               return vector.applyMatrix4(this);
+       };
+
+       Matrix4.prototype.translate = function () {
+               console.error('THREE.Matrix4: .translate() has been removed.');
+       };
+
+       Matrix4.prototype.rotateX = function () {
+               console.error('THREE.Matrix4: .rotateX() has been removed.');
+       };
+
+       Matrix4.prototype.rotateY = function () {
+               console.error('THREE.Matrix4: .rotateY() has been removed.');
+       };
+
+       Matrix4.prototype.rotateZ = function () {
+               console.error('THREE.Matrix4: .rotateZ() has been removed.');
+       };
+
+       Matrix4.prototype.rotateByAxis = function () {
+               console.error('THREE.Matrix4: .rotateByAxis() has been removed.');
+       };
+
+       Matrix4.prototype.applyToBufferAttribute = function (attribute) {
+               console.warn('THREE.Matrix4: .applyToBufferAttribute() has been removed. Use attribute.applyMatrix4( matrix ) instead.');
+               return attribute.applyMatrix4(this);
+       };
+
+       Matrix4.prototype.applyToVector3Array = function () {
+               console.error('THREE.Matrix4: .applyToVector3Array() has been removed.');
+       };
+
+       Matrix4.prototype.makeFrustum = function (left, right, bottom, top, near, far) {
+               console.warn('THREE.Matrix4: .makeFrustum() has been removed. Use .makePerspective( left, right, top, bottom, near, far ) instead.');
+               return this.makePerspective(left, right, top, bottom, near, far);
+       };
+
+       Matrix4.prototype.getInverse = function (matrix) {
+               console.warn('THREE.Matrix4: .getInverse() has been removed. Use matrixInv.copy( matrix ).invert(); instead.');
+               return this.copy(matrix).invert();
+       }; //
+
+
+       Plane.prototype.isIntersectionLine = function (line) {
+               console.warn('THREE.Plane: .isIntersectionLine() has been renamed to .intersectsLine().');
+               return this.intersectsLine(line);
+       }; //
+
+
+       Quaternion.prototype.multiplyVector3 = function (vector) {
+               console.warn('THREE.Quaternion: .multiplyVector3() has been removed. Use is now vector.applyQuaternion( quaternion ) instead.');
+               return vector.applyQuaternion(this);
+       };
+
+       Quaternion.prototype.inverse = function () {
+               console.warn('THREE.Quaternion: .inverse() has been renamed to invert().');
+               return this.invert();
+       }; //
+
+
+       Ray.prototype.isIntersectionBox = function (box) {
+               console.warn('THREE.Ray: .isIntersectionBox() has been renamed to .intersectsBox().');
+               return this.intersectsBox(box);
+       };
+
+       Ray.prototype.isIntersectionPlane = function (plane) {
+               console.warn('THREE.Ray: .isIntersectionPlane() has been renamed to .intersectsPlane().');
+               return this.intersectsPlane(plane);
+       };
+
+       Ray.prototype.isIntersectionSphere = function (sphere) {
+               console.warn('THREE.Ray: .isIntersectionSphere() has been renamed to .intersectsSphere().');
+               return this.intersectsSphere(sphere);
+       }; //
+
+
+       Triangle.prototype.area = function () {
+               console.warn('THREE.Triangle: .area() has been renamed to .getArea().');
+               return this.getArea();
+       };
+
+       Triangle.prototype.barycoordFromPoint = function (point, target) {
+               console.warn('THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord().');
+               return this.getBarycoord(point, target);
+       };
+
+       Triangle.prototype.midpoint = function (target) {
+               console.warn('THREE.Triangle: .midpoint() has been renamed to .getMidpoint().');
+               return this.getMidpoint(target);
+       };
+
+       Triangle.prototypenormal = function (target) {
+               console.warn('THREE.Triangle: .normal() has been renamed to .getNormal().');
+               return this.getNormal(target);
+       };
+
+       Triangle.prototype.plane = function (target) {
+               console.warn('THREE.Triangle: .plane() has been renamed to .getPlane().');
+               return this.getPlane(target);
+       };
+
+       Triangle.barycoordFromPoint = function (point, a, b, c, target) {
+               console.warn('THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord().');
+               return Triangle.getBarycoord(point, a, b, c, target);
+       };
+
+       Triangle.normal = function (a, b, c, target) {
+               console.warn('THREE.Triangle: .normal() has been renamed to .getNormal().');
+               return Triangle.getNormal(a, b, c, target);
+       }; //
+
+
+       Shape.prototype.extractAllPoints = function (divisions) {
+               console.warn('THREE.Shape: .extractAllPoints() has been removed. Use .extractPoints() instead.');
+               return this.extractPoints(divisions);
+       };
+
+       Shape.prototype.extrude = function (options) {
+               console.warn('THREE.Shape: .extrude() has been removed. Use ExtrudeGeometry() instead.');
+               return new ExtrudeGeometry(this, options);
+       };
+
+       Shape.prototype.makeGeometry = function (options) {
+               console.warn('THREE.Shape: .makeGeometry() has been removed. Use ShapeGeometry() instead.');
+               return new ShapeGeometry(this, options);
+       }; //
+
+
+       Vector2.prototype.fromAttribute = function (attribute, index, offset) {
+               console.warn('THREE.Vector2: .fromAttribute() has been renamed to .fromBufferAttribute().');
+               return this.fromBufferAttribute(attribute, index, offset);
+       };
+
+       Vector2.prototype.distanceToManhattan = function (v) {
+               console.warn('THREE.Vector2: .distanceToManhattan() has been renamed to .manhattanDistanceTo().');
+               return this.manhattanDistanceTo(v);
+       };
+
+       Vector2.prototype.lengthManhattan = function () {
+               console.warn('THREE.Vector2: .lengthManhattan() has been renamed to .manhattanLength().');
+               return this.manhattanLength();
+       }; //
+
+
+       Vector3.prototype.setEulerFromRotationMatrix = function () {
+               console.error('THREE.Vector3: .setEulerFromRotationMatrix() has been removed. Use Euler.setFromRotationMatrix() instead.');
+       };
+
+       Vector3.prototype.setEulerFromQuaternion = function () {
+               console.error('THREE.Vector3: .setEulerFromQuaternion() has been removed. Use Euler.setFromQuaternion() instead.');
+       };
+
+       Vector3.prototype.getPositionFromMatrix = function (m) {
+               console.warn('THREE.Vector3: .getPositionFromMatrix() has been renamed to .setFromMatrixPosition().');
+               return this.setFromMatrixPosition(m);
+       };
+
+       Vector3.prototype.getScaleFromMatrix = function (m) {
+               console.warn('THREE.Vector3: .getScaleFromMatrix() has been renamed to .setFromMatrixScale().');
+               return this.setFromMatrixScale(m);
+       };
+
+       Vector3.prototype.getColumnFromMatrix = function (index, matrix) {
+               console.warn('THREE.Vector3: .getColumnFromMatrix() has been renamed to .setFromMatrixColumn().');
+               return this.setFromMatrixColumn(matrix, index);
+       };
+
+       Vector3.prototype.applyProjection = function (m) {
+               console.warn('THREE.Vector3: .applyProjection() has been removed. Use .applyMatrix4( m ) instead.');
+               return this.applyMatrix4(m);
+       };
+
+       Vector3.prototype.fromAttribute = function (attribute, index, offset) {
+               console.warn('THREE.Vector3: .fromAttribute() has been renamed to .fromBufferAttribute().');
+               return this.fromBufferAttribute(attribute, index, offset);
+       };
+
+       Vector3.prototype.distanceToManhattan = function (v) {
+               console.warn('THREE.Vector3: .distanceToManhattan() has been renamed to .manhattanDistanceTo().');
+               return this.manhattanDistanceTo(v);
+       };
+
+       Vector3.prototype.lengthManhattan = function () {
+               console.warn('THREE.Vector3: .lengthManhattan() has been renamed to .manhattanLength().');
+               return this.manhattanLength();
+       }; //
+
+
+       Vector4.prototype.fromAttribute = function (attribute, index, offset) {
+               console.warn('THREE.Vector4: .fromAttribute() has been renamed to .fromBufferAttribute().');
+               return this.fromBufferAttribute(attribute, index, offset);
+       };
+
+       Vector4.prototype.lengthManhattan = function () {
+               console.warn('THREE.Vector4: .lengthManhattan() has been renamed to .manhattanLength().');
+               return this.manhattanLength();
+       }; //
+
+
+       Object3D.prototype.getChildByName = function (name) {
+               console.warn('THREE.Object3D: .getChildByName() has been renamed to .getObjectByName().');
+               return this.getObjectByName(name);
+       };
+
+       Object3D.prototype.renderDepth = function () {
+               console.warn('THREE.Object3D: .renderDepth has been removed. Use .renderOrder, instead.');
+       };
+
+       Object3D.prototype.translate = function (distance, axis) {
+               console.warn('THREE.Object3D: .translate() has been removed. Use .translateOnAxis( axis, distance ) instead.');
+               return this.translateOnAxis(axis, distance);
+       };
+
+       Object3D.prototype.getWorldRotation = function () {
+               console.error('THREE.Object3D: .getWorldRotation() has been removed. Use THREE.Object3D.getWorldQuaternion( target ) instead.');
+       };
+
+       Object3D.prototype.applyMatrix = function (matrix) {
+               console.warn('THREE.Object3D: .applyMatrix() has been renamed to .applyMatrix4().');
+               return this.applyMatrix4(matrix);
+       };
+
+       Object.defineProperties(Object3D.prototype, {
+               eulerOrder: {
+                       get: function () {
+                               console.warn('THREE.Object3D: .eulerOrder is now .rotation.order.');
+                               return this.rotation.order;
+                       },
+                       set: function (value) {
+                               console.warn('THREE.Object3D: .eulerOrder is now .rotation.order.');
+                               this.rotation.order = value;
+                       }
+               },
+               useQuaternion: {
+                       get: function () {
+                               console.warn('THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.');
+                       },
+                       set: function () {
+                               console.warn('THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.');
+                       }
+               }
+       });
+
+       Mesh.prototype.setDrawMode = function () {
+               console.error('THREE.Mesh: .setDrawMode() has been removed. The renderer now always assumes THREE.TrianglesDrawMode. Transform your geometry via BufferGeometryUtils.toTrianglesDrawMode() if necessary.');
+       };
+
+       Object.defineProperties(Mesh.prototype, {
+               drawMode: {
+                       get: function () {
+                               console.error('THREE.Mesh: .drawMode has been removed. The renderer now always assumes THREE.TrianglesDrawMode.');
+                               return TrianglesDrawMode;
+                       },
+                       set: function () {
+                               console.error('THREE.Mesh: .drawMode has been removed. The renderer now always assumes THREE.TrianglesDrawMode. Transform your geometry via BufferGeometryUtils.toTrianglesDrawMode() if necessary.');
+                       }
+               }
+       });
+
+       SkinnedMesh.prototype.initBones = function () {
+               console.error('THREE.SkinnedMesh: initBones() has been removed.');
+       }; //
+
+
+       PerspectiveCamera.prototype.setLens = function (focalLength, filmGauge) {
+               console.warn('THREE.PerspectiveCamera.setLens is deprecated. ' + 'Use .setFocalLength and .filmGauge for a photographic setup.');
+               if (filmGauge !== undefined) this.filmGauge = filmGauge;
+               this.setFocalLength(focalLength);
+       }; //
+
+
+       Object.defineProperties(Light.prototype, {
+               onlyShadow: {
+                       set: function () {
+                               console.warn('THREE.Light: .onlyShadow has been removed.');
+                       }
+               },
+               shadowCameraFov: {
+                       set: function (value) {
+                               console.warn('THREE.Light: .shadowCameraFov is now .shadow.camera.fov.');
+                               this.shadow.camera.fov = value;
+                       }
+               },
+               shadowCameraLeft: {
+                       set: function (value) {
+                               console.warn('THREE.Light: .shadowCameraLeft is now .shadow.camera.left.');
+                               this.shadow.camera.left = value;
+                       }
+               },
+               shadowCameraRight: {
+                       set: function (value) {
+                               console.warn('THREE.Light: .shadowCameraRight is now .shadow.camera.right.');
+                               this.shadow.camera.right = value;
+                       }
+               },
+               shadowCameraTop: {
+                       set: function (value) {
+                               console.warn('THREE.Light: .shadowCameraTop is now .shadow.camera.top.');
+                               this.shadow.camera.top = value;
+                       }
+               },
+               shadowCameraBottom: {
+                       set: function (value) {
+                               console.warn('THREE.Light: .shadowCameraBottom is now .shadow.camera.bottom.');
+                               this.shadow.camera.bottom = value;
+                       }
+               },
+               shadowCameraNear: {
+                       set: function (value) {
+                               console.warn('THREE.Light: .shadowCameraNear is now .shadow.camera.near.');
+                               this.shadow.camera.near = value;
+                       }
+               },
+               shadowCameraFar: {
+                       set: function (value) {
+                               console.warn('THREE.Light: .shadowCameraFar is now .shadow.camera.far.');
+                               this.shadow.camera.far = value;
+                       }
+               },
+               shadowCameraVisible: {
+                       set: function () {
+                               console.warn('THREE.Light: .shadowCameraVisible has been removed. Use new THREE.CameraHelper( light.shadow.camera ) instead.');
+                       }
+               },
+               shadowBias: {
+                       set: function (value) {
+                               console.warn('THREE.Light: .shadowBias is now .shadow.bias.');
+                               this.shadow.bias = value;
+                       }
+               },
+               shadowDarkness: {
+                       set: function () {
+                               console.warn('THREE.Light: .shadowDarkness has been removed.');
+                       }
+               },
+               shadowMapWidth: {
+                       set: function (value) {
+                               console.warn('THREE.Light: .shadowMapWidth is now .shadow.mapSize.width.');
+                               this.shadow.mapSize.width = value;
+                       }
+               },
+               shadowMapHeight: {
+                       set: function (value) {
+                               console.warn('THREE.Light: .shadowMapHeight is now .shadow.mapSize.height.');
+                               this.shadow.mapSize.height = value;
+                       }
+               }
+       }); //
+
+       Object.defineProperties(BufferAttribute.prototype, {
+               length: {
+                       get: function () {
+                               console.warn('THREE.BufferAttribute: .length has been deprecated. Use .count instead.');
+                               return this.array.length;
+                       }
+               },
+               dynamic: {
+                       get: function () {
+                               console.warn('THREE.BufferAttribute: .dynamic has been deprecated. Use .usage instead.');
+                               return this.usage === DynamicDrawUsage;
+                       },
+                       set: function () {
+                               console.warn('THREE.BufferAttribute: .dynamic has been deprecated. Use .usage instead.');
+                               this.setUsage(DynamicDrawUsage);
+                       }
+               }
+       });
+
+       BufferAttribute.prototype.setDynamic = function (value) {
+               console.warn('THREE.BufferAttribute: .setDynamic() has been deprecated. Use .setUsage() instead.');
+               this.setUsage(value === true ? DynamicDrawUsage : StaticDrawUsage);
+               return this;
+       };
+
+       BufferAttribute.prototype.copyIndicesArray = function () {
+               console.error('THREE.BufferAttribute: .copyIndicesArray() has been removed.');
+       }, BufferAttribute.prototype.setArray = function () {
+               console.error('THREE.BufferAttribute: .setArray has been removed. Use BufferGeometry .setAttribute to replace/resize attribute buffers');
+       }; //
+
+       BufferGeometry.prototype.addIndex = function (index) {
+               console.warn('THREE.BufferGeometry: .addIndex() has been renamed to .setIndex().');
+               this.setIndex(index);
+       };
+
+       BufferGeometry.prototype.addAttribute = function (name, attribute) {
+               console.warn('THREE.BufferGeometry: .addAttribute() has been renamed to .setAttribute().');
+
+               if (!(attribute && attribute.isBufferAttribute) && !(attribute && attribute.isInterleavedBufferAttribute)) {
+                       console.warn('THREE.BufferGeometry: .addAttribute() now expects ( name, attribute ).');
+                       return this.setAttribute(name, new BufferAttribute(arguments[1], arguments[2]));
+               }
+
+               if (name === 'index') {
+                       console.warn('THREE.BufferGeometry.addAttribute: Use .setIndex() for index attribute.');
+                       this.setIndex(attribute);
+                       return this;
+               }
+
+               return this.setAttribute(name, attribute);
+       };
+
+       BufferGeometry.prototype.addDrawCall = function (start, count, indexOffset) {
+               if (indexOffset !== undefined) {
+                       console.warn('THREE.BufferGeometry: .addDrawCall() no longer supports indexOffset.');
+               }
+
+               console.warn('THREE.BufferGeometry: .addDrawCall() is now .addGroup().');
+               this.addGroup(start, count);
+       };
+
+       BufferGeometry.prototype.clearDrawCalls = function () {
+               console.warn('THREE.BufferGeometry: .clearDrawCalls() is now .clearGroups().');
+               this.clearGroups();
+       };
+
+       BufferGeometry.prototype.computeOffsets = function () {
+               console.warn('THREE.BufferGeometry: .computeOffsets() has been removed.');
+       };
+
+       BufferGeometry.prototype.removeAttribute = function (name) {
+               console.warn('THREE.BufferGeometry: .removeAttribute() has been renamed to .deleteAttribute().');
+               return this.deleteAttribute(name);
+       };
+
+       BufferGeometry.prototype.applyMatrix = function (matrix) {
+               console.warn('THREE.BufferGeometry: .applyMatrix() has been renamed to .applyMatrix4().');
+               return this.applyMatrix4(matrix);
+       };
+
+       Object.defineProperties(BufferGeometry.prototype, {
+               drawcalls: {
+                       get: function () {
+                               console.error('THREE.BufferGeometry: .drawcalls has been renamed to .groups.');
+                               return this.groups;
+                       }
+               },
+               offsets: {
+                       get: function () {
+                               console.warn('THREE.BufferGeometry: .offsets has been renamed to .groups.');
+                               return this.groups;
+                       }
+               }
+       });
+
+       InterleavedBuffer.prototype.setDynamic = function (value) {
+               console.warn('THREE.InterleavedBuffer: .setDynamic() has been deprecated. Use .setUsage() instead.');
+               this.setUsage(value === true ? DynamicDrawUsage : StaticDrawUsage);
+               return this;
+       };
+
+       InterleavedBuffer.prototype.setArray = function () {
+               console.error('THREE.InterleavedBuffer: .setArray has been removed. Use BufferGeometry .setAttribute to replace/resize attribute buffers');
+       }; //
+
+
+       ExtrudeGeometry.prototype.getArrays = function () {
+               console.error('THREE.ExtrudeGeometry: .getArrays() has been removed.');
+       };
+
+       ExtrudeGeometry.prototype.addShapeList = function () {
+               console.error('THREE.ExtrudeGeometry: .addShapeList() has been removed.');
+       };
+
+       ExtrudeGeometry.prototype.addShape = function () {
+               console.error('THREE.ExtrudeGeometry: .addShape() has been removed.');
+       }; //
+
+
+       Scene.prototype.dispose = function () {
+               console.error('THREE.Scene: .dispose() has been removed.');
+       }; //
+
+
+       Uniform.prototype.onUpdate = function () {
+               console.warn('THREE.Uniform: .onUpdate() has been removed. Use object.onBeforeRender() instead.');
+               return this;
+       }; //
+
+
+       Object.defineProperties(Material.prototype, {
+               wrapAround: {
+                       get: function () {
+                               console.warn('THREE.Material: .wrapAround has been removed.');
+                       },
+                       set: function () {
+                               console.warn('THREE.Material: .wrapAround has been removed.');
+                       }
+               },
+               overdraw: {
+                       get: function () {
+                               console.warn('THREE.Material: .overdraw has been removed.');
+                       },
+                       set: function () {
+                               console.warn('THREE.Material: .overdraw has been removed.');
+                       }
+               },
+               wrapRGB: {
+                       get: function () {
+                               console.warn('THREE.Material: .wrapRGB has been removed.');
+                               return new Color();
+                       }
+               },
+               shading: {
+                       get: function () {
+                               console.error('THREE.' + this.type + ': .shading has been removed. Use the boolean .flatShading instead.');
+                       },
+                       set: function (value) {
+                               console.warn('THREE.' + this.type + ': .shading has been removed. Use the boolean .flatShading instead.');
+                               this.flatShading = value === FlatShading;
+                       }
+               },
+               stencilMask: {
+                       get: function () {
+                               console.warn('THREE.' + this.type + ': .stencilMask has been removed. Use .stencilFuncMask instead.');
+                               return this.stencilFuncMask;
+                       },
+                       set: function (value) {
+                               console.warn('THREE.' + this.type + ': .stencilMask has been removed. Use .stencilFuncMask instead.');
+                               this.stencilFuncMask = value;
+                       }
+               },
+               vertexTangents: {
+                       get: function () {
+                               console.warn('THREE.' + this.type + ': .vertexTangents has been removed.');
+                       },
+                       set: function () {
+                               console.warn('THREE.' + this.type + ': .vertexTangents has been removed.');
+                       }
+               }
+       });
+       Object.defineProperties(ShaderMaterial.prototype, {
+               derivatives: {
+                       get: function () {
+                               console.warn('THREE.ShaderMaterial: .derivatives has been moved to .extensions.derivatives.');
+                               return this.extensions.derivatives;
+                       },
+                       set: function (value) {
+                               console.warn('THREE. ShaderMaterial: .derivatives has been moved to .extensions.derivatives.');
+                               this.extensions.derivatives = value;
+                       }
+               }
+       }); //
+
+       WebGLRenderer.prototype.clearTarget = function (renderTarget, color, depth, stencil) {
+               console.warn('THREE.WebGLRenderer: .clearTarget() has been deprecated. Use .setRenderTarget() and .clear() instead.');
+               this.setRenderTarget(renderTarget);
+               this.clear(color, depth, stencil);
+       };
+
+       WebGLRenderer.prototype.animate = function (callback) {
+               console.warn('THREE.WebGLRenderer: .animate() is now .setAnimationLoop().');
+               this.setAnimationLoop(callback);
+       };
+
+       WebGLRenderer.prototype.getCurrentRenderTarget = function () {
+               console.warn('THREE.WebGLRenderer: .getCurrentRenderTarget() is now .getRenderTarget().');
+               return this.getRenderTarget();
+       };
+
+       WebGLRenderer.prototype.getMaxAnisotropy = function () {
+               console.warn('THREE.WebGLRenderer: .getMaxAnisotropy() is now .capabilities.getMaxAnisotropy().');
+               return this.capabilities.getMaxAnisotropy();
+       };
+
+       WebGLRenderer.prototype.getPrecision = function () {
+               console.warn('THREE.WebGLRenderer: .getPrecision() is now .capabilities.precision.');
+               return this.capabilities.precision;
+       };
+
+       WebGLRenderer.prototype.resetGLState = function () {
+               console.warn('THREE.WebGLRenderer: .resetGLState() is now .state.reset().');
+               return this.state.reset();
+       };
+
+       WebGLRenderer.prototype.supportsFloatTextures = function () {
+               console.warn('THREE.WebGLRenderer: .supportsFloatTextures() is now .extensions.get( \'OES_texture_float\' ).');
+               return this.extensions.get('OES_texture_float');
+       };
+
+       WebGLRenderer.prototype.supportsHalfFloatTextures = function () {
+               console.warn('THREE.WebGLRenderer: .supportsHalfFloatTextures() is now .extensions.get( \'OES_texture_half_float\' ).');
+               return this.extensions.get('OES_texture_half_float');
+       };
+
+       WebGLRenderer.prototype.supportsStandardDerivatives = function () {
+               console.warn('THREE.WebGLRenderer: .supportsStandardDerivatives() is now .extensions.get( \'OES_standard_derivatives\' ).');
+               return this.extensions.get('OES_standard_derivatives');
+       };
+
+       WebGLRenderer.prototype.supportsCompressedTextureS3TC = function () {
+               console.warn('THREE.WebGLRenderer: .supportsCompressedTextureS3TC() is now .extensions.get( \'WEBGL_compressed_texture_s3tc\' ).');
+               return this.extensions.get('WEBGL_compressed_texture_s3tc');
+       };
+
+       WebGLRenderer.prototype.supportsCompressedTexturePVRTC = function () {
+               console.warn('THREE.WebGLRenderer: .supportsCompressedTexturePVRTC() is now .extensions.get( \'WEBGL_compressed_texture_pvrtc\' ).');
+               return this.extensions.get('WEBGL_compressed_texture_pvrtc');
+       };
+
+       WebGLRenderer.prototype.supportsBlendMinMax = function () {
+               console.warn('THREE.WebGLRenderer: .supportsBlendMinMax() is now .extensions.get( \'EXT_blend_minmax\' ).');
+               return this.extensions.get('EXT_blend_minmax');
+       };
+
+       WebGLRenderer.prototype.supportsVertexTextures = function () {
+               console.warn('THREE.WebGLRenderer: .supportsVertexTextures() is now .capabilities.vertexTextures.');
+               return this.capabilities.vertexTextures;
+       };
+
+       WebGLRenderer.prototype.supportsInstancedArrays = function () {
+               console.warn('THREE.WebGLRenderer: .supportsInstancedArrays() is now .extensions.get( \'ANGLE_instanced_arrays\' ).');
+               return this.extensions.get('ANGLE_instanced_arrays');
+       };
+
+       WebGLRenderer.prototype.enableScissorTest = function (boolean) {
+               console.warn('THREE.WebGLRenderer: .enableScissorTest() is now .setScissorTest().');
+               this.setScissorTest(boolean);
+       };
+
+       WebGLRenderer.prototype.initMaterial = function () {
+               console.warn('THREE.WebGLRenderer: .initMaterial() has been removed.');
+       };
+
+       WebGLRenderer.prototype.addPrePlugin = function () {
+               console.warn('THREE.WebGLRenderer: .addPrePlugin() has been removed.');
+       };
+
+       WebGLRenderer.prototype.addPostPlugin = function () {
+               console.warn('THREE.WebGLRenderer: .addPostPlugin() has been removed.');
+       };
+
+       WebGLRenderer.prototype.updateShadowMap = function () {
+               console.warn('THREE.WebGLRenderer: .updateShadowMap() has been removed.');
+       };
+
+       WebGLRenderer.prototype.setFaceCulling = function () {
+               console.warn('THREE.WebGLRenderer: .setFaceCulling() has been removed.');
+       };
+
+       WebGLRenderer.prototype.allocTextureUnit = function () {
+               console.warn('THREE.WebGLRenderer: .allocTextureUnit() has been removed.');
+       };
+
+       WebGLRenderer.prototype.setTexture = function () {
+               console.warn('THREE.WebGLRenderer: .setTexture() has been removed.');
+       };
+
+       WebGLRenderer.prototype.setTexture2D = function () {
+               console.warn('THREE.WebGLRenderer: .setTexture2D() has been removed.');
+       };
+
+       WebGLRenderer.prototype.setTextureCube = function () {
+               console.warn('THREE.WebGLRenderer: .setTextureCube() has been removed.');
+       };
+
+       WebGLRenderer.prototype.getActiveMipMapLevel = function () {
+               console.warn('THREE.WebGLRenderer: .getActiveMipMapLevel() is now .getActiveMipmapLevel().');
+               return this.getActiveMipmapLevel();
+       };
+
+       Object.defineProperties(WebGLRenderer.prototype, {
+               shadowMapEnabled: {
+                       get: function () {
+                               return this.shadowMap.enabled;
+                       },
+                       set: function (value) {
+                               console.warn('THREE.WebGLRenderer: .shadowMapEnabled is now .shadowMap.enabled.');
+                               this.shadowMap.enabled = value;
+                       }
+               },
+               shadowMapType: {
+                       get: function () {
+                               return this.shadowMap.type;
+                       },
+                       set: function (value) {
+                               console.warn('THREE.WebGLRenderer: .shadowMapType is now .shadowMap.type.');
+                               this.shadowMap.type = value;
+                       }
+               },
+               shadowMapCullFace: {
+                       get: function () {
+                               console.warn('THREE.WebGLRenderer: .shadowMapCullFace has been removed. Set Material.shadowSide instead.');
+                               return undefined;
+                       },
+                       set: function () {
+                               console.warn('THREE.WebGLRenderer: .shadowMapCullFace has been removed. Set Material.shadowSide instead.');
+                       }
+               },
+               context: {
+                       get: function () {
+                               console.warn('THREE.WebGLRenderer: .context has been removed. Use .getContext() instead.');
+                               return this.getContext();
+                       }
+               },
+               vr: {
+                       get: function () {
+                               console.warn('THREE.WebGLRenderer: .vr has been renamed to .xr');
+                               return this.xr;
+                       }
+               },
+               gammaInput: {
+                       get: function () {
+                               console.warn('THREE.WebGLRenderer: .gammaInput has been removed. Set the encoding for textures via Texture.encoding instead.');
+                               return false;
+                       },
+                       set: function () {
+                               console.warn('THREE.WebGLRenderer: .gammaInput has been removed. Set the encoding for textures via Texture.encoding instead.');
+                       }
+               },
+               gammaOutput: {
+                       get: function () {
+                               console.warn('THREE.WebGLRenderer: .gammaOutput has been removed. Set WebGLRenderer.outputEncoding instead.');
+                               return false;
+                       },
+                       set: function (value) {
+                               console.warn('THREE.WebGLRenderer: .gammaOutput has been removed. Set WebGLRenderer.outputEncoding instead.');
+                               this.outputEncoding = value === true ? sRGBEncoding : LinearEncoding;
+                       }
+               },
+               toneMappingWhitePoint: {
+                       get: function () {
+                               console.warn('THREE.WebGLRenderer: .toneMappingWhitePoint has been removed.');
+                               return 1.0;
+                       },
+                       set: function () {
+                               console.warn('THREE.WebGLRenderer: .toneMappingWhitePoint has been removed.');
+                       }
+               }
+       });
+       Object.defineProperties(WebGLShadowMap.prototype, {
+               cullFace: {
+                       get: function () {
+                               console.warn('THREE.WebGLRenderer: .shadowMap.cullFace has been removed. Set Material.shadowSide instead.');
+                               return undefined;
+                       },
+                       set: function () {
+                               console.warn('THREE.WebGLRenderer: .shadowMap.cullFace has been removed. Set Material.shadowSide instead.');
+                       }
+               },
+               renderReverseSided: {
+                       get: function () {
+                               console.warn('THREE.WebGLRenderer: .shadowMap.renderReverseSided has been removed. Set Material.shadowSide instead.');
+                               return undefined;
+                       },
+                       set: function () {
+                               console.warn('THREE.WebGLRenderer: .shadowMap.renderReverseSided has been removed. Set Material.shadowSide instead.');
+                       }
+               },
+               renderSingleSided: {
+                       get: function () {
+                               console.warn('THREE.WebGLRenderer: .shadowMap.renderSingleSided has been removed. Set Material.shadowSide instead.');
+                               return undefined;
+                       },
+                       set: function () {
+                               console.warn('THREE.WebGLRenderer: .shadowMap.renderSingleSided has been removed. Set Material.shadowSide instead.');
+                       }
+               }
+       });
+       function WebGLRenderTargetCube(width, height, options) {
+               console.warn('THREE.WebGLRenderTargetCube( width, height, options ) is now WebGLCubeRenderTarget( size, options ).');
+               return new WebGLCubeRenderTarget(width, options);
+       } //
+
+       Object.defineProperties(WebGLRenderTarget.prototype, {
+               wrapS: {
+                       get: function () {
+                               console.warn('THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS.');
+                               return this.texture.wrapS;
+                       },
+                       set: function (value) {
+                               console.warn('THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS.');
+                               this.texture.wrapS = value;
+                       }
+               },
+               wrapT: {
+                       get: function () {
+                               console.warn('THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT.');
+                               return this.texture.wrapT;
+                       },
+                       set: function (value) {
+                               console.warn('THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT.');
+                               this.texture.wrapT = value;
+                       }
+               },
+               magFilter: {
+                       get: function () {
+                               console.warn('THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter.');
+                               return this.texture.magFilter;
+                       },
+                       set: function (value) {
+                               console.warn('THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter.');
+                               this.texture.magFilter = value;
+                       }
+               },
+               minFilter: {
+                       get: function () {
+                               console.warn('THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter.');
+                               return this.texture.minFilter;
+                       },
+                       set: function (value) {
+                               console.warn('THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter.');
+                               this.texture.minFilter = value;
+                       }
+               },
+               anisotropy: {
+                       get: function () {
+                               console.warn('THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy.');
+                               return this.texture.anisotropy;
+                       },
+                       set: function (value) {
+                               console.warn('THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy.');
+                               this.texture.anisotropy = value;
+                       }
+               },
+               offset: {
+                       get: function () {
+                               console.warn('THREE.WebGLRenderTarget: .offset is now .texture.offset.');
+                               return this.texture.offset;
+                       },
+                       set: function (value) {
+                               console.warn('THREE.WebGLRenderTarget: .offset is now .texture.offset.');
+                               this.texture.offset = value;
+                       }
+               },
+               repeat: {
+                       get: function () {
+                               console.warn('THREE.WebGLRenderTarget: .repeat is now .texture.repeat.');
+                               return this.texture.repeat;
+                       },
+                       set: function (value) {
+                               console.warn('THREE.WebGLRenderTarget: .repeat is now .texture.repeat.');
+                               this.texture.repeat = value;
+                       }
+               },
+               format: {
+                       get: function () {
+                               console.warn('THREE.WebGLRenderTarget: .format is now .texture.format.');
+                               return this.texture.format;
+                       },
+                       set: function (value) {
+                               console.warn('THREE.WebGLRenderTarget: .format is now .texture.format.');
+                               this.texture.format = value;
+                       }
+               },
+               type: {
+                       get: function () {
+                               console.warn('THREE.WebGLRenderTarget: .type is now .texture.type.');
+                               return this.texture.type;
+                       },
+                       set: function (value) {
+                               console.warn('THREE.WebGLRenderTarget: .type is now .texture.type.');
+                               this.texture.type = value;
+                       }
+               },
+               generateMipmaps: {
+                       get: function () {
+                               console.warn('THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps.');
+                               return this.texture.generateMipmaps;
+                       },
+                       set: function (value) {
+                               console.warn('THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps.');
+                               this.texture.generateMipmaps = value;
+                       }
+               }
+       }); //
+
+       Audio.prototype.load = function (file) {
+               console.warn('THREE.Audio: .load has been deprecated. Use THREE.AudioLoader instead.');
+               const scope = this;
+               const audioLoader = new AudioLoader();
+               audioLoader.load(file, function (buffer) {
+                       scope.setBuffer(buffer);
+               });
+               return this;
+       };
+
+       AudioAnalyser.prototype.getData = function () {
+               console.warn('THREE.AudioAnalyser: .getData() is now .getFrequencyData().');
+               return this.getFrequencyData();
+       }; //
+
+
+       CubeCamera.prototype.updateCubeMap = function (renderer, scene) {
+               console.warn('THREE.CubeCamera: .updateCubeMap() is now .update().');
+               return this.update(renderer, scene);
+       };
+
+       CubeCamera.prototype.clear = function (renderer, color, depth, stencil) {
+               console.warn('THREE.CubeCamera: .clear() is now .renderTarget.clear().');
+               return this.renderTarget.clear(renderer, color, depth, stencil);
+       };
+
+       ImageUtils.crossOrigin = undefined;
+
+       ImageUtils.loadTexture = function (url, mapping, onLoad, onError) {
+               console.warn('THREE.ImageUtils.loadTexture has been deprecated. Use THREE.TextureLoader() instead.');
+               const loader = new TextureLoader();
+               loader.setCrossOrigin(this.crossOrigin);
+               const texture = loader.load(url, onLoad, undefined, onError);
+               if (mapping) texture.mapping = mapping;
+               return texture;
+       };
+
+       ImageUtils.loadTextureCube = function (urls, mapping, onLoad, onError) {
+               console.warn('THREE.ImageUtils.loadTextureCube has been deprecated. Use THREE.CubeTextureLoader() instead.');
+               const loader = new CubeTextureLoader();
+               loader.setCrossOrigin(this.crossOrigin);
+               const texture = loader.load(urls, onLoad, undefined, onError);
+               if (mapping) texture.mapping = mapping;
+               return texture;
+       };
+
+       ImageUtils.loadCompressedTexture = function () {
+               console.error('THREE.ImageUtils.loadCompressedTexture has been removed. Use THREE.DDSLoader instead.');
+       };
+
+       ImageUtils.loadCompressedTextureCube = function () {
+               console.error('THREE.ImageUtils.loadCompressedTextureCube has been removed. Use THREE.DDSLoader instead.');
+       }; //
+
+
+       function CanvasRenderer() {
+               console.error('THREE.CanvasRenderer has been removed');
+       } //
+
+       function JSONLoader() {
+               console.error('THREE.JSONLoader has been removed.');
+       } //
+
+       const SceneUtils = {
+               createMultiMaterialObject: function () {
+                       console.error('THREE.SceneUtils has been moved to /examples/jsm/utils/SceneUtils.js');
+               },
+               detach: function () {
+                       console.error('THREE.SceneUtils has been moved to /examples/jsm/utils/SceneUtils.js');
+               },
+               attach: function () {
+                       console.error('THREE.SceneUtils has been moved to /examples/jsm/utils/SceneUtils.js');
+               }
+       }; //
+
+       function LensFlare() {
+               console.error('THREE.LensFlare has been moved to /examples/jsm/objects/Lensflare.js');
+       }
+
+       if (typeof __THREE_DEVTOOLS__ !== 'undefined') {
+               /* eslint-disable no-undef */
+               __THREE_DEVTOOLS__.dispatchEvent(new CustomEvent('register', {
+                       detail: {
+                               revision: REVISION
+                       }
+               }));
+               /* eslint-enable no-undef */
+
+       }
+
+       if (typeof window !== 'undefined') {
+               if (window.__THREE__) {
+                       console.warn('WARNING: Multiple instances of Three.js being imported.');
+               } else {
+                       window.__THREE__ = REVISION;
+               }
+       }
+
+       exports.ACESFilmicToneMapping = ACESFilmicToneMapping;
+       exports.AddEquation = AddEquation;
+       exports.AddOperation = AddOperation;
+       exports.AdditiveAnimationBlendMode = AdditiveAnimationBlendMode;
+       exports.AdditiveBlending = AdditiveBlending;
+       exports.AlphaFormat = AlphaFormat;
+       exports.AlwaysDepth = AlwaysDepth;
+       exports.AlwaysStencilFunc = AlwaysStencilFunc;
+       exports.AmbientLight = AmbientLight;
+       exports.AmbientLightProbe = AmbientLightProbe;
+       exports.AnimationClip = AnimationClip;
+       exports.AnimationLoader = AnimationLoader;
+       exports.AnimationMixer = AnimationMixer;
+       exports.AnimationObjectGroup = AnimationObjectGroup;
+       exports.AnimationUtils = AnimationUtils;
+       exports.ArcCurve = ArcCurve;
+       exports.ArrayCamera = ArrayCamera;
+       exports.ArrowHelper = ArrowHelper;
+       exports.Audio = Audio;
+       exports.AudioAnalyser = AudioAnalyser;
+       exports.AudioContext = AudioContext;
+       exports.AudioListener = AudioListener;
+       exports.AudioLoader = AudioLoader;
+       exports.AxesHelper = AxesHelper;
+       exports.AxisHelper = AxisHelper;
+       exports.BackSide = BackSide;
+       exports.BasicDepthPacking = BasicDepthPacking;
+       exports.BasicShadowMap = BasicShadowMap;
+       exports.BinaryTextureLoader = BinaryTextureLoader;
+       exports.Bone = Bone;
+       exports.BooleanKeyframeTrack = BooleanKeyframeTrack;
+       exports.BoundingBoxHelper = BoundingBoxHelper;
+       exports.Box2 = Box2;
+       exports.Box3 = Box3;
+       exports.Box3Helper = Box3Helper;
+       exports.BoxBufferGeometry = BoxGeometry;
+       exports.BoxGeometry = BoxGeometry;
+       exports.BoxHelper = BoxHelper;
+       exports.BufferAttribute = BufferAttribute;
+       exports.BufferGeometry = BufferGeometry;
+       exports.BufferGeometryLoader = BufferGeometryLoader;
+       exports.ByteType = ByteType;
+       exports.Cache = Cache;
+       exports.Camera = Camera;
+       exports.CameraHelper = CameraHelper;
+       exports.CanvasRenderer = CanvasRenderer;
+       exports.CanvasTexture = CanvasTexture;
+       exports.CatmullRomCurve3 = CatmullRomCurve3;
+       exports.CineonToneMapping = CineonToneMapping;
+       exports.CircleBufferGeometry = CircleGeometry;
+       exports.CircleGeometry = CircleGeometry;
+       exports.ClampToEdgeWrapping = ClampToEdgeWrapping;
+       exports.Clock = Clock;
+       exports.Color = Color;
+       exports.ColorKeyframeTrack = ColorKeyframeTrack;
+       exports.CompressedTexture = CompressedTexture;
+       exports.CompressedTextureLoader = CompressedTextureLoader;
+       exports.ConeBufferGeometry = ConeGeometry;
+       exports.ConeGeometry = ConeGeometry;
+       exports.CubeCamera = CubeCamera;
+       exports.CubeReflectionMapping = CubeReflectionMapping;
+       exports.CubeRefractionMapping = CubeRefractionMapping;
+       exports.CubeTexture = CubeTexture;
+       exports.CubeTextureLoader = CubeTextureLoader;
+       exports.CubeUVReflectionMapping = CubeUVReflectionMapping;
+       exports.CubeUVRefractionMapping = CubeUVRefractionMapping;
+       exports.CubicBezierCurve = CubicBezierCurve;
+       exports.CubicBezierCurve3 = CubicBezierCurve3;
+       exports.CubicInterpolant = CubicInterpolant;
+       exports.CullFaceBack = CullFaceBack;
+       exports.CullFaceFront = CullFaceFront;
+       exports.CullFaceFrontBack = CullFaceFrontBack;
+       exports.CullFaceNone = CullFaceNone;
+       exports.Curve = Curve;
+       exports.CurvePath = CurvePath;
+       exports.CustomBlending = CustomBlending;
+       exports.CustomToneMapping = CustomToneMapping;
+       exports.CylinderBufferGeometry = CylinderGeometry;
+       exports.CylinderGeometry = CylinderGeometry;
+       exports.Cylindrical = Cylindrical;
+       exports.DataTexture = DataTexture;
+       exports.DataTexture2DArray = DataTexture2DArray;
+       exports.DataTexture3D = DataTexture3D;
+       exports.DataTextureLoader = DataTextureLoader;
+       exports.DataUtils = DataUtils;
+       exports.DecrementStencilOp = DecrementStencilOp;
+       exports.DecrementWrapStencilOp = DecrementWrapStencilOp;
+       exports.DefaultLoadingManager = DefaultLoadingManager;
+       exports.DepthFormat = DepthFormat;
+       exports.DepthStencilFormat = DepthStencilFormat;
+       exports.DepthTexture = DepthTexture;
+       exports.DirectionalLight = DirectionalLight;
+       exports.DirectionalLightHelper = DirectionalLightHelper;
+       exports.DiscreteInterpolant = DiscreteInterpolant;
+       exports.DodecahedronBufferGeometry = DodecahedronGeometry;
+       exports.DodecahedronGeometry = DodecahedronGeometry;
+       exports.DoubleSide = DoubleSide;
+       exports.DstAlphaFactor = DstAlphaFactor;
+       exports.DstColorFactor = DstColorFactor;
+       exports.DynamicBufferAttribute = DynamicBufferAttribute;
+       exports.DynamicCopyUsage = DynamicCopyUsage;
+       exports.DynamicDrawUsage = DynamicDrawUsage;
+       exports.DynamicReadUsage = DynamicReadUsage;
+       exports.EdgesGeometry = EdgesGeometry;
+       exports.EdgesHelper = EdgesHelper;
+       exports.EllipseCurve = EllipseCurve;
+       exports.EqualDepth = EqualDepth;
+       exports.EqualStencilFunc = EqualStencilFunc;
+       exports.EquirectangularReflectionMapping = EquirectangularReflectionMapping;
+       exports.EquirectangularRefractionMapping = EquirectangularRefractionMapping;
+       exports.Euler = Euler;
+       exports.EventDispatcher = EventDispatcher;
+       exports.ExtrudeBufferGeometry = ExtrudeGeometry;
+       exports.ExtrudeGeometry = ExtrudeGeometry;
+       exports.FaceColors = FaceColors;
+       exports.FileLoader = FileLoader;
+       exports.FlatShading = FlatShading;
+       exports.Float16BufferAttribute = Float16BufferAttribute;
+       exports.Float32Attribute = Float32Attribute;
+       exports.Float32BufferAttribute = Float32BufferAttribute;
+       exports.Float64Attribute = Float64Attribute;
+       exports.Float64BufferAttribute = Float64BufferAttribute;
+       exports.FloatType = FloatType;
+       exports.Fog = Fog;
+       exports.FogExp2 = FogExp2;
+       exports.Font = Font;
+       exports.FontLoader = FontLoader;
+       exports.FrontSide = FrontSide;
+       exports.Frustum = Frustum;
+       exports.GLBufferAttribute = GLBufferAttribute;
+       exports.GLSL1 = GLSL1;
+       exports.GLSL3 = GLSL3;
+       exports.GammaEncoding = GammaEncoding;
+       exports.GreaterDepth = GreaterDepth;
+       exports.GreaterEqualDepth = GreaterEqualDepth;
+       exports.GreaterEqualStencilFunc = GreaterEqualStencilFunc;
+       exports.GreaterStencilFunc = GreaterStencilFunc;
+       exports.GridHelper = GridHelper;
+       exports.Group = Group;
+       exports.HalfFloatType = HalfFloatType;
+       exports.HemisphereLight = HemisphereLight;
+       exports.HemisphereLightHelper = HemisphereLightHelper;
+       exports.HemisphereLightProbe = HemisphereLightProbe;
+       exports.IcosahedronBufferGeometry = IcosahedronGeometry;
+       exports.IcosahedronGeometry = IcosahedronGeometry;
+       exports.ImageBitmapLoader = ImageBitmapLoader;
+       exports.ImageLoader = ImageLoader;
+       exports.ImageUtils = ImageUtils;
+       exports.ImmediateRenderObject = ImmediateRenderObject;
+       exports.IncrementStencilOp = IncrementStencilOp;
+       exports.IncrementWrapStencilOp = IncrementWrapStencilOp;
+       exports.InstancedBufferAttribute = InstancedBufferAttribute;
+       exports.InstancedBufferGeometry = InstancedBufferGeometry;
+       exports.InstancedInterleavedBuffer = InstancedInterleavedBuffer;
+       exports.InstancedMesh = InstancedMesh;
+       exports.Int16Attribute = Int16Attribute;
+       exports.Int16BufferAttribute = Int16BufferAttribute;
+       exports.Int32Attribute = Int32Attribute;
+       exports.Int32BufferAttribute = Int32BufferAttribute;
+       exports.Int8Attribute = Int8Attribute;
+       exports.Int8BufferAttribute = Int8BufferAttribute;
+       exports.IntType = IntType;
+       exports.InterleavedBuffer = InterleavedBuffer;
+       exports.InterleavedBufferAttribute = InterleavedBufferAttribute;
+       exports.Interpolant = Interpolant;
+       exports.InterpolateDiscrete = InterpolateDiscrete;
+       exports.InterpolateLinear = InterpolateLinear;
+       exports.InterpolateSmooth = InterpolateSmooth;
+       exports.InvertStencilOp = InvertStencilOp;
+       exports.JSONLoader = JSONLoader;
+       exports.KeepStencilOp = KeepStencilOp;
+       exports.KeyframeTrack = KeyframeTrack;
+       exports.LOD = LOD;
+       exports.LatheBufferGeometry = LatheGeometry;
+       exports.LatheGeometry = LatheGeometry;
+       exports.Layers = Layers;
+       exports.LensFlare = LensFlare;
+       exports.LessDepth = LessDepth;
+       exports.LessEqualDepth = LessEqualDepth;
+       exports.LessEqualStencilFunc = LessEqualStencilFunc;
+       exports.LessStencilFunc = LessStencilFunc;
+       exports.Light = Light;
+       exports.LightProbe = LightProbe;
+       exports.Line = Line;
+       exports.Line3 = Line3;
+       exports.LineBasicMaterial = LineBasicMaterial;
+       exports.LineCurve = LineCurve;
+       exports.LineCurve3 = LineCurve3;
+       exports.LineDashedMaterial = LineDashedMaterial;
+       exports.LineLoop = LineLoop;
+       exports.LinePieces = LinePieces;
+       exports.LineSegments = LineSegments;
+       exports.LineStrip = LineStrip;
+       exports.LinearEncoding = LinearEncoding;
+       exports.LinearFilter = LinearFilter;
+       exports.LinearInterpolant = LinearInterpolant;
+       exports.LinearMipMapLinearFilter = LinearMipMapLinearFilter;
+       exports.LinearMipMapNearestFilter = LinearMipMapNearestFilter;
+       exports.LinearMipmapLinearFilter = LinearMipmapLinearFilter;
+       exports.LinearMipmapNearestFilter = LinearMipmapNearestFilter;
+       exports.LinearToneMapping = LinearToneMapping;
+       exports.Loader = Loader;
+       exports.LoaderUtils = LoaderUtils;
+       exports.LoadingManager = LoadingManager;
+       exports.LogLuvEncoding = LogLuvEncoding;
+       exports.LoopOnce = LoopOnce;
+       exports.LoopPingPong = LoopPingPong;
+       exports.LoopRepeat = LoopRepeat;
+       exports.LuminanceAlphaFormat = LuminanceAlphaFormat;
+       exports.LuminanceFormat = LuminanceFormat;
+       exports.MOUSE = MOUSE;
+       exports.Material = Material;
+       exports.MaterialLoader = MaterialLoader;
+       exports.Math = MathUtils;
+       exports.MathUtils = MathUtils;
+       exports.Matrix3 = Matrix3;
+       exports.Matrix4 = Matrix4;
+       exports.MaxEquation = MaxEquation;
+       exports.Mesh = Mesh;
+       exports.MeshBasicMaterial = MeshBasicMaterial;
+       exports.MeshDepthMaterial = MeshDepthMaterial;
+       exports.MeshDistanceMaterial = MeshDistanceMaterial;
+       exports.MeshFaceMaterial = MeshFaceMaterial;
+       exports.MeshLambertMaterial = MeshLambertMaterial;
+       exports.MeshMatcapMaterial = MeshMatcapMaterial;
+       exports.MeshNormalMaterial = MeshNormalMaterial;
+       exports.MeshPhongMaterial = MeshPhongMaterial;
+       exports.MeshPhysicalMaterial = MeshPhysicalMaterial;
+       exports.MeshStandardMaterial = MeshStandardMaterial;
+       exports.MeshToonMaterial = MeshToonMaterial;
+       exports.MinEquation = MinEquation;
+       exports.MirroredRepeatWrapping = MirroredRepeatWrapping;
+       exports.MixOperation = MixOperation;
+       exports.MultiMaterial = MultiMaterial;
+       exports.MultiplyBlending = MultiplyBlending;
+       exports.MultiplyOperation = MultiplyOperation;
+       exports.NearestFilter = NearestFilter;
+       exports.NearestMipMapLinearFilter = NearestMipMapLinearFilter;
+       exports.NearestMipMapNearestFilter = NearestMipMapNearestFilter;
+       exports.NearestMipmapLinearFilter = NearestMipmapLinearFilter;
+       exports.NearestMipmapNearestFilter = NearestMipmapNearestFilter;
+       exports.NeverDepth = NeverDepth;
+       exports.NeverStencilFunc = NeverStencilFunc;
+       exports.NoBlending = NoBlending;
+       exports.NoColors = NoColors;
+       exports.NoToneMapping = NoToneMapping;
+       exports.NormalAnimationBlendMode = NormalAnimationBlendMode;
+       exports.NormalBlending = NormalBlending;
+       exports.NotEqualDepth = NotEqualDepth;
+       exports.NotEqualStencilFunc = NotEqualStencilFunc;
+       exports.NumberKeyframeTrack = NumberKeyframeTrack;
+       exports.Object3D = Object3D;
+       exports.ObjectLoader = ObjectLoader;
+       exports.ObjectSpaceNormalMap = ObjectSpaceNormalMap;
+       exports.OctahedronBufferGeometry = OctahedronGeometry;
+       exports.OctahedronGeometry = OctahedronGeometry;
+       exports.OneFactor = OneFactor;
+       exports.OneMinusDstAlphaFactor = OneMinusDstAlphaFactor;
+       exports.OneMinusDstColorFactor = OneMinusDstColorFactor;
+       exports.OneMinusSrcAlphaFactor = OneMinusSrcAlphaFactor;
+       exports.OneMinusSrcColorFactor = OneMinusSrcColorFactor;
+       exports.OrthographicCamera = OrthographicCamera;
+       exports.PCFShadowMap = PCFShadowMap;
+       exports.PCFSoftShadowMap = PCFSoftShadowMap;
+       exports.PMREMGenerator = PMREMGenerator;
+       exports.ParametricBufferGeometry = ParametricGeometry;
+       exports.ParametricGeometry = ParametricGeometry;
+       exports.Particle = Particle;
+       exports.ParticleBasicMaterial = ParticleBasicMaterial;
+       exports.ParticleSystem = ParticleSystem;
+       exports.ParticleSystemMaterial = ParticleSystemMaterial;
+       exports.Path = Path;
+       exports.PerspectiveCamera = PerspectiveCamera;
+       exports.Plane = Plane;
+       exports.PlaneBufferGeometry = PlaneGeometry;
+       exports.PlaneGeometry = PlaneGeometry;
+       exports.PlaneHelper = PlaneHelper;
+       exports.PointCloud = PointCloud;
+       exports.PointCloudMaterial = PointCloudMaterial;
+       exports.PointLight = PointLight;
+       exports.PointLightHelper = PointLightHelper;
+       exports.Points = Points;
+       exports.PointsMaterial = PointsMaterial;
+       exports.PolarGridHelper = PolarGridHelper;
+       exports.PolyhedronBufferGeometry = PolyhedronGeometry;
+       exports.PolyhedronGeometry = PolyhedronGeometry;
+       exports.PositionalAudio = PositionalAudio;
+       exports.PropertyBinding = PropertyBinding;
+       exports.PropertyMixer = PropertyMixer;
+       exports.QuadraticBezierCurve = QuadraticBezierCurve;
+       exports.QuadraticBezierCurve3 = QuadraticBezierCurve3;
+       exports.Quaternion = Quaternion;
+       exports.QuaternionKeyframeTrack = QuaternionKeyframeTrack;
+       exports.QuaternionLinearInterpolant = QuaternionLinearInterpolant;
+       exports.REVISION = REVISION;
+       exports.RGBADepthPacking = RGBADepthPacking;
+       exports.RGBAFormat = RGBAFormat;
+       exports.RGBAIntegerFormat = RGBAIntegerFormat;
+       exports.RGBA_ASTC_10x10_Format = RGBA_ASTC_10x10_Format;
+       exports.RGBA_ASTC_10x5_Format = RGBA_ASTC_10x5_Format;
+       exports.RGBA_ASTC_10x6_Format = RGBA_ASTC_10x6_Format;
+       exports.RGBA_ASTC_10x8_Format = RGBA_ASTC_10x8_Format;
+       exports.RGBA_ASTC_12x10_Format = RGBA_ASTC_12x10_Format;
+       exports.RGBA_ASTC_12x12_Format = RGBA_ASTC_12x12_Format;
+       exports.RGBA_ASTC_4x4_Format = RGBA_ASTC_4x4_Format;
+       exports.RGBA_ASTC_5x4_Format = RGBA_ASTC_5x4_Format;
+       exports.RGBA_ASTC_5x5_Format = RGBA_ASTC_5x5_Format;
+       exports.RGBA_ASTC_6x5_Format = RGBA_ASTC_6x5_Format;
+       exports.RGBA_ASTC_6x6_Format = RGBA_ASTC_6x6_Format;
+       exports.RGBA_ASTC_8x5_Format = RGBA_ASTC_8x5_Format;
+       exports.RGBA_ASTC_8x6_Format = RGBA_ASTC_8x6_Format;
+       exports.RGBA_ASTC_8x8_Format = RGBA_ASTC_8x8_Format;
+       exports.RGBA_BPTC_Format = RGBA_BPTC_Format;
+       exports.RGBA_ETC2_EAC_Format = RGBA_ETC2_EAC_Format;
+       exports.RGBA_PVRTC_2BPPV1_Format = RGBA_PVRTC_2BPPV1_Format;
+       exports.RGBA_PVRTC_4BPPV1_Format = RGBA_PVRTC_4BPPV1_Format;
+       exports.RGBA_S3TC_DXT1_Format = RGBA_S3TC_DXT1_Format;
+       exports.RGBA_S3TC_DXT3_Format = RGBA_S3TC_DXT3_Format;
+       exports.RGBA_S3TC_DXT5_Format = RGBA_S3TC_DXT5_Format;
+       exports.RGBDEncoding = RGBDEncoding;
+       exports.RGBEEncoding = RGBEEncoding;
+       exports.RGBEFormat = RGBEFormat;
+       exports.RGBFormat = RGBFormat;
+       exports.RGBIntegerFormat = RGBIntegerFormat;
+       exports.RGBM16Encoding = RGBM16Encoding;
+       exports.RGBM7Encoding = RGBM7Encoding;
+       exports.RGB_ETC1_Format = RGB_ETC1_Format;
+       exports.RGB_ETC2_Format = RGB_ETC2_Format;
+       exports.RGB_PVRTC_2BPPV1_Format = RGB_PVRTC_2BPPV1_Format;
+       exports.RGB_PVRTC_4BPPV1_Format = RGB_PVRTC_4BPPV1_Format;
+       exports.RGB_S3TC_DXT1_Format = RGB_S3TC_DXT1_Format;
+       exports.RGFormat = RGFormat;
+       exports.RGIntegerFormat = RGIntegerFormat;
+       exports.RawShaderMaterial = RawShaderMaterial;
+       exports.Ray = Ray;
+       exports.Raycaster = Raycaster;
+       exports.RectAreaLight = RectAreaLight;
+       exports.RedFormat = RedFormat;
+       exports.RedIntegerFormat = RedIntegerFormat;
+       exports.ReinhardToneMapping = ReinhardToneMapping;
+       exports.RepeatWrapping = RepeatWrapping;
+       exports.ReplaceStencilOp = ReplaceStencilOp;
+       exports.ReverseSubtractEquation = ReverseSubtractEquation;
+       exports.RingBufferGeometry = RingGeometry;
+       exports.RingGeometry = RingGeometry;
+       exports.SRGB8_ALPHA8_ASTC_10x10_Format = SRGB8_ALPHA8_ASTC_10x10_Format;
+       exports.SRGB8_ALPHA8_ASTC_10x5_Format = SRGB8_ALPHA8_ASTC_10x5_Format;
+       exports.SRGB8_ALPHA8_ASTC_10x6_Format = SRGB8_ALPHA8_ASTC_10x6_Format;
+       exports.SRGB8_ALPHA8_ASTC_10x8_Format = SRGB8_ALPHA8_ASTC_10x8_Format;
+       exports.SRGB8_ALPHA8_ASTC_12x10_Format = SRGB8_ALPHA8_ASTC_12x10_Format;
+       exports.SRGB8_ALPHA8_ASTC_12x12_Format = SRGB8_ALPHA8_ASTC_12x12_Format;
+       exports.SRGB8_ALPHA8_ASTC_4x4_Format = SRGB8_ALPHA8_ASTC_4x4_Format;
+       exports.SRGB8_ALPHA8_ASTC_5x4_Format = SRGB8_ALPHA8_ASTC_5x4_Format;
+       exports.SRGB8_ALPHA8_ASTC_5x5_Format = SRGB8_ALPHA8_ASTC_5x5_Format;
+       exports.SRGB8_ALPHA8_ASTC_6x5_Format = SRGB8_ALPHA8_ASTC_6x5_Format;
+       exports.SRGB8_ALPHA8_ASTC_6x6_Format = SRGB8_ALPHA8_ASTC_6x6_Format;
+       exports.SRGB8_ALPHA8_ASTC_8x5_Format = SRGB8_ALPHA8_ASTC_8x5_Format;
+       exports.SRGB8_ALPHA8_ASTC_8x6_Format = SRGB8_ALPHA8_ASTC_8x6_Format;
+       exports.SRGB8_ALPHA8_ASTC_8x8_Format = SRGB8_ALPHA8_ASTC_8x8_Format;
+       exports.Scene = Scene;
+       exports.SceneUtils = SceneUtils;
+       exports.ShaderChunk = ShaderChunk;
+       exports.ShaderLib = ShaderLib;
+       exports.ShaderMaterial = ShaderMaterial;
+       exports.ShadowMaterial = ShadowMaterial;
+       exports.Shape = Shape;
+       exports.ShapeBufferGeometry = ShapeGeometry;
+       exports.ShapeGeometry = ShapeGeometry;
+       exports.ShapePath = ShapePath;
+       exports.ShapeUtils = ShapeUtils;
+       exports.ShortType = ShortType;
+       exports.Skeleton = Skeleton;
+       exports.SkeletonHelper = SkeletonHelper;
+       exports.SkinnedMesh = SkinnedMesh;
+       exports.SmoothShading = SmoothShading;
+       exports.Sphere = Sphere;
+       exports.SphereBufferGeometry = SphereGeometry;
+       exports.SphereGeometry = SphereGeometry;
+       exports.Spherical = Spherical;
+       exports.SphericalHarmonics3 = SphericalHarmonics3;
+       exports.SplineCurve = SplineCurve;
+       exports.SpotLight = SpotLight;
+       exports.SpotLightHelper = SpotLightHelper;
+       exports.Sprite = Sprite;
+       exports.SpriteMaterial = SpriteMaterial;
+       exports.SrcAlphaFactor = SrcAlphaFactor;
+       exports.SrcAlphaSaturateFactor = SrcAlphaSaturateFactor;
+       exports.SrcColorFactor = SrcColorFactor;
+       exports.StaticCopyUsage = StaticCopyUsage;
+       exports.StaticDrawUsage = StaticDrawUsage;
+       exports.StaticReadUsage = StaticReadUsage;
+       exports.StereoCamera = StereoCamera;
+       exports.StreamCopyUsage = StreamCopyUsage;
+       exports.StreamDrawUsage = StreamDrawUsage;
+       exports.StreamReadUsage = StreamReadUsage;
+       exports.StringKeyframeTrack = StringKeyframeTrack;
+       exports.SubtractEquation = SubtractEquation;
+       exports.SubtractiveBlending = SubtractiveBlending;
+       exports.TOUCH = TOUCH;
+       exports.TangentSpaceNormalMap = TangentSpaceNormalMap;
+       exports.TetrahedronBufferGeometry = TetrahedronGeometry;
+       exports.TetrahedronGeometry = TetrahedronGeometry;
+       exports.TextBufferGeometry = TextGeometry;
+       exports.TextGeometry = TextGeometry;
+       exports.Texture = Texture;
+       exports.TextureLoader = TextureLoader;
+       exports.TorusBufferGeometry = TorusGeometry;
+       exports.TorusGeometry = TorusGeometry;
+       exports.TorusKnotBufferGeometry = TorusKnotGeometry;
+       exports.TorusKnotGeometry = TorusKnotGeometry;
+       exports.Triangle = Triangle;
+       exports.TriangleFanDrawMode = TriangleFanDrawMode;
+       exports.TriangleStripDrawMode = TriangleStripDrawMode;
+       exports.TrianglesDrawMode = TrianglesDrawMode;
+       exports.TubeBufferGeometry = TubeGeometry;
+       exports.TubeGeometry = TubeGeometry;
+       exports.UVMapping = UVMapping;
+       exports.Uint16Attribute = Uint16Attribute;
+       exports.Uint16BufferAttribute = Uint16BufferAttribute;
+       exports.Uint32Attribute = Uint32Attribute;
+       exports.Uint32BufferAttribute = Uint32BufferAttribute;
+       exports.Uint8Attribute = Uint8Attribute;
+       exports.Uint8BufferAttribute = Uint8BufferAttribute;
+       exports.Uint8ClampedAttribute = Uint8ClampedAttribute;
+       exports.Uint8ClampedBufferAttribute = Uint8ClampedBufferAttribute;
+       exports.Uniform = Uniform;
+       exports.UniformsLib = UniformsLib;
+       exports.UniformsUtils = UniformsUtils;
+       exports.UnsignedByteType = UnsignedByteType;
+       exports.UnsignedInt248Type = UnsignedInt248Type;
+       exports.UnsignedIntType = UnsignedIntType;
+       exports.UnsignedShort4444Type = UnsignedShort4444Type;
+       exports.UnsignedShort5551Type = UnsignedShort5551Type;
+       exports.UnsignedShort565Type = UnsignedShort565Type;
+       exports.UnsignedShortType = UnsignedShortType;
+       exports.VSMShadowMap = VSMShadowMap;
+       exports.Vector2 = Vector2;
+       exports.Vector3 = Vector3;
+       exports.Vector4 = Vector4;
+       exports.VectorKeyframeTrack = VectorKeyframeTrack;
+       exports.Vertex = Vertex;
+       exports.VertexColors = VertexColors;
+       exports.VideoTexture = VideoTexture;
+       exports.WebGL1Renderer = WebGL1Renderer;
+       exports.WebGLCubeRenderTarget = WebGLCubeRenderTarget;
+       exports.WebGLMultipleRenderTargets = WebGLMultipleRenderTargets;
+       exports.WebGLMultisampleRenderTarget = WebGLMultisampleRenderTarget;
+       exports.WebGLRenderTarget = WebGLRenderTarget;
+       exports.WebGLRenderTargetCube = WebGLRenderTargetCube;
+       exports.WebGLRenderer = WebGLRenderer;
+       exports.WebGLUtils = WebGLUtils;
+       exports.WireframeGeometry = WireframeGeometry;
+       exports.WireframeHelper = WireframeHelper;
+       exports.WrapAroundEnding = WrapAroundEnding;
+       exports.XHRLoader = XHRLoader;
+       exports.ZeroCurvatureEnding = ZeroCurvatureEnding;
+       exports.ZeroFactor = ZeroFactor;
+       exports.ZeroSlopeEnding = ZeroSlopeEnding;
+       exports.ZeroStencilOp = ZeroStencilOp;
+       exports.sRGBEncoding = sRGBEncoding;
+
+       Object.defineProperty(exports, '__esModule', { value: true });
+
+})));
+
+},{}]},{},[1]);